bluemira.magnetostatics.finite_element_2d ========================================= .. py:module:: bluemira.magnetostatics.finite_element_2d .. autoapi-nested-parse:: Solver for a 2D magnetostatic problem with cylindrical symmetry Classes ------- .. autoapisummary:: bluemira.magnetostatics.finite_element_2d.FemMagnetostatic2d Module Contents --------------- .. py:class:: 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 (:math:`\Psi`), are then reduced to the form ([Zohm]_, page 25): .. math:: 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]_): .. math:: \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 :math:`v` is the basis element function of the defined functional subspace :math:`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` :param p_order: Order of the approximating polynomial basis functions .. py:attribute:: p_order :value: 2 .. py:attribute:: mesh :value: None .. py:attribute:: V :value: None .. py:attribute:: g :value: None .. py:attribute:: boundaries :value: None .. py:attribute:: psi :value: None .. py:method:: set_mesh(mesh: dolfinx.mesh.Mesh | str, boundaries: dolfinx.mesh.Mesh | str | None = None) Set the mesh for the solver :param mesh: Filename of the xml file with the mesh definition or a dolfin mesh :param boundaries: Filename of the xml file with the boundaries definition or a MeshFunction that defines the boundaries .. py:method:: 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 :param g: Right hand side function of the Poisson problem :param dirichlet_bc_function: Dirichlet boundary condition function :param dirichlet_marker: Identification number for the dirichlet boundary .. py:method:: solve() -> bluemira.magnetostatics.fem_utils.BluemiraFemFunction Solve Fem problem :returns: Magnetic flux :rtype: psi .. py:method:: calculate_b(interpolation_eltype: tuple | None = None) -> bluemira.magnetostatics.fem_utils.BluemiraFemFunction Calculates the magnetic field intensity from psi :param interpolation_eltype: dolfinx element type for interpolation :returns: magnetic field intensity :rtype: B :raises ValueError: Cannot calculate B for a given element .. rubric:: Notes code from Fenics_tutorial ( https://link.springer.com/book/10.1007/978-3-319-52462-7), pag. 104