Dear All,
I am trying to solve transient problem for porous media.
Unfortunately, the time-dependent function is not updating after time increment, which gives us an undesired output value.
Kindly suggest, where it went wrong.
code is as mentioned below/////////////
//real uold=473.14;
//func uo = 473.15-10*t;
border C1(t1=-1,1) { x = 10*t1; y= -10; }
border C2(t1=-1,1) { x = 10; y = 10*t1; }
border C3(t1=-1,1) { x = -10*t1; y =10; }
border C4(t1=-1,1) { x = -10; y = -10*t1;}
mesh Th= buildmesh(C1(20)+C2(20)+C3(20)+C4(20));
//plot(Th, wait=1);
fespace Vh(Th, P1);
Vh u, v, uu, f, g=473.15;
real dt=0.01;
real phio= 0.1003, rhof=1000.0, cvf = 4200, kts=2.49, cvs=1000.0, rhos=2910.2;
real cpf=4200, ktf=0.6, qs =0;
real kt= (1-phio)*kts+phio*ktf;
real RhoCv= (1-phio)*rhos*cvs+ phio*rhof*cvf;
problem pht(u,v) = int2d(Th) ( dt*kt*(dx(u)*dx(v)+dy(u)*dy(v)) )
+ int2d(Th) (RhoCv*v*u)
+ int2d(Th)(-RhoCv*v*uu)
+ int2d(Th) (-qs*v)
+ on(C2, u=f)
+ on(C4, u= g);
real t =0; // initial time
uu = 473.15; // initial condition
for ( int m = 0; m <=3/dt; m++ )
{
t = t+dt;
cout<<"time is ="<< t<<endl;
f = 473.15 - 10*t;
cout<< "func is f ="<< f[]<<endl;
pht;
plot(u, wait = 0, value =1, fill= 1);
uu = u;
//cout<< "result at center="<< u(0,0)<<endl;
}
I have taken the reference for solving my problem is Evolution Problem given in documentation of FreeFem++. link is
========================================= https://doc.freefem.org/models/evolution-problems.html
==========================================
while taking function f outside an error occurs " identifier t does not exist".
I put real t =0; before, then it’s getting fixed but again the f value is not updating after time loop increasing.
Dear Simon,
Thank you for your suggestion and now the f value is updating but still that the temperature variation should be gradient type behavior like in time evolution problem (like the above result).
but my output result from this code is totally different from the original output result (pic below).
Also, the output at the center is supposed to be u(0,0) = 458.053, which I am not getting.
where I am getting wrong according to the problem, I am not getting.