# Understanding problem

**URL:** https://community.freefem.org/t/understanding-problem/2684
**Category:** General Discussion
**Created:** [September 5, 2023, 11:09am UTC](https://community.freefem.org/t/understanding-problem/2684 "2023-09-05T11:09:46Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![moufide](https://avatars.discourse-cdn.com/v4/letter/m/48db29/32.png) [@moufide](https://community.freefem.org/u/moufide)
#### Post date: [September 5, 2023, 11:09am UTC](https://community.freefem.org/t/understanding-problem/2684/1 "2023-09-05T11:09:46Z")

</div>

Good evening everyone  
I would like to understand this code:

// Parameters  
func u0 = 10. + 90._x/6.;  
func k = 1.8_(y\<0.5) + 0.2;  
real ue = 25.;  
real alpha=0.25;  
real T=5.;  
real dt=0.1 ;

// Mesh  
mesh Th = square(30, 5, [6.\*x,y]);  
// Fespace  
fespace Vh(Th, P1);  
Vh u=u0, v, uold;

// Problem  
problem thermic(u, v)  
= int2d(Th)(  
u\*v/dt

- k\*(  
dx(u) \* dx(v)
- dy(u) \* dy(v)  
)  
)
- int1d(Th, 1, 3)(  
alpha_u_v  
)

- int1d(Th, 1, 3)(  
alpha_ue_v  
)
- int2d(Th)(  
uold\*v/dt  
)

- on(2, 4, u=u0)  
;

// Time iterations  
ofstream ff(“thermic.dat”);  
for(real t = 0; t \< T; t += dt){  
uold = u; //equivalent to u^{n-1} = u^n  
thermic; //here the thermic problem is solved  
ff \<\< u(3., 0.5) \<\< endl;  
plot(u);  
}

I would like to understand this line “uold = u; //equivalent to u^{n-1} = u^n” after this line what is the value of u,?.  
Is u still unknown?  
I want to evaluate the L2 norm of the derivative of the solution, that is to say each time I want to calculate (u^n+1-u^n)/dt.  
Will this value of the derivative not always be zero ?

---

<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: [September 5, 2023, 3:39pm UTC](https://community.freefem.org/t/understanding-problem/2684/2 "2023-09-05T15:39:18Z")

</div>

No and No because at this stage u is not update to the next value.  
so you save le previous value .  
After thermic you compute the next value of u ( u at t = t+ dt)  
and uold value of u at time t.

(u-uold)/dt is a approximation of the time derivative in this case.
