mfem / mfem

Lightweight, general, scalable C++ library for finite element methods
http://mfem.org
BSD 3-Clause "New" or "Revised" License
1.67k stars 486 forks source link

Results doesn't converge for the example Hertz #1220

Closed TangLaoya closed 4 years ago

TangLaoya commented 4 years ago

Dear all, I tried to modify the example hertz for my project in branch 'mfem-hertz-dev'. The two versions hertz doens't converge and have different behavior, could anyone help me to take a look at it? I run the example by the following command: hertz -cr "0 0 -0.2 0 0 0.2 0.2 0.4 1"

Thanks, Tang Laoya

electromagnetics.zip

TangLaoya commented 4 years ago

Another question: how to define mesh elements' regions (when there are different regions in the whole model) and assign conductivity, permittivity, and permeability for different regions?

Thanks, Tang Laoya

TangLaoya commented 4 years ago

suppose I have transmit coil with -cr "0 0 -0.01 0 0 0.01 0.03 0.032 1" and receive coil with size "0 0 0.1 0 0 0.12 0.03 0.032" (similar to transmit coil but no current) the coils are placed in well with radius 0.1 m and conductivity 1 S/m, outside the well the conductivity of ground is 0.1 S/m, the relative dielectric constants of all regions are set to be 10. The amplitude of current in transmit coil is 1 A and frequency is 1 MHz. I need to calculate the induced voltage in receive coil. Could you please help me to figure the simple example to solve this problem?

Thanks, Tang Laoya

TangLaoya commented 4 years ago

Dear @mlstowell, Do you have any suggestion for my problem?

Thanks, Tang Laoya

mlstowell commented 4 years ago

Hello, @TangLaoya ,

This is a difficult operator to solve and we don't have many good options. This is the primary reason why this miniapp has not made its way into the master branch of MFEM. The iterative solvers in this miniapp will need a preconditioner to improve convergence and how well this might work depends on the wavelength and the magnitude of the conductivity. Another option is to use a direct solver like SuperLU, MUMPS, or STRUMPACK. These tend to have higher memory requirements but they generally don't have convergence issues as long as the wavelength is not too short.

If the conductivity is large enough and the frequency is not too high you may be able to use HypreAMS as a preconditioner (@tzanio coauthored a paper on this with A. Grayver "Large-scale 3D geoelectromagnetic modeling using parallel adaptive high-order finite element methodEM modeling with high-order FEM".) Best wishes, Mark

TangLaoya commented 4 years ago

Dear Mark, Thank you very much for your kindly reply, I will try to use the direct solver such as PARDISO or MUMPS. My issue is that why two versions have different behavior, is there any problem in the code when I added circle ring? For my another question that how to fill the electromagnetic parameters when multiple domains exist, could you please provide a simple example?

Thanks, Tang Laoya

mlstowell commented 4 years ago

Hi, @TangLaoya ,

A different source should lead to different results. Specifically, what type of differing behavior are you seeing?

The code is configured to use piecewise constant material parameters where regions of the mesh which have been tagged with different attribute numbers will have different material coefficients. For example, if your mesh has two regions marked with attributes 1 and 2 then you could specify their conductivities with -pws '0.1 1.0'. Note that the number of values you provide must match the largest attribute number. For example, if your mesh has two regions which are marked with attributes 2 and 4 then you need to provide 4 values like this -pws '0 0.1 0 1.0'. Where I have used 0's as place holders for attributes 1 and 3 which don't appear in the mesh. Similarly, values for the dielectric constant can be passed with -pwe and the magnetic permeability with -pwm.

Best wishes, Mark

TangLaoya commented 4 years ago

Dear Mark, I have the same setting for two versions. The only difference is that one is hertz.cpp and the other is hertz_ser.cpp. Furthermore, I added the 'current_ring' function in tesla.cpp into hertz.cpp and hertz_ser.cpp to let the model become more close to my project.

I will try to use these options to study how the materials are assigned to elements.

Thanks, Tang Laoya