Rate of change in temperature at everypoint on a heated circle

I solved a natural convection problem in a circle of radius r=0.1 with center (x0,y0)=(0.5,0.0.2*sqrt(3)). Now I am trying to find the rate of heat transfer i.e.
∂T/∂n
where n is normal at a point on a circle where we have to compute the rate of heat transfer as mentioned in the following figure.


Could you please guide me to find the rate of heat transfer on every point of a circle using a loop?
Thanks

Something like this?

mesh Th; // mesh
int BoundaryLabel = 1; // boundary label
real k = 1.0; // thermal conductivity 
int1d(Th,BoundaryLabel)(k*(N.x*dx(T) + N.y*dy(T)));

Thanks, Chris for your response.
Why you take int1d??? I think it is like grad(T)'[N.x, N.y] at some point on the circle. But the problem is how I can compute grad(T)'[N.x, N.y] at some specific point of the circle such as (x1,y1), where N.x and N.y should be the x and y compute of the normal “n” on the circle at point (x1,y1). Could you please guide me in this direction or any other which is appropriate?

@cmd May be this will help you to elaborate on my point.

Just create a vector like:

Vh Tx = dx(T);
Vh Ty = dy(T);

And then you can evaluate this at any point and compute the heat flux.

Thanks @cmd. What about the normal vector “n” at any point? It will be the same and just the change in dx(T) and dy(T)? if not then how I can evaluate N.x and N.y at any point on the circle?

You can compute it yourself using the known geometry of your mesh. Or you can do something like:

varf vHF(p,q) = on(BoundaryLabel, p = N.x*dx(T) + N.y*dy(T));
Vh HF;
HF[] = vHF(0,Vh,tgv=1);

I think the earlier point about trying to do a point wise result is well taken but
extending on your idea I guess you also flag the dofs that make up the boundary,
The IND result appears to select the boundary dofs, fwiw.

load "msh3"
load "medit"
load "isoline"
 load "mjm_dscope_freefem"
real szx=100;
real szy=100;
int nx=50;
int ny=50;
int nc=30;
real r=20;
real[int,int] cp(2,nc);
for(int i=0; i<nc; ++i) 
	{ real t=1.0*i/nc;  cp(0,i)=r*cos(t*2.0*pi); cp(1,i)=r*sin(t*2.0*pi); }
border left(t=0, 1){x=-szx/2; y=szy*(t-.5);label=1; }
border top(t=0, 1){x=szx*(t-.5);y=szy/2; label=2; }
border right(t=0, 1){x=szx/2; y=-szy*(t-.5);label=3; }
border bottom(t=0, 1){x=-szx*(t-.5);y=-szy/2; label=4; }
border mycircle(t=0, 1){
P=Curve(cp, 0, nc-1, t);
label=5;
}// EOM

mesh Th = buildmesh(left(-ny)+top(-nx)+right(-nx)+bottom(-ny)+mycircle(nc));
//plot(Th);
//medit("mesh",Th);
fespace Vh(Th,P1);
Vh p,q,ind;
Vh T=x*x;
// https://community.freefem.org/t/rate-of-change-in-temperature-at-everypoint-on-a-heated-circle/2708/6

varf vIND(ind,q) = on(5, ind = 5 );
varf vHF(p,q) = on(5, p = N.x*dx(T) + N.y*dy(T));
Vh HF,IND;
IND[] = vIND(0,Vh,tgv=1);
HF[] = vHF(0,Vh,tgv=1);
cout << " n = "<<HF[].n<<endl;
cout << " ind = "<<IND[]<<endl;
//medit("ind",Th,IND);

/*
meshL Th1=Sline(1024,[x]);
fespace Mh(Th1,P1);
Mh asol=uh(x,x);
Mh anex=uex(x,x);
Mh diff=anex-asol; // =uex(x,x);
//mjmdscopeL(Th1,"names asol anex diff "+nn,asol,anex,diff,"asdf"); // warning  do not forget () 
mjmdscopeL(Th1,"names asol anex diff "+nn,asol,anex,diff,"asdf"); // warning  do not forget () 

*/
//mjmdscopeL(Th1,"names asol anex diff "+nn,asol,anex,diff); // warning  do not forget () 

Thank you @cmd and @marchywka for your response. I have seen the normal on a curved body can be computed as:
image
where n_x and n_y are the x and y components respectively. Since the x and y component of a circle at any point is -cos(theta) and sin(theta) respectively. May, I compute the rate of heat transfer at any point (x_i,y_i) on the circle such x_i=0.5+rcos(theta), y_i=0.5+rsin(theta), where (0.5,0.5) is center of circle and r is radius, using the following expression:
-cos(theta)dx(T)(x_i,y_i)+sin(theta)dy(T)(x_i,y_i), for 0<theta<2pir

This gives the following error:
Compile error :
line number :19, Curve

Hi @cmd @marchywka the following is the Poisson equation solved in a circle of radius 0.1 and center (0.5, ):

real Mesh=60;
real ra=0.1;
border C(t=0,1){x=0.5+racos(2pit);y=0.2sqrt(3)+rasin(2pit);}
mesh Th=buildmesh(C(Mesh));
plot(Th,wait=1);
fespace Vh(Th,P2);
func f= x
y;
Vh U,V;
problem Poisson(U,V,solver=LU)=
int2d(Th)(dx(U)*dx(V) + dy(U)*dy(V))

  • int2d(Th)( f*V )

