Dear Dominique,

I still don't fully understand why your code doesn't work, even though I
was able to reproduce the same error.
However, the way to fix your code is to also provide the address of an
additional mesh_fem for the penalty:"

// With penalization

const size_type degree = 1;const bgeot::dim_type  qdimPenlaty = 1;auto
&mfPenalty = getfem::classical_mesh_fem(mesh, degree, qdimPenlaty);
getfem::add_normal_Dirichlet_condition_with_penalization(model, mim,
"u", dirichlet_coefficient_cyl, CYLINDER_BOUNDARY_NUM ,"CylinderData",
&mfPenalty);

Best regards,
                      Andriy

On 2 March 2015 at 11:57, Dominique Fratantonio <
[email protected]> wrote:

> Dear Andriy,
>
> thank you so much for your support. I perfectly understand that it's not
> easy to fix the problem without having the complete code.
> Anyway, mf_u.qdim() = 2. Do you have other questions that can help to
> understand the problem?
> The type of element I used for mf_u is FEM_PK(2,2). I also tried to use a
> FEM_PK(2,1) element instead, but this does not fix the problem.
> As you suggested, I tried to not specify the dataname "CylinderData" and
> let Getfem take the default value, but the same error 'Non matrix field'
> still appears.
> Without specifying "CylinderData" the call of the function becomes:
>
>
> add_normal_Dirichlet_condition_with_penalization(model,mim,"u",coefficient_penalization,
> region_id);
>
> So I don't understand which one of the 5 inputs has something wrong. As I
> said, in the same code I succeeded to use the similar function
> 'add_Dirichlet_condition_with_penalization', and I thought that the use of
> 'add_normal_Dirichlet_condition_with_penalization' would have been almost
> identical.
>
> Again, thank you so much for your very helpful support.
>
> Best regards,
> Dominique
>
>
>
> 2015-03-02 9:45 GMT+01:00 Andriy Andreykiv <[email protected]>:
>
>> Dear Dominique,
>>
>> It's hard to be completely sure about the cause, as your code is not
>> complete so we can't see, for instance, how you create mf_u.
>> Is it's qdim > 1?
>> Nonetheless, I suspect the error comes from incompatibility of the mf_u
>> dimension and the dimension of "CylinderData".
>> The fact that it expects matrix field to me implies that
>> The simplest remedy would be to try take into account that you don't
>> really need to specify "CylinderData" as it's zero and then let Getfem
>> take the default.
>>
>> Best regards,
>>                        Andriy
>>
>> On 28 February 2015 at 15:03, Dominique Fratantonio <
>> [email protected]> wrote:
>>
>>> Hi,
>>>
>>> I wanted to be sure that my last email answer did not cause any
>>> misunderstanding.
>>> I still have the same problem with the function
>>> 'add_normal_Dirichlet_boundary_condition_with_penalization'.
>>> I report here again the extract of my code:
>>>
>>>
>>> //--------------------------------------------------------------------------------------------------------------------------------------------------//
>>>
>>>    // Main unknown of the problem:
>>>    model.add_fem_variable("u", mf_u);
>>>
>>>    // Viscous term
>>>    // Linearized elasticity brick:
>>>    model.add_initialized_fixed_size_data("lambda", plain_vector(1,
>>> 0.0)); // Second viscosity coefficient
>>>    model.add_initialized_fixed_size_data("nu", plain_vector(1,
>>> 1/(pd.Re)));
>>>    getfem::add_isotropic_linearized_elasticity_brick(model, mim, "u",
>>> "lambda", "nu");
>>>
>>>    // Incompressible constraint
>>>    // p used as Lagrange multiplier, but it doesn't need to be
>>>    // add_multiplier as for the Dirichlet boundary conditions
>>>    // Linearized incompressibility condition brick:
>>>    model.add_fem_variable("p", mf_p);
>>>    getfem::add_linear_incompressibility(model, mim, "u", "p");
>>>
>>>    // Dirichlet condition on inflow:
>>>    std::vector<scalar_type> F(mf_u.nb_dof());
>>>    gmm::clear(F);
>>>    getfem::interpolation_function(mf_u, F, u_exact);
>>>    model.add_initialized_fem_data("InflowData", mf_u, F);
>>>
>>>    if (PENALIZATION_INFLOW && act_DNS) {
>>>        // With penalization
>>>        scalar_type dirichlet_coefficient_inflow = 1e8;
>>>
>>>  
>>> getfem::add_Dirichlet_condition_with_penalization(model,mim,"u",dirichlet_coefficient_inflow,INFLOW_BOUNDARY_NUM,"InflowData");
>>>    } else {
>>>        // With multipliers
>>>        model.add_multiplier("Inflow", mf_mult_inflow, "u", mim,
>>>  INFLOW_BOUNDARY_NUM);
>>>        getfem::add_Dirichlet_condition_with_multipliers(model, mim,
>>> "u","Inflow",INFLOW_BOUNDARY_NUM,"InflowData");
>>>    }
>>>
>>>    // Dirichlet condition on cylinder:
>>>    bgeot::base_vector no_penetration(1); no_penetration[0]=0;
>>>    model.add_initialized_fixed_size_data("CylinderData",no_penetration);
>>>
>>>    if (PENALIZATION_CYL && act_DNS) {
>>>        // With penalization
>>>        scalar_type dirichlet_coefficient_cyl = 1e8;
>>>
>>>  
>>> getfem::add_normal_Dirichlet_condition_with_penalization(model,mim,"u",dirichlet_coefficient_cyl,CYLINDER_BOUNDARY_NUM,"CylinderData");
>>>    } else {
>>>        // With multipliers
>>>        model.add_multiplier("Cylinder", mf_mult_cyl, "u", mim,
>>> CYLINDER_BOUNDARY_NUM);
>>>
>>>  
>>> getfem::add_normal_Dirichlet_condition_with_multipliers(model,mim,"u","Cylinder",CYLINDER_BOUNDARY_NUM,"CylinderData");
>>>    }
>>>
>>>    // Build matrices
>>>    model.assembly(getfem::model::BUILD_ALL);
>>>
>>>
>>> //------------------------------------------------------------------------------------------------------------------------------------------------------//
>>>
>>> Moreover, I'm completely out of idea about what the following error
>>> means:
>>>
>>>
>>> //------------------------------------------------------------------------------------------------------------------------------------------------------//
>>>
>>> Trace 2 in getfem_models.cc, line 5667: Stiffness matrix assembly for
>>> isotropic linearized elasticity
>>> Trace 2 in getfem_models.cc, line 5931: Stokes term assembly
>>> Trace 2 in getfem_models.cc, line 3157: Mass term assembly for Dirichlet
>>> condition
>>> Trace 2 in getfem_models.cc, line 3201: Source term assembly for
>>> Dirichlet condition
>>> Trace 2 in getfem_models.cc, line 3157: Mass term assembly for Dirichlet
>>> condition
>>> ============================================
>>> |      An error has been detected !!!      |
>>> ============================================
>>> Error in getfem_assembling_tensors.cc, line 488 :
>>> Non matrix field
>>>
>>>
>>> //------------------------------------------------------------------------------------------------------------------------------------------------------//
>>>
>>> Again, I just wanted to be sure that you know that I still have the same
>>> problem.
>>>
>>> Thank you very much in advance.
>>>
>>>
>>> 2015-02-23 10:17 GMT+01:00 Yves Renard <[email protected]>:
>>>
>>>>
>>>> Dear Kostas,
>>>>
>>>> There is no release 4.3.2. I incremented the patch number in
>>>> configure.ac to produce some archives and it as been automatically
>>>> ported to the web site but this is an artefact. I will correct this.
>>>>
>>>> Yves.
>>>>
>>>>
>>>> Le 23/02/2015 09:56, Konstantinos Poulios a écrit :
>>>>
>>>>   Hi, I am wondering where is the link for 4.3.2 (or even 4.3.1) here:
>>>>
>>>> http://download.gna.org/getfem/stable/
>>>>
>>>>  I can only see the tarball for 4.3.
>>>>
>>>>  Am I missing something?
>>>>
>>>>  Best regards
>>>>  Kostas
>>>>
>>>> On Sun, Feb 22, 2015 at 5:54 PM, Dominique Fratantonio <
>>>> [email protected]> wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>>  I'm using getfem-4.3.2 and I am having some problem with the
>>>>> function 'add_normal_Dirichlet_condition_with_penalization'.
>>>>> Here an extract of how I am implementing it:
>>>>>
>>>>>
>>>>> //--------------------------------------------------------------------------------------------------------------------------------------------------//
>>>>>
>>>>>     // Main unknown of the problem:
>>>>>    model.add_fem_variable("u", mf_u);
>>>>>
>>>>>     // Viscous term
>>>>>    // Linearized elasticity brick:
>>>>>    model.add_initialized_fixed_size_data("lambda", plain_vector(1,
>>>>> 0.0)); // Second viscosity coefficient
>>>>>    model.add_initialized_fixed_size_data("nu", plain_vector(1,
>>>>> 1/(pd.Re)));
>>>>>    getfem::add_isotropic_linearized_elasticity_brick(model, mim, "u",
>>>>> "lambda", "nu");
>>>>>
>>>>>     // Incompressible constraint
>>>>>    // p used as Lagrange multiplier, but it doesn't need to be
>>>>>    // add_multiplier as for the Dirichlet boundary conditions
>>>>>    // Linearized incompressibility condition brick:
>>>>>    model.add_fem_variable("p", mf_p);
>>>>>    getfem::add_linear_incompressibility(model, mim, "u", "p");
>>>>>
>>>>>     // Dirichlet condition on inflow:
>>>>>    std::vector<scalar_type> F(mf_u.nb_dof());
>>>>>    gmm::clear(F);
>>>>>    getfem::interpolation_function(mf_u, F, u_exact);
>>>>>    model.add_initialized_fem_data("InflowData", mf_u, F);
>>>>>
>>>>>     if (PENALIZATION_INFLOW && act_DNS) {
>>>>>        // With penalization
>>>>>        scalar_type dirichlet_coefficient_inflow = 1e8;
>>>>>
>>>>>  
>>>>> getfem::add_Dirichlet_condition_with_penalization(model,mim,"u",dirichlet_coefficient_inflow,INFLOW_BOUNDARY_NUM,"InflowData");
>>>>>    } else {
>>>>>        // With multipliers
>>>>>        model.add_multiplier("Inflow", mf_mult_inflow, "u", mim,
>>>>>  INFLOW_BOUNDARY_NUM);
>>>>>        getfem::add_Dirichlet_condition_with_multipliers(model, mim,
>>>>> "u","Inflow",INFLOW_BOUNDARY_NUM,"InflowData");
>>>>>    }
>>>>>
>>>>>     // Dirichlet condition on cylinder:
>>>>>    bgeot::base_vector no_penetration(1); no_penetration[0]=0;
>>>>>
>>>>>  model.add_initialized_fixed_size_data("CylinderData",no_penetration);
>>>>>
>>>>>     if (PENALIZATION_CYL && act_DNS) {
>>>>>        // With penalization
>>>>>        scalar_type dirichlet_coefficient_cyl = 1e8;
>>>>>
>>>>>  
>>>>> getfem::add_normal_Dirichlet_condition_with_penalization(model,mim,"u",dirichlet_coefficient_cyl,CYLINDER_BOUNDARY_NUM,"CylinderData");
>>>>>    } else {
>>>>>        // With multipliers
>>>>>        model.add_multiplier("Cylinder", mf_mult_cyl, "u", mim,
>>>>> CYLINDER_BOUNDARY_NUM);
>>>>>
>>>>>  
>>>>> getfem::add_normal_Dirichlet_condition_with_multipliers(model,mim,"u","Cylinder",CYLINDER_BOUNDARY_NUM,"CylinderData");
>>>>>    }
>>>>>
>>>>>     // Build matrices
>>>>>    model.assembly(getfem::model::BUILD_ALL);
>>>>>
>>>>>
>>>>> //------------------------------------------------------------------------------------------------------------------------------------------------------//
>>>>>
>>>>>  In the above extract of the code, everything works fine except when
>>>>> I try to use 'add_normal_Dirichlet_condition_with_penalization'.
>>>>> The similar function 'add_Dirichlet_condition_with_penalization' works
>>>>> fine as well.
>>>>> Altought I succeed in compiling the code, when
>>>>> 'add_normal_Dirichlet_condition_with_penalization' runs, I obtain the
>>>>> following error:
>>>>>
>>>>>
>>>>> //------------------------------------------------------------------------------------------------------------------------------------------------------//
>>>>>
>>>>>  Trace 2 in getfem_models.cc, line 5667: Stiffness matrix assembly
>>>>> for isotropic linearized elasticity
>>>>> Trace 2 in getfem_models.cc, line 5931: Stokes term assembly
>>>>> Trace 2 in getfem_models.cc, line 3157: Mass term assembly for
>>>>> Dirichlet condition
>>>>> Trace 2 in getfem_models.cc, line 3201: Source term assembly for
>>>>> Dirichlet condition
>>>>> Trace 2 in getfem_models.cc, line 3157: Mass term assembly for
>>>>> Dirichlet condition
>>>>> ============================================
>>>>> |      An error has been detected !!!      |
>>>>> ============================================
>>>>> Error in getfem_assembling_tensors.cc, line 488 :
>>>>> Non matrix field
>>>>>
>>>>>
>>>>> //------------------------------------------------------------------------------------------------------------------------------------------------------//
>>>>>
>>>>>  I really do not understand how to fix this problem and what it means.
>>>>>
>>>>>  Thank you in advance.
>>>>> Cheers.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> Getfem-users mailing list
>>>>> [email protected]
>>>>> https://mail.gna.org/listinfo/getfem-users
>>>>>
>>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> Getfem-users mailing 
>>>> [email protected]https://mail.gna.org/listinfo/getfem-users
>>>>
>>>>
>>>>
>>>> --
>>>>
>>>>   Yves Renard ([email protected])       tel : (33) 04.72.43.87.08
>>>>   Pole de Mathematiques, INSA-Lyon             fax : (33) 04.72.43.85.29
>>>>   20, rue Albert Einstein
>>>>   69621 Villeurbanne Cedex, FRANCE
>>>>   http://math.univ-lyon1.fr/~renard
>>>>
>>>> ---------
>>>>
>>>>
>>>> _______________________________________________
>>>> Getfem-users mailing list
>>>> [email protected]
>>>> https://mail.gna.org/listinfo/getfem-users
>>>>
>>>>
>>>
>>> _______________________________________________
>>> Getfem-users mailing list
>>> [email protected]
>>> https://mail.gna.org/listinfo/getfem-users
>>>
>>>
>>
>
_______________________________________________
Getfem-users mailing list
[email protected]
https://mail.gna.org/listinfo/getfem-users

Reply via email to