Dear Wolfgang Bangerth, Thank you very much for your answer and for pointing to the relevant steps examples.
I would like to be sure that I am doing the right thing. First, I used DoFRenumbering::component_wise(dof_handler) and got the desired order, thank you. Then I use the extractors *const FEValuesExtractors::Scalar real_component(0);* * const FEValuesExtractors::Scalar imag_component(1);* *Is it correct the following approach to get the global mass matrix of one component? *I get a big 2x2 block matrix with non-zero values on the left top block. Is this corresponding to the global mass matrix of one of the components? *Mass_matrix_tmp(i,j)+=((fe_values[real_component].value(i, q_point) * fe_values[real_component].value(j, q_point)) * fe_values.JxW(q_point));* Thank you again. Best regards, El lunes, 8 de noviembre de 2021 a las 23:04:48 UTC+1, Wolfgang Bangerth escribió: > > Joss: > > > It is not very clear to me what is the order followed when using > > multi-components. As an example to put my question more clear I cann > > point to step-29 where there are 2 components used. > > > > My common sense would be that the system_matrix global operator would > > have first real and then the imaginar components. However, printing the > > matrix and looking at it, I can see the values are somehow intercalated > > (rows and columns). > > *Could someone please clarify this?* > > The way we typically like to think about this is that the DoFHandler > chooses "some" order that simply is what it is. If you want something > specific, you need to say so explicitly. In your case, if you want all > of the real components first and then all of the imaginary components, > then you need to say that that is what you want, and the way to do that > is DoFRenumbering::component_wise(). This function is used in any number > of tutorial programs, see for example step-20 and step-22. > > > > I would also like to ask how can I get the mass matrix of one of the > > components. Using the following for each cell and locating for the > > global matrix I get the two components (again not sure how the order > is...) > > /Mass_matrix(i,j)+=((fe_values.shape_value(i, q_point) * > > fe_values.shape_value(j, q_point)) * fe_values.JxW(q_point));/ > > This results in a different matrix than you want: If the matrix was > structured by component (i.e., it is a 2x2 block matrix), then each of > the four blocks will end up with a mass matrix. That's likely not what > you intended. > > On the other hand... > > > > > On the other hand, using the following, does not allow me to use the > > local_dof_indices function, as using only one component, the dof is half: > > /Mass_matrix(i,j)+=((fe_values.shape_value_component(i, q_point,0) * > > fe_values.shape_value(j, q_point,0)) * fe_values.JxW(q_point));/ > > ...this will only put a mass matrix into the top left block. > > The general strategy to working with all multi-component problems is to > use the "extractors". See again step-20, step-22, and the documentation > module about vector-valued problems. > > Best > W. > > > -- > ------------------------------------------------------------------------ > Wolfgang Bangerth email: [email protected] > www: http://www.math.colostate.edu/~bangerth/ > -- The deal.II project is located at http://www.dealii.org/ For mailing list/forum options, see https://groups.google.com/d/forum/dealii?hl=en --- You received this message because you are subscribed to the Google Groups "deal.II User Group" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/dealii/4753691e-f4e5-4934-9553-a7fa958496bcn%40googlegroups.com.