on(C,U=1) ;
Poisson;
real n=11;
real[int] xx(n),flux(n);
for(int i=0;i<n;i++)
{
xx[i] = (2pii)/(n-1);
flux[i]=-cos(xx[i])dx(U)(0.5+racos(xx[i]),0.2sqrt(3)+rasin(xx[i]))
-sin(xx[i])dy(U)(0.5+racos(xx[i]),0.2sqrt(3)+rasin(xx[i]));
cout<<raxx[i]<<" "<<flux[i]<<endl;
}
macro grad(u) [dx(u),dy(u)]//
cout<<"flux1 = "<<((grad(U))'
[N.x,N.y])<<endl;
plot(U);

Now I have computed ∂U/∂n on 500 points on the circle. My way is correct? If yes then how can get the same values on every 500 points using (grad(U))'*[N.x,N.y] command?

@cmd @marchywka could you please give your valuable suggestions on the above posts please. Thanks!

Can you upload the code? Did it run? I guess you can do it pointwise
uising u(x,y) and FF should give you the value at that arbitrary point
with interpolation If you want to calculate the normal yourself
its easy for a circle but difficult in general.

Yes, @marchywka you are right this is easy for the circle that is why I mentioned this code and computed the required expression using some mathematics, now I want to know how I can get the same results using ((grad(U))'* [N.x, N.y]) command or some other way which is appropriate for every shape not only circle.

The code I gave here should do what you’re asking. If not, please explain why it doesn’t do what you need.

How I can extract flux[1], flux[2],…,flux[500] (as I obtained in above), where flux[i] are the rate of change on the circle for 500 different points.

The code I provided should give you the flux at each point on the boundary in the array HF[]

Yes sir @cmd , I got an array for this circle problem (posted by me) as bellow.
0.009976449806 0.01022786813 0 0.01017127374 0
0 0.01036609768 0.01010309073 0 0.009996923058
0 0 0.01026848656 0 0
0.01005449145 0.01028976586 0 0 0
0 0 0 0.00988521446 0.00983777796
0 0.009760014285 0 0 0.009681407371
0.009626978686 0.009370266281 0 0.009495604429 0
0 0.00950908328 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0.01026828858 0 0 0
0.01023723867 0 0.0100778128 0 0.01049083483
0.01028432381 0.01026328347 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0.009178976079 0 0.008948200174
0.009317974872 0 0 0 0
0.009620942578 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0.01017972185
0.009804091975 0 0.01008043608 0.0103381028 0
0.01020221113 0 0 0 0.01025413732
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0.01003440996
0.008979116319 0 0 0.009211466015 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0.01014617075 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0.01015735372 0.009878638772 0 0.009768710773 0
0 0.009638180034 0 0 0
0 0 0.009850216655 0 0
0.009638531588 0.009303229429 0 0.009486680878 0
0 0.008808276496 0.00892237405 0 0
0.008736047786 0.008641869733 0 0.008553388845 0.008482261106
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0.009640006896 0 0.009363356954 0 0
0 0 0 0 0
0 0.008381280385 0 0 0.008352637005
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0.008178891123 0 0 0.008094416784
0.007921689614 0 0.008035840762 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0.009187034163 0 0.009467530159
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0.008906538187
0 0.009034063396 0 0 0
0 0 0.007920278564 0.0081499919 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0.008781110423 0 0.008897509133 0
0 0 0 0.008030449285 0
0.007771554442 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0.008762036982 0 0.008709343918 0.007504656477 0.00766564131
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0.008616690592 0 0.008551253631
0.00772690838 0 0.007563498948 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0.008481464341 0.008401306223 0
0.007601874843 0 0.007479486991 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0.008348593026 0 0.008253466641 0.007498606579 0
0.007430781148 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0.008178010639 0
0.008169095043 0.007451143256 0 0.007342576625 0
0 0 0 0 0
0 0 0 0 0.007081512038
0.00731168822 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0.008008827717
0 0.008000198325 0 0 0
0 0 0 0 0
0 0 0 0 0.0072574087
0.007384942941 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0.008004415351 0 0.00789793697 0
0 0 0 0 0
0 0.00725077262 0 0.007265244413 0
0.00709932628 0.007246035103 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0.007883428924 0 0.007768981524 0 0
0 0 0 0.007245020798 0.007392743923
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0.007796203849 0 0.007662102185
0 0 0 0 0.007232847062
0.007291578599 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0.00772438426 0 0.00756676888
0 0 0 0.007308923286 0
0.007145375743 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0.007654159697 0.007484197262 0 0.007355853744
0.00716194191 0 0 0 0
0 0 0 0 0
0 0 0.007611156238 0 0
0.007549765583 0 0.007423663465

@cmd I want to plot in 2D on the x-axis surface length means 0 to 2pira and on the y-axis value of flux. How can I get appropriate data in a .dat file so that I can plot in tecplot.?

It looks like the data is there. You will have to post-process it to plot it.
https://doc.freefem.org/documentation/visualization.html