[Solved!] Mgdyn simulation problem (is it boundary conditions?)

General discussion about Elmer
Nick_99
Posts: 49
Joined: 12 Jul 2023, 10:07
Antispam: Yes

Re: Mgdyn simulation problem (is it boundary conditions?)

Post by Nick_99 »

Hi everyone,

I have a rather strange update for you all.

I was rummaging through some of my earlier attempts at the 3D magnets and came across one I called "cube magnets". The only difference that I can see between this attempt and the bar magnet one I was talking about at the beginning of this discussion is the geometry. The cube magnets are cubes ( :lol: ) and the region surrounding them is also a cube. The results from this simulation also look a lot better than the bar magnets. Would anyone happen to know why?
Screenshot from 2023-07-20 15-17-46.png
(240.96 KiB) Not downloaded yet

Notably, the region's centroid is not in the middle of the two cube magnets. Would this have something to do with the improved results?
Screenshot from 2023-07-20 15-14-37.jpg
(142.1 KiB) Not downloaded yet
Edit: I ran a simulation using the same sif file but I just repositioned the cube region such that the centroid is directly in-between the two magnets. The simulation gave the same results as the one with the region off-centre.


The case.sif files for both of the simulations are practically the same. The solver settings are identical. The only real difference is that the target boundaries in the boundary condition are different.

The sif for the 3D bar magnets is the first sif file shown in this post. The geometry file is also in that post.

The sif for the "cube magnets" is:

Code: Select all

Header
  CHECK KEYWORDS Warn
  Mesh DB "." "."
  Include Path ""
  Results Directory "./results"
End

Simulation
  Max Output Level = 5
  Coordinate System = Cartesian
  Coordinate Mapping(3) = 1 2 3
  Simulation Type = Steady state
  Steady State Max Iterations = 1
  Output Intervals(1) = 1
  Coordinate Scaling = 1e-3
  Solver Input File = case.sif
  Post File = case.vtu
End

Constants
  Gravity(4) = 0 -1 0 9.82
  Stefan Boltzmann = 5.670374419e-08
  Permittivity of Vacuum = 8.85418781e-12
  Permeability of Vacuum = 1.25663706e-6
  Boltzmann Constant = 1.380649e-23
  Unit Charge = 1.6021766e-19
End

Body 1
  Target Bodies(1) = 1
  Name = "Body 1"
  Equation = 1
  Material = 3
End

Body 2
  Target Bodies(1) = 2
  Name = "Body 2"
  Equation = 1
  Material = 2
End

Body 3
  Target Bodies(1) = 3
  Name = "Body 3"
  Equation = 1
  Material = 1
End

Solver 1
  Equation = MgDyn
  Procedure = "MagnetoDynamics" "WhitneyAVSolver"
  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 = Iterative
  Linear System Iterative Method = BiCGStab
  Linear System Max Iterations = 500
  Linear System Convergence Tolerance = 1.0e-10
  BiCGstabl polynomial degree = 2
  Linear System Preconditioning = ILU0
  Linear System ILUT Tolerance = 1.0e-3
  Linear System Abort Not Converged = False
  Linear System Residual Output = 10
  Linear System Precondition Recompute = 1
End

Solver 2
  Equation = MgDynPost
  Procedure = "MagnetoDynamics" "MagnetoDynamicsCalcFields"
  Calculate Magnetic Field Strength = True
  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 = Iterative
  Linear System Iterative Method = BiCGStab
  Linear System Max Iterations = 500
  Linear System Convergence Tolerance = 1.0e-10
  BiCGstabl polynomial degree = 2
  Linear System Preconditioning = ILU0
  Linear System ILUT Tolerance = 1.0e-3
  Linear System Abort Not Converged = False
  Linear System Residual Output = 10
  Linear System Precondition Recompute = 1
End

Equation 1
  Name = "Equation 1"
  Active Solvers(2) = 1 2
End

Material 1
  Name = "Air"
  Relative Permeability = 1
End

