The following are some of the possible electromagnetic formulations.

Some definitions below

de Rham cohomology is a tool belonging to both algebraic topology and differential topology, capable of expressing basic topological information about smooth manifolds in a form particularly adapted to computation and the concrete representation of the cohomology classes.

de Rham Complex is a cochain complex of diffrential forms on some smooth manifold M with the exterior derivative as the differential. 0form -> 1-form -> 2 form -> etc. with each operation resulting in a derivative of the earlir form.

a k-form w is closed if dw=0. w is called exact if w=da for some (k-1) form a.

cohomology is a general term for a sequence of abelian groups associated to a topological space often defined from a cochain complex.

Vector - Covector : a covector field is a quantity that makes sense when integrated over a curve ( circulation), eg: force field, gravity field, electric field, magnetic field, etc.

Tensors : Transformational matrices

Dirichlet BC: essential BC: first type of BC, specifies the value at the boundary.If the value is 0, it is caled homogeneous BC, else inhomogeneous BC.

$$ \hat n \times \vec e = e_t $$

Neumann BC: natural BC: second type of BC, specifies the value of the derivative at the boundary

$$ \hat n \cdot \vec d = d_n $$

Eucledean space: Named after Greek mathematetian Euclid of Alexandria. Euclidean n-space is cartesian space or n-space. This is the space of all n-tuples of real numbers, each tuple representing a point.

Hilbert space: Named after David Hilbert. Generalizes the notion of Euclidean space. It extends the methods of vector algebra and calculus from 2D euclidean plane and 2D space to spaces with any finite or infinite number of dimentions. Hilbert space is an abstract vector space.

$$ \vec{F1} = grad \space f0 = \nabla f0 = (\partial_x, \partial_y, \partial_z)f0 $$

$$ \vec{F2} = curl \space \vec{F1} = \nabla \times \vec{F1} = (\partial_x, \partial_y, \partial_z) \times \vec{F1} $$

$$ f3 = div \space \vec{F2} = \nabla \cdot \vec{F2} = (\partial_x, \partial_y, \partial_z) \cdot \vec{F2} $$

Whitney elements: descrete form of hilbert space.

0-form : Grad operation possible on these :Scalar, continuous field : electric field, magnetic scalar potential, temperature: 0-simplex (node): (nodal elements) conforming finite elements in H1(omega) interpolate scalar fields that are continuous across any interfface.

1-form : vector field of continuous tangential component : electric field e, magnetic field h : 1-simplex ( edge): (edge elements) curl conforming finite elements in H(curl:omega) ensure the continuity of the tangential component of the field.

Consider the Surface with a normal vector n, and the boundary dS with a tangential vector Tau:

$$ on \space domain \space \partial S, \int {\vec h} \cdot \hat \tau \space dL = on \space domain S, \int (\vec j+\partial_t \vec d)\cdot\hat n \space dS $$

$$ on \space domain \space \partial S, \int{\vec{e}}\cdot\hat\tau dL = on \space domain S,-\int \partial_t \vec b\cdot\hat n \space dS $$

Consider the surface S with normal vector n as a boundary between volume V1 and V2:

$$ \hat n \times (\vec h2 - \vec h1) | _S = \vec j_s $$

$$ \hat n \times (\vec e2 - \vec e1) | _S = 0 $$

2-form : vector field of continuous normal component : magnetic field b, current density j, electric field d : 2-simplex(face) : (face elements) div-conforming finite elements in H(div:omega) ensure the continuity of normal component of the interpolated field.

$$ on \space domain \space S, \int {\vec b} \cdot \hat n \space dS = 0 $$

$$ on \space domain \space S, \int {\vec d} \cdot \hat n \space dS = on \space domain \space V, \int \rho \space dV $$

$$ on \space domain \space S, \int {\vec j} \cdot \hat n \space dS = 0 $$

$$ \hat n \times (\vec b2 - \vec b1) | _S = 0 $$

