# Electrostatics template


• Download the templates (they are also directly available in the ONELAB bundle)
• Create a geometry with Gmsh, or open an existing geometry
• File/Merge the Electrostatics.pro template
• For each physical group in the model, you will be asked to select the material, sources or boundary conditions

Every time you run your model, the ONELAB database is saved to disk (you can later reload it using the gear menu). A flattened problem file containing the GetDP definitions is also saved in case you want to edit it manually later on.

## Governing equations

The equations describing electrostatics are obtained by dropping the terms with time derivatives (since we only consider static phenomena) in Maxwell's equations. The equations involving the electric and magnetic quantities (the electric field $\vec{e}$ and the electric displacement $\vec{d}$ on one side, the magnetic field $\vec{h}$ and the magnetic induction $\vec{b}$ on the other) then become decoupled and in order to determine the electric field we can thus only consider: \begin{align} \Curl{\vec{e}} &= 0 , \label{eq:curle}\\ \Div{\vec{d}} &= \rho , \label{eq:divd} \end{align} together with the dielectric constitutive law $$\vec{d} = \epsilon \vec{e} + \vec{p}_e , \label{eq:de}$$ where the charge density $\rho$ and the source polarization $\vec{p}_e$ are given (see Maxwell's equations for additional details).

## Scalar electric potential

Since $\Curl{\vec{e}} = 0$, the electric field can be derived from a scalar potential (the electric scalar potential $v$ such that $$\vec{e} = - \Grad{v} . \label{eq:v}$$

Introducing \eqref{eq:v} and \eqref{eq:de} in \eqref{eq:divd}, we obtain $$\label{eq:elesta} -\Div{\epsilon\,\Grad{v}} = \rho .$$ Our goal is to solve this equation in a bounded open set $\Omega$ of the oriented Euclidean space $\Ethree$. Note that if $\epsilon$ is a constant, \eqref{eq:elesta} reduces to Poisson's equation: $\Delta\,v=-\rho/\epsilon$.

## Weak formulation

Domain and its boundary.

Let us skip all the mathematical details related to the conditions for the existence and uniqueness of the solution to this problem and focus instead on reformulating of the problem in order to solve it using the finite element method with GetDP. In order to do this, we need to transform the original partial differential equation into a so-called weak formulation. This weak formulation is obtained by testing equation \eqref{eq:elesta} with a series of functions, which means taking the scalar product of the equation with these test functions. Mathematically, one can show that \eqref{eq:elesta} is equivalent to finding the solution $v$ such that $$\label{eq:elesta_weak} - \int_\Omega (\Div{\epsilon\,\Grad{v}}) \,v' \,d\Omega = \int_\Omega \rho \,v' \,d\Omega$$ holds for all test functions $v'$ in an appropriate function space. This is the weak formulation of \eqref{eq:elesta}, where the appropriate function spaces for $v$ and $v'$ are Sobolev spaces of square integrable functions whose gradients are also square integrable, the precise definition of which depends on the applied boundary conditions. Using the $(\cdot,\cdot)$ notation for the scalar product, we can write the weak formulation in a more compact form as: Find $v$ such that $$\label{eq:elesta_weak2} - (\Div{\epsilon\,\Grad{v}} , v')_\Omega = (\rho , v')_\Omega, \quad \forall v'.$$ It is advantageous to integrate the left-hand side of \eqref{eq:elesta_weak2} by parts, which symmetrizes it and reduces the continuity requirements on $\epsilon$ and $v$. Applying Green's first identity, the weak formulation then becomes: Find $v$ such that: $$\label{eq:elesta_weak3} (\epsilon\,\Grad{v} , \Grad{v'} )_\Omega - (\epsilon\, \vec{n}\cdot\Grad{v} , v' )_{\partial\Omega} = (\rho , v')_\Omega ,\quad \forall v'.$$ The weak formulation \eqref{eq:elesta_weak3} is what is written symbolically in the Electrostatics.pro template.