Calculate magnetic energy
-
- Posts: 42
- Joined: 23 May 2012, 05:26
- Antispam: Yes
Calculate magnetic energy
Good evening,
I would like to know if there is an example to show how the magnetic energy can be computed for a magnetostatic problem. I have simulated a solenoid in 2D axi-symmetry using the magnetostatic solver, I would like to compute the magnetic energy.
Best,
Frederic
I would like to know if there is an example to show how the magnetic energy can be computed for a magnetostatic problem. I have simulated a solenoid in 2D axi-symmetry using the magnetostatic solver, I would like to compute the magnetic energy.
Best,
Frederic
Re: Calculate magnetic energy
i,
you can enter mathematical expressions in the ElmerPost command line. For example to calculate the magnitude of an electric field, you can write
Or you can use the ResultOutput solver to save your results in vtu format, visualize them in ParaView and use the calculator there.
Or else you can use SaveData/SaveScalars to calculate your result in ElmerSolver directly and save it to a file.
HTH,
Matthias
you can enter mathematical expressions in the ElmerPost command line. For example to calculate the magnitude of an electric field, you can write
Code: Select all
math efield = tovector(Electric.field.1,Electric.field.2,Electric.field.3)
math elfield_mag = sqrt(vdot(efield,efield))
Or else you can use SaveData/SaveScalars to calculate your result in ElmerSolver directly and save it to a file.
HTH,
Matthias
-
- Posts: 42
- Joined: 23 May 2012, 05:26
- Antispam: Yes
Re: Calculate magnetic energy
Thanks,
Frederic
Frederic
-
- Posts: 42
- Joined: 23 May 2012, 05:26
- Antispam: Yes
Re: Calculate magnetic energy
Hi mzenker,
I have tried to find a way to use SaveData ans SaveSaclars without success. How do I implement the magnetic energy calculation directly in Elmer sif file?, I am stuck there without any clues how to get the appropirate variable and so on.
I have tried to find a way to use SaveData ans SaveSaclars without success. How do I implement the magnetic energy calculation directly in Elmer sif file?, I am stuck there without any clues how to get the appropirate variable and so on.
Code: Select all
Header
CHECK KEYWORDS Warn
Mesh DB "." "."
Include Path ""
Results Directory ""
End
Simulation
Max Output Level = 4
Coordinate System = "Axi Symmetric"
Coordinate Mapping(3) = 1 2 3
Simulation Type = Steady state
Steady State Max Iterations = 1
Output Intervals = 1
Timestepping Method = BDF
BDF Order = 1
Solver Input File = solenoid2D.sif
Post File = solenoid2D.ep
End
Constants
Gravity(4) = 0 -1 0 9.82
Stefan Boltzmann = 5.67e-08
Permeability of Vacuum = 1.257e-6
Permittivity of Vacuum = 8.8542e-12
Boltzmann Constant = 1.3807e-23
Unit Charge = 1.602e-19
End
Body 1
Target Bodies(1) = 10000
Name = "Body 1"
Equation = 1
Material = 2
Body Force = 1
End
Body 2
Target Bodies(1) = 20000
Name = "Body 2"
Equation = 1
Material = 1
End
Body 3
Target Bodies(1) = 30000
Name = "Body 3"
Equation = 1
Material = 1
End
Solver 1
Equation = Magnetic Vector Potential equation
Variable = -dofs 1 Magnetic Vector Potential
Procedure = "StatMagSolve" "StatMagSolver"
Calculate Magnetic Flux = Logical True
Calculate Magnetic Flux Abs = Logical True
Calculate Joule Heating = True
Exec Solver = Always
Stabilize = True
Bubbles = False
Lumped Mass Matrix = False
Optimize Bandwidth = True
Steady State Convergence Tolerance = 1.0e-5
Nonlinear System Convergence Tolerance = 1.0e-8
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-8
Linear System Preconditioning = ILU0
Linear System ILUT Tolerance = 1.0e-3
Linear System Abort Not Converged = False
Linear System Residual Output = 1
Linear System Precondition Recompute = 1
End
Solver 2
Exec Solver = after timestep"
exec interval = 1
Equation = "ResultOutput"
Procedure = File "ResultOutputSolve" "ResultOutputSolver"
Output File Name = "solenoid2D."
Output Format = "vtu"
Vtu Format = Logical True
End
Solver 3
Exec Solver = After All
Equation = SaveScalars
Procedure = "SaveData" "SaveScalars"
Filename = "magneticEnergy.dat"
End
Equation 1
Name = "Magnetic Vector Potential equation"
Active Solvers(1) = 1
Static Magnetic Field Logical = Logical True
End
Body Force 1
Name = "BodyForce 1"
Current Density = 1000
End
Material 1
Name = "Air (room temperature)"
Heat expansion Coefficient = 3.43e-3
Viscosity = 1.983e-5
Heat Conductivity = 0.0257
Relative Permittivity = 1.00059
Sound speed = 343.0
Viscosity = 1.983e-5
Heat Capacity = 1005.0
Density = 1.205
Relative Permittivity = 1.00059
End
Material 2
Name = "Copper (generic)"
Poisson ratio = 0.34
Heat expansion Coefficient = 16.5e-6
Electric Conductivity = 59.59e6
Youngs modulus = 115.0e9
Heat Conductivity = 401.0
Sound speed = 3810.0
Heat Capacity = 385.0
Mesh Poisson ratio = 0.34
Density = 8960.0
Poisson ratio = 0.34
Youngs modulus = 115.0e9
End
Boundary Condition 1
Target Boundaries = 40000
Name = "BoundaryCondition 1"
Magnetic Vector Potential = Real 0.0
End
- Attachments
-
- solenoid2D.msh.zip
- Mesh for computation
- (1.29 MiB) Downloaded 480 times
-
- Site Admin
- Posts: 4832
- Joined: 22 Aug 2009, 11:57
- Antispam: Yes
- Location: Espoo, Finland
- Contact:
Re: Calculate magnetic energy
Hi
Look at SaveScalars manual. I guess your energy is \int B^2/2\mu dV. The "convective energy" looks a little bitt like this but you should define a material parameter inverse to permeability i.e. reluctivity to utilize that directly. Assuming you would have "magnetic field" as the field you would then set for SaveScalars.
Much more preferable would be to make a minor addition to the solver itself so that it would compute optimally the energy from the vector potential directly i.e. \int \curl A / 2\mu dV.
-Peter
Look at SaveScalars manual. I guess your energy is \int B^2/2\mu dV. The "convective energy" looks a little bitt like this but you should define a material parameter inverse to permeability i.e. reluctivity to utilize that directly. Assuming you would have "magnetic field" as the field you would then set for SaveScalars.
Code: Select all
Variable 1 = "Magnetic Field"
Operator 1 = "convective energy"
Coefficient 1 = "Reluctivity"
-Peter
-
- Posts: 42
- Joined: 23 May 2012, 05:26
- Antispam: Yes
Re: Calculate magnetic energy
Peter,
I have tried something similar:
But, I cannot find the appropriate variable for the computation. Here is the message that I get:
WARNING:: SaveData: Variable does not exist: magnetic field
I have not explored the option of changing the solver!
Best,
Frederic
I have tried something similar:
Code: Select all
Solver 3
Exec Solver = After All
Equation = SaveScalars
Procedure = "SaveData" "SaveScalars"
Filename = "magneticEnergy.dat"
Variable 1 = "Magnetic Field"
! I tried: "magnetic flux density_abs" as well without success
Operator 1 = "convective energy"
Coefficient 1 = "Reluctivity"
End
WARNING:: SaveData: Variable does not exist: magnetic field
I have not explored the option of changing the solver!
Best,
Frederic
-
- Posts: 42
- Joined: 23 May 2012, 05:26
- Antispam: Yes
Re: Calculate magnetic energy
Peter,
Sorry, I made a mistake in the name of the variable in my *.sif file. The following code produces a result which has not been cross-checked yet, but it runs. The variable is "magnetic field density_abs".
Thanks again,
Frederic
Sorry, I made a mistake in the name of the variable in my *.sif file. The following code produces a result which has not been cross-checked yet, but it runs. The variable is "magnetic field density_abs".
Thanks again,
Frederic
Code: Select all
Header
CHECK KEYWORDS Warn
Mesh DB "." "."
Include Path ""
Results Directory ""
End
Simulation
Max Output Level = 4
Coordinate System = "Axi Symmetric"
Coordinate Mapping(3) = 1 2 3
Simulation Type = Steady state
Steady State Max Iterations = 1
Output Intervals = 1
Timestepping Method = BDF
BDF Order = 1
Solver Input File = solenoid2D.sif
Post File = solenoid2D.ep
Output File = solenoid2D.results
End
Constants
Gravity(4) = 0 -1 0 9.82
Stefan Boltzmann = 5.67e-08
Permeability of Vacuum = 1.2566370614e-6
Permittivity of Vacuum = 8.8542e-12
Boltzmann Constant = 1.3807e-23
Unit Charge = 1.602e-19
End
Body 1
Target Bodies(1) = 10000
Name = "Body 1"
Equation = 1
Material = 2
Body Force = 1
End
Body 2
Target Bodies(1) = 20000
Name = "Body 2"
Equation = 1
Material = 1
End
Body 3
Target Bodies(1) = 30000
Name = "Body 3"
Equation = 1
Material = 1
End
Solver 1
Equation = Magnetic Vector Potential equation
Variable = -dofs 1 Magnetic Vector Potential
Procedure = "StatMagSolve" "StatMagSolver"
Calculate Magnetic Flux = Logical True
Calculate Magnetic Flux Abs = Logical True
Calculate Joule Heating = True
Exec Solver = Always
Stabilize = True
Bubbles = False
Lumped Mass Matrix = False
Optimize Bandwidth = True
Steady State Convergence Tolerance = 1.0e-5
Nonlinear System Convergence Tolerance = 1.0e-8
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-8
Linear System Preconditioning = ILU0
Linear System ILUT Tolerance = 1.0e-3
Linear System Abort Not Converged = False
Linear System Residual Output = 1
Linear System Precondition Recompute = 1
End
Solver 2
Exec Solver = after timestep"
exec interval = 1
Equation = "ResultOutput"
Procedure = File "ResultOutputSolve" "ResultOutputSolver"
Output File Name = "solenoid2D."
Output Format = "vtu"
Vtu Format = Logical True
End
Solver 3
Exec Solver = After All
Equation = SaveScalars
Procedure = "SaveData" "SaveScalars"
Filename = "magneticEnergy.dat"
Variable 1 = "magnetic flux density_abs"
Operator 1 = "convective energy"
Coefficient 1 = "Reluctivity"
End
Equation 1
Name = "Magnetic Vector Potential equation"
Active Solvers(1) = 1
Static Magnetic Field Logical = Logical True
End
Body Force 1
Name = "BodyForce 1"
Current Density = 1000
End
Material 1
Name = "Air (room temperature)"
Heat expansion Coefficient = 3.43e-3
Viscosity = 1.983e-5
Heat Conductivity = 0.0257
Relative Permittivity = 1.00059
Sound speed = 343.0
Viscosity = 1.983e-5
Heat Capacity = 1005.0
Density = 1.205
Reluctivity = Real 0.795774715e6
End
Material 2
Name = "Copper (generic)"
Poisson ratio = 0.34
Heat expansion Coefficient = 16.5e-6
Electric Conductivity = 59.59e6
Youngs modulus = 115.0e9
Heat Conductivity = 401.0
Sound speed = 3810.0
Heat Capacity = 385.0
Mesh Poisson ratio = 0.34
Density = 8960.0
Poisson ratio = 0.34
Youngs modulus = 115.0e9
Reluctivity = Real 0.795774715e6
End
Boundary Condition 1
Target Boundaries = 40000
Name = "BoundaryCondition 1"
Magnetic Vector Potential = Real 0.0
End
-
- Site Admin
- Posts: 4832
- Joined: 22 Aug 2009, 11:57
- Antispam: Yes
- Location: Espoo, Finland
- Contact:
Re: Calculate magnetic energy
Hi Frederic
Note that this approach has the optimal accuracy only when elements are of equal size and the reluctivity is continuous. The errors are not big but still not quite optimal... The reason is that part of the information is lost when the magnetic field density is averaged to a nodal quantity from the integration points.
-Peter
Note that this approach has the optimal accuracy only when elements are of equal size and the reluctivity is continuous. The errors are not big but still not quite optimal... The reason is that part of the information is lost when the magnetic field density is averaged to a nodal quantity from the integration points.
-Peter
Re: Calculate magnetic energy
Hi,ftrillaudp wrote:Good evening,
I would like to know if there is an example to show how the magnetic energy can be computed for a magnetostatic problem. I have simulated a solenoid in 2D axi-symmetry using the magnetostatic solver, I would like to compute the magnetic energy.
Best,
Frederic
are you THE Frederic Trillaud who worked with the worlds first laser quenching device for NbTi strands under the supervision of THE Arnaud Devred?
If yes, guess who am I.
Cheers,
Eelis
-
- Posts: 42
- Joined: 23 May 2012, 05:26
- Antispam: Yes
Re: Calculate magnetic energy
Hi,
I am this person!
Frederic
I am this person!
Frederic