Material 2
  Name = "S"
  Electric Conductivity = 625000
  Magnetization 1 = Real -890e3
  Relative Permeability = 1.0997785406
End

Material 3
  Name = "N"
  Electric Conductivity = 625000
  Magnetization 1 = Real 890e3
  Relative Permeability = 1.0997785406
End

Boundary Condition 1
  Target Boundaries(6) = 1 2 3 4 5 6 
  Name = "BoundaryCondition 1"
  AV {e} = Real 0
End
The geometry for the "cube magnets" is:

Code: Select all

// Gmsh project created on Tue Jul 11 12:42:34 2023
SetFactory("OpenCASCADE");

lc = 8; // Region
lp = 2; // Magnets

//+
//Box(1) = {-10, -10, -10, 20, 20, 20};
//+
//Box(2) = {40, 0, 0, 20, 20, 20};
//+
Point(26) = {-10, -20, 10, lp};
Point(27) = {10, -20, 10, lp};
Point(28) = {-10, -20, -10, lp};
Point(29) = {10, -20, -10, lp};
Point(30) = {-10, 0, 10, lp};
Point(31) = {10, 0, 10, lp};
Point(32) = {-10, 0, -10, lp};
Point(33) = {10, 0, -10, lp};

Point(34) = {-10, 20, 10, lp};
Point(35) = {10, 20, 10, lp};
Point(36) = {-10, 20, -10, lp};
Point(37) = {10, 20, -10, lp};
Point(38) = {-10, 40, 10, lp};
Point(39) = {10, 40, 10, lp};
Point(40) = {-10, 40, -10, lp};
Point(41) = {10, 40, -10, lp};



Point(17) = {100, 80, 80, lc};
//+
Point(19) = {-100, 80, 80, lc};
//+
Point(20) = {-100, -80, 80, lc};
//+
Point(21) = {100, -80, 80, lc};
//+
Point(22) = {100, -80, -80, lc};
//+
Point(23) = {100, 80, -80, lc};
//+
Point(24) = {-100, -80, -80, lc};
//+
Point(25) = {-100, 80, -80, lc};
//+
Line(25) = {17, 21};
//+
Line(26) = {21, 20};
//+
Line(27) = {19, 20};
//+
Line(28) = {17, 19};
//+
Line(29) = {19, 25};
//+
Line(30) = {24, 20};
//+
Line(31) = {25, 24};
//+
Line(32) = {22, 23};
//+
Line(33) = {23, 25};
//+
Line(34) = {17, 23};
//+
Line(35) = {22, 21};
//+
Line(36) = {22, 24};
//+
Curve Loop(13) = {31, 30, -27, 29};
//+
Plane Surface(13) = {13};
//+
Curve Loop(14) = {28, 27, -26, -25};
//+
Plane Surface(14) = {14};
//+
Curve Loop(15) = {33, -29, -28, 34};
//+
Plane Surface(15) = {15};
//+
Curve Loop(16) = {26, -30, -36, 35};
//+
Plane Surface(16) = {16};
//+
Curve Loop(17) = {31, -36, 32, 33};
//+
Plane Surface(17) = {17};
//+
Curve Loop(18) = {34, -32, 35, -25};
//+
Plane Surface(18) = {18};
//+
Line(37) = {33, 31};
//+
Line(38) = {31, 30};
//+
Line(39) = {30, 32};
//+
Line(40) = {32, 33};
//+
Line(41) = {29, 33};
//+
Line(42) = {31, 27};
//+
Line(43) = {29, 27};
//+
Line(44) = {27, 26};
//+
Line(45) = {28, 29};
//+
Line(46) = {28, 26};
//+
Line(47) = {26, 30};
//+
Line(48) = {28, 32};
//+
Curve Loop(19) = {38, -47, -44, -42};
//+
Plane Surface(19) = {19};
//+
Curve Loop(20) = {45, 41, -40, -48};
//+
Plane Surface(20) = {20};
//+
Curve Loop(21) = {41, 37, 42, -43};
//+
Plane Surface(21) = {21};
//+
Curve Loop(22) = {46, 47, 39, -48};
//+
Plane Surface(22) = {22};
//+
Curve Loop(23) = {45, 43, 44, -46};
//+
Plane Surface(23) = {23};
//+
Curve Loop(24) = {39, 40, 37, 38};
//+
Plane Surface(24) = {24};
//+
Surface Loop(1) = {19, 24, 22, 23, 20, 21};
//+
Volume(1) = {1};
//+
Line(49) = {34, 35};
//+
Line(50) = {39, 38};
//+
Line(51) = {38, 34};
//+
Line(52) = {35, 39};
//+
Line(53) = {39, 41};
//+
Line(54) = {40, 38};
//+
Line(55) = {37, 35};
//+
Line(56) = {36, 34};
//+
Line(57) = {37, 36};
//+
Line(58) = {36, 40};
//+
Line(59) = {41, 37};
//+
Line(60) = {40, 41};
//+
Curve Loop(25) = {59, 55, 52, 53};
//+
Plane Surface(25) = {25};
//+
Curve Loop(26) = {56, -51, -54, -58};
//+
Plane Surface(26) = {26};
//+
Curve Loop(27) = {59, 57, 58, 60};
//+
Plane Surface(27) = {27};
//+
Curve Loop(28) = {50, 51, 49, 52};
//+
Plane Surface(28) = {28};
//+
Curve Loop(29) = {57, 56, 49, -55};
//+
Plane Surface(29) = {29};
//+
Curve Loop(30) = {53, -60, 54, -50};
//+
Plane Surface(30) = {30};
//+
Surface Loop(2) = {25, 27, 29, 26, 28, 30};
//+
Volume(2) = {2};
//+
Surface Loop(3) = {18, 15, 17, 13, 16, 14};
//+
Surface Loop(4) = {21, 20, 23, 19, 24, 22};
//+
Surface Loop(5) = {25, 27, 29, 26, 28, 30};
//+
Volume(3) = {3, 4, 5};
I have updated the permeability in the "cube magnets" to be consistent with the real permeability of magnets. Thanks to fjimenez for pointing out my error. The permeability in the earlier post has not been updated.

