Hello everyone,
I was just wondering how I could go about calculating total magnetic energy. I am doing very simple 2D simulations of many magnets. I see that there are multiple norm values in the solver log file, but I do not think that I am looking for an average. If possible, I would like get a total energy.
Thanks,
Montana
Calculating magnetic energy
-
- Posts: 2312
- Joined: 25 Jan 2019, 01:28
- Antispam: Yes
Re: Calculating magnetic energy
Chapter 58 of the models manual describes doing operations on variables in an additional solver
https://www.nic.funet.fi/pub/sci/physic ... Manual.pdf
Solver 3
Exec Solver = After Timestep
Equation = SaveScalars
Procedure = "SaveData" "SaveScalars"
Filename = "fieldstrenght.dat"
Variable 1 = Magnetic Field Strength
Operator 1 = sum
Operator 2 = mean
Operator 3 = max
End
https://www.nic.funet.fi/pub/sci/physic ... Manual.pdf
Solver 3
Exec Solver = After Timestep
Equation = SaveScalars
Procedure = "SaveData" "SaveScalars"
Filename = "fieldstrenght.dat"
Variable 1 = Magnetic Field Strength
Operator 1 = sum
Operator 2 = mean
Operator 3 = max
End
-
- Posts: 6
- Joined: 31 Jul 2020, 01:31
- Antispam: Yes
Re: Calculating magnetic energy
Thanks so much. I believe that's exactly what I was looking for. It's strange to me that that's included in the models manual and not the solver manual.
-
- Site Admin
- Posts: 4828
- Joined: 22 Aug 2009, 11:57
- Antispam: Yes
- Location: Espoo, Finland
- Contact:
Re: Calculating magnetic energy
Hi
I believe the CalcFields computes the magnetic energy automatically. You just have to follow the output or have even an empty instance of SaveScalars.
ElmerSolver Manual includes the services of the library that are usable for all PDE modules, Elmer Models Manual describes the features related to modules that are read in on-the-fly. The naming is somewhat confusing as the whole program is ElmerSolver and individual modules are also called Solvers. If we would start today maybe we use different terms.
-Peter
I believe the CalcFields computes the magnetic energy automatically. You just have to follow the output or have even an empty instance of SaveScalars.
ElmerSolver Manual includes the services of the library that are usable for all PDE modules, Elmer Models Manual describes the features related to modules that are read in on-the-fly. The naming is somewhat confusing as the whole program is ElmerSolver and individual modules are also called Solvers. If we would start today maybe we use different terms.
-Peter
Re: Calculating magnetic energy
Hi, Kevin,kevinarden wrote: ↑06 Apr 2021, 12:25 Chapter 58 of the models manual describes doing operations on variables in an additional solver
https://www.nic.funet.fi/pub/sci/physic ... Manual.pdf
Solver 3
Exec Solver = After Timestep
Equation = SaveScalars
Procedure = "SaveData" "SaveScalars"
Filename = "fieldstrenght.dat"
Variable 1 = Magnetic Field Strength
Operator 1 = sum
Operator 2 = mean
Operator 3 = max
End
I tried to run these coding in my sif file. However, there was a problem about finding SavaScalars Equation. I got the errors as the following:
Can not find SaveData"savescalars_Init0.
Can not find SaveData"savescalars_Init0.dll.
Can not find .\SaveData"savescalars_Init0.
Can not find .\SaveData"savescalars_Init0.dll.
Can not find C:\Program Files\Elmer 9.0-Release/share/elmersolver/lib\SaveData"savescalars_Init0.
Can not find C:\Program Files\Elmer 9.0-Release/share/elmersolver/lib\SaveData"savescalars_Init0.dll.
I already appended this Equation to Elmer before I started solving the problem, but it still gives me an error. I am very confused now. hopefully I can hear some suggestions from you, Thank you.
-
- Posts: 2312
- Joined: 25 Jan 2019, 01:28
- Antispam: Yes
Re: Calculating magnetic energy
I do not have that issue on linux nor windows. Elmer looks in the current working directory, then the usual installation directory for library files. If you have installed Elmer in a different directory you may have to set the $ELMER_HOME system variable for it to find stuff correctly.
-
- Posts: 2312
- Joined: 25 Jan 2019, 01:28
- Antispam: Yes
Re: Calculating magnetic energy
There are also new windows installers available (4/1) to install the latest version of the code. There is a good youtube video on installing in windows.
-
- Site Admin
- Posts: 4828
- Joined: 22 Aug 2009, 11:57
- Antispam: Yes
- Location: Espoo, Finland
- Contact:
Re: Calculating magnetic energy
Hi
I don't think these are errors. These are optional slots for doing some initialization. They may be misleading but they are not errors. You get the main "SaveScalars" routine loaded and that is what matters.
-Peter
I don't think these are errors. These are optional slots for doing some initialization. They may be misleading but they are not errors. You get the main "SaveScalars" routine loaded and that is what matters.
-Peter
Re: Calculating magnetic energy
Hi, Kevin,
Thanks. I have solved that issue. But I still get an error saying " Requested variable does not exist: magnetic field strength". I am wondering if this is the correct variable. Do you know how to fix this issue? The sif file is attached.
Thanks. I have solved that issue. But I still get an error saying " Requested variable does not exist: magnetic field strength". I am wondering if this is the correct variable. Do you know how to fix this issue? The sif file is attached.
- Attachments
-
- case.sif
- (2.92 KiB) Downloaded 154 times
-
- Posts: 2312
- Joined: 25 Jan 2019, 01:28
- Antispam: Yes
Re: Calculating magnetic energy
You don't have the magdynamicscalc solver to calculate the fields
Equation = "MGDynamicsCalc"
Procedure = "MagnetoDynamics" "MagnetoDynamicsCalcFields"
Equation = "MGDynamicsCalc"
Procedure = "MagnetoDynamics" "MagnetoDynamicsCalcFields"