PMSM Simulation Symmetric vs Full Model

Numerical methods and mathematical models of Elmer
Post Reply
zmladen
Posts: 43
Joined: 28 Apr 2013, 17:15
Antispam: Yes

PMSM Simulation Symmetric vs Full Model

Post by zmladen »

Hello,

I have made 2 models, the first one is called "model_full" and the other one "model_symm". The first one is based on the full PMSM model and the second one has only 1/3 of the model and uses the symmetry of the machine. It seems that the models give identical results (see images below).

Results of the "model_full"
model_full_scaled.png
model_full_scaled.png (153.62 KiB) Viewed 809 times
Results of the "model_symm"
model_symm_scaled.png
model_symm_scaled.png (89.49 KiB) Viewed 809 times
The problem is that the symm model takes longer time to calculate than the full model. Eventhough, the number of elements of the symm model is 3 times smaller than of the full model. The SIF file settings should be identical. It is also noticable that the mgdyn2d solver of the symm model needs much more iterations to run than the full model.


Solver output of the "model_full"

Code: Select all

MAIN: -------------------------------------
MAIN: 
ComputeChange: NS (ITER=1) (NRM,RELC): (  1.3282287     0.75250525E-02 ) :: mgdyn2d
ComputeChange: NS (ITER=2) (NRM,RELC): (  1.3282146     0.10664113E-04 ) :: mgdyn2d
ComputeChange: NS (ITER=3) (NRM,RELC): (  1.3283190     0.78585266E-04 ) :: mgdyn2d
ComputeChange: NS (ITER=4) (NRM,RELC): (  1.3283152     0.28531122E-05 ) :: mgdyn2d
ComputeChange: NS (ITER=5) (NRM,RELC): (  1.3283151     0.67824760E-07 ) :: mgdyn2d
ComputeChange: NS (ITER=1) (NRM,RELC): ( 0.58164935      2.0000000     ) :: mgdynpost
ComputeChange: NS (ITER=2) (NRM,RELC): ( 0.58168381     0.59254137E-04 ) :: mgdynpost
ComputeChange: NS (ITER=4) (NRM,RELC): (  141854.69      2.0000000     ) :: mgdynpost
ComputeChange: NS (ITER=5) (NRM,RELC): (  141860.93     0.43985741E-04 ) :: mgdynpost
ComputeChange: NS (ITER=9) (NRM,RELC): ( 0.26418459E-02  2.0000000     ) :: mgdynpost
ComputeChange: SS (ITER=1) (NRM,RELC): (  0.0000000      0.0000000     ) :: SaveScalars
ElmerSolver: *** Elmer Solver: ALL DONE ***
ElmerSolver: The end
SOLVER TOTAL TIME(CPU,REAL):       383.59      390.54
ELMER SOLVER FINISHED AT: 2022/01/04 23:00:47
Solver output of the "model_symm"

Code: Select all

