Dear professor, dear all,
I have to assemble a complicated term and I used the high level generic assembly. The problem is the following.
I have a 2D mesh on which two fems are defined: mf_u that is P2 with qdim=2, for velocity, and mf_mult with qdim=2, for Lagrange multiplier, that is P1. This mesh is symmetric with respect to the x axis (y = 0). On the symmetry axis there is a filament represented by a 1D segment that for the 2D mesh is a boundary. On this segment an other mesh mesh made by 1D elements is defined and a fem mf_fil based on Hermite elements is defined.
Now, for some reasons, I had to use the partial mesh fem object. I define mf_u_up on the upper part of the 2D mesh and on the dof on the symmetry axis (therefore on the filament too), and mf_u_dwn on the lower part of the 2D mesh and on the dof on the symmetry axis (therefore on the filament too). In the same way I define mf_mult_up and mf_mult_dwn.
Then, I declare a model, varables and data:
//-----------------------------------------------------------------------------------------------------------------------------------------------
getfem::model model_2;
model_2.clear();
model_2.add_initialized_fem_data("vel_0_up", mf_u_up, vel_0_up);
model_2.add_initialized_fem_data("vel_0_dwn",mf_u_dwn, vel_0_dwn);
model_2.add_fem_variable("lambda_up", mf_mult_up);
model_2.add_fem_variable("lambda_dwn", mf_mult_dwn);
model_2.add_fem_variable("r", p.mf_fil); //r is the displacement y
//Define the interpolate transformation from 2D mesh to 1D mesh
add_interpolate_transformation_from_expression(model_2, "my_transformation", p.mesh_fil, p.mesh, "Print(X)");
getfem::add_linear_generic_assembly_brick(model_2, p.mim_fil,"Print(Interpolate(Grad_vel_0_up, my_transformation).[0.0; 1.0])*r.Interpolate(Test_lambda_up, my_transformation)");
getfem::add_linear_generic_assembly_brick(model_2, p.mim_fil,"Print(Interpolate(Grad_vel_0_dwn, my_transformation).[0.0; 1.0])*r.Interpolate(Test_lambda_dwn, my_transformation)");
model_2.assembly(getfem::model::BUILD_ALL);
//------------------------------------------------------------------------------------------------------------------------------------------------------------//
I need to compute an integral on the filament that is 1D with some quantities that are 2D, therefore I use the Interpolate transformation.
vel_0_up, and vel_0_dwn are data that are previously computed and I also exported them in .vtk so that I can obtain the terms Grad_vel_0_up.[0.0;1.0], Grad_vel_0_dwn.[0.0;1.0] on the filament with paraview. As you can see, I used the Print command so I could save the value of those quantities. Unfortunately, they do not seem to be correct. In particular, the first component of Grad_vel_0_up.[0.0;1.0] is the double than the one obtained with paraview while for Grad_vel_0_dwn.[0.0;1.0] on the filament I obtain something that is almost zero everywhere on the filament. I would expect something symmetric (maybe with differnt sign) due to the fact that vel_0_up and vel_0_dwn are symmetric.
Am I doing something wrong? Is it possible that it is due to the fact that I am using partial mesh fem?
I hope the question is clear.
Kind regards,
Eleonora.