I'm trying to simulate the force between two metal plates, each having a magnetic field with multiple poles. (a linear motor in 2D aka planar motor). The required magnetic field should be sin(x)sin(z). The current to create such a field is {cos(z)sin(x), -sin(z)cos(x)}, which has a divergence of 0. However, I haven't been able to get the magnetic solver to run with any current > 0. I believe it's because the current density is being "cut-off", and there are a non-integer number of magnetic poles, which creates divergent current at the boundary.
I've thus been trying to understand how the coordinate system works for the fortran body forces, as well as trying to visualize the current density that's currently being generated. I tried several forum posts, including things about "SaveBoundaryValues" and "SaveMaterials" but I haven't been able to get it to work. I've also tried using the StatCurrentSolver, but it seems to ignore body force currents and only takes its input from potential. If I was able to view the current density vector field in paraview, I'm sure this problem could be solved quickly.
What are the coordinates used in the body force fortran function? Where are they referenced to? (the body the force is applied to?, if so, where is 0?)
Much thanks.
Display computed current density body force
-
- Posts: 6
- Joined: 20 Dec 2020, 18:50
- Antispam: Yes
Display computed current density body force
- Attachments
-
- case.sif
- (2.83 KiB) Downloaded 113 times
-
- Site Admin
- Posts: 4812
- Joined: 22 Aug 2009, 11:57
- Antispam: Yes
- Location: Espoo, Finland
- Contact:
Re: Display computed current density body force
Hi
In your sif the coordinates are passed to the CurrDensX etc. subroutines. Maybe you can share them as well.
Note that your currents should be divergence free or otherwise the system cannot have a solution. However, there is a way to fix the current density by adding "Fix Input Current Density = True" to the AV solver.
-Peter
In your sif the coordinates are passed to the CurrDensX etc. subroutines. Maybe you can share them as well.
Note that your currents should be divergence free or otherwise the system cannot have a solution. However, there is a way to fix the current density by adding "Fix Input Current Density = True" to the AV solver.
-Peter
-
- Posts: 6
- Joined: 20 Dec 2020, 18:50
- Antispam: Yes
Re: Display computed current density body force
Alright, I have worked on this some more, and made some progress, but I'm still unable to get the magnetic simulation to converge. I figured out the coordinates now, and I was able to visualise the current vector field by looking at the two components individually, using a potential solver:
Together, that should make 4 loops of current, like this: So, the current looks good to me. Should have divergence == 0. And yet, still no converge. The simulation starts with an error of E+3 and hovers around there and E+4 forever (at least the few minutes I let it run).
I have tried adding "Fix Input Current Density = True", but it didn't seem to change anything.
What could be going wrong? Is it a problem to have large currents right up against an edge, but parallel to it? Can the meshing create divergence?
Together, that should make 4 loops of current, like this: So, the current looks good to me. Should have divergence == 0. And yet, still no converge. The simulation starts with an error of E+3 and hovers around there and E+4 forever (at least the few minutes I let it run).
I have tried adding "Fix Input Current Density = True", but it didn't seem to change anything.
What could be going wrong? Is it a problem to have large currents right up against an edge, but parallel to it? Can the meshing create divergence?
Last edited by evantandersen on 15 Nov 2021, 21:24, edited 1 time in total.
-
- Posts: 6
- Joined: 20 Dec 2020, 18:50
- Antispam: Yes
Re: Display computed current density body force
Here is what I've been using so far. The case-view.sif is what I used to visualize what the body force was doing (and learn the coordinate system)
I meshed the stp file with all of the default settings, except for a max-mesh size of 3 for all the surfaces of the inner 2 plates (in netgen).
I meshed the stp file with all of the default settings, except for a max-mesh size of 3 for all the surfaces of the inner 2 plates (in netgen).
- Attachments
-
- project.zip
- (7.98 KiB) Downloaded 93 times
-
- Site Admin
- Posts: 4812
- Joined: 22 Aug 2009, 11:57
- Antispam: Yes
- Location: Espoo, Finland
- Contact:
Re: Display computed current density body force
Hi
The AV Solver only gives you the potentials. You need to have a postprocessing solver. Check for keyword "Calculate Nodal Forces" as in the following tests:
After you have computed the nodal forces you still need to sum them together. You can use SaveScalars for this, for example.
-Peter
The AV Solver only gives you the potentials. You need to have a postprocessing solver. Check for keyword "Calculate Nodal Forces" as in the following tests:
Code: Select all
elmeruser@elmeruser-VirtualBox:~/elmerfem/fem/tests$ grep 'Calculate Nodal Forces' */*.sif
mgdyn2D_em_harmonic/konesec.sif: Calculate Nodal Forces = True
mgdyn_angular_steady/case.sif: Calculate Nodal Forces = Logical True
mgdyn_anisotropic_rel/cyl-case.sif: Calculate Nodal Forces = Logical True
MgDynDiscontBCs/case.sif: Calculate Nodal Forces = Logical True
mgdyn_hypre_ams/case.sif: !Calculate Nodal Forces = Logical True
mgdyn_nodalforce2d/konesec.sif: Calculate Nodal Forces = Logical True
mgdyn_stump_jfix2/stump.sif: Calculate Nodal Forces = True
mgdyn_stump_jfix/stump.sif: Calculate Nodal Forces = True
TEAM30a_3ph_slip_bf/TEAM30a_3ph_slip_bf.sif: Calculate Nodal Forces = True
TEAM30a_3ph_transient/TEAM30a_3ph_harmonic.sif: Calculate Nodal Forces = True
TEAM30a_3ph_transient/TEAM30a_3ph_transient.sif: Calculate Nodal Forces = True
TEAM30a_3ph_w_bf/TEAM30a_3ph_w_bf.sif: Calculate Nodal Forces = True
-Peter
-
- Posts: 6
- Joined: 20 Dec 2020, 18:50
- Antispam: Yes
Re: Display computed current density body force
The WhitneyAVSolver should still converge without those stages though, right? My problem is that I can't get the system to converge. The simulation just runs forever with ever increasing errors.
I briefly tried adding those stages but it didn't seem to change that behaviour.
-
- Site Admin
- Posts: 4812
- Joined: 22 Aug 2009, 11:57
- Antispam: Yes
- Location: Espoo, Finland
- Contact:
Re: Display computed current density body force
Hi
You're right. Without convergence there is nothing. This equation does not have gauging bu default. So it does not have an inverse either and hence the ILU is not really good for preconditioning. Try with "none" and linear solvers "BiCGStabl" + "Polynomial Degree = 4" or "Idrs" and "Idrs Parameter = 6", for example.
Also have the "Fix Input Current Density" set to True since even if you would have a divergence free current density for the continuous function this might not be the case for the discrete system.
-Peter
You're right. Without convergence there is nothing. This equation does not have gauging bu default. So it does not have an inverse either and hence the ILU is not really good for preconditioning. Try with "none" and linear solvers "BiCGStabl" + "Polynomial Degree = 4" or "Idrs" and "Idrs Parameter = 6", for example.
Also have the "Fix Input Current Density" set to True since even if you would have a divergence free current density for the continuous function this might not be the case for the discrete system.
-Peter