Dear all,
Any ideas, what is the best way to go when implementing Maxwell equations
to make them dimension independent? Or at least to have the same code for
2d and 3d cases?
Simply using dim template parameter doesn`t work by definition - when
switching from 3D to 2D you need to specify, should it be TE or TM mode
(which field, electric of magnetic, should be normal to the 2D plane).
Introducing some boolean variable `isTEmode` to be True or False can help,
but this will lead to many if\then codes... As soon as it is still the same
Maxwell equation I hope there is a better way to do this. Any ideas?
>From the code point of view it does not work either at the moment. Using
fe (FE_RaviartThomas<dim> (degree), 1, FE_Nedelec<dim> (degree), 1),
where Raviart-Thomas face element is needed for magnetic field, Nedelec
edge element is needed for electric field and
const FEValuesExtractors::Vector B_field (0);
const FEValuesExtractors::Vector E_field (dim);
const auto &curl_W_j = fe_values[E_field].curl (j, q);
const auto &F_i = fe_values[B_field].value (i, q);
works fine for 3D (some wave is traveling in free space) and breaks down in
2D during compilation of a weak-form integral local component.
/home/tig/symlink/dealii/examples/step-maxwell-nonliner/step-maxwell-linear.cc:
In instantiation of ‘void Maxwell::MaxwellTD<dim>::assemble_system() [with
int dim = 2]’:
/home/tig/symlink/dealii/examples/step-maxwell-nonliner/step-maxwell-linear.cc:549:20:
required from ‘void Maxwell::MaxwellTD<dim>::run() [with int dim = 2]’
/home/tig/symlink/dealii/examples/step-maxwell-nonliner/step-maxwell-linear.cc:648:32:
required from here
/home/tig/symlink/dealii/examples/step-maxwell-nonliner/step-maxwell-linear.cc:394:51:
error: no match for ‘operator*’ (operand types are ‘const dealii::Tensor<1,
1, double>’ and ‘const dealii::Tensor<1, 2, double>’)
local_rhs_KT (i, j) += curl_W_j * F_i * fe_values.JxW (q)
Full example is available online at GitHub
https://github.com/kostyfisik/dealii/blob/0188064ee4dd0cdd53d515f33932732b0a2d5d66/examples/step-maxwell-nonliner/step-maxwell-linear.cc
Best regards,
Konstantin Ladutenko
--
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].
For more options, visit https://groups.google.com/d/optout.