bluemira.magnetostatics.finite_element_2d

Solver for a 2D magnetostatic problem with cylindrical symmetry

Classes

FemMagnetostatic2d

A 2D magnetostatic solver. The solver is thought as support for the fem fixed

Module Contents

class bluemira.magnetostatics.finite_element_2d.FemMagnetostatic2d(p_order: int = 2)

A 2D magnetostatic solver. The solver is thought as support for the fem fixed boundary module and it is limited to axisymmetric magnetostatic problem with toroidal current sources. The Maxwell equations, as function of the poloidal magnetic flux (\(\Psi\)), are then reduced to the form ([Zohm], page 25):

\[r^2 \nabla\cdot\left(\frac{\nabla\Psi}{r^2}\right) = 2 \pi r \mu_0 J_{\Phi}\]

whose weak formulation is defined as ([Villone]):

\[\int_{D_p} {\frac{1}{r}}{\nabla}{\Psi}{\cdot}{\nabla} v \,dr\,dz = 2 \pi \mu_0 \int_{D_p} J_{\Phi} v \,dr\,dz\]

where \(v\) is the basis element function of the defined functional subspace \(V\).

[Zohm]

H. Zohm, Magnetohydrodynamic Stability of Tokamaks, Wiley-VCH, Germany, 2015

[Villone]

VILLONE, F. et al. Plasma Phys. Control. Fusion 55 (2013) 095008, DOI: 10.1088/0741-3335/55/9/095008

Parameters:

p_order (int) – Order of the approximating polynomial basis functions

p_order = 2
mesh = None
V = None
g = None
boundaries = None
psi = None
set_mesh(mesh: dolfinx.mesh.Mesh | str, boundaries: dolfinx.mesh.Mesh | str | None = None)

Set the mesh for the solver

Parameters:
  • mesh (dolfinx.mesh.Mesh | str) – Filename of the xml file with the mesh definition or a dolfin mesh

  • boundaries (dolfinx.mesh.Mesh | str | None) – Filename of the xml file with the boundaries definition or a MeshFunction that defines the boundaries

define_g(g: dolfinx.fem.Expression | bluemira.magnetostatics.fem_utils.BluemiraFemFunction | None = None, dirichlet_bc_function: dolfinx.fem.Expression | bluemira.magnetostatics.fem_utils.BluemiraFemFunction | None = None, dirichlet_marker: int | None = None, neumann_bc_function: dolfinx.fem.Expression | bluemira.magnetostatics.fem_utils.BluemiraFemFunction | None = None)

Define Dirichlet boundary conditions and setup problem

Parameters:
solve() bluemira.magnetostatics.fem_utils.BluemiraFemFunction

Solve Fem problem

Returns:

Magnetic flux

Return type:

psi

calculate_b(interpolation_eltype: tuple | None = None) bluemira.magnetostatics.fem_utils.BluemiraFemFunction

Calculates the magnetic field intensity from psi

Parameters:

interpolation_eltype (tuple | None) – dolfinx element type for interpolation

Returns:

magnetic field intensity

Return type:

B

Raises:

ValueError – Cannot calculate B for a given element

Notes

code from Fenics_tutorial ( https://link.springer.com/book/10.1007/978-3-319-52462-7), pag. 104