# Curl in cylindrical coordinate

**URL:** <https://community.freefem.org/t/curl-in-cylindrical-coordinate/305>\
**Category:** General Discussion\
**Created:** [March 18, 2020, 6:31pm UTC](https://community.freefem.org/t/curl-in-cylindrical-coordinate/305 "2020-03-18T18:31:45Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![marcodeba](https://avatars.discourse-cdn.com/v4/letter/m/977dab/32.png) [@marcodeba](https://community.freefem.org/u/marcodeba)\
**Post date:** [March 18, 2020, 6:31pm UTC](https://community.freefem.org/t/curl-in-cylindrical-coordinate/305/1 "2020-03-18T18:31:45Z")

</div>

Hi everybody!  
I need to perform some magnetostatic analysis in geometries that are actually close to a solenoid.  
I’m producing the mesh in 2D, due to the Axial symmetry of the problem and, using the A-formulation of the Ampere Law, I need to introduce the operator CURL, but I’m not succeeding in writing down the weak formulation of the operator itself.  
Does anybody succeeded in performing the same calculation? (The very same problem exists for me also modeling a simple solenoid with only one winding, because of course using the cartesian operator is like analyzing two infinite and straight conductors that are leading opposite current… nice problem, but not what I want to solve actually!)  
I’m going to thanks already a lot all the people that would help me in solving this problem!

Have a nice day!

---

<div class="post-metadata">

**Author:** ![frederichecht](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/frederichecht/32/15_2.png) [@frederichecht](https://community.freefem.org/u/frederichecht)\
**Post date:** [March 18, 2020, 8:52pm UTC](https://community.freefem.org/t/curl-in-cylindrical-coordinate/305/2 "2020-03-18T20:52:21Z")

</div>

I think first without formulation and equation it is hard to give a correct  
answer.

I find on the web:

The same technique does not work in magnetostatics since, in general, curl H ̸= 0. However, since

div B = 0

we conclude the existence of a vector potential A : R3 → R3 with B = −curlA in D. Substituting this into Ampere’s Law yields (for homogeneous media Ω) after multiplication with μ0

−μ0J = curlcurlA = ∇div A − ∆A.

Since curl ∇ = 0 we can add gradients ∇u to A without changing B. We will see later that we can choose u such that the resulting potential A satisfies div A = 0. This choice of normalization is called Coulomb gauge.

With this normalization we also get in the magnetostatic case the Poisson equation ∆A = −μ0J .

We note that in this case the Laplacian has to be taken component wise.

In your case J is normal to the 2d plan so A will be a scalar field in the plan.

#### 

![\boldsymbol \nabla \wedge \mathbf{A} = \left(\frac{1}{r}\frac{\partial \mathrm{A}z}{\partial \theta} - \frac{\partial \mathrm{A}\theta}{\partial z}\right) \mathbf{u_r} + \left(\frac{\partial \mathrm{A}r}{\partial z} - \frac{\partial \mathrm{A}z}{\partial r}\right)\mathbf{u\theta} + \frac{1}{r}\left(\frac{\partial}{\partial r}(r \mathrm{A}\theta) - \frac{\partial \mathrm{A}_r}{\partial \theta}\right) \mathbf{u_z}](https://wikimedia.org/api/rest_v1/media/math/render/svg/3956fa2b2fe757010d19af5d74200904a0806866).  
=\> 2 case scalaire avec A\_\theta et le vectoriel A\_z et A\_r

---

<div class="post-metadata">

**Author:** ![Larik](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/larik/32/101_2.png) [@Larik](https://community.freefem.org/u/Larik)\
**Post date:** [March 19, 2020, 7:21am UTC](https://community.freefem.org/t/curl-in-cylindrical-coordinate/305/3 "2020-03-19T07:21:55Z")

</div>

Hi, I’m also solving the same problem in terms of magnetic vector potential Curl( **A** )= **B** , where **A** is vector potential, **B** is magnetic induction (magnetic flux density). In magnetostatics the governing equation is -L( **A** )= mu0 **J** , where L is Laplace operator (depending on coordinate system), mu0 = 4_pi_1e-7 is magnetic constant, J is electric current density.  
Now I solved problem of calculation A and B for line wire for Cartesian  
[magnetic.edp](https://community.freefem.org/uploads/short-url/12BYcWGfJwUKFefzxz2tzfodDhU.edp) (1.3 KB) and polar [magneticAxi.edp](https://community.freefem.org/uploads/short-url/s1IlQF1xcZh62fgnmTm9tuwosMG.edp) (1.0 KB) geometries. You can try to play with different meshes and element types (P1 or P2), you will see how they influence on the calculation error. Description of writing in polar coordinates you can find in Documentation/Learning by Examples/Heat Conduction/Axisymmetry: 3D Rod with circular section.  
For the single ring with current `I` the analytical solution is A = mu0/(4\*pi) P theta / r^2, where P = `I` pi R^2 is magnetic moment of circuit, R is the circuit radius, theta is the angle between the symmetry axis and direction to point where A is being determinated, r is a distance from center of ring.  
I think that the second code have to be correct with the CORRECT boundary conditions. For now I now that on Axis A=0 and the total magnetic flux should be equals to zero  
int **B**  **n** dS = 0 = int Curl( **A** ) **n** dS = 0 where **n** is normal vector to dS. But for now I have not realized it. Here is code [magneticAxiRing.edp](https://community.freefem.org/uploads/short-url/5dfISQEZz9FPE42QoqbeeKnLX2k.edp) (2.1 KB) I’m working with it.  
If you succeed, let us know.

---

<div class="post-metadata">

**Author:** ![marcodeba](https://avatars.discourse-cdn.com/v4/letter/m/977dab/32.png) [@marcodeba](https://community.freefem.org/u/marcodeba)\
**Post date:** [March 27, 2020, 1:12pm UTC](https://community.freefem.org/t/curl-in-cylindrical-coordinate/305/4 "2020-03-27T13:12:16Z")

</div>

Thanks evrybody! Problem solved!
