# Second order dxx, solver crash

**URL:** <https://community.freefem.org/t/second-order-dxx-solver-crash/1635>\
**Category:** General Discussion\
**Created:** [March 30, 2022, 3:18pm UTC](https://community.freefem.org/t/second-order-dxx-solver-crash/1635 "2022-03-30T15:18:42Z")\
**Posts on this page:** 5\
**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:** [March 30, 2022, 3:18pm UTC](https://community.freefem.org/t/second-order-dxx-solver-crash/1635/1 "2022-03-30T15:18:42Z")

</div>

```
          Hi everybody,

I have a difficulty with the second order dxx().

```

Take a simple model, u’’’(x)=1 \<=\> int2d u’’(x)_v(x)=int2d 6_v(x). The solution is polynomial of degree 3, like x^3 + constant

mesh Th=square(100,100);  
fespace Vh(Th, P2);   
Vh u, v;

solve equa(u,v,solver=UMFPACK) =  
int2d(Th) ( -dxx(u)_dx(v) ) - int2d(Th) ( 6.0_v ) + on( 4, u= 1.0 )+ on( 2, u= 2.0 ) ;

But it doesn’'t work. The example bilapMorley.edp for the bilaplacien work perfectly. I modify it to have a 1D problem but the solver crash.

Is it a problem of formulation or the fespace is not correct ?

```
            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:** [March 31, 2022, 4:31pm UTC](https://community.freefem.org/t/second-order-dxx-solver-crash/1635/2 "2022-03-31T16:31:21Z")

</div>

First, You use 2D finite element for 1d problem,  
secondly, you use P2 finite element to compute third derivative  
third: you vationnal form is crazy if v = 1 then you have 0 = 6 =\> system not invertible .

A code in 1d (wrong ) the formulation is wrong pb of Boundary condition  
you have 3 constants unknown and you set only 2 …

```auto
load "msh3" 
meshL Th=segment(100);
fespace Vh(Th, P2); 
Vh u, v ,xx=x, xxx=x*x*x;

solve equa(u,v,solver=UMFPACK) =
int1d(Th) ( -dxx(u)*dx(v) + 1e-5*dx(u)*dx(v)) - int1d(Th) ( 6*(v) ) + on(1,2,u=xxx);

plot([xx[],u[]],[xx[],xxx[]],wait=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:** [April 13, 2022, 10:27pm UTC](https://community.freefem.org/t/second-order-dxx-solver-crash/1635/3 "2022-04-13T22:27:22Z")

</div>

```
  Hi, 

```

I have some setbacks. Your code does’nt work on my machine, is it abnormal or voluntary ?  
The error code is :

> Build Nodes/DF on mesh : n.v. 101, n. elmt. 100, n b. elmt. 2  
> nb of Nodes 201 nb of DoF 201 DFon=1100  
> – FESpace: Nb of Nodes 201 Nb of DoF 201  
> current line = 11  
> Assertion fail : (0)  
> line :245, in file …/femlib/P012\_3dCurve.cpp  
> Assertion fail : (0)  
> line :245, in file …/femlib/P012\_3dCurve.cpp  
> err code 6 , mpirank 0

I have ever tried to reinstall 2 times from the binaries, version 4.6 and to compile from the source , version 4.10.  
Before that, i used freefem 4.4 which don’t use 1 D element, it’s why my code use 2 D element.

I’m much more used to finite difference method , sorry for my dumb question. I don’t understand why P2 finite element is bad in this case ? Because I need dxx so second order ?

3 constants is needed, now i see that, x³+1 is not the only solution without enough constraints.

About the third remark, did you want to say that we have a conflict between int1d(Th)(6\*v) and on(2,u=xxx ) (xxx=0) if v=1 at x=0 ?

But applying the integration by parts :

y’’ =6 =\> y’‘\*v =6 \*v \<=\> int2d -y’‘\*v’ + int1d y’‘_v = int2d 6_v \<=\> int2d y’\*v’’ - int1d y’\*v’ + int1d y’'_v = int2d 6_v  
I suppose that a factor is missing ? I tried several patchs but nothing work.

```
      Thank for your reply

```

---

<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:** [April 15, 2022, 12:18pm UTC](https://community.freefem.org/t/second-order-dxx-solver-crash/1635/4 "2022-04-15T12:18:36Z")

</div>

You have to use the last FreeFem version 4.11 no version 4.6 (Thu Apr 2 14:11:06 2020 +0200)

---

<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:** [April 19, 2022, 8:46pm UTC](https://community.freefem.org/t/second-order-dxx-solver-crash/1635/5 "2022-04-19T20:46:13Z")

</div>

Now it work with the version 4.11 from binary packages, (the last test was under 4.10 ).

I tried to add : +int0d(Th,1) (dxx(u)\*v) for dxx(u)=0 at x=0,  
or +int0d(Th,2) (dxx(u)_v) - int0d(Th,2) ( 6_v ) for dxx(u)=6 at x=1  
but nothing work.
