# Improving residual error, magnetostatic

**URL:** <https://community.freefem.org/t/improving-residual-error-magnetostatic/1878>\
**Category:** General Discussion\
**Created:** [July 6, 2022, 10:32pm UTC](https://community.freefem.org/t/improving-residual-error-magnetostatic/1878 "2022-07-06T22:32:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![tess35](https://avatars.discourse-cdn.com/v4/letter/t/ac8455/32.png) [@tess35](https://community.freefem.org/u/tess35)\
**Post date:** [July 6, 2022, 10:32pm UTC](https://community.freefem.org/t/improving-residual-error-magnetostatic/1878/1 "2022-07-06T22:32:29Z")

</div>

```
       Hi everyone,

```

I come back to the magnetostatic module (of FreeFem) and i discovered a residual error too much high for an another problem that i’m working on.

An analytical formula give the field at the center of the coil:  
Bcenter = Jfil\* (asinh((2\* Rext)/length)/2-asinh((2\* Rint)/length)/2)\* length\* u0  
Jfil=5E6 A/m^2 , length=1 ; R1=0,1 m R2=0,2 m , Bcenter = 0.601128704 T

But with my files, i have still an error of 1-4% except if i increase drastically the mesh with more than 700 000 tetrahedrons and it take time to solve.

Could you give me any advice to decrease the error ? I would need something inferior to 1E-5 in relative.

```
       Sincerely

```

---

<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:** [July 7, 2022, 9:00am UTC](https://community.freefem.org/t/improving-residual-error-magnetostatic/1878/2 "2022-07-07T09:00:59Z")

</div>

First a error of 1E-5 is very small, this imply use order 2 finite element at least.

---

<div class="post-metadata">

**Author:** ![tess35](https://avatars.discourse-cdn.com/v4/letter/t/ac8455/32.png) [@tess35](https://community.freefem.org/u/tess35)\
**Post date:** [July 7, 2022, 10:18pm UTC](https://community.freefem.org/t/improving-residual-error-magnetostatic/1878/3 "2022-07-07T22:18:15Z")

</div>

Yes, it’s very small, but I want to find the result from two opposite vectors. The result is between 1E-1 - 1E-2 ( in relative error ), so i need a sufficient precision to examine.

The module’s example use the P2 element ?