My issue is basically this: Why are the results from the 3D bar magnets so different to the results I'm seeing in the "cube magnets"? The solver settings are the same. The only difference really is the bodies in the boundary condition and the geometry. What about the geometry is making this produce better results than the bar magnets with the sphere as a region?

Kind regards,
Nick

P.S. When I'm referring to the bar magnets example, I'm referring to the geometry and case.sif in this post.
Nick_99
Posts: 49
Joined: 12 Jul 2023, 10:07
Antispam: Yes

Re: Mgdyn simulation problem (is it boundary conditions?)

Post by Nick_99 »

Hi all,

From everyone's help, I now have a 3D mgydn simulation of bar magnets that converges and produces results.

My issue
Unfortunately I've run into issues with the results not aligning with my intuition and the results of my 2D Elmer bar magnet sim (it is possible that I set up the sim incorrectly but I'm doubtful).

For the images below, the plots are of the magnetic field strength plotted as a function of position. The position I'm using is along the x-axis and directly through the centre of one magnet, the air gap, and then the other magnet. The simulation setup (Solver) and ParaView (plot over line) are setup in the same way. See the image below for a visual description
function_of_pos.png
(10.6 KiB) Not downloaded yet

I'm expecting the magnetic field strength results of the 3D sim to look similar to the 2D sim:
Results-2D.png
(38.92 KiB) Not downloaded yet

Instead, the result from the 3D sim looks like:
elmer_3D.png
(41.88 KiB) Not downloaded yet

What I've done
I looked on the web and stumbled upon a blog post on the Elmer website which discusses improved visualisation of discontinuous fields. If I'm correct, then this is what raback's reply was referring to (but I stand to be corrected). This did make the elemental values look much better in the ParaView line plot but the shape and magnitude of the plot still don't line up with what I'm expecting.

