1 Introduction

Many applications of current interest require merging different engineering fields, such as mechanical, electrical on civil engineering. The corresponding multi-physics problems will have to use different fields, which are each obtained by a particular solution procedure and a dedicated computer code. The most efficient approach to such multi-physics problems is to create a master code that allows to exchange information in real time and for every iteration among dedicated mono-physics simulation codes. The latter was accomplished successfully for fluid-structure interactions (e.g., [25, 26]), by using the partitioned solution procedure [14] that allows reusing existing codes. This currently seems not to be possible when it comes to the coupling of mechanics and electromagnetism, due to complete different philosophy in representing different fields and governing global equations on either side, with equilibrium versus global constitutive law.

Thus, the vast majority of works on coupled mechanics and electromagnetism turned toward extending the philosophy specialized for their particular field to all the other fields computations. The current approach by mechanics experts relies upon the standard isoparametric finite element approximations and the simplest case of using a scalar potential for electric and magnetic fields [32, 33], which can accommodate, for instance, piezoelectric or piezomagnetic devices. This type of approach is further extended to higher order approximations, large displacement and homogenization techniques always using the finite element approximation for all fields; see [15, 40] and [27], among others.

A completely different approach is followed by experts in physics and electrical engineering, with a typical attempt by [43] where the formalism most suitable for electromagnetism is generalized to also describe mechanics. The theoretical formulation of this kind does not consider the local fields, but rather the global quantities set within the corresponding mathematical structure, often called De Rham’s complex [7]. The discrete approximation based on such formulation is rather different than standard finite element method [48], and is based on differential forms and exterior calculus.

The mathematical foundation of that kind of discretization is found in [34] or [4] and one of the first applications appears in the literature under the name of edge elements, allowing to calculate variables on edges for a particular kind of problem in electromagnetism, the calculation of eddy-currents [8]. The step forward in the right direction is offered by Whitney’s elements with a more complete choice of unknowns where not only edges, but also facets and volumes could allocate variables [9]. Since then, several works explored linear tetrahedron edge elements, [1] or [11], prisms, pyramids and hexahedron linear elements [13, 17] or [34], and more recently some higher order elements [30, 45, 46] or [47]. However, many of these elements cannot be fully invariant (as verified for hexahedral elements implementing Whitney’s discretization) for distorted meshes as revealed by the basic 3D patch test [29, 48]; the proof is given in [34], where only hexahedral element produced by affine isoparametric transformation can be used; in other words, the element cannot be used for a degenerated parallelepiped. We note in passing that such condition is always fulfilled for linear tetrahedron, since the transformation is always affine, unless the Jacobian is negative or zero.

The cell method proposed in [2, 39] or [43] makes use of different geometrical entities in every element, such as vertices, edges, faces and volumes in order to provide the best locations for unknown parameters. The advantage of such an approach is its ability to preserve tangential and normal continuity for electric and magnetic variables. This is achieved by cell-based discretization of the global governing equations transforming continuum operators into discrete operators over each cell. The choice of discrete approximation and element connectivity is based entirely on the complete topology of the problem and the connections of the different elements between them. The main disadvantage from standpoint of coupling is the end product of discretization, which is equivalent to the global constitutive equations, which would be very difficult (if not impossible) to generalize to any other but linear case. In addition, this method complicates meshing since it requires perfect match between the primal and the dual mesh when allocating the dual variables [38].

For eventual coupling with mechanics it is important to note that the cell method approach is in contrast to the standard finite element philosophy. The latter relies upon the weak formulation of (equilibrium) equations to provide the corresponding discretization [48]. Solving such weak form does not guarantee that the equation is ensured at every point of the domain, but rather in average sense in a partitioned volume. All unknown variables, called degrees of freedom, are placed at nodes; inside the element the discrete approximation is continuous and offers an important advantage of partition-of-unity to make sure the basic case (patch test) is verified. Yet, the finite element approximation typically does not offer the continuity of field derivatives across element boundaries, which was the main obstacle of extending the low-order finite element approximations to electric or magnetic fields.

Similarly, the cell method approach is not easily adapted to mechanics with several attempts to recast all fields within such unified framework typical for physics, such as [10] or electromagnetics code like GetDP [12]. Namely, despite similarities in theoretical formalisms, the mechanics primal and dual variables are second order tensors as opposed to electric, magnetic, and thermal fields where they remain vectors. Attempts to generalize the cell method approach to solve the problems with more complicated mechanics models have not been recorded, and furthermore, they seem very difficult to imagine. Namely, plasticity coupled with electric field [32] requires precise localization of the plastic zone that keeps changing throughout computations, making a global constitutive equation impossible to describe. However, a few authors have used the exterior calculus formalism to adapt it to finite element method philosophy such as [3]

As for theoretical aspects of the problem, the electromagnetics community also evaluated a potential energy-type of variational formulation [20, 21, 35], which is no different from mechanical approach in, for instance, [22]. Alternatively, other variational formulations explored concern the complementary potential energy approach, which dual to the former variational form, as suggested in [36, 37] or [16]. These latter works are again cast in the standard format of electro-engineering with the formulation trying to bracket the error estimates in term of the constitutive equations. Interestingly enough, one type of error estimates for mechanics proposed in [28] also considers the same approach where the potential energy based formulation gives the upper limit while the complementary gives the lower limit.

The main motivation for this work is seeking the optimal formulation for coupled electromagnetic and thermomechanical fields, which will be amenable to the material and mechanics point-of-view and the finite element discrete approximations that can be combined with existing approaches and be integrated within the standard computer code architecture. This is especially the case when considering a currently very important issue of seeking to open up the path toward exploration of the engineering materials which can be heterogeneous or experience hardening and permanent damage with microscale point-of-view that proved very successfully in mechanics (e.g., [5] or [23]). This approach is in contrast with the cell method, where variables are discretized by means of global operators as opposed to the localization that requires phenomena like plasticity or damage. In contrast to the current tendency to introduce higher order approximations, the discrete approximations proposed in this work are low-order (linear), which makes them more suitable for heterogeneous materials and inelasticity regime where the solution in general is not smooth. In addition, we recast the novel approach to electrostatics and magnetostatics where the constitutive equations are explicit part of the formulation to be easily generalized to more complex behavior like ferroelectricity. We also recast the discrete approximation in the manner that can be combined with finite element codes, by exploiting the partition-of-unity property of the finite element discretization.

The outline of the paper is as follows. In Sect. 2, two points of view for electromagnetism are presented and the differences are discussed. Different variational formulations, both primal and dual, are introduced in Sect. 3 in the spirit of mechanics with their corresponding weak forms. The discrete approximations are constructed in agreement with Whitney’s elements, and details are presented for tetrahedron element in Sect. 4. In Sect. 5, several validation tests and examples are calculated by using the proposed formulations and implementation in a research version of FEAP- Finite Element Analysis Program. Finally, some concluding remarks are stated in Sect. 6.

2 Electrostatic and magnetostatic phenomena

2.1 Classical formulation

The traditional description of the electromagnetic phenomena is defined by four laws first proposed by Faraday, Ampère and Gauss. These equations feature electric field \(\varvec{E}\), magnetic field \(\varvec{H}\) and their dual fields, electric displacement \(\varvec{D}\) and magnetic induction \(\varvec{B}\). They can jointly be cast in terms of four differential equations, known as Maxwell’s equations for electromagnetism [5]. The latter provides, from the macroscopic point-of-view, an adequate description for many electromagnetic phenomena observations on how these fields evolve in the presence of the free electric flux \(\varvec{J}\) and free electric charge density \(\rho _q^f\):

