# How to determine the normal flux along a curved surface?

**URL:** <https://community.freefem.org/t/how-to-determine-the-normal-flux-along-a-curved-surface/756>\
**Category:** General Discussion\
**Created:** [January 24, 2021, 9:10pm UTC](https://community.freefem.org/t/how-to-determine-the-normal-flux-along-a-curved-surface/756 "2021-01-24T21:10:01Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mr.Good](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/mr.good/32/382_2.png) [@Mr.Good](https://community.freefem.org/u/Mr.Good)\
**Post date:** [January 24, 2021, 9:10pm UTC](https://community.freefem.org/t/how-to-determine-the-normal-flux-along-a-curved-surface/756/1 "2021-01-24T21:10:01Z")

</div>

![image](https://canada1.discourse-cdn.com/flex030/uploads/freefem/original/1X/e9c7392b87bc5bf84936734b29f78bccbd77b82a.png)

* * *

Dear users,  
I am working on a Natural convection problem via freeFEM?  
A researcher has plotted the results of Normal(grad(T)) along a circle see the top right figure.  
what will be the command of Normal(grad(T)) along a Circle in FreeFEM?  
Detail is attached in the image below.

---

<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:** [January 25, 2021, 10:17am UTC](https://community.freefem.org/t/how-to-determine-the-normal-flux-along-a-curved-surface/756/2 "2021-01-25T10:17:54Z")

</div>

just do

```
   macro grad(u) [dx(u),dy(u)]//
   real flux = int1d(Th,circle)( grad(T)'*[N.x,N.y]) ;
```

---

<div class="post-metadata">

**Author:** ![Mr.Good](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/mr.good/32/382_2.png) [@Mr.Good](https://community.freefem.org/u/Mr.Good)\
**Post date:** [February 12, 2021, 11:41am UTC](https://community.freefem.org/t/how-to-determine-the-normal-flux-along-a-curved-surface/756/3 "2021-02-12T11:41:28Z")

</div>

Thanks for your kind guidance. It works fine for entire length but it gives only one values.  
How do i plot along the running circle for entire running flux. mean x-axis (0-2pi) and y-axis (flux calculation from 0 to 2pi).  
Check this command please .  
see the first post where the results are plotted along a circle

for (int ii = 0 ; ii \< nn; ii++)  
{xx[ii] = ii/nn;

macro grad(u) [dx(u),dy(u)]//  
flux[ii] = int1d(Th,circle)( grad(T)’\*[N.x,N.y])(ii/nn,ii/nn) ;

ofstream gnu ( “Flux=.txt” );  
for (int ii = 0; ii \< nn; ii++)  
gnu \<\< flux[ii] \<\< endl;}

---

<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:** [February 12, 2021, 12:42pm UTC](https://community.freefem.org/t/how-to-determine-the-normal-flux-along-a-curved-surface/756/4 "2021-02-12T12:42:22Z")

</div>

Your question is not clear, so your idea never works.

I think, (but I am not sur) you to compute the flux on arc of size theta  
where arc go from 0 to theta.

so the flux on the arc will be something like  
int1d on arc(theta) of ( grad(T)’\*[N.x,N.y])  
if ( xc,yc) is the center of the circle the angle of circle is atan2(y-yc,x-xc) in [-pi,p2[ with 0 angle on axis x in -pi, pi

So you can compute make a loop for theta in [0, 2\*pi]  
int1d(Th,circle)( (pi+atan2(y-yc,x-xc) \< theta )_grad(T)’_[N.x,N.y]);

---

<div class="post-metadata">

**Author:** ![M\_Usman](https://avatars.discourse-cdn.com/v4/letter/m/e5b9ba/32.png) [@M\_Usman](https://community.freefem.org/u/M_Usman)\
**Post date:** [September 13, 2023, 8:11am UTC](https://community.freefem.org/t/how-to-determine-the-normal-flux-along-a-curved-surface/756/5 "2023-09-13T08:11:51Z")

</div>

Dear Professor, @frederichecht thanks for the useful discussion. The above command will work? If I just want to compute the rate of heat transfer i.e.  
∂T/∂n  
every point of the circle (radius=0.1, center=(0.5,0.2\*sqrt(3))), where n is normal at every point of the circle. If the surface is not a curve, where I want to compute heat transfer, I simply use dx(T)(x,y) or dy(T)(x,y), where x and y are those points where I have to compute the rate of heat exchange.

---

<div class="post-metadata">

**Author:** ![M\_Usman](https://avatars.discourse-cdn.com/v4/letter/m/e5b9ba/32.png) [@M\_Usman](https://community.freefem.org/u/M_Usman)\
**Post date:** [September 13, 2023, 11:39am UTC](https://community.freefem.org/t/how-to-determine-the-normal-flux-along-a-curved-surface/756/6 "2023-09-13T11:39:57Z")

</div>

![image](https://canada1.discourse-cdn.com/flex030/uploads/freefem/original/2X/7/7c636c9435c82e1212ec40a429dc4428a2cb3185.png)

It can be seen that as theta varies points at the surface also vary. So how to compute the value of Nu at other values of theta?
