This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

Impose div a=0 for curl-curl

+2 votes

Hello Fenics pros,

In Fenics it is easily possible to impose boundary conditions to spaces.
But I need something more.
Solving the Problem
$$(\mu^{-1} curl(a),curl(v))=(j,v)$$
requires that $$a\in H_0(curl)\cap H(div^0)$$
That is, a gauging condition is applied. a is a vector potential and not unique up to an integration constant, which is a gradient. So we need to gauge the problem and need to impose div(a)=0 (the $H(div^0)$ part ) for the whole domain.
Can this be done in Fenics?
(For my specific purpose it does not suffice to add this constraint with a Lagrange multiplier. If someone needs to know why, I will explain.)

Getting an answer would be of great help. Thanks

Edit
The problem above is the primal formulation which gives us the vector potential $a$ as main variable and $b(=\mu h)$ is obtained by postprocessing, thus loosing some regularity.
So, to solve this very problem we introduce a Lagrange multiplier to "get $div(a)=0$ into the equation". Then we have
$$
(\mu^{-1}curl(a),curl(v))+(a,grad(psi))=(j,v)
$$
$$
(v,grad(phi))=0
$$
But what I need is $b$ as the primal variable (it only needs to be multiplied by $\mu^{-1}$ to obtain $h$). The goal is to obtain a $h$ that satisfies $curl(h)=j_q$ everywhere in the domain ($j_q$ is now a projected version).
Therefore I would like to solve the mixed formulation:
$$
(\mu h,h')-(curl(a),h')=0
$$
$$
(curl(h),v)=(j,v)
$$
$v,h'$ being the testfunctions, seeking $a,h$.
Now imposing $div(a)=0$ I have no working theory how this could be done.
If I had the possibility to impose it in the spaces, this formulation might work, but since this is not possible I don't know how to approach this formulation to obtain a $h$ with the required regularity.
I hope this explains it, is this clear?

A hint on how to impose div(a)=0 by a Lagrange multiplier to the mixed formulation would be equally helpful. I have been searching the web for this a long time...

asked May 26, 2016 by jayjay FEniCS Novice (340 points)
edited May 27, 2016 by jayjay

2 Answers

+3 votes

There are no divergence free elements in FEniCS. The
only way to impose this condition is therefore require
div(a) = 0 with a Lagrange multipliers or by a penalty term
like a augmented Lagrangian method. Can you explain why
you do not want to do that?

answered May 26, 2016 by Kent-Andre Mardal FEniCS Expert (14,380 points)
+3 votes

There are divergence free elements. They are just not in FEniCS
because there a several problems associated with them.
See for instance works of Malek and Turek.

You explanation is not clear. What is 'b'?

Your problem is associated with the mixed formulation of the Hodge
Laplacian. Have a look at:
https://arxiv.org/abs/0906.4325
if you want to try to implement it in FEniCS on mixed form.

answered May 27, 2016 by Kent-Andre Mardal FEniCS Expert (14,380 points)

$b=\mu h$, see my edits in the text. b is magnetic flux density, h magnetic field and a a vector potential that implicitly satisfies $div(b)=0$.

The mixed form of Hodge Laplacian which appears to
be closely linked to your application is straightforward
to implement in FEniCS. You would use
H(curl)/H(div) compatible elements.

For implementation in FEniCS you may have a look at
chapter 35 in the FEniCS book. This not the best reference
for the mathematics concerning this problem, but at
least it shows some code that we implemented and
combinations of elements that are appropriate.

Yes you're right. I looked over the paper and it seems to give some formulations that have two lagrange multipliers and the corresponding PDEs. Then a stability analysis is performed, but I have no knowledge about exterior calculus and the De Rahm complex, so this is not a quick possibility to solve my problem but rather a time consuming task to get into that matter. But at least I know now, that there is no easy solution to my problem...
Thank you for pointing me to the paper, although it is not the time to read it now, I will return to it one day.

...