MAIN: -------------------------------------
MAIN: 
ComputeChange: NS (ITER=1) (NRM,RELC): ( 0.64438315E+10 0.95086411     ) :: mgdyn2d
ComputeChange: NS (ITER=2) (NRM,RELC): ( 0.21521892E+10 0.99851837     ) :: mgdyn2d
ComputeChange: NS (ITER=3) (NRM,RELC): ( 0.74377213E+11  1.8875105     ) :: mgdyn2d
ComputeChange: NS (ITER=4) (NRM,RELC): ( 0.73780847E+10  1.6390162     ) :: mgdyn2d
ComputeChange: NS (ITER=5) (NRM,RELC): ( 0.49697598E+11  1.4829262     ) :: mgdyn2d
ComputeChange: NS (ITER=6) (NRM,RELC): ( 0.20485144E+12  1.2190487     ) :: mgdyn2d
ComputeChange: NS (ITER=7) (NRM,RELC): ( 0.28329232E+11  1.5140381     ) :: mgdyn2d
ComputeChange: NS (ITER=8) (NRM,RELC): ( 0.13660855E+11 0.69865901     ) :: mgdyn2d
ComputeChange: NS (ITER=9) (NRM,RELC): ( 0.14849375E+10  1.6078284     ) :: mgdyn2d
ComputeChange: NS (ITER=10) (NRM,RELC): ( 0.20076820E+10 0.29934236     ) :: mgdyn2d
ComputeChange: NS (ITER=11) (NRM,RELC): ( 0.26720109E+10 0.28391987     ) :: mgdyn2d
ComputeChange: NS (ITER=12) (NRM,RELC): ( 0.30158262E+10 0.12089494     ) :: mgdyn2d
ComputeChange: NS (ITER=13) (NRM,RELC): ( 0.32799188E+10 0.83895570E-01 ) :: mgdyn2d
ComputeChange: NS (ITER=14) (NRM,RELC): ( 0.20597227E+10 0.45703296     ) :: mgdyn2d
ComputeChange: NS (ITER=15) (NRM,RELC): ( 0.21601730E+10 0.47607962E-01 ) :: mgdyn2d
ComputeChange: NS (ITER=16) (NRM,RELC): ( 0.80494376E+10  1.1536708     ) :: mgdyn2d
ComputeChange: NS (ITER=17) (NRM,RELC): ( 0.27316929E+10 0.98649111     ) :: mgdyn2d
ComputeChange: NS (ITER=18) (NRM,RELC): ( 0.59357366E+10 0.73932962     ) :: mgdyn2d
ComputeChange: NS (ITER=19) (NRM,RELC): ( 0.24568341E+12  1.9056394     ) :: mgdyn2d
ComputeChange: NS (ITER=20) (NRM,RELC): ( 0.21519202E+10  1.9652685     ) :: mgdyn2d
ComputeChange: NS (ITER=1) (NRM,RELC): ( 0.57873685      2.0000000     ) :: mgdynpost
ComputeChange: NS (ITER=2) (NRM,RELC): ( 0.63266331     0.89031606E-01 ) :: mgdynpost
ComputeChange: NS (ITER=4) (NRM,RELC): (  124474.42      2.0000000     ) :: mgdynpost
ComputeChange: NS (ITER=5) (NRM,RELC): (  181066.91     0.37044085     ) :: mgdynpost
ComputeChange: NS (ITER=9) (NRM,RELC): ( 0.27665042E-02  2.0000000     ) :: mgdynpost
ComputeChange: SS (ITER=1) (NRM,RELC): (  0.0000000      0.0000000     ) :: SaveScalars
ElmerSolver: *** Elmer Solver: ALL DONE ***
ElmerSolver: The end
SOLVER TOTAL TIME(CPU,REAL):       405.21      411.34
ELMER SOLVER FINISHED AT: 2022/01/04 23:07:45

Thanks,
Mladen
Attachments
model_full.zip
(780.49 KiB) Downloaded 87 times
zmladen
Posts: 43
Joined: 28 Apr 2013, 17:15
Antispam: Yes

Re: PMSM Simulation Symmetric vs Full Model

Post by zmladen »

I could not attach more than 3 files for some reason. Here the symm model files as well.

-Mladen
Attachments
model_symm.zip
(257.69 KiB) Downloaded 84 times
zmladen
Posts: 43
Joined: 28 Apr 2013, 17:15
Antispam: Yes

Re: PMSM Simulation Symmetric vs Full Model

Post by zmladen »

When I runf the sumulation without the steel parts (rotort and stator as air) the simulation of symm model runs very fast.

Code: Select all

MAIN: 
ComputeChange: NS (ITER=1) (NRM,RELC): ( 0.45360765E+12  1.9266357     ) :: mgdyn2d
ComputeChange: NS (ITER=2) (NRM,RELC): ( 0.45360765E+12  0.0000000     ) :: mgdyn2d
ComputeChange: NS (ITER=1) (NRM,RELC): ( 0.17542539      2.0000000     ) :: mgdynpost
ComputeChange: NS (ITER=2) (NRM,RELC): ( 0.21571294     0.20600156     ) :: mgdynpost
ComputeChange: NS (ITER=4) (NRM,RELC): (  199087.11      2.0000000     ) :: mgdynpost
ComputeChange: NS (ITER=5) (NRM,RELC): (  300601.80     0.40631157     ) :: mgdynpost
ComputeChange: NS (ITER=9) (NRM,RELC): ( 0.81952356E-03  2.0000000     ) :: mgdynpost
ComputeChange: SS (ITER=1) (NRM,RELC): (  0.0000000      0.0000000     ) :: SaveScalars
ElmerSolver: *** Elmer Solver: ALL DONE ***
ElmerSolver: The end
SOLVER TOTAL TIME(CPU,REAL):        72.75       76.78
ELMER SOLVER FINISHED AT: 2022/01/05 15:43:05

zmladen
Posts: 43
Joined: 28 Apr 2013, 17:15
Antispam: Yes

Re: PMSM Simulation Symmetric vs Full Model

Post by zmladen »

Hello,

just wanted to post here the reply from Peter that he wrote within the "PMSM Simulation with Symmetry BC" topic (viewtopic.php?t=7669). This, in my opinion resolves the issue with the simulation time of the symm model used in the MgDyn2D solver.
Hi,

This sounds funny. Maybe you could try to analyze more closely where the time is consumed.

Is the number of nonlinear iterations increased, or the time used for linear solves increased? The assembly time should trivially decrease.

Basically the quadratic elements and mortars may not like each other that much. I would start from linear (and denser) mesh and go quadratic maybe using p-elements (p:2).

