Dear Yves,
Thanks to your tips I understood where the problem was and I succeeded in solving it.
Thank you for your help,
Simone
Da: Yves Renard <address@hidden>
Inviato: mercoledì 26 ottobre 2016 13.33.36
A: Simone Di Gregorio; address@hidden
Oggetto: Re: [Getfem-users] [GetFem-users] Problem in Dof Enumeration and consequent wrong matrix assembly
Dear Simone,
I do not understand well your problem. In GetFEM++, there
is no guaranty of a certain correspondence between dof
enumeration and element indices or vertex indices. The
correspondence can be retrieved via the methods
mf.ind_basic_dof_of_element(cv). Moreover, if I understand
well you compute a mass matrix between a P1 and a
P0 fem. In what sense do you expect a symmetry of this
matrix ?
Note that in the stable releases of Getfem, the order for
scanning the elements for dof enumeration follows a
Cutill-Mc Kee algorithm. By default, this is no longer the
case with the svn version. However, it is quite dangerous
to expect a priori a certain correspondence between dof
indices and mesh element indices.
Best regards,
Yves.
Le 25/10/2016 à 16:55, Simone Di Gregorio a écrit :
Dear GetFem++ users,
I found a problem regarding the resolution of a fem problem. I must solve a 1D-network in terms of pressure and velocity. I have a 1-D network whose mesh structure, made with regions, is like below
BEGIN MESH STRUCTURE DESCRIPTION
CONVEX 0 'GT_PK(1,1)' 0 1
CONVEX 1 'GT_PK(1,1)' 1 2
CONVEX 2 'GT_PK(1,1)' 2 3
CONVEX 3 'GT_PK(1,1)' 4 5
CONVEX 4 'GT_PK(1,1)' 5 6
CONVEX 5 'GT_PK(1,1)' 6 3
CONVEX 6 'GT_PK(1,1)' 3 7
CONVEX 7 'GT_PK(1,1)' 7 8
CONVEX 8 'GT_PK(1,1)' 8 9
END MESH STRUCTURE DESCRIPTION
BEGIN REGION 0
0 1 2
END REGION 0
BEGIN REGION 1
3 4 5
END REGION 1
BEGIN REGION 2
6 7 8
END REGION 2
I use this part of code to obtain mesh_fem:
// pf_Uvi is 'FEM_PK(1,1)' ;
//pf_coefvi is 'FEM_PK(1,0)';
//meshv is the mesh described before;
//nb_branches=3;
for(size_type i=0; i<nb_branches; ++i){
mesh_fem mf_tmp(meshv);
mf_tmp.set_finite_element(meshv.region(i).index(), pf_coefv);
mf_coefvi.emplace_back(mf_tmp);
mf_tmp.clear();
mesh_fem mf_tmp1(meshv);
mf_tmp1.set_finite_element(meshv.region(i).index(), pf_Uv);
mf_Uvi.emplace_back(mf_tmp1);
mf_tmp1.clear();
}
It usually works well for various meshes but in this case in the REGION 1 the dof enumeration of mf_Uvi is wrong, in fact it comes out like:
BEGIN MESH_FEM
QDIM 1
CONVEX 3 'FEM_PK(1,1)'
CONVEX 4 'FEM_PK(1,1)'
CONVEX 5 'FEM_PK(1,1)'
BEGIN DOF_ENUMERATION
3: 3 2
4: 2 0
5: 0 1
END DOF_ENUMERATION
END MESH_FEM
So the Dof enumeration is 3 2 2 0 0 1 while in all other branches is 0 1 1 2 2 3.
While for mf_coefvi in REGION 1 the dof enumeration is in descending order instead of being in ascending order. (So it is 2 1 0 instead of 0 1 2)
BEGIN MESH_FEM
QDIM 1
CONVEX 3 'FEM_PK(1,0)'
CONVEX 4 'FEM_PK(1,0)'
CONVEX 5 'FEM_PK(1,0)'
BEGIN DOF_ENUMERATION
3: 2
4: 1
5: 0
END DOF_ENUMERATION
END MESH_FEM
The problem is not only here, but also if I use this mesh_fem to build the mass matrix, it results to be not symmetric.
//descr.IM_TYPEV='IM_GAUSS1D(6)'
pintegration_method pim_v = int_method_descriptor(descr.IM_TYPEV);
mimv.set_integration_method(meshv.convex_index(), pim_v);
getfem::asm_mass_matrix_param(M, mimv, mf_Uvi[1], mf_coefvi[1], coef,
meshv.region(1));
Moreover, also the results of the fem problem are completely wrong.
Instead I noticed that modifying the convex of REGION 1 of the mesh in this way (inverting the node numbers):
CONVEX 3 'GT_PK(1,1)' 3 6
CONVEX 4 'GT_PK(1,1)' 6 5
CONVEX 5 'GT_PK(1,1)' 5 4
I obtain:
- a correct Dof Enumeration:
BEGIN DOF_ENUMERATION
3: 0 1
4: 1 2
5: 2 3
END DOF_ENUMERATION
- a symmetric mass matrix
- a correct solution in terms of velocity
but a wrong solution in terms of pressure (maybe for the boundary conditions).
So I would to know if it is possible to solve the problem and what could be the reason of this error.
Best regards,
Simone Di Gregorio
_______________________________________________
Getfem-users mailing list
address@hidden
https://mail.gna.org/listinfo/getfem-users
--
Yves Renard (address@hidden) 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
---------
|