Page 1 of 1

Understanding SaveScalar Solver

Posted: 04 Jan 2022, 11:34
by zmladen
Hello,

i am trying to understand how the "r outer" and "r inner" radii are connected with the SaveScalars solver (Solver 5 in the code) used in the PMSM machine of tutorial from Pavel. Also how does the solver knows it should calculate the Torque?

Code: Select all

Body 16 
 Target Bodies(1) = 16 
 Name = "rotor airgap" 
 Equation = 1 
 Material = 1 
 Body Force = 1 
 r outer = Real 0.0406 
 r inner = Real 0.040 
End 

Code: Select all

!save scalar variables - torque T [Nm] 
Solver 5 
 Exec Solver = After Timestep 
 Filename = "scalars.dat" 
 Procedure = "SaveData" "SaveScalars" 
 Show Norm Index = 1 
End
In the literature it is stated that you can use SaveLine solver and define the coordinates using the "Polyline Coordinates".

Code: Select all

Solver n
 Equation = "SaveLine"
Procedure = File "SaveData" "SaveLine"
Filename = "g.dat"
File Append = Logical True
Polyline Coordinates(2,2) = Real 0.0 1.0 0.0 2.0
End
Also in the example given in the documentation (see code below). Does the solver n calculate the values of the listed variables under given operators on the boundary m? How does the SaveScalar solver know which boundary intex to use? Probably it uses all boundaries where "Save Scalars = Logical True" is given? If I would need to calculate variables on the other boundaries as well would I need a SaveScalar solver for each boundary? In that cas, wow the particular SaveScalar solver is connected with the corresponding boundary index?

Code: Select all

Solver n
 Exec Solver = after timestep
 Equation = String SaveScalars
 Procedure = File "SaveData" "SaveScalars"
 Filename = File "f.dat"
 Variable 1 = String Temperature
 Operator 1 = String max
 Variable 2 = String Temperature
 Operator 2 = String min
 Variable 3 = String Temperature
 Operator 3 = String mean
End

Boundary Condition m
 Save Scalars = Logical True
End

Re: Understanding SaveScalar Solver

Posted: 04 Jan 2022, 14:17
by raback
Hi

There is a convention between the different solvers that they may internally compute some important scalars that will be simply added to the list stucture of the simulation. You find sniplets roughly like this in the code:

Code: Select all

CALL ListAddConstReal( Model % Simulation,'res: torque',torque)
So the SaveScalars really does not know anything about the torque, it just saves all data with prefix "res:".

The torque is computed in the MagnetoDynamics solvers when that "r inner" and "r outer" are given.

-Peter

Re: Understanding SaveScalar Solver

Posted: 04 Jan 2022, 14:22
by raback
Hi

For the 2nd part, yes "Save Scalars" is the mask. However, you can change the mask for each "Operator i" by "Mask Name i". See test case "savescalars_mask" for an example.

-Peter

Re: Understanding SaveScalar Solver

Posted: 04 Jan 2022, 14:40
by zmladen
Hello Peter,

so, for the MagnetoDynamics solver when defining two radii inside the body section the torque is always calculated? The radii can be named randomly like "r1" and "r2" or the naming should be used as in the example of Pavel "r outer" and "r inner"?

Re: Understanding SaveScalar Solver

Posted: 04 Jan 2022, 15:04
by zmladen
Where i can find the "savescalars_mask" test case?

Re: Understanding SaveScalar Solver

Posted: 04 Jan 2022, 15:53
by kevinarden

Re: Understanding SaveScalar Solver

Posted: 04 Jan 2022, 16:25
by zmladen
Thanks!
Mladen