When your systems come bigger iterative solvers will beat the direct ones. This may still be faster with direct ones.

Particularly for iterative ones you could try adding "Mortar BCs Additive = Logical True" to mgdyn solver. This sums up the constraints related to same dof which makes sense usually but is not the default because backward compatibility issues.

-Peter
By adding the "Mortar BCs Additive = Logical True" to mgdyn solver the simulation now converges and runs much faster even with nonlinear BH material! Approximately 3x faster than before.

Solver Output

Code: Select all

MAIN: -------------------------------------
MAIN: Time: 61/61:   1.694E-03
MAIN: Estimated time left:  2.3 seconds
MAIN: -------------------------------------
MAIN: 
ComputeChange: NS (ITER=1) (NRM,RELC): (  9834.3518     0.14582817E-03 ) :: mgdyn2d
ComputeChange: NS (ITER=2) (NRM,RELC): (  9833.4478     0.91931219E-04 ) :: mgdyn2d
ComputeChange: NS (ITER=3) (NRM,RELC): (  9834.3533     0.92083289E-04 ) :: mgdyn2d
ComputeChange: NS (ITER=4) (NRM,RELC): (  9834.3706     0.17561767E-05 ) :: mgdyn2d
ComputeChange: NS (ITER=5) (NRM,RELC): (  9834.3702     0.37930891E-07 ) :: mgdyn2d
ComputeChange: NS (ITER=1) (NRM,RELC): ( 0.61751962      2.0000000     ) :: mgdynpost
ComputeChange: NS (ITER=2) (NRM,RELC): ( 0.68320835     0.10100303     ) :: mgdynpost
ComputeChange: NS (ITER=4) (NRM,RELC): (  151607.00      2.0000000     ) :: mgdynpost
ComputeChange: NS (ITER=5) (NRM,RELC): (  217866.01     0.35866771     ) :: mgdynpost
ComputeChange: NS (ITER=9) (NRM,RELC): ( 0.30219590E-02  2.0000000     ) :: mgdynpost
ComputeChange: SS (ITER=1) (NRM,RELC): (  0.0000000      0.0000000     ) :: SaveScalars
ElmerSolver: *** Elmer Solver: ALL DONE ***
ElmerSolver: The end
SOLVER TOTAL TIME(CPU,REAL):       154.07      160.59

Code: Select all

Solver 2
  Equation = MgDyn2D
  Variable = Potential
  Procedure = "MagnetoDynamics2D" "MagnetoDynamics2D"
  Exec Solver = Always
  Stabilize = True
  Optimize Bandwidth = True
  Steady State Convergence Tolerance = 1.0e-5
  Nonlinear System Convergence Tolerance = 1.0e-7
  Nonlinear System Max Iterations = 20
  Nonlinear System Newton After Iterations = 3
  Nonlinear System Newton After Tolerance = 1.0e-3
  Nonlinear System Relaxation Factor = 1
  Linear System Solver = Direct
  Linear System Direct Method = MUMPS
  Mortar BCs Additive = Logical True
End
I've uploaded the project folder as well for reference.

Mladen
Attachments
symm model fast.zip
(189.47 KiB) Downloaded 83 times
zmladen
Posts: 43
Joined: 28 Apr 2013, 17:15
Antispam: Yes

Re: PMSM Simulation Symmetric vs Full Model

Post by zmladen »

It there a docu of parameters or keywords that can be used to setup a particular solver? I cant find anything about the "Mortar BCs Additive = Logical True" in the documentation.

Mladen
raback
Site Admin
Posts: 4812
Joined: 22 Aug 2009, 11:57
Antispam: Yes
Location: Espoo, Finland
Contact:

Re: PMSM Simulation Symmetric vs Full Model

Post by raback »

Hi

Great that the effect of the trick was so huge!

Unfortunately this seems to be undocumented. I just added a few lines to the documentation.

The feature is in quite many tests. Historically we faced this same issue and hence not all cases out there have this. This is a conflict between the the periodic mortars and rotational ones. Hence it only affects the case where part of the machine is solved.

Code: Select all

mgdyn2D_em_conforming/ref.sif:  Mortar BCs Additive = True
MgDynDiscontBCs/case.sif:  Mortar BCs Additive = Logical true 
mgdyn_steady_wire_periodic/case.sif:  Mortar BCs Additive = Logical True
MortarPoisson2Dpriority/case.sif:  Mortar BCs Additive = Logical True
MortarPoisson2Dsum/case.sif:  Mortar BCs Additive = Logical True
RotatingBCMagnetoDynamicsConformingAnti/case.sif:  Mortar BCs Additive = Logical True
RotatingBCMagnetoDynamicsConforming/case.sif:  Mortar BCs Additive = Logical True
-Peter
Post Reply