I started playing around with the shape of the region containing the bar magnets (sphere vs. box) and saw no changes. I then looked at changing the size of the region (i.e. the distance between the magnets and the boarders of the region). This didn't change the results.

My gut is telling me that the issue might be one (or more or none :lol: ) of the following:
  • Incorrect Elmer setup
  • Incorrect geometry design and/or mesh generation
  • Incorrect ParaView usage
I don't think I'm using ParaView (with the plot over line option) incorrectly as the results are identical when compared to the method described by Rich's post.

Here's the sif file for the simulation

Code: Select all

Header
  CHECK KEYWORDS Warn
  Mesh DB "." "."
  Include Path ""
  Results Directory ""
End

Simulation
  Max Output Level = 5
  Coordinate System = Cartesian
  Coordinate Mapping(3) = 1 2 3
  Simulation Type = Steady state
  Steady State Max Iterations = 1
  Output Intervals(1) = 1
  Coordinate Scaling = 1e-3
  Solver Input File = case.sif
  Post File = case.vtu
End

Constants
  Gravity(4) = 0 -1 0 9.82
  Stefan Boltzmann = 5.670374419e-08
  Permittivity of Vacuum = 8.85418781e-12
  Permeability of Vacuum = 1.25663706e-6
  Boltzmann Constant = 1.380649e-23
  Unit Charge = 1.6021766e-19
End

Body 1
  Target Bodies(1) = 1
  Name = "Body 1"
  Equation = 1
  Material = 2
End

Body 2
  Target Bodies(1) = 2
  Name = "Body 2"
  Equation = 1
  Material = 3
End

Body 3
  Target Bodies(1) = 3
  Name = "Body 3"
  Equation = 1
  Material = 1
End

Solver 1
  Equation = MgDyn
  Procedure = "MagnetoDynamics" "WhitneyAVSolver"
  Exec Solver = Always
  Stabilize = True
  Optimize Bandwidth = True
  Steady State Convergence Tolerance = 1.0e-5
  Nonlinear System Convergence Tolerance = 1.0e-10
  Nonlinear System Max Iterations = 50
  Nonlinear System Newton After Iterations = 3
  Nonlinear System Newton After Tolerance = 1.0e-3
  Nonlinear System Relaxation Factor = 1
  Linear System Solver = Iterative
  Linear System Iterative Method = BiCGStab
  Linear System Max Iterations = 500
  Linear System Convergence Tolerance = 1.0e-10
  BiCGstabl polynomial degree = 2
  Linear System Preconditioning = ILU0
  Linear System ILUT Tolerance = 1.0e-3
  Linear System Abort Not Converged = False
  Linear System Residual Output = 10
  Linear System Precondition Recompute = 1
End

Solver 2
  Equation = MgDynPost
  Calculate Magnetic Field Strength = True
  Procedure = "MagnetoDynamics" "MagnetoDynamicsCalcFields"
  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 = 50
  Nonlinear System Newton After Iterations = 3
  Nonlinear System Newton After Tolerance = 1.0e-3
  Nonlinear System Relaxation Factor = 1
  Linear System Solver = Iterative
  Linear System Iterative Method = BiCGStab
  Linear System Max Iterations = 500
  Linear System Convergence Tolerance = 1.0e-10
  BiCGstabl polynomial degree = 2
  Linear System Preconditioning = ILU0
  Linear System ILUT Tolerance = 1.0e-3
  Linear System Abort Not Converged = False
  Linear System Residual Output = 10
  Linear System Precondition Recompute = 1
End

