Extract the airgap flux density (electrical machine)

Numerical methods and mathematical models of Elmer
dapu
Posts: 19
Joined: 16 Jan 2022, 12:35
Antispam: Yes

Extract the airgap flux density (electrical machine)

Post by dapu »

Hi,

My Purpose is to extract the airgap flux density per timestep. I have 3 layers mesh in the airgap and I'd like to get the data in the layer near the stator bore radius. I tried several ways to do it:
1. Extracting the data from the vtu files
The magnetic flux densities are stored as CellData in the vtu files. I did it in Python using package vtk to extract all the flux densities from every cell and calculated the cell center. So that I can filter the data with the radius. It works, but it doesn't look very nice.
2. SaveLine
  • I tried to export the data using SaveLine. The Line is an existing line that is the sliding boundary. It did the work. But it is not the layer I need.
  • I tried to export the data using a defined Polyline. But I didn't succeed to make it work. The idea is to make a circular polyline and get the data along this line. I used the following code:

Code: Select all

 Exec Solver = after timestep !
  Equation = "SaveLine_1"
  Procedure = "SaveData" "SaveLine"
  Filename = line.dat
  Variable 1 = Magnetic Flux Density 1
  Variable 2 = Magnetic Flux Density 2
  Variable 3 = Magnetic Flux Density 3
  Variable 4 = Magnetic Flux Density e 1
  Variable 5 = Magnetic Flux Density e 2
  Variable 6 = Magnetic Flux Density e 3
! Put all data in the same file
!  File Append = True
! Number the files [1,2,...] starting from 1st free number
  Filename Numbering = True

  Coordinate Transformation = String "cartesian to cylindrical"
  Coordinate Transformation Use Degrees = Logical True
  Polyline Coordinates(2,3) = Real 0.13475 0.0 0.0 0.13475 90.0 0   ! 0.13475, radius of the stator airgap
  Polyline Divisions(1) = Integer 768
Does anyone have a better solution?
Thank you!

-Dapu
Attachments
saveLine.png
(23.53 KiB) Not downloaded yet
vtu.png
(47.14 KiB) Not downloaded yet
Last edited by dapu on 27 Jan 2022, 23:47, edited 1 time in total.
dapu
Posts: 19
Joined: 16 Jan 2022, 12:35
Antispam: Yes

Re: Best Way to extract the airgap flux density (electrical machine)

Post by dapu »

Or could I export the flux density elementwise of a body? For example, I define a layer airgap as a body, how can I output the flux density of this body elememtwise per timestep in a transient simulation? Now I work with SaveLine and output the flux density along an existing line. But the discontinuities don't look so nice.
disconti.png
(27.33 KiB) Not downloaded yet
raback
Site Admin
Posts: 4812
Joined: 22 Aug 2009, 11:57
Antispam: Yes
Location: Espoo, Finland
Contact:

Re: Extract the airgap flux density (electrical machine)

Post by raback »

Hi

How about if you add these lines to the MgDyn2D solver:

Code: Select all

  Calculate Loads = True
  Calculate Boundary Weights = Logical True
and then plot the line (az loads)./(az boundary weights). If this looks good we can discuss what you just did ;-)

-Peter
dapu
Posts: 19
Joined: 16 Jan 2022, 12:35
Antispam: Yes

Re: Extract the airgap flux density (electrical machine)

Post by dapu »

Hi Peter,

thanks for the reply. Here is the load/weight of the first timestep. (extracting from the vtu file)
load_weight.png
(33.69 KiB) Not downloaded yet
load_weight.png
(33.69 KiB) Not downloaded yet
-dapu
Attachments
load_weight_zoomed.png
(53.91 KiB) Not downloaded yet
raback
Site Admin
Posts: 4812
Joined: 22 Aug 2009, 11:57
Antispam: Yes
Location: Espoo, Finland
Contact:

Re: Extract the airgap flux density (electrical machine)

Post by raback »

Hi

They should be available in SaveLine. Maybe plot it rather with matlab/octave/gnuplot. Data that is only at boundaries is not easily restored from VTU files.

-Peter
dapu
Posts: 19
Joined: 16 Jan 2022, 12:35
Antispam: Yes

Re: Extract the airgap flux density (electrical machine)

Post by dapu »

Yes, It's in the line.dat. Thanks.
-Dapu
loads_weight_saveline.png
(103.28 KiB) Not downloaded yet
raback
Site Admin
Posts: 4812
Joined: 22 Aug 2009, 11:57
Antispam: Yes
Location: Espoo, Finland
Contact:

Re: Extract the airgap flux density (electrical machine)

Post by raback »

Hi,

Does this look smoother (apart from the end points)? It does not look similar than the earlier fluxes.

So what this is the the reaction force that comes after the FEM equations have been resolved. It is the best estimate for \int \phi (1/mu)dA/dn dS, where \phi is the nodal basis function. It is analogous to computing reaction forces for elasticity or heat equation (in term of N or W). So the flux need to be divided by the respective effective area of the nodes. Luckily for airgap the material law is simple so just multiply the result with permeability of vacuum, pi*4e-7.

I don't know whether this looks better on slave or master side. You could try both, I think there probably is not a huge difference.

-Peter
dapu
Posts: 19
Joined: 16 Jan 2022, 12:35
Antispam: Yes

Re: Extract the airgap flux density (electrical machine)

Post by dapu »

Hi Peter,

Thanks for the reply. I understand what you mean. And here is a comparison between two mesh grades: 180 Elements and 360 Elements in the airgap. It should be fine enough. And the flux density and loads/weights come from the same "SaveLine" results. The x-axis is the atan2(coordinates) from the "SaveLine" results, which is the angle of the nodes. After inspecting the results, I find why I have these discontinuities. The plot with the name "angle" is the geometrical angle of the exported nodes. angle(nodes(1)) almost equals angle(nodes(2)). And I exported the results from an existing line.
For example, with the model having 180 elements in the airgap, the length of the exported result with "SaveLine" is 360.

-dapu
loads_weights.png
(46.81 KiB) Not downloaded yet
flux_density.png
(37.31 KiB) Not downloaded yet
angle.png
(51.46 KiB) Not downloaded yet
raback
Site Admin
Posts: 4812
Joined: 22 Aug 2009, 11:57
Antispam: Yes
Location: Espoo, Finland
Contact:

Re: Extract the airgap flux density (electrical machine)

Post by raback »

Hi Dapu,

I'm a little puzzled where you get these discontinuities. I could see that the elemental fields are discontinuous (they use internally Discontinuous Galerkin basis) but certainly the loads and weights should not be.

Could you maybe post a minimal version of your setup. Or at least "mesh.header" and the sif file.

-Peter
dapu
Posts: 19
Joined: 16 Jan 2022, 12:35
Antispam: Yes

Re: Extract the airgap flux density (electrical machine)

Post by dapu »

Hi Peter,

I figured out where the discontinuities come from. The problem is, with the SaveLine, every node on this line will be exported twice. Here is an example from this forum. It reproduces the same results that I have. After running this example, you will find the node index in column 4 of the line.dat. The same node will be always exported twice. But the flux densities of the 1st export and 2nd export are not the same.

Thanks.

-Dapu
Attachments
Archiv.zip
(499.62 KiB) Downloaded 82 times
Post Reply