MatrixFree & complex-valued Helmholtz equation

60 views
Skip to first unread message

Hermes Sampedro

unread,
Oct 13, 2021, 12:07:07 PM10/13/21
to deal.II User Group
Good evening, 

I am implementing the problem presented in step-29 using a MatrixFree approach as presented in step-37.

I have few questions that I would like to ask regarding the local_apply() function (shown in step-37):
  • I am confused about the way of having access to the different complex components. In this case, as the double for loop (i, j) is avoided,  the condition  if(phi.system_to_component_index(i).first==phi.system_to_component_index(j).fsst)   is not longer valid. How can I include it in this particular case?
  • In step-29 we had in the assemble_system(): cell_matrix(i, j) +=(((fe_values.shape_value(i, q_point) *fe_values.shape_value(j, q_point)) *(-omega * omega) +(fe_values.shape_grad(i, q_point) *fe_values.shape_grad(j, q_point)) *c * c) *fe_values.JxW(q_point));   Is it right to write it here as: (omega*omega)*phi.get_values(q)+phi.get_gradient(q)*(c*c)*phi.JxW(q);
  • The same has to be repeated for 

Captura de pantalla 2021-10-13 a las 18.54.55.png

Thank you very much
Regards, 
H.

Hermes Sampedro

unread,
Oct 15, 2021, 8:02:10 AM10/15/21
to deal.II User Group
Dear all, 

I still have issues figuring out how to have access to the component index when doing a MatrixFree implementation with complex values. I would really appreciate it if someone could help me.

Thank you very much
Regards, 
H

peterrum

unread,
Oct 18, 2021, 12:32:54 AM10/18/21
to deal.II User Group
Hi Hermes,

I would suggest that you first take a look at step-67 (https://www.dealii.org/developer/doxygen/deal.II/step_67.html): it deals with systems with multiple components. Although I am not particular familiar with step-29, I guess you can express your complex system as two component system so that many aspects shown in step-67 could be used here.

PM

Hermes Sampedro

unread,
Oct 19, 2021, 5:27:11 AM10/19/21
to deal.II User Group
Thank you very much for the answer. 
I read step-67 and 59 and is somewhere mentioned that there are many different ways to deal with multiple components. In my case (complex values) need only 2.
I was wondering if it is possible to use the MatrixFreeOperators::LaplaceOperator and MatrixFreeOperators::MassOperato with 2 components. If so, could you please give me some clues? 

Thank you very much.
Regards, 
Hermes

Hermes Sampedro

unread,
Oct 19, 2021, 11:21:42 AM10/19/21
to deal.II User Group
Hi again, 
I realized that there is an option to set n_components. Is it the right parameter to choose the number of components (assuming that I set the right components on FE_Q)?

using LaplaceType = MatrixFreeOperators::LaplaceOperator<dim, degree_finite_element, degree_finite_element+1, n_components,LinearAlgebra::distributed::Vector<double>>

LaplaceType Laplace_matrix;


If this is right, I would like to ask the last question if you do not mind. Assuming that I create a MatrixFreeOperators::LaplaceOperator and a MatrixFreeOperators::MassOperator
for example:
MassType mass_matrx;
LaplaceType Laplace_matrix;  


How could I get an operator K  that contains both, mass matrix (M) and laplace (L) matrix as for example: K = M + L? Is that possible with this approach?

Thank you again
Regards, 
H.




Reply all
Reply to author
Forward
0 new messages