# Feel++

## Mixed Poisson

### Notations and units

 Notation Quantity k conductivity \Lambda resistivity

### Equations

Mixed Poisson equations are

\begin{align} \boldsymbol{u} + k\nabla p &= \boldsymbol{f}\\ \nabla\cdot \boldsymbol{u} &= g \end{align}

completed by boundary conditions.

The conductivity k can be non-linear. If it depends only on the primal variable p, it is already handle by the model, in other cases, one needs to provide the corresponding expression.

### MixedPoisson Toolbox

The model is described in a json file which path is given by the option `mixedpoisson.model_json`. The construction of this file is detailed in the following sections.

#### Models

The models are not considered for now.

Model section
``"Model": "HDG"``

#### Materials

The definition of the conductivity k depends on the material, it can be linear or non-linear. In the linear case, it is given in the material we work on by the keyword `cond` and in the non-linear case, by `condNL`.

Material section
``````"Materials":
{
"<marker>":
{
"name": "copper",
"cond": "1",
"condNL": "2*p:p"
}
}``````

The keywords `cond` and `condNL` can be changed respectively by the options `mixedpoisson.conductivity_json` and `mixedpoisson.conductivityNL_json`.

#### Boundary Conditions

All boundary conditions are described in the same way

Listing : boundary conditions in json
``````"BoundaryConditions":
{
"<field>":
{
"<bc_type>":
{
"<marker>":
{
"<option1>":"<value1>",
"<option2>":"<value2>",
// ...
}
}
}
}``````

Different types of boundary condition are available.

##### Dirichlet condition
p = g_D
 Field Type Option Value `potential` `Dirichlet` `expr` g_D
##### Neumann condition
-k\nabla p \cdot\boldsymbol{n} = g_N
 Field Type Option Value `potential` `Neumann` `expr` g_DN or -k\nabla p

The choice between g_DN or -k\nabla p is base on the dimension of the expression.

##### Robin condition
-k\nabla p \cdot\boldsymbol{n} + g_R^1 p = g_R^2
 Field Type Option Value `potential` `Robin` `expr1` g_R^1 `potential` `Robin` `expr2` g_R^2
##### Integral boundary condition
\int_{\Gamma_I} \boldsymbol{u}\cdot\boldsymbol{n} = g_I
 Field Type Option Value `flux` `Integral` `expr` g_I

#### Source Terms

The source terms f and \boldsymbol{g} are treated as boundary condtions.

 Field Type Option Value `potential` `SourceTerm` `expr` f `flux` `SourceTerm` `expr` \boldsymbol{g}

#### Post Process

Two fields can be exported, the potential p and the flux \boldsymbol{u}.

Post Process section
``````"PostProcess":
{
"Fields":["potential","flux"]
}``````

### Create applications

In order to solve linear problem, an application should contain at least

Minimal Linear case
``````    typedef FeelModels::MixedPoisson<FEELPP_DIM,FEELPP_ORDER> mp_type;
auto MP = mp_type::New("mixedpoisson");
MP->init();
MP->assembleAll();
MP->solve();
MP->exportResults();``````