$$\begin{aligned} \left\{ \begin{array}{l} \nabla \times \varvec{E} = - \dot{\varvec{B}} \\ \nabla \times \varvec{H} = \varvec{J} + \dot{\varvec{D}} \\ \nabla \cdot \varvec{D} = \rho _q^f \\ \nabla \cdot \varvec{B} = 0 \end{array} \right. \end{aligned}$$
(1)

These equations are enough to describe a pure electromagnetic problem. However, if mechanics are involved, the definition of Lorentz’s force must be added. One can also recover from (1)\(_2\) and (1)\(_3\) the condition on the conservation of electric charge that constraints \(\rho _q^f\) and \(\varvec{J}\) for coupled electromagnetic case according to:

$$\begin{aligned} \dot{\rho }_q^f + \nabla \cdot \varvec{J} = 0 \end{aligned}$$
(2)

Considering static case for the sake of simplicity, with negligible rate of change of electric and magnetic fields and time derivatives \(\dot{\varvec{B}}\), \(\dot{\varvec{D}}\) and \(\dot{\rho }_q^f\) equal to zero, we uncouple electrostatics and magnetostatics; thus, one obtains two separate problems, one for (i) electrostatics:

$$\begin{aligned} \left\{ \begin{array}{l} \nabla \times \varvec{E} = \varvec{0} \\ \nabla \cdot \varvec{D} = \rho _q^f \end{array} \right. \end{aligned}$$
(3)

and another for (ii) magnetostatics:

$$\begin{aligned} \left\{ \begin{array}{l} \nabla \times \varvec{H} = \varvec{J} \\ \nabla \cdot \varvec{B} = 0 \end{array} \right. \end{aligned}$$
(4)

Moreover, for static case the result in (2) simplifies to \( \nabla \cdot \varvec{J} = 0\), placing a constraint on the electric flux, treated as a source term in magnetostatic formulation. Thanks to this kind of weak coupling, each of these problems can be handled independently from one another. For clarity, we first focus on electrostatics, and then briefly revisit magnetostatic case in order to point out the prominent differences.

One has to deal with two diametrically different constitutive behaviors for electric field in terms of conductors versus insulators. The key difference between those two types of behavior is that the electrons for the conductors are free to move, whereas for the insulators the electrons remain bounded to their nucleus [5, 23].

In conductors, the field of interest is electric flux \(\varvec{J}\), which measures the flow of electrons through a surface. For the simplest linear relation between the electric field and the electric flux defined for conductors through the conductivity coefficient \(\gamma \), we can write:

$$\begin{aligned} \varvec{J} = \gamma \varvec{E} \end{aligned}$$
(5)

which indicates that the electric flux will clearly go in the same direction as the electric field. For perfect conductors, the conductivity coefficient \(\gamma \rightarrow \infty \) whereas for perfect insulators \(\gamma \rightarrow 0\). Most of all real materials fall in-between these two extremes. Namely, an insulator like glass has free electric flux, although it remains many orders of magnitude lower than the one in a conductor such as copper; for instance, the two materials we just compared have a relation of conductivities of the order \(\gamma _{\mathrm {con}} \approx 10^{20} \gamma _{\mathrm {ins}}\) [31]. Thus, the flux in an insulator material is simply considered as zero.

In fact, insulators react to electric fields by orienting dipoles, deformed atoms or molecules with two opposite charges held in place by molecular forces. Thus, these charges are not free to move as it happens with conductors. The orientation of dipoles is measured by the polarization vector \(\varvec{P}\). Dielectric materials are a particular case of insulators where the polarization is proportional to \(\varvec{E}\). Therefore, the electric displacement definition can be written as:

$$\begin{aligned} \varvec{D} = \epsilon _0 \varvec{E} + \varvec{P} = \epsilon _0 \left( \varvec{I} + \varvec{\chi }_{\mathrm {e}} \right) \varvec{E} = \varvec{\epsilon } \varvec{E} \end{aligned}$$
(6)

with \(\epsilon _0\) as the permittivity of the vacuum, \(\varvec{\epsilon }\) as the permittivity of the material, and \(\varvec{I}\) as the second-order identity tensor.

In Fig. 1, we illustrate the behavior of conductors and dielectric materials with respect to an applied electric field. For conductors, the electrons move through the domain in the direction of \(\varvec{E}\). For the insulator, the dipoles inside the domain are also oriented in the same direction, but net charges appear only at the boundaries, due to cancellation of opposite charges inside the domain [19].

Fig. 1
figure 1

Different behavior of conductors (left) and dielectric (right) electric materials

In contrast to the complexity of electric behavior placed between two extremes of conductors and insulators, the magnetic constitutive behavior is simpler and it does not have a conductor analogy. For this paper, only diamagnetic materials are taken into account, where the magnetization \(\varvec{M}\) is proportional to \(\varvec{H}\). Thus, we define the magnetic induction through linear constitutive relation:

$$\begin{aligned} \varvec{B} = \mu _0 \left( \varvec{H} + \varvec{M} \right) = \mu _0 \left( \varvec{I} + \varvec{\chi }_\mathrm {h} \right) \varvec{H} = \varvec{\mu } \varvec{H} \end{aligned}$$
(7)

with \(\mu _0\) as the permeability of vacuum and \(\varvec{\mu }\) as the permeability of the material.

2.2 Proposed theoretical formulations

In this section we present our main objectives of generalizing the electromagnetics formulation for the case that can include heterogeneous materials, and further account for combined constitutive behavior with mechanics. Hence, we seek to establish a clear analogy with mechanics point-of-view in formulating the boundary value problems in electrostatics in the vein of the mechanical problem formulation. Consider a domain \(\bar{\varOmega }\), with two different parts distinguished: the interior of domain \(\varOmega \) and its boundary \(\varGamma \). In addition, the boundary can be separated into two different parts, depending on the primary or dual variable imposed. For electrostatics, on \(\varGamma _V\) we impose the essential or Dirichlet boundary condition through scalar electric potential V, and on \(\varGamma _D\) the natural or Neumann boundary condition through the normal component of \(\varvec{D}\) [5, 23]. The complete set of equations that describe the electrostatic phenomena for such domain can then be written as follows:

$$\begin{aligned} \begin{array}{l} \text{ Field } \text{ equations: }\\ \left. \begin{array}{ll} \text{ Kinematics } &{} \qquad \varvec{E} = -\nabla V\\ \text{ Constitutive } &{} \qquad \varvec{D} = \varvec{\epsilon } \varvec{E}\\ \text{ Equilibrium } &{} \qquad \nabla \cdot \varvec{D} = \rho _q^f \end{array} \right\} \text{ in } \varOmega \\ \text{ Boundary } \text{ conditions: }\\ \begin{array}{lll} \text{ Essential } \text{ BC } \qquad &{} V = \bar{V} &{} \quad \text{ in } \varGamma _V\\ \text{ Natural } \text{ BC } \qquad &{} \varvec{D} \cdot \varvec{n} = \bar{D} &{} \quad \text{ in } \varGamma _D \end{array} \end{array} \end{aligned}$$
(8)

We indicated in the first equation in (8), that a “kinematics” equation links V and \(\varvec{E}\) in the equivalent manner as displacements are related to strains in mechanics. This equation automatically implies the electrostatic version of Faraday’s law (3)\(_1\). The second equation in (8) shows the constitutive relation between \(\varvec{E}\) and \(\varvec{D}\) through the permittivity tensor, in a similar way that stresses are related to strains through the elasticity tensor. The final equation balancing the divergence of \(\varvec{D}\) with \(\rho _q^f\) corresponds to mechanics equilibrium equation relating the divergence of the stress tensor with the volume force.

A complementary problem formulation in terms of dual variables can also be posed. It will be illustrated for magnetostatics by using magnetic vector potential \(\varvec{A}\), equivalent to Airy’s function for the stress tensor \(\varvec{\sigma }\). The corresponding complementary single-field formulation can be written as:

$$\begin{aligned} \begin{array}{l} \text{ Field } \text{ equations: }\\ \left. \begin{array}{ll} \text{ Compatibility } &{} \qquad \varvec{B} = \nabla \times \varvec{A}\\ \text{ Constitutive } &{} \qquad \varvec{H} = \varvec{\nu } \varvec{B}\\ \text{ Equilibrium } &{} \qquad \nabla \times \varvec{H} = \varvec{J} \end{array} \right\} \text{ in } \varOmega \\ \text{ Boundary } \text{ conditions: }\\ \begin{array}{lll} \text{ Essential } \text{ BC } \qquad &{} \varvec{A} = \bar{\varvec{A}} &{} \quad \text{ in } \varGamma _A\\ \text{ Natural } \text{ BC } \qquad &{} \varvec{n} \times \varvec{H} = \bar{\varvec{J}} &{} \quad \text{ in } \varGamma _H \end{array} \end{array} \end{aligned}$$
(9)

where \(\varvec{\nu } = \varvec{\mu }^{-1}\) is the reluctancy of the material. The key difference from related problems in mechanics is the choice of vector potential and the curl operator instead of the gradient to define \(\varvec{B}\) . Such a choice allows to automatically satisfy (4)\(_2\).

3 Variational formulations

In this section, three variational formulations of the electrostatic problem are presented providing the basis for the corresponding choice of the finite element discrete approximation. The first two are single-field formulations: one is based on total potential energy with scalar potential V as the main variable, and the other is based on the total complementary potential energy with \(\varvec{D}\). A mixed formulation is proposed as well based on the Hellinger-Reissner principle for mechanics adapted to electrostatics with two independent variables V and \(\varvec{D}\). A magnetic formulation is provided in the last place to highlight the analogy between the complementary energy formulation of electrostatic and the corresponding formulation for magnetostatics.

3.1 Single field electrostatic formulation with scalar potential

The simplest approach for the electrostatic problems is by using a single independent field as electric scalar potential V [21, 44]. The remaining fields are obtained by using the strong form Eqs. (8)\(_1\) and (8)\(_2\). Namely, the weak form of balance equation in (8)\(_3\) leads to variational formulation of the electrostatics:

$$\begin{aligned} \varPi ^{\mathrm {V}}\left( V \right)= & {} \int _\varOmega \left\{ \dfrac{1}{2}~\varvec{\epsilon }~\nabla V \cdot \nabla V \right. \nonumber \\&\left. - V~\rho _q^f \right\} ~\text{ d }\varOmega + \int _{\varGamma _D} V \bar{D}~\text{ d }\varGamma \end{aligned}$$
(10)

where \(\bar{D}\) is the electric displacement imposed at the Neumann boundary. Any trial functions must satisfy the Dirichlet boundary condition with \(\left. V \right| _{\varGamma _V} = \bar{V}\), which should be applied at least at one point in order to guarantee a unique solution. Minimizing this potential leads to the corresponding variational equation:

$$\begin{aligned} G^{\mathrm {V}}_V \left( V;V^{*} \right):= & {} \int _{\varOmega } \nabla V^{*} \cdot \varvec{\epsilon } \nabla V~\text{ d }\varOmega - \int _{\varOmega } V^{*} \rho _q^f~\text{ d }\varOmega \nonumber \\&+ \int _{\varGamma _D} V^{*} \bar{D}~\text{ d }\varGamma = 0 \end{aligned}$$
(11)

where \(V^{*}\) is the variation of V, which should take zero value at the Dirichlet boundary \(\left. V^{*}\right| _{\varGamma _V} = 0\). The standard choice of finite element discrete approximation is suitable for this variational formulation [32].

3.2 Hellinger-Reissner hybrid formulation for electrostatics

It is possible to further weaken one of the equations in (8) in order to establish the variational formulation of the problem by using two independent fields, V and \(\varvec{D}\). This is the Hellinger-Reissner type of variational formulation [44], for which the mechanics equivalent is obtained featuring the complementary energy, which can be written as:

$$\begin{aligned} \varPi ^{\mathrm {HR}} \left( V,\varvec{D} \right)= & {} \int _\varOmega \left\{ - \dfrac{1}{2}~\varvec{\epsilon }^{-1}~\varvec{D} \cdot \varvec{D} - \nabla V \cdot \varvec{D} - V~\rho _q^f \right\} ~\text{ d }\varOmega \nonumber \\&+ \int _{\varGamma _D} V~\bar{D}~\text{ d }\varGamma \end{aligned}$$
(12)

Keeping these two fields V and \(\varvec{D}\) independent allows to improve representation of the electric displacement field with respect to the one obtained from the single field formulation in (10) above. The variational equations corresponding to this potential can be obtained as:

$$\begin{aligned} \displaystyle G^{\mathrm {HR}}_V \left( V,\varvec{D};V^{*} \right):= & {} - \int _{\varOmega } \nabla V^{*} \cdot \varvec{D}~\text{ d }\varOmega - \int _{\varOmega } V^{*} ~ \rho _q^f~\text{ d }\varOmega \nonumber \\&\displaystyle + \int _{\varGamma _D} V^{*}~\bar{D}~\text{ d }\varGamma = 0;\nonumber \\ \displaystyle G^{\mathrm {HR}}_D \left( V,\varvec{D};\varvec{D}^{*} \right):= & {} - \int _{\varOmega } \varvec{D}^{*} \cdot \varvec{\epsilon }^{-1} \varvec{D}~\text{ d }\varOmega \nonumber \\&- \int _{\varOmega } \varvec{D}^{*} \cdot \nabla V ~\text{ d }\varOmega = 0 \end{aligned}$$
(13)

The first variational equation recovers the strong form of the Gauss’ law in (8)\(_3\) while the second recovers the constitutive relation in (8)\(_2\).

3.3 Complementary energy dual formulation with vector potential for electrostatics

With this type of formulation, we use two different vector potentials, \(\varvec{U}\) and \(\varvec{S}\), in order to fully define the electric displacement field [21, 36, 37]. Namely, we compute \(\varvec{D}\) as the following decomposition:

$$\begin{aligned} \varvec{D} = \varvec{S} + \nabla \times \varvec{U} \end{aligned}$$
(14)

This decomposition allows to replace both potentials in (3)\(_2\) and then treat (3)\(_1\) in weak form. It is possible to establish the variational formulation for this total complementary potential energy:

$$\begin{aligned}&\displaystyle \varPi ^{\mathrm {D}}\left( \varvec{U}, \varvec{S} \right) = - \int _\varOmega \left\{ \dfrac{1}{2}~\varvec{\epsilon }^{-1} \nabla \times \varvec{U} \cdot \nabla \times \varvec{U} + \dfrac{1}{2}~\varvec{\epsilon }^{-1} \varvec{S} \cdot \varvec{S} \right. \nonumber \\&\quad \displaystyle \left. +~\varvec{\epsilon }^{-1} \nabla \times \varvec{U} \cdot \varvec{S} \right\} ~\text{ d }\varOmega + \int _{\varGamma _V} \bar{V}~\varvec{S} \cdot \varvec{n}~\text{ d }\varGamma \nonumber \\&\quad - \int _{\varGamma _V} \varvec{n} \times \bar{\varvec{E}} \cdot \varvec{U}~\text{ d }\varGamma \end{aligned}$$
(15)

Computing the corresponding variations with respect to the potentials, the weak form can be obtained as a result:

$$\begin{aligned} \displaystyle G^{\mathrm {D}}_U \left( \varvec{U}, \varvec{S};\varvec{U}^{*} \right):= & {} -\int _{\varOmega } \nabla \times \varvec{U}^{*} \cdot \varvec{\epsilon }^{-1} \nabla \times \varvec{U}~\text{ d }\varOmega \nonumber \\&- \int _{\varOmega } \nabla \times \varvec{U}^{*} \cdot \varvec{\epsilon }^{-1} \varvec{S}~\text{ d }\varOmega \nonumber \\&\displaystyle - \int _{\varGamma _V} \varvec{n} \times \bar{\varvec{E}} \cdot \varvec{U}^{*}~\text{ d }\varGamma = 0 ;\nonumber \\ \displaystyle G^{\mathrm {D}}_S \left( \varvec{U}, \varvec{S};\varvec{S}^{*} \right):= & {} - \int _{\varOmega } \varvec{S}^{*} \cdot \varvec{\epsilon }^{-1} \varvec{S}~\text{ d }\varOmega \nonumber \\&- \int _{\varOmega } \varvec{S}^{*} \cdot \varvec{\epsilon }^{-1} \nabla \times \varvec{U}~\text{ d }\varOmega \nonumber \\&\displaystyle + \int _{\varGamma _V} \bar{V} \varvec{S}^{*} \cdot \varvec{n}~\text{ d }\varGamma = 0 \end{aligned}$$
(16)

with \(\bar{\varvec{E}}\) and \(\bar{V}\) as the imposed electric field and electric scalar potential.

3.4 Complementary energy dual formulation with single vector potential for magnetostatics

The dual formulation of this kind is yet easier to construct for the magnetostatic problem defined in (9), since no source term will appear [35]. The complementary energy variational formulation can then be written as:

$$\begin{aligned} \varPi ^\mathrm {A}(\varvec{A})= & {} \int _\varOmega \dfrac{1}{2}~\varvec{\mu }^{-1} \nabla \times \varvec{A} \cdot \nabla \times \varvec{A}~\text{ d }\varOmega - \int _\varOmega \varvec{A} \cdot \varvec{J}~\text{ d }\varOmega \nonumber \\&+ \int _{\varGamma _H} \varvec{A} \cdot \bar{\varvec{J}}_s~\text{ d }\varGamma \end{aligned}$$
(17)

The weak form is obtained by minimizing this variational formulation with respect to the single field to obtain:

$$\begin{aligned} G^\mathrm {A}_A(\varvec{A};\varvec{A}^{*}):= & {} \int _\varOmega \nabla \times \varvec{A}^{*} \cdot \varvec{\mu }^{-1} \nabla \times \varvec{A}~\text{ d }\varOmega - \int _\varOmega \varvec{A}^{*} \cdot \varvec{J}~\text{ d }\varOmega \nonumber \\&+ \int _{\varGamma _H} \varvec{A}^{*} \cdot \bar{\varvec{J}}_s~\text{ d }\varGamma \end{aligned}$$
(18)

where \(\varvec{A}^{*}\) is the corresponding variation.

4 Finite element discrete approximation with Whitney’s element basis

The main goal of Whitney’s elements is to construct discrete approximation of vector fields by using differential forms [6]. These differential forms, yet called i-forms (where \(i=0, 1, 2 \text{ or } 3\)), are linear functionals of vector fields which can be used to fully define the particular vector field. The unknown variables will the be the values of these differential forms, to be used as the finite element method degrees of freedom. The main advantage of using this kind of approximation is the ability of constructing them in somewhat intrinsic manner, regardless of particular choice of reference frame. Another big advantage of using differential forms is that every degree of freedom remains a scalar, even though the discrete approximation represents a vector field. Thus, the interpolation functions ought to be of vectorial character, which allows to preserve boundary conditions in a natural way. More importantly, such discrete approximation can be used to enforce the corresponding continuity across element boundary and thus improve the result accuracy.

The preferred formulation in mechanics in terms of vector fields [22], can be recast in terms of differential forms. The latter are linear functionals of the vector field, which are associated with both geometric and physical entities. Thus, for the discrete approximation constructed by the finite elements, we can choose:

  • 0-form associated with vertices, which preserves point continuity.

  • 1-form associated with edges, which preserves continuity of the electric field tangential component:

    $$\begin{aligned} e_i = \int _C \varvec{E} \cdot \text{ d }\varvec{l} \end{aligned}$$
    (19)

    where \(\text{ d }\varvec{l}\) is the vector associated to element edge C.

  • 2-form associated with faces, which preserves continuity of the electric displacement normal component over the facet:

    $$\begin{aligned} d_i = \int _S \varvec{D} \cdot \varvec{n}~\text{ d }S \end{aligned}$$
    (20)

    where \(\varvec{n}\) is the unit exterior normal and \(\text{ d }S\) is an infinitesimal element of the surface.

  • 3-form associated with volumes.

In order to recover the continuum vector fields from differential forms, special interpolation functions are used. These functions are scalars for 0- and 3-forms, and vectors for 1- and 2-forms. In order to reconstruct a particular field, a linear combination of all the corresponding geometric entities is established for every element. For instance, for the voltage, the electric field and the electric displacement:

Fig. 2
figure 2

Tonti diagram for electrostatic problem with scalar potential

Fig. 3
figure 3

Locations of unknowns at nodes, edges and facets in a tetrahedral element and the corresponding positive orientations, with the reference frame placed at node 1

$$\begin{aligned} \varvec{V} = \sum _{a=1}^{n_{v}} \,^0\mathcal {N}_a ~v_a ; \qquad \varvec{E} = \sum _{a=1}^{n_{e}} \,^1\varvec{\mathcal {N}}_a ~e_a ; \qquad \varvec{D} = \sum _{a=1}^{n_{f}} \,^2\varvec{\mathcal {N}}_a ~d_a \end{aligned}$$
(21)

where \(\,^0\mathcal {N}_a\), \(\,^1\varvec{\mathcal {N}}_a\) and \(\,^2\varvec{\mathcal {N}}_a\) are respectively, 0-, 1- and 2-form interpolation functions for node, edge and facet a, whereas \(n_v\) is the number of vertices, \(n_e\) is the number of edges and \(n_f\) is the number of facets per element.

The choice of differential forms is especially suitable for describing a unified mathematical structure of Maxwell’s equations in terms of the exterior derivative (e.g. [4]). Here, we use an operator defined for each i-form to obtain \((i+1)\)-form, which is expressed as follows:

$$\begin{aligned} \text{0-form } \quad \xrightarrow {\nabla } \quad \text{1-form } \quad \xrightarrow {\nabla \times } \quad \text{2-form } \quad \xrightarrow {\nabla \cdot } \quad \text{3-form } \end{aligned}$$
(22)

We show in Fig. 2 operators acting on the different i-forms and the relations among them. Such a scheme is referred to as Tonti’s diagram, e.g. [10]. The exterior derivative for electrostatics with scalar potential formulation reduces to:

The use of differential forms can be represented by discrete approximation by using Whitney’s finite elements (e.g. [9]), which have the advantage to unify the traitment of line, surface and volume integral in the sense of partition-of-unity. In Fig. 3, we show the isoparametric reference element used for tetrahedral mesh, where we indicate the different locations of nodes, edges and faces and their corresponding orientations for Whitney’s element. There are four vertex, six edge and four facet unknowns for each Whitney’s tetrahedral element. Center of the reference frame \(\left\{ \xi , \eta , \zeta \right\} \) is located at local node number 1 and each side starting at this node is of unit length.

The interpolation functions for 0-form are:

$$\begin{aligned} \,^0\mathcal {N}_1= & {} 1 - \xi - \eta - \zeta ; \qquad \,^0\mathcal {N}_2 = \xi ; \qquad \,^0\mathcal {N}_3 = \eta ; \nonumber \\ \qquad \,^0\mathcal {N}_4= & {} \zeta \end{aligned}$$
(23)

where the subscript \(a=1,\ldots ,4\) is the local number of node and the superscript “0” denotes the corresponding index for a particular i-form. Each of these interpolation functions take unit value on their corresponding node and 0 at all other nodes, which make the nodal value at every node independent of the others. This will guarantee the field continuity between adjacent elements; Finally, these shape functions are differentiable inside the element domain, and guarantee the partition-of-unity property:

$$\begin{aligned} \sum _{i=1}^{n_v} \,^0\mathcal {N}_i(\xi , \eta , \zeta ) = 1 \quad \forall (\xi , \eta , \zeta ) \in \varOmega ^e \end{aligned}$$
(24)

This isoparametric element is used to construct the different tetrahedron elements in the mesh by distorting the reference element. Interpolation functions for 0-form are used to create the mapping from reference coordinates to physical coordinates through:

$$\begin{aligned} \varvec{x}(\varvec{\xi }) = \sum _{i=1}^{n_v} \,^0\mathcal {N}_i(\varvec{\xi }) \varvec{x}_i \quad \Rightarrow \quad \begin{array}{l} \displaystyle x(\xi , \eta , \zeta ) = \sum _{i=1}^{n_v} \,^0\mathcal {N}_i(\xi , \eta , \zeta ) x_i \\ \displaystyle y(\xi , \eta , \zeta ) = \sum _{i=1}^{n_v} \,^0\mathcal {N}_i(\xi , \eta , \zeta ) y_i \\ \displaystyle z(\xi , \eta , \zeta ) = \sum _{i=1}^{n_v} \,^0\mathcal {N}_i(\xi , \eta , \zeta ) z_i \end{array} \end{aligned}$$
(25)

where \(x_i\), \(y_i\) and \(z_i\) are the corresponding physical coordinates for every element node. The isoparametric mapping of element geometry can be characterized by the corresponding Jacobian matrix \(\varvec{j}\), which can be written as:

$$\begin{aligned} \varvec{j}&= \left[ \begin{array}{ccc} \displaystyle \displaystyle \frac{\partial x}{\partial \xi } &{}\quad \displaystyle \displaystyle \frac{\partial y}{\partial \xi } &{}\quad \displaystyle \displaystyle \frac{\partial z}{\partial \xi } \\ \displaystyle \displaystyle \frac{\partial x}{\partial \eta } &{}\quad \displaystyle \displaystyle \frac{\partial y}{\partial \eta } &{}\quad \displaystyle \displaystyle \frac{\partial z}{\partial \eta } \\ \displaystyle \displaystyle \frac{\partial x}{\partial \zeta } &{}\quad \displaystyle \displaystyle \frac{\partial y}{\partial \zeta } &{}\quad \displaystyle \displaystyle \frac{\partial z}{\partial \zeta } \\ \end{array} \right] \nonumber \\&= \left[ \begin{array}{ccc} (x_2-x_1) &{}\quad (y_2-y_1) &{}\quad (z_2-z_1) \\ (x_3-x_1) &{}\quad (y_3-y_1) &{}\quad (z_3-z_1) \\ (x_4-x_1) &{}\quad (y_4-y_1) &{}\quad (z_4-z_1) \\ \end{array} \right] \end{aligned}$$
(26)

We note that the Jacobian matrix for a tetrahedron element has constant entries that depend only on the element nodal coordinates. The Jacobian matrix provides direct connection between the gradients with respect to natural and the one with respect to physical coordinates; denoting the latter as \(\nabla _x\) and the former as \(\nabla _\xi \), we can easily show (e.g. [22]) that:

$$\begin{aligned} \nabla _x = \varvec{j}^{-1} \nabla _\xi \end{aligned}$$
(27)

In order to create the gradients of the 0-form interpolation functions defining the electric field from scalar potential, we make use of this new definition of the nabla operator in order to write the corresponding discrete approximation:

$$\begin{aligned} \,^0\varvec{\mathcal {B}}_i = \varvec{j}^{-1} \nabla _\xi \,^0\mathcal {N}_i \end{aligned}$$
(28)

where \(\,^0\varvec{\mathcal {B}}_i\) is the gradient of 0-form interpolation functions for node i.

The edge interpolation functions are constructed as the linear combination of 0-forms and its gradients, resulting with vector values. For example, for an edge a between nodes i and j, such a vector base function is defined as:

$$\begin{aligned} \,^1\varvec{\mathcal {N}}_a = \,^1\varvec{\mathcal {N}}_{i \rightarrow j} = \varphi _a \left( \,^0\mathcal {N}_i \,^0\varvec{\mathcal {B}}_j - \,^0\mathcal {N}_j \,^0\varvec{\mathcal {B}}_i \right) \end{aligned}$$
(29)

where two different notations are adopted, referring to either edge a or to the edge from node i to node j, which illustrates the edge orientation more clearly. The incidence coefficient \(\varphi _a\) takes values either \(+\,1\) or \(-\,1\), depending on the agreement between the edge orientation on the reference element (see Fig. 3) with the corresponding edge in the global mesh. The convention sign for global edge orientation is taken arbitrarily. In this work, the unique global orientation is obtained by following the global node numbers: for an edge between nodes with global numbers i and j, the positive edge orientation goes from i to j when \(i<j\) and negative in the opposite case. Thus, it follows that \(\,^1\varvec{\mathcal {N}}_{i \rightarrow j} = - \,^1\varvec{\mathcal {N}}_{j \rightarrow i}\).

By following this convention, we can write explicitly 1-form interpolation functions for the six edges of a tetrahedron element:

$$\begin{aligned} \begin{array}{l} \,^1\varvec{\mathcal {N}}_1 = \,^1\varvec{\mathcal {N}}_{1 \rightarrow 2} = \varphi _1~\varvec{j}^{-1} \left( 1-\eta -\zeta ,\xi ,\xi \right) ^{\mathsf {T}};\\ \,^1\varvec{\mathcal {N}}_2 = \,^1\varvec{\mathcal {N}}_{1 \rightarrow 3} = \varphi _3~\varvec{j}^{-1} \left( \eta ,1-\xi -\zeta ,\eta \right) ^{\mathsf {T}};\\ \,^1\varvec{\mathcal {N}}_3 = \,^1\varvec{\mathcal {N}}_{1 \rightarrow 4} = \varphi _5~\varvec{j}^{-1} \left( \zeta ,\zeta ,1-\xi -\eta \right) ^{\mathsf {T}};\\ \,^1\varvec{\mathcal {N}}_4 = \,^1\varvec{\mathcal {N}}_{2 \rightarrow 3} = \varphi _2~\varvec{j}^{-1} \left( -\eta ,\xi ,0 \right) ^{\mathsf {T}};\\ \,^1\varvec{\mathcal {N}}_5 = \,^1\varvec{\mathcal {N}}_{2 \rightarrow 4} = \varphi _4~\varvec{j}^{-1} \left( \zeta ,0,\xi \right) ^{\mathsf {T}};\\ \,^1\varvec{\mathcal {N}}_6 = \,^1\varvec{\mathcal {N}}_{3 \rightarrow 4} = \varphi _6~\varvec{j}^{-1} \left( 0,-\zeta ,\eta \right) ^{\mathsf {T}}\end{array} \end{aligned}$$
(30)

As depicted in (22), the exterior derivative of 1-form is the curl operator and consequently, the derivation of the curl of these 1-forms \(\,^1\varvec{\mathcal {C}}_a\) is needed. This definition is obtained by applying the curl operator to \(\,^1\varvec{\mathcal {N}}_a\):

$$\begin{aligned} \,^1\varvec{\mathcal {C}}_a&= \,^1\varvec{\mathcal {C}}_{i \rightarrow j} = \nabla _x \times \,^1\varvec{\mathcal {N}}_{i \rightarrow j} = \varvec{j}^{-1} \nabla _\xi \times \,^1\varvec{\mathcal {N}}_{i \rightarrow j} \nonumber \\&= 2\varphi _a \,^0\varvec{\mathcal {B}}_i \times \,^0\varvec{\mathcal {B}}_j \end{aligned}$$
(31)

where \(\varphi _a\) as the incidence coefficient and it is defined as for the 1-form. This convention is in agreement with the right-hand screw rule since the resulting flow is solenoidal with respect to edge a.

The facet interpolation functions are a combination of 0-form and the cross product of the gradients. Facet a is defined with positive orientation if the set of nodes \(\{i,j,k\}\) defines the flow normal to the facet by the right-hand rule. The corresponding vector base functions are constructed as:

$$\begin{aligned} \displaystyle \,^2\varvec{\mathcal {N}}_a&= \,^2\varvec{\mathcal {N}}_{i \rightarrow j \rightarrow k}= 2 \left( \,^0\mathcal {N}_{i} \,^0\varvec{\mathcal {B}}_j \times \,^0\varvec{\mathcal {B}}_k \right. \nonumber \\&\left. \quad + \,^0\mathcal {N}_{j} \,^0\varvec{\mathcal {B}}_k \times \,^0\varvec{\mathcal {B}}_i \displaystyle + \,^0\mathcal {N}_{k} \,^0\varvec{\mathcal {B}}_i \times \,^0\varvec{\mathcal {B}}_j \right) \end{aligned}$$
(32)

These the facet interpolations can be described as the combination of 0-forms and curls of 1-form, following the idea of the mathematical structure to define \((i+1)\)-forms:

$$\begin{aligned} \,^2\varvec{\mathcal {N}}_a = \,^2\varvec{\mathcal {N}}_{i \rightarrow j \rightarrow k} = \,^0\mathcal {N}_{i} \,^1\varvec{\mathcal {C}}_{j \rightarrow k} + \,^0\mathcal {N}_{j} \,^1\varvec{\mathcal {C}}_{k \rightarrow i} + \,^0\mathcal {N}_{j} \,^1\varvec{\mathcal {C}}_{k \rightarrow i} \end{aligned}$$
(33)

4.1 Whitney’s element implementation

The finite element code chosen for this numerical implementation is FEAP [42]. The mesh is prepared in pre-processing to allocate all kinds of variables in different kinds of nodes which leads to the enhancement of the standard computer architecture not with respect to the choice of degrees of freedom but with respect to the corresponding shape functions (using different shape functions for different kind of nodes).

Fig. 4
figure 4

Schema of the location of the nodes depending on their location on a regular 15-node isoparametric tetrahedron

Taking advantage of the 14-node isoparametric elements, the nodes are classified into vertex, edge and facet nodes as sketched in Fig. 4, where the numbering of the local nodes for the isoparametric tetrahedra is also displayed. Depending on the geometrical entity, the corresponding degree of freedom is put on nodes 1 to 4, 5 to 10 or 11 to 14. This ensures the continuity of these variables among elements. For the chosen Whitney’s interpolations, the position of the nodes does not matter as long as the node is placed on the corresponding edge or facet.

4.1.1 Implementation of single-field scalar potential for electrostatics

The definition of the discrete approximations for scalar potential, put on vertices according to [36, 37]:

$$\begin{aligned} V \approx \sum _{i=1}^{4} \,^0\mathcal {N}_i(\varvec{x}) v_i \end{aligned}$$
(34)

where \(v_i\) are the degrees of freedom or unknowns that the code is going to calculate. Introducing this approximation into the weak form (11), we obtain the residual corresponding to the scalar potential, which is written in matrix form:

$$\begin{aligned} \displaystyle \mathcal {R}^V_a:= & {} \int _{\varOmega } \,^0\varvec{\mathcal {B}}_a^{\mathsf {T}}~\varvec{\epsilon } \sum _{i=1}^{4} \left[ \,^0\varvec{\mathcal {B}}_i~v_i \right] ~\text{ d }\varOmega - \int _{\varOmega } \,^0\mathcal {N}_a~\rho _q^f~\text{ d }\varOmega \nonumber \\&+ \int _{\varGamma _D} \,^0\mathcal {N}_a~\bar{D}~\text{ d }\varGamma ; \quad \displaystyle a = 1, 2, 3, 4 \end{aligned}$$
(35)

By consistent linearization of this residual, we obtain the corresponding tangent matrix, which can also be written in matrix notation:

$$\begin{aligned} \mathcal {K}^{V}_{ab} = - \int _\varOmega \,^0\varvec{\mathcal {B}}_a^{\mathsf {T}}~\varvec{\epsilon }~\,^0\varvec{\mathcal {B}}_b~\text{ d }\varOmega ; \quad a, b = 1, 2, 3, 4 \end{aligned}$$
(36)

Note that this matrix and the residual pertain only to vertex nodes a and b, whereas they are equal to zero for edge and facet nodes. The central problem to solve for the unknown nodal values of scalar potential can be written as:

$$\begin{aligned} \varvec{\mathcal {K}}\varvec{v} = \varvec{f} \end{aligned}$$
(37)

where \(\varvec{f}\) is the force vector. For this formulation, each entry of this vector is defined as:

$$\begin{aligned} f_a = - \int _{\varOmega } \,^0\mathcal {N}_a~\rho _q^f~\text{ d }\varOmega + \int _{\varGamma _D} \,^0\mathcal {N}_a~\bar{D}~\text{ d }\varGamma \end{aligned}$$
(38)

4.1.2 Implementation of Hellinger-Reissner formulation

The same methodology is taken for Hellinger-Reissner formulation, this time introducing a new approximation for the electric displacement:

$$\begin{aligned} \varvec{D} \approx \sum _{i=11}^{14} \,^2\varvec{\mathcal {N}}_i(\varvec{x}) d_i \end{aligned}$$
(39)

where \(d_i\) are the degrees of freedom associated with \(\varvec{D}\). Introducing this approximation in (13) the corresponding residuals can be obtained:

$$\begin{aligned} \displaystyle \mathcal {R}^D_a= & {} - \int _\varOmega \,^2\varvec{\mathcal {N}}_a^{\mathsf {T}}~\varvec{\epsilon }^{-1} \sum _{i=11}^{14}\left[ \,^2\varvec{\mathcal {N}}_i~d_i\right] ~\text{ d }\varOmega \nonumber \\&- \int _\varOmega \,^2\varvec{\mathcal {N}}_a^{\mathsf {T}}~\sum _{j=1}^4\left[ \,^0\varvec{\mathcal {B}}_j~vj \right] ~\text{ d }\varOmega ;\quad \nonumber \\&\displaystyle a = 11, 12, 13, 14;\nonumber \\ \displaystyle \mathcal {R}^V_a= & {} - \int _\varOmega \,^0\varvec{\mathcal {B}}_a^{\mathsf {T}}\sum _{i=11}^{14}\left[ \,^2\varvec{\mathcal {N}}_i~d_i\right] ~\text{ d }\varOmega \nonumber \\&- \int _\varOmega \,^0\mathcal {N}_a~\rho _q^f~\text{ d }\varOmega + \int _{\varGamma _D} \,^0\mathcal {N}_a~\bar{D}~\text{ d }\varGamma ;\nonumber \\&\displaystyle a = 1, 2, 3, 4 \end{aligned}$$
(40)

Then, linearizing the previous equations, the problem to solve is:

$$\begin{aligned} \varvec{\mathcal {K}}\left\{ \begin{array}{c} \varvec{d} \\ \varvec{v} \end{array} \right\} = \left\{ \begin{array}{c} \varvec{0} \\ \varvec{f} \end{array} \right\} \end{aligned}$$
(41)

where the stiffness matrix \(\varvec{\mathcal {K}}\) can be split into four different sub-matrices:

$$\begin{aligned} \varvec{\mathcal {K}}_{ab} = \left( \begin{array}{ccc} \mathcal {K}^{DD}_{ab} &{}\quad \mathcal {K}^{DV}_{ab} \\ \mathcal {K}^{VD}_{ab} &{}\quad 0 \end{array} \right) \end{aligned}$$
(42)

The entries of that stiffness matrix are:

$$\begin{aligned} \displaystyle \mathcal {K}^{DD}_{ab}= & {} \int _\varOmega \,^2\varvec{\mathcal {N}}_a ^{\mathsf {T}}~\varvec{\epsilon }^{-1}~\,^2\varvec{\mathcal {N}}_b ~\text{ d }\varOmega ; \nonumber \\&a, b = 11, 12, 13, 14 \nonumber \\ \displaystyle \mathcal {K}^{DV}_{ab}= & {} \int _\varOmega \,^2\varvec{\mathcal {N}}_a ^{\mathsf {T}}~\,^0\varvec{\mathcal {B}}_b ~\text{ d }\varOmega ; \nonumber \\&a = 11, 12, 13, 14; \ b = 1,2,3,4 ;\nonumber \\ \displaystyle \mathcal {K}^{VD}_{ab}= & {} \int _\varOmega \,^0\varvec{\mathcal {B}}_a^{\mathsf {T}}~\,^2\varvec{\mathcal {N}}_b~\text{ d }\varOmega ; \nonumber \\&a = 1,2,3,4; \ b = 11, 12, 13, 14 \end{aligned}$$
(43)

And the force vector \(\varvec{f}\) for node a is:

$$\begin{aligned} f_a = - \int _\varOmega \,^0\mathcal {N}_a~\rho _q^f~\text{ d }\varOmega + \int _{\varGamma _D} \,^0\mathcal {N}_a~\bar{D}~\text{ d }\varGamma ; \quad a=1,2,3,4 \end{aligned}$$
(44)

4.1.3 Implementation of complementary energy dual formulation for electrostatics with two vector potentials

Introducing the split and separate discrete approximations for \(\varvec{U}\) and \(\varvec{S}\), the definition of \(\varvec{D}\) can be obtained as:

$$\begin{aligned} \varvec{D} \approx \sum _{i=5}^{10} \,^1\varvec{\mathcal {C}}_i(\varvec{x}) u_i + \sum _{j=11}^{14} \,^2\varvec{\mathcal {N}}_j(\varvec{x}) s_j \end{aligned}$$
(45)

where \(u_i\) and \(s_j\) are the degrees of freedom or unknowns that we are going to compute. Note that even though the potentials \(\varvec{U}\) and \(\varvec{S}\) are vectors, their corresponding degrees of freedom (as differential forms) are scalars, since we will use the vector-type interpolations (namely, one-forms). Moreover, the orientations of chosen unknown differential forms are defined by edge-curl of 1-forms and face shape functions 2-forms.

Introducing the last definition into the weak forms above, the final residuals can be written in matrix notation; namely, for \(\varvec{D}\)-form:

$$\begin{aligned} \displaystyle \mathcal {R}^U_a= & {} \int _\varOmega \,^1\varvec{\mathcal {C}}_a ^{\mathsf {T}}~\varvec{\epsilon }^{-1} \sum _{i=5}^{10} \left[ \,^1\varvec{\mathcal {C}}_i~u_i \right] ~\text{ d }\varOmega \nonumber \\&\quad + \int _\varOmega \,^1\varvec{\mathcal {C}}_a^{\mathsf {T}}~\varvec{\epsilon }^{-1} \sum _{j=11}^{14} \left[ \,^2\varvec{\mathcal {N}}_j~s_j\right] \nonumber \\&\quad \displaystyle + \int _{\varGamma _1} \,^1\varvec{\mathcal {N}}_a ^{\mathsf {T}}\left( \varvec{n} \times \varvec{E}_0 \right) ~\text{ d }\varGamma ; \quad a = 5, 6, \ldots , 10 \nonumber \\ \displaystyle \mathcal {R}^S_a= & {} \int _\varOmega \,^2\varvec{\mathcal {N}}_a^{\mathsf {T}}~\varvec{\epsilon }^{-1} \sum _{i=5}^{10} \left[ \,^1\varvec{\mathcal {C}}_i~u_i \right] ~\text{ d }\varOmega \nonumber \\&\quad + \int _\varOmega \,^2\varvec{\mathcal {N}}_a^{\mathsf {T}}~\varvec{\epsilon }^{-1} \sum _{j=11}^{14} \left[ \,^2\varvec{\mathcal {N}}_j~s_j\right] ~\text{ d }\varOmega \nonumber \\&\quad \displaystyle - \int _{\varGamma _2} \,^2\varvec{\mathcal {N}}_a^{\mathsf {T}}\varvec{n}~\bar{V}~\text{ d }\varGamma ; \quad a = 11, 12, 13, 14 \end{aligned}$$
(46)

Furthermore, the stiffness matrix can be split in different sub-matrices for \(\varvec{D}\)-form:

$$\begin{aligned} \varvec{\mathcal {K}}_{ab} = \left( \begin{array}{cc} \mathcal {K}^{UU}_{ab} &{}\quad \mathcal {K}^{US}_{ab} \\ \mathcal {K}^{SU}_{ab} &{}\quad \mathcal {K}^{SS}_{ab} \end{array} \right) \end{aligned}$$
(47)

The entries of this stiffness matrix are:

$$\begin{aligned} \displaystyle \mathcal {K}^{UU}_{ab}= & {} - \int _\varOmega \,^1\varvec{\mathcal {C}}_a ^{\mathsf {T}}~\varvec{\epsilon }^{-1}~\,^1\varvec{\mathcal {C}}_b ~\text{ d }\varOmega ; \nonumber \\&a, b = 5, 6, \ldots , 10 \nonumber \\ \displaystyle \mathcal {K}^{US}_{ab}= & {} - \int _\varOmega \,^1\varvec{\mathcal {C}}_a ^{\mathsf {T}}~\varvec{\epsilon }^{-1}~ \,^2\varvec{\mathcal {N}}_b ~\text{ d }\varOmega ; \nonumber \\&a = 5, 6, \ldots , 10; b = 11, 12, 13, 14 \nonumber \\ \displaystyle \mathcal {K}^{SU}_{ab}= & {} - \int _\varOmega \,^2\varvec{\mathcal {N}}_a^{\mathsf {T}}~\varvec{\epsilon }^{-1}~\,^1\varvec{\mathcal {C}}_b ~\text{ d }\varOmega ; \nonumber \\&a = 11, 12, 13, 14; b = 5, 6, \ldots , 10 \nonumber \\ \displaystyle \mathcal {K}^{UU}_{ab}= & {} - \int _\varOmega \,^2\varvec{\mathcal {N}}_a^{\mathsf {T}}~\varvec{\epsilon }^{-1}~\,^2\varvec{\mathcal {N}}_b~\text{ d }\varOmega ; \nonumber \\&a, b = 11, 12, 13, 14 \end{aligned}$$
(48)

And the components of the force vector \(\varvec{f}\) are defined as:

$$\begin{aligned} \begin{array}{l} \displaystyle f_{1,a} = \int _{\varGamma _1} \,^1\varvec{\mathcal {N}}_a ^{\mathsf {T}}\left( \varvec{n} \times \bar{\varvec{E}} \right) ~\text{ d }\varGamma \\ \displaystyle f_{2,a} = - \int _{\varGamma _2} \,^2\varvec{\mathcal {N}}_a^{\mathsf {T}}\varvec{n}~\bar{V}~\text{ d }\varGamma \end{array} \end{aligned}$$
(49)

4.1.4 Gauging a vector potential and boundary conditions for complementary energy formulation

The previous formulation makes use of a vector potential \(\varvec{U}\). The rotational part of the electric displacement is obtained from such potential. To provide a specific value of electric displacement \(\varvec{D}\), there is not a unique possibility of \(\varvec{U}\), since any irrotational potential to be added to this potential would not affect the electric displacement value, but only act as an integration constant. This non-uniqueness can be removed if the vector potential \(\varvec{U}\) is gauged. A previous work in [41] has a complete relation of different references on the existing methods to gauge such potential. The method chosen in this paper is the identification of a tree set. This method is based on the topological aspect of the discretization employed to define a set of linearly dependent differential forms, which have to be eliminated in order to return a unique vector potential. In the finite element method, the removal of those variables implies prescribing the degrees of freedom on the tree set corresponding to the edges of the tetrahedral mesh.

The details for identifying one of the tree sets are given in [18], including a method to determine all possible tree combinations through the incidence matrix. A tree set must contain \(n_n -1\) edges, and they cannot close a surface. For simplicity, the value imposed in those edges is zero.

In this paper, an algorithm to select a tree set has been designed based on a matrix that contains as many rows as edges. In each row, there are the initial and final global numbers of the vertex nodes of the corresponding edge. The method begins evaluating the two global node numbers of the first row. If they are different, the edge is accepted in the tree set. Then, the first node number is replaced by the second one every time it appears in another matrix entry. The method is repeated for every row until the tree has \(n_n -1\) branches.

Fig. 5
figure 5

Tree set (continuous lines) for regular mesh. Every hexahedron represents six tetrahedra in cubic disposition. Every point is a vertex node

If the mesh is regular, like the one drawn in Fig. 5, a more specific and systematic algorithm to select the tree can be used, as stated in [24]. This algorithm starts selecting all the edges in the line defined by the intersection of the planes \(y=z=0\). Then, in the plane \(z=0\), all the edges in y direction that start in every vertex node of the previous line are picked. Finally, every vertical line starting from all vertex nodes in plane \(z=0\) are selected as well.

The complementary energy usually provides superior accuracy of the electric displacement, but presents a difficulty with respect to the standard V-formulation in not readily providing all other fields of interest, such as voltage potential. Moreover, an additional difficulty concerns any problem where both Dirichlet and Neumann boundary conditions have to be imposed. Namely, with the chosen differential forms as unknowns, a particular edge, the topological entity that contains the variable to solve, leads to an ambiguous situation that it can belong to both kinds of boundary surfaces, Dirichlet and Neumann. The difficulty pertains to deciding for every boundary face which edge should take care of the Dirichlet boundary condition. Moreover, for the remaining edge that handles the Neumann boundary, the residual term ought to be distributed over the edges of the triangle that are not considered in the Dirichlet boundary.

4.1.5 Implementation of dual formulation of magnetostatics with single vector potential

A similar approach to the last formulation for magnetostatics can be taken by introducing the chosen approximations for magnetic vector potential \(\varvec{A}\):

$$\begin{aligned} \varvec{A} \approx \sum _{i=1}^{n_e} \,^1\varvec{\mathcal {N}}_i(\varvec{x}) a_i \end{aligned}$$
(50)

where \(a_i\) are the degrees of freedom or unknowns that the code is going to calculate. Introducing the last definition into (18), the corresponding residuals can be written as:

$$\begin{aligned} \displaystyle \mathcal {R}^A_a= & {} \int _\varOmega \,^1\varvec{\mathcal {C}}_a^{\mathsf {T}}~\varvec{\mu }^{-1} \sum _{i=1}^{n_e}\left[ \,^1\varvec{\mathcal {C}}_i~a_i\right] ~\text{ d }\varOmega - \int _\varOmega \,^1\varvec{\mathcal {N}}_a^{\mathsf {T}}~ \varvec{J}~\text{ d }\varOmega \nonumber \\&\displaystyle + \int _{\varGamma _H} \,^1\varvec{\mathcal {N}}_a ^{\mathsf {T}}~\bar{\varvec{J}}_s~\text{ d }\varGamma ; \quad a = 5, 6, \ldots , 10 \end{aligned}$$
(51)

By consistent linearization of this residual, we obtain the system similar to the one in (37). The corresponding tangent matrix can be written in matrix notation:

$$\begin{aligned} \mathcal {K}^{A}_{ab} = - \int _\varOmega \,^1\varvec{\mathcal {C}}_a^{\mathsf {T}}~\varvec{\mu }^{-1}~\,^1\varvec{\mathcal {C}}_b ~\text{ d }\varOmega ; \quad a, b = 5, 6, \ldots , 10\nonumber \\ \end{aligned}$$
(52)

and the force vector \(\varvec{f}\) component is defined as:

$$\begin{aligned} f_a = - \int _\varOmega \,^1\varvec{\mathcal {N}}_a^{\mathsf {T}}~ \varvec{J}~\text{ d }\varOmega + \int _{\varGamma _H} \,^1\varvec{\mathcal {N}}_a ^{\mathsf {T}}~\bar{\varvec{J}}_s~\text{ d }\varGamma \end{aligned}$$
(53)
Fig. 6
figure 6

Voltage and electric displacement distributions calculated for the first validation example. First row, V-formulation; second row, Hellinger-Reissner

5 Numerical simulations and validation tests

In this section, we present the results of several numerical simulations that can illustrate performance of different formulations. First, we choose several validation test examples, which are compared against known analytic solution. A more complex test case where analytic solution is not available is presented afterwards, including the results of some practical applications solved with different formulations.

5.1 Validation tests

The following numerical examples are called validation tests due to the fact that an analytic solution exists for each one of them. This is a necessary condition to satisfy in order to prove that the different formulations can all solve the problems where both analytical and numerical results fully agree. However, this is not always fully sufficient, if the problem does not allow to test each and every aspect of the proposed formulation.

In order to find an analytic solution, we assume that \(\varvec{E}\) is the negative gradient of V and the constitutive relation for \(\varvec{D}\) in (6) are written for isotropy and that the permittivity tensor \(\varvec{\epsilon }\) can be simplified to \(\epsilon ~\varvec{I}\). With these hypotheses, the electrostatic problem can be fully defined in terms of the scalar potential:

$$\begin{aligned} \nabla ^2 V(x,y,z) = \frac{-\rho _q^f}{\epsilon } \end{aligned}$$
(54)

This equation is the well known Poisson equation, which reduces to the Laplace equation when \(\rho _q^f = 0\). The latter is much easier to solve and represents a sort of patch test.

Fig. 7
figure 7

Voltage and electric displacement distributions calculated for the second validation example. First row, V-formulation; second row, Hellinger-Reissner

Fig. 8
figure 8

Voltage and electric displacement distributions calculated for the third validation example. First row, V-formulation; second row, Hellinger-Reissner

5.1.1 Laplace equation, imposed scalar potential

The geometry of this first example is a cube that has the following boundary conditions turning into a one-dimensional problem:

$$\begin{aligned} \begin{array}{l} \left. \displaystyle \frac{\partial V}{\partial x} \right| _{x=0} = \left. \displaystyle \frac{\partial V}{\partial x} \right| _{x=l_x} = \left. \displaystyle \frac{\partial V}{\partial y} \right| _{y=0} = \left. \displaystyle \frac{\partial V}{\partial y} \right| _{y=l_y} = 0 ; \\ \displaystyle V(x,y,0) = 0 ; \quad V(x,y,l_z) = V_z \end{array} \end{aligned}$$
(55)

The lateral faces do not allow electric displacement flowing out of the cube, whereas top and bottom faces have imposed and constant scalar potentials. The solution for the scalar potential:

$$\begin{aligned} V(z) = \frac{V_z}{l_z}~z \end{aligned}$$
(56)

V is a linear distribution in z. Hence, from this expression it is possible to calculate the electric displacement as:

$$\begin{aligned} \varvec{D} = - \epsilon \nabla V = \left( \begin{array}{c} 0\\ 0\\ -\epsilon V_z/l_z \end{array} \right) \end{aligned}$$
(57)

The only non-zero component is the third one taking a constant value. The selected dimensions for this example are \(l_x = l_y = l_z = 2 \times 10^{-3}\) m, the imposed \(V_z = 20\) V and \(\epsilon =15 \times 10^{-12}\) F/m.

As can be seen in Fig. 6, the computed distribution of voltage potential is indeed linear with bottom and top values 0 and 20 V, respectively. The computed value for \(D_z = -1.5 \times 10^{-7}\) C/m\(^2\) is homogeneous as expected from (57).

5.1.2 Laplace equation, imposed scalar potential and electric displacement

In this example, imposing the Neumann boundary condition is the main difference from the previous example. Thus, there is only a slight variation in the chosen boundary conditions with respect to the previous example:

$$\begin{aligned} \begin{array}{l} \displaystyle \left. \displaystyle \frac{\partial V}{\partial x} \right| _{x=0} = \left. \displaystyle \frac{\partial V}{\partial x} \right| _{x=l_x} = \left. \displaystyle \frac{\partial V}{\partial y} \right| _{y=0} = \left. \displaystyle \frac{\partial V}{\partial y} \right| _{y=l_y} = 0 ;\\ \displaystyle V(x,y,0) = 0 ; \quad \displaystyle \frac{\partial V}{\partial z} = \frac{-\bar{D}_z}{\epsilon } \end{array} \end{aligned}$$
(58)

This computed solution can still be simplified to unidimensional and linear in V:

$$\begin{aligned} V(x,y,z) = \frac{-\bar{D}_z}{\epsilon }~z \end{aligned}$$
(59)

The material properties and measures are the same as in the last example, with \(D_z = 1.5 \times 10^{-7}\) C/m\(^2\). This gives \(V(x,y,l_z) = -20\) V on top and a constant electric displacement of value \(D_z = 1.5 \times 10^{-7}\) C/m\(^2\) as shown in Fig. 7.

5.1.3 Poisson equation, imposed scalar potential

In this validation case, a source term is activated to induce non-homogeneous field values. The boundary conditions considered in this section are the same as those considered in the first numerical example with:

$$\begin{aligned} \begin{array}{l} \left. \displaystyle \frac{\partial V}{\partial x} \right| _{x=0} = \left. \displaystyle \frac{\partial V}{\partial x} \right| _{x=l_x} = \left. \displaystyle \frac{\partial V}{\partial y} \right| _{y=0} = \left. \displaystyle \frac{\partial V}{\partial y} \right| _{y=l_y} = 0 ;\\ \displaystyle \qquad V(x,y,0) = 0 ; \quad V(x,y,l_z) = V_z \end{array} \end{aligned}$$
(60)

For a problem of this kind, the solution can be obtained as a superposition of a Poisson equation solution with homogeneous boundary conditions and a Laplace problem taking into account those conditions. The final solution can be expressed as:

$$\begin{aligned} V(x,y,z) = \frac{V_z}{l_z}~z + \sum _{p=1,3,\ldots }^{\infty } \frac{4~\rho _q^f~l_z^2}{\epsilon ~p^3~\pi ^3} \sin \left( \frac{p\pi z}{l_z}\right) \end{aligned}$$
(61)

where 50 terms in the summation have been taken into account, \(\rho _q^f = 0.01\) and the other coefficients are the same as in Sect. 5.1.1 except \(V_z=80\) V, taken higher to see clearly the asymmetry of the problem.

In Fig. 8 left, it can be appreciated in the voltage distribution that the maximum is concentrated a little bit above the middle vertical section with a theoretical maximum value of approximately 374 V, obtained from the maximization of (61). The closer to this theoretical value, for the mesh plotted with 1000 elements, is V-formulation. The distribution of \(D_z\) can be obtained by deriving (61), and the summation gives an almost linear response with values at the bottom of \(D_z = -1.06 \times 10^{-5}\) C/m\(^2\) and at the top of \(D_z = 9.37 \times 10^{-6}\) C/m\(^2\).

One can also notice the existence of slight oscillations near the edges of the mesh in Fig. 8 right. In the case of V-formulation, the electric displacement can only be constant for every element. Taking into account that the analytical solution is linear, the exact solution can never be reached, although the more refined the mesh is, the closer to the analytical solution will be. The number of elements surrounding a particular point in the mesh is essential to the plot since the stresses plotted in the figure are smoothened. The edges are influenced by half of the elements within the same row. Regarding H-R, even though D field can be indeed linear, it is limited by (13) as it has to be compatible with the gradient subspace of voltage. Therefore, the oscillations now appear along all iso-stress lines since tetrahedra within the same row now have different values.

Fig. 9
figure 9

Energy convergence for both V-formulation and Hellinger-Reissner, and the exact solution

In Fig. 9, a convergence study on the energy by mesh refinement has been performed. Even though V-formulation is closer to the maximum expected value of V, H-R is closer than V-formulation to the analytical solution for energy (\(1/2~\varvec{E} \cdot \varvec{D} = 8.98 \times 10^{-9}\) J) at an equal number of elements, as could be expected from a mixed method, improving the accuracy of the electric displacement calculation.

5.1.4 Tubular geometry

This example is also among validation examples, but somewhat more demanding with respect to element distortion, resulting from a change in geometry turning the parallelepiped shape into a hollowed cylinder or a tube. This modification allows to determine if there is any mesh dependence of the solution with respect to element distortion. Also, it allows to fully verify proposed formulation for distorted mesh.

Fig. 10
figure 10

Schematic geometry representation of a quarter of the hollowed cylinder. Symmetry planes in \(x=0\) and \(y=0\). Dimensions in cm

The geometry of the problem is defined in Fig. 10 along with the boundary conditions and dimensions. Only a quarter of the geometry is represented since it is an axisymmetric problem. On the interior lateral face, a voltage \(\bar{V}_1 = 0\) V is imposed; on the exterior lateral face, either voltage \(\bar{V}_2 = 20\) V or \(\varvec{D} \cdot \varvec{n} = \bar{D}\) is imposed depending on the kind of problem. An electric charge density \(\rho _q^f\) is imposed in the material as well for the Poisson case. The properties for the material of this example remains the same as the previous ones except for the permittivity, in agreement with the dielectric material of the next case \(\varvec{\epsilon } = 4 \epsilon _0 \varvec{I}\).

Fig. 11
figure 11

Voltage and norm of electric displacement distributions calculated for the fourth validation example, with both lateral faces with V boundary condition. First row, V-formulation; second row, Hellinger-Reissner; third row, complementary energy formulation

The analytical solution for the proposed problem can be obtained by taking into account the axisymmetry and cylindrical coordinates. Thus, both Laplace and Poisson equations will now be affected by the change of coordinates. Since the solution V(r) only depends on the radius, the equation to solve reduces to an Euler-Cauchy ordinary differential equation with a particular term in the case of the Poisson equation:

$$\begin{aligned} r^2 \frac{\text{ d }^2 V}{\text{ d }r^2} + r \frac{\text{ d }V}{\text{ d }r} = r^2~\rho _q^f \end{aligned}$$
(62)

The solution to the previous equation is of the form:

$$\begin{aligned} V(r) = C_1 \ln \left( r \right) + C_2 + \rho _q^f \frac{r^2}{4} \end{aligned}$$
(63)

The boundary conditions for the equivalent previous numerical examples are:

$$\begin{aligned} \begin{array}{lll} \displaystyle V(r_0) = 0 ; &{} \quad \displaystyle V(r_1) = \bar{V}_1; &{} \quad \displaystyle \text{ Laplace, } \text{ imposed } V\\ \displaystyle V(r_0) = 0 ; &{} \quad \displaystyle \left. \frac{\text{ d }V}{\text{ d }r}\right| _{r=r_1} = \frac{\bar{D}_1}{\epsilon }; &{} \quad \displaystyle \text{ Laplace, } \text{ imposed } \bar{D}\\ \displaystyle V(r_0) = 0 ; &{} \quad \displaystyle V(r_1) = \bar{V}_1; &{} \quad \displaystyle \text{ Poisson, } \text{ imposed } \bar{V} \end{array} \end{aligned}$$
(64)

Thus, the voltage expressions for each of the three cases are:

$$\begin{aligned} \begin{array}{ll} \displaystyle V(r) = \frac{\bar{V}_1 \ln \left( r/r_0 \right) }{\ln \left( r_1/r_0 \right) } ; &{} \quad \displaystyle \text{ Laplace, } \text{ imposed } V\\ \displaystyle V(r) = \frac{\bar{D}_1~r_1 \ln \left( r_0/r \right) }{\epsilon } ; &{} \quad \displaystyle \text{ Laplace, } \text{ imposed } \bar{D}\\ \begin{array}{l} \displaystyle V(r) = \frac{\bar{V}_1 \ln \left( r/r_0 \right) }{\ln \left( r_1/r_0 \right) } + \rho _q^f \frac{r^2}{4} \\ \displaystyle \qquad +\, \frac{\rho _q^f \left( r_0^2 \ln \left( r/r_1 \right) - r_1^2 \ln \left( r/r_0 \right) \right) }{4 \ln \left( r_1/r_0 \right) }; \end{array}&\quad \displaystyle \text{ Poisson, } \text{ imposed } \bar{V} \end{array} \end{aligned}$$
(65)

All these cases show good agreement with the analytical solution. As can be seen in Fig. 11 left, where the case for Laplace equation and imposed V at the external face is plotted, voltage distribution is no longer linear, but rather follows a logarithmic distribution starting from zero at the internal lateral face to 20 at the external lateral face. The problem being axisymmetric results with the only variation in the radial direction.

In the Fig. right, the norm of electric displacement is plotted. This variable follows an inverse distribution with the radius. In the figure, different plot bounds can be observed for both formulations as the exact solution cannot be reached with linear tetrahedral elements. The exact values for \(\left| \varvec{D}(r)\right| \) are \(\left| \varvec{D}(r_0)\right| = 6.448 \times 10^{-8}\) C/m\(^2\) and \(\left| \varvec{D}(r_1)\right| = 2.149 \times 10^{-8}\) C/m\(^2\).

The complementary energy formulation has also been used to solve the same problem as a comparison with the two formulations used through this section. As previously discussed, the voltage cannot be obtained directly from the calculated variables. On the other hand, the norm of electric displacement is plotted, obtaining similar or even more accurate results as with the previous formulations.

Fig. 12
figure 12

Left, energy convergence for V-formulation, Hellinger-Reissner and Complementary energy formulation compared with the exact solution. Right, computation time for all the formulations tested

In Fig. 12 left, a small mesh convergence study for the case run above is shown. In this study, all formulations converge to the analytical solution using a few thousands of elements, being the complementary energy formulation the more accurate for every mesh configuration and V-formulation the more inaccurate.

However, as can be seen in the Fig right, the latter is unquestionably the fastest of them all. The slowest, in any case, is Hellinger-Reissner due to the higher amount of variables, which also make it the one that spends the most memory. Complementary energy shoots up as well due to the necessity to solve the Dirichlet boundary conditions, which makes it inefficient for being a single field formulation.

5.2 Parallel plate capacitor simulation

This numerical example simulates a parallel plate capacitor that consists of two electrodes, represented by conductor plates charged, and a dielectric cylinder with \(\varvec{\epsilon } = 4 \epsilon _0 \varvec{I}\). Figure 13 shows the dimensions for a quarter of the geometry since symmetry conditions on planes \(x=0\) and \(y=0\) allow to reduce the problem.

Despite the fact that in the graphical illustration in this figure only two different solid materials are presented, for the actual computation we have to introduce vacuum or air as a third material connecting the two solid materials. Hence, the permittivity of this added material is that of the vacuum \(\epsilon _0\). We note in passing that such a solution is typical of electromagnetic spectrum, which does not need matter to propagate, and yet the finite element method does need the mesh with a connection between nodes to solve such problem.

Fig. 13
figure 13

Schematic geometry representation of a quarter of the parallel plate capacitor; two charged conductor plates and a dielectric cylinder. Symmetry planes in \(x=0\) and \(y=0\). Dimensions in cm

Fig. 14
figure 14

Electric field and displacement vector representation calculated for the parallel plate capacitor example. First row, V-formulation; second row, Hellinger-Reissner

Boundary conditions can be imposed numerically by setting all nodes of the two conductor plates to the corresponding potential: top to \(V = 3000\) V and bottom to ground potential or \(V = 0\) V.

One can observe that the presence of the dielectric with a higher permittivity than that of the air and the fact that the conductor plates are finite breaks the unidimensional nature of this problem. If the plates as well as the cylinder were infinite, the electric field and displacement would be completely regular and vertical.

This problem has been extracted from [37] to demonstrate that potential and complementary energy formulations, after refinement of the mesh, tend to the same solution. The purpose of this problem is to compare our formulations with an electrostatic example already solved, although in the cited reference there are not explicit results for electric field or displacement, but rather a qualitative representation of both fields. This representation is replicated in Fig. 14 indicating the flow orientation of electric field.

As expected, the main difference between \(\varvec{E}\) (first column) and \(\varvec{D}\) (second column) in that figure is that the presence of the dielectric cylinder with different permittivity creates a discontinuity in electric field as opposed to the continuity of electric displacement. This fact can be appreciated in the magnitude difference of the arrows inside the cylinder and outside. This presence of the dielectric creates also a distortion of both fields, bending them.

The arrows in the air material surrounding the capacitor bend around the two electrodes as it is expected from an electrostatic problem, from higher to lower potentials and the intensity of the fields lower as they come out from symmetry planes rather than external sides.

The total energy of the system is represented in Fig. 15 for both V-formulation and Hellinger-Reissner formulations. It is important to note that both formulations approach the same system energy value when sufficient mesh refinement is carried out, although for this particular case, a finer mesh was impossible to generate due to our low computational resources. As the number of elements increase, energy values for V-formulation come from higher to lower as opposed to Hellinger-Reissner. This is a consequence of using the potential or the complementary energy for the calculations.

For the same number of elements, Hellinger-Reissner formulation takes more computation time due to the presence of an additional degree of freedom. However, the accuracy is higher energy-wise since no big improvement is obtained with higher number of elements. Therefore, for a low number of elements, one can conclude that Hellinger-Reissner formulation is preferable.

Fig. 15
figure 15

Total electrostatic energy by number of elements of the mesh with two formulations: V-formulation (V-form) and Hellinger-Reissner (H-R)

6 Conclusions

This work provides the first step in establishing the firm link between electromagnetic and mechanical point of view, introducing several novelties on the way for solving numerically electrostatic and magnetostatic problems. In particular, energy-based variational formulations for several single-field and mixed multi-field formulation have been developed instead of the constitutive-based global equations currently used cell method, the preferred tool of physics and electrical engineering community. This energy formulation allows to study induced heterogeneities typical of inelastic material behavior and not only linear constitutive laws typical of classical works on electromagnetics. Although a detailed development in this paper is mostly provided for electrostatics, we briefly showed that an equivalent magnetostatic formulation can easily be recovered with an adequate change of the corresponding field variables.

Numerical implementation of discrete approximation is based upon Whitney’s elements. In this paper, we have developed in detail the approach granting the partition-of-unity to chosen discrete approximation in tetrahedron element, which applies to the corresponding shape functions. Moreover, the proposed discrete approximation improves the accuracy of the electromagnetic fields, since it preserves either tangential or normal continuity of primal and dual variables, respectively. This method can also be extended to higher-order interpolation, it remains to be seen if it should result in optimal solution when dealing with induced heterogeneities of materials coming from inelastic non-linear behavior, which remains our main motivation for the work presented in this paper.

The numerical examples in this paper provide full validation of the proposed discrete approximations based upon tetrahedra elements. They also illustrate the full scope of the problems and possible applications that can be solved with this kind of elements, first for the case of electrostatics and second by analogy for magnetostatics. Of particular interest is the superior result we are able to achieve in the parallel plate capacitor simulations establishing accuracy even with small number of elements for here proposed Hellinger-Reissner formulation in comparison with any other approach.