! This solver has a smaller number than ResultOutput since we want the original unaveraged data.
! Solver 4 will average the data (see https://www.elmerfem.org/blog/models/improved-visualization-of-discontinuous-fields/).
Solver 3
  Exec Solver = after timestep
  Equation = SaveScalars
  Procedure = "SaveData" "SaveLine"
  Filename = xaxis.dat
  Polyline Coordinates(2,3) = -0.15 0.0 0.0 0.15 0.0 0.0
  Polyline Divisions(1) = 1000
End

Solver 4
  Exec Solver = after timestep
  Equation = "ResultOutput"
  Procedure = "ResultOutputSolve" "ResultOutputSolver"
  Output File Name = f
  Vtu format = True
  Discontinuous Bodies = True
  ! bloated alternative for the above maintaining all discontinuities
  ! Discontinuous Galerkin = True 
  Save Geometry Ids = True
  ! use this only in conjunction with quadratic mesh   
  Save Linear Elements = True  
  ! Save Bulk Only = True 
  ! Save Boundaries Only = True 
End

Equation 1
  Name = "Equation 1"
  Active Solvers(4) = 1 2 3 4
End

Material 1
  Name = "Air"
  Relative Permeability = 1.0
End

Material 2
  Name = "N"
  Relative Permeability = Real 1.0997785406
  Electric Conductivity = Real 625000
  
  Magnetization 1 = Real 890000
  Magnetization 2 = Real 0
  Magnetization 3 = Real 0
End

Material 3
  Name = "S"
  Relative Permeability = Real 1.0997785406
  Electric Conductivity = Real 625000
  
  Magnetization 1 = Real -890000
  Magnetization 2 = Real 0
  Magnetization 3 = Real 0
End

Boundary Condition 1
  Target Boundaries(6) = 13 14 15 16 17 18 
  Name = "BoundaryCondition 1"
  AV {e} = Real 0
End
Here's the gmsh file:

Code: Select all

// Gmsh project created on Mon Jul 24 09:22:14 2023

lm = 0.7; // mags
lc = 800.0; // region

SetFactory("OpenCASCADE");
//+
Point(1) = {-110, 15, 2.5, lm};
//+
Point(2) = {-10, 15, 2.5, lm};
//+
Point(3) = {-10, -15, 2.5, lm};
//+
Point(4) = {-110, -15, 2.5, lm};
//+
Point(5) = {-110, -15, -2.5, lm};
//+
Point(6) = {-10, -15, -2.5, lm};
//+
Point(7) = {-10, 15, -2.5, lm};
//+
Point(8) = {-110, 15, -2.5, lm};
//+
Point(9) = {10, 15, -2.5, lm};
//+
Point(10) = {10, -15, -2.5, lm};
//+
Point(11) = {110, -15, -2.5, lm};
//+
Point(12) = {110, 15, -2.5, lm};
//+
Point(13) = {110, 15, 2.5, lm};
//+
Point(14) = {110, -15, 2.5, lm};
//+
Point(15) = {10, -15, 2.5, lm};
//+
Point(16) = {10, 15, 2.5, lm};
//+
Line(1) = {1, 2};
//+
Line(2) = {2, 7};
//+
Line(3) = {7, 6};
//+
Line(4) = {6, 3};
//+
Line(5) = {3, 2};
//+
Line(6) = {3, 4};
//+
Line(7) = {4, 5};
//+
Line(8) = {5, 6};
//+
Line(9) = {8, 5};
//+
Line(10) = {4, 1};
//+
Line(11) = {1, 8};
//+
Line(12) = {8, 7};
//+
Line(13) = {9, 12};
//+
Line(14) = {12, 11};
//+
Line(15) = {11, 10};
//+
Line(16) = {10, 9};
//+
Line(17) = {9, 16};
//+
Line(18) = {15, 10};
//+
Line(19) = {12, 13};
//+
Line(20) = {11, 14};
//+
Line(21) = {14, 13};
//+
Line(22) = {13, 16};
//+
Line(23) = {16, 15};
//+
Line(24) = {15, 14};
//+
Curve Loop(1) = {16, 17, 23, 18};
//+
Plane Surface(1) = {1};
//+
Curve Loop(2) = {14, 20, 21, -19};
//+
Plane Surface(2) = {2};
//+
Curve Loop(3) = {15, -18, 24, -20};
//+
Curve Loop(4) = {15, -18, 24, -20};
//+
Curve Loop(5) = {18, -15, 20, -24};
//+
Plane Surface(3) = {5};
//+
Curve Loop(6) = {13, 19, 22, -17};
//+
Plane Surface(4) = {6};
//+
Curve Loop(7) = {13, 14, 15, 16};
//+
Plane Surface(5) = {7};
//+
Curve Loop(8) = {23, 24, 21, 22};
//+
Plane Surface(6) = {8};
//+
Curve Loop(9) = {3, -8, -9, 12};
//+
Plane Surface(7) = {9};
//+
Curve Loop(10) = {9, -7, 10, 11};
//+
Plane Surface(8) = {10};
//+
Curve Loop(11) = {2, 3, 4, 5};
//+
Plane Surface(9) = {11};
//+
Curve Loop(12) = {8, 4, 6, 7};
//+
Plane Surface(10) = {12};
//+
Curve Loop(13) = {12, -2, -1, 11};
//+
Plane Surface(11) = {13};
//+
Curve Loop(14) = {1, -5, 6, 10};
//+
Plane Surface(12) = {14};
//+
Surface Loop(1) = {12, 11, 7, 9, 10, 8};
//+
Volume(1) = {1};
//+
Surface Loop(2) = {6, 1, 5, 4, 2, 3};
//+
Volume(2) = {2};
//+
Point(17) = {-8000, -8000, -8000, lc};
//+
Point(18) = {-8000, -8000, 8000, lc};
//+
Point(19) = {-8000, 8000, -8000, lc};
//+
Point(20) = {-8000, 8000, 8000, lc};
//+
Point(21) = {8000, 8000, 8000, lc};
//+
Point(22) = {8000, -8000, 8000, lc};
//+
Point(23) = {8000, -8000, -8000, lc};
//+
Point(24) = {8000, 8000, -8000, lc};
//+
Line(25) = {21, 22};
//+
Line(26) = {22, 23};
//+
Line(27) = {23, 24};
//+
Line(28) = {24, 21};
//+
Line(29) = {21, 20};
//+
Line(30) = {20, 18};
//+
Line(31) = {18, 22};
//+
Line(32) = {17, 23};
//+
Line(33) = {17, 18};
//+
Line(34) = {17, 19};
//+
Line(35) = {19, 24};
//+
Line(36) = {19, 20};
//+
Curve Loop(15) = {27, -35, -34, 32};
//+
Plane Surface(13) = {15};
//+
Curve Loop(16) = {27, 28, 25, 26};
//+
Plane Surface(14) = {16};
//+
Curve Loop(17) = {32, -26, -31, -33};
//+
Plane Surface(15) = {17};
//+
Curve Loop(18) = {36, -29, -28, -35};
//+
Plane Surface(16) = {18};
//+
Curve Loop(19) = {34, 36, 30, -33};
//+
Plane Surface(17) = {19};
//+
Curve Loop(20) = {30, 31, -25, 29};
//+
Plane Surface(18) = {20};
//+
Surface Loop(3) = {17, 13, 14, 16, 18, 15};
//+
Surface Loop(4) = {7, 9, 11, 12, 10, 8};
//+
Surface Loop(5) = {6, 1, 5, 4, 2, 3};
//+
Surface Loop(6) = {18, 17, 13, 14, 16, 15};
//+
Surface Loop(7) = {12, 11, 7, 9, 10, 8};
//+
Surface Loop(8) = {18, 17, 13, 14, 16, 15};
//+
Surface Loop(9) = {12, 11, 7, 9, 10, 8};
//+
Surface Loop(10) = {6, 1, 5, 4, 2, 3};
//+
Volume(3) = {8, 9, 10};
Could someone please help me with some guidance?

Kind regards,
Nick
kevinarden
Posts: 2361
Joined: 25 Jan 2019, 01:28
Antispam: Yes

Re: Mgdyn simulation problem (is it boundary conditions?)

Post by kevinarden »

I took your magnet geometry and 3d geo, made 1 change I changed the 3d magnet to 1 unit thick because the 2D case inherently has 1 unit thickness. I compared the plot along the axis of the magnets in 2D and 3D. I also did the 2D case in another program FEMM.
The comparison between 2d FEMM, 2D Elmer, and 3D Elmer look reasonable to me.

I put all of the case files here

https://github.com/mrkearden/mag2D3D

there are plots of the comparison between FEMM and Elmer 2D/3D in the repository
Nick_99
Posts: 49
Joined: 12 Jul 2023, 10:07
Antispam: Yes

Re: Mgdyn simulation problem (is it boundary conditions?)

Post by Nick_99 »

Oh wow :o
Thank you so much for your effort!! I greatly appreciate it.
I will go through your documents and get back to you :D
Nick_99
Posts: 49
Joined: 12 Jul 2023, 10:07
Antispam: Yes

Re: Mgdyn simulation problem (is it boundary conditions?)

Post by Nick_99 »

Update: My apologies. I was plotting the wrong series (guess that's what happens when you're tired :lol:). I will post a comment once I finished going through all of your files.

Original: I guess I'm just rubbish at using ParaView but I can't get the results to look like yours :(

I downloaded the files from your repo and opened the vtu inside the 3D folder. I then used the plot over line filter and set the line to run along the x-axis. This is the result I got.

Screenshot from 2023-07-26 17-24-17.png
(197.69 KiB) Not downloaded yet

I'm not sure why my plot ranges from 7.8 to 8.2 while yours ranges from 0 to 0.22.

I've attached the ParaView state (which just needs to have its extension changed back to pvsm as the forum won't let me upload an extension of that type) in case it helps.
Attachments
paraview_state.txt
(234.04 KiB) Downloaded 24 times
kevinarden
Posts: 2361
Joined: 25 Jan 2019, 01:28
Antispam: Yes

Re: Mgdyn simulation problem (is it boundary conditions?)

Post by kevinarden »

I specifically set my plot line from the left side of the left magnet to the right side of the right magnet, leaving out the air volume. In my model/plots the plot line is -.11,0,0 to 0.11, 0, 0 , the left edge center of the magnet to the right edges center of the other end.
Nick_99
Posts: 49
Joined: 12 Jul 2023, 10:07
Antispam: Yes

Re: Mgdyn simulation problem (is it boundary conditions?)

Post by Nick_99 »

Thanks!

I've managed to replicate all of your results. Thank you so so much!! And thanks again to everyone who joined the discussion for their time and effort.
raback
Site Admin
Posts: 4841
Joined: 22 Aug 2009, 11:57
Antispam: Yes
Location: Espoo, Finland
Contact:

Re: [Solved!] Mgdyn simulation problem (is it boundary conditions?)

Post by raback »

Hi Nick,

Nice that things have converged! Your effort is very much appreciated. Devil often lies in the detail as they say.

Would you want to include this test case are a reference case here:
https://github.com/ElmerCSC/elmer-elmag

I think test cases with comparisons to some reference cases are important in making the code more accessible to people.

-Peter
Nick_99
Posts: 49
Joined: 12 Jul 2023, 10:07
Antispam: Yes

Re: [Solved!] Mgdyn simulation problem (is it boundary conditions?)

Post by Nick_99 »

Hi Peter,

I agree! I will add them to the repo shortly :-)

Edit: I have created a pull request.

Kind regards,
Nick
raback
Site Admin
Posts: 4841
Joined: 22 Aug 2009, 11:57
Antispam: Yes
Location: Espoo, Finland
Contact:

Re: [Solved!] Mgdyn simulation problem (is it boundary conditions?)

Post by raback »

Hi Nick,

I did minor edits to the sif file so that it represents the strategies that I would current recommend.

I also added SaveLine instance that eliminates the cumbersome route (for large cases) via vtu files paraview.

If I may pester you, the comparison to Ansys was really nice. It would be nice to have them at the same plot.

-Peter
Post Reply