Derivative and integration of physical variable over Boundary

Dear all,
I am trying to compute the heat flux and cumulative heat flux over a boundary section of the square.

I have tried with writing the code as : flux = int1d(Th, 4)(-dx(T)*N.x)

but each time I am getting the same real number for different grid sizes.

Also, please comment on getting the list of values of (-dx(T)*N.x) over a specific boundary.

I am worried a lot about getting these values.

Thanks

Try these
Vh T,v;
varf Flux (T,v)= int1d(Th, 4)((-dx(T)*N.x)*v);
Real [int] FLUX=Flux(0,Vh);
cout<<" FLUX "<<FLUX<<endl;

1 Like

Thanks @Daoudi for your help.

with little modification, it is compatible with my code script.
Vh v;
varf Flux (unused,v)= int1d(Th, 4)((-dx(T)*N.x)*v);
real [int] FLUX=Flux(0,Vh);
cout<<" FLUX "<<FLUX<<endl;

I am surprised after getting the result in (n x 4) matrix form.

Further, I was trying to export the data for heat_flux = (-dx(T)*N.x)
on the boundary ( x=0, 0<= y <= 1) that has named as 4 in the script .

For this purpose, I have followed a similar pattern of coding which is showing errors while compilation.

Vh v1; varf flux (unused,v1)= ((-dx(T)*N.x)*v1); real [int] flux11 = flux(0,Vh); cout<<" flux"<<flux11<<endl;

Also, for exporting the data I have gone through the script below which I have again no luck this time.

ofstream ff5("testcase1.csv");
for(real p1 = 0.0; p1<1.01; p1 = p1 + 0.01)
{
ff5<< 0.0<<","<< p1 << ","<< FLUX(0.0, p1)<<endl;
}

mesh Th=square(np,np);
fespace Vh(Th,P2);
Vh Flux
N.x= -1.; //Because your domain is a square
Flux=-dx(T);
real [int] Flux11=Flux[];
ofstream ff5(“testcase1.txt”)
{
for (int I=0;I<np+1;I++)
ff5<<Flux11(I*(np+1))<<endl;
}

1 Like

It works and serves my purposes.

Thanks @Daoudi .

I am an absolute learner in FreeFEM field.

So, will you mind if I ask you for supporting material that deals with such an operation in FreeFEM?

Should, I thoroughly learn the C++ coding or only basic study may help me to pick these ideas and scripts of FreeFEM.