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)(
alphauv
)
- int1d(Th, 1, 3)(
alphauev
) - 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 ?