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 ( ) 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?
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? 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
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};
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.