$$ \hat n \times (\vec d2 - \vec d1) | _S = \rho_s $$

3-form : scalar field : electric charge density : 3-simplex(volume): (volume elements) filite elements in L2(omega) do not impose any continuity ( discontinuous) between elements on the interpolated field.

$$ on \space domain \space S, \int {\vec d} \cdot \hat n \space dS = on \space domain \space V, \int \rho \space dV $$

We have the following Maxwell’s equations.

$$ \nabla\times\vec{B} = \mu_0\vec{J} + \mu_0\epsilon_0\frac{\partial{\vec{E}}}{\partial t} \space \space (1) $$

$$ \nabla\cdot\vec{B} = 0 \space \space(2) $$

$$ \nabla \times \vec{E} = - \frac{\partial{\vec{B}}}{\partial t} \space \space (3) $$

$$ \nabla\cdot\vec{E} = \frac{\rho}{\epsilon_0}\space \space (4) $$

$$ from (2), \space B = \nabla \times A \space \space(5) $$

$$ from (4), (5), \space E = -\frac{\partial A}{\partial t} - \nabla \phi_e \space \space(6) $$

$$ from (3),(5),(6), \space $$

Electrostatic formulations

$$ \nabla \times e = 0, \nabla \cdot d = q, d = \epsilon e; BC: n \times e | \Gamma_e = 0, n \cdot d | \Gamma_d = 0 $$

$$ -\nabla(\epsilon\nabla v) = q, v = electric \space scalar \space potential $$

Weak formulation

$$ -\nabla(\epsilon\nabla v) = q \space in \space\Omega $$

integrating the equation weighted by test functions w over the whole domain:

$$ on \space \Omega, \int(-\nabla(\epsilon\nabla v)) w_i d\Omega = on \space \Omega, \int (q) w_id\Omega $$

We have the following identity:

$$ \vec V \cdot \nabla u + u \nabla \cdot \vec V = \nabla \cdot (u \vec V)$$

So, the equation above can be written as

$$ on \space \Omega, \int(-\nabla(w_i \epsilon\nabla v) + \epsilon \nabla v \cdot \nabla w_i) d\Omega = on \space \Omega, \int (q) w_id\Omega $$

We have the following identity:

$$ on \space \Omega, \int \nabla \cdot \vec a d \Omega = on \space \Gamma = \partial \Omega, \oint \vec a d \Gamma $$

The equation above can be written as

$$ on \space \Gamma = \partial \Omega, \int w_i (-\epsilon \nabla v) d\Gamma + on \space \Omega, \int \epsilon \nabla v \cdot \nabla w_i d \Omega = on \space \Omega, \int q w_i d\Omega $$

The BC would render the first term zero resulting in the following equation

$$ on \space \Omega, \int \epsilon \nabla v \cdot \nabla w_i d \Omega = on \space \Omega, \int q w_i d\Omega $$

we assume the scalar quantity v to be found as an approximate sum of functions with weights

$$ v = \sum_j u_j s_j, \space with s_j(x) =0 at \Gamma_Dirichlet $$

$$ where \space s_j(x) \space is \space the \space shape \space function \space set, and \space u_j \space is \space the \space unknown \space coefficient $$ These are also the degrees of freedom of the system of equations

For the Ritz-Galerkin method, the shape function, and the weight functions are equal.

We then have the following equation

$$ on \space \Omega, \int \epsilon \nabla v \cdot \nabla w_i d \Omega = on \space \Omega, \int q w_i d\Omega $$

turned to the following by substitution

$$ \sum_j (\int \epsilon \nabla s_j \cdot \nabla w_i d \Omega ) u_j = \int q w_i d\Omega $$

This is equivalent to the matrix system

$$ [K_{ij}][u_j]=[f_i] $$

We assume the following linear combination for v

$$ v = \sum_n v_n s_n $$

We then declare the function space called Hgrad_v_EleSta (Gradient Conforming Hilbert space for v for electrostatic problem). Defined for getdp below:

FunctionSpace{
  { Name Hgrad_v_EleSta; Type Form0; //0-form quantity to be solved - scalar field
  BasisFunction {
    { Name sn; NameOfCoef vn; Function BF_Node; //assume nodal basis functions. the basis/shape functions are sn and the coefficients/DoF is vn here. 
      Support Dom_Hgrad_v_Ele; Entity NodesOf[All]; } // operate on all nodes of the domain
    }
  Constraint {
    { NameOfCoef vn; EntityType NodesOf; NameOfConstraint Dirichlet_Ele; } //  the constraint on vn for dirichlet BC. 
    }
  }
}
Constraint {
  { Name Dirichlet_Ele; Type Assign; // piecewise BC possible 
    Case {
      { Region Ground; Value 0.; }
      { Region Electrode; Value 1.e-3; }
    }
  }
}

For quick reference, the equation below is represented in the formulation below.

$$ on \space \Gamma = \partial \Omega, \int w_i (-\epsilon \nabla v) d\Gamma + on \space \Omega, \int \epsilon \nabla v \cdot \nabla w_i d \Omega = on \space \Omega, \int q w_i d\Omega $$

The above can be written in terms of inner products

$$ \lt -\epsilon \nabla v, w_i \gt + (\epsilon \nabla v, \nabla w_i) = (q,w_i) $$

The following term is handled by dirichlet constraints

$$ on \space \Gamma = \partial \Omega, \int w_i (-\epsilon \nabla v) d\Gamma $$

$$ \lt -\epsilon \nabla v, w_i \gt $$

The following formulation has reference to the below terms, where wi is the parameter after the comma,

$$ on \space \Omega, \int \epsilon \nabla v \cdot \nabla w_i d \Omega = on \space \Omega, \int q w_i d\Omega $$

$$ (\epsilon \nabla v, \nabla w_i) = (q,w_i) $$

Formulation {
  { Name Electrostatics_v; Type FemEquation; // 
    Quantity {
      { Name v; Type Local; NameOfSpace Hgrad_v_Ele; } // refer to the function space that we created, and the quantity name that needs to be solved. 
    }
    Equation {
      Integral { [ epsilon[] * Dof{d v} , {d v} ]; In Vol_Ele; Jacobian Vol; Integration Int; }
  }
}

Electrokinetics formulations

$$ \nabla \times e = 0, \nabla \cdot j = 0, j = \sigma e; BC: n \times e | \Gamma_e = 0, n \cdot jd | \Gamma_d = 0 $$

$$ -\nabla \cdot (\sigma \nabla v) = 0 $$

Electrodymanics formulation

$$ \nabla \times \vec e = 0, \nabla \times \vec h = \vec j + \partial_t \vec d, \vec j = \sigma \vec e, \vec d = \epsilon \vec e $$

$$ \nabla \cdot (\sigma \nabla v + \epsilon \nabla \partial_t v) = 0 $$

Magnetostatics formulations

$$ \nabla \times \vec h = \vec j_s, \nabla \cdot \vec b = 0, \vec b = \mu \vec h + \vec bs $$

$$ \nabla \times (\frac{1}{\mu}\nabla \times \vec a) = \vec j_s, \vec b = \nabla \times \vec a $$

b-conforming weak form

$$ (\frac{1}{\mu} \nabla \times \vec a, \nabla \times \vec a ) = (\vec j , vec a) $$

Magnetodynamics formulations

$$ \nabla \times \vec h = \vec j, \nabla \times \vec e = -\partial_t \vec b, \nabla \cdot \vec b = 0, \vec b = \mu \vec h + \vec bs, \vec j = \sigma \vec e + \vec js $$

$$ \nabla \times (\frac{1}{\mu}\nabla \times \vec a) + \sigma (\partial_t \vec a + \nabla v) = \vec js, \vec b = \nabla \times \vec a, \vec e = -\nabla v - \partial_t \vec a $$