# Rate of change in temperature at everypoint on a heated circle

**URL:** <https://community.freefem.org/t/rate-of-change-in-temperature-at-everypoint-on-a-heated-circle/2708>\
**Category:** General Discussion\
**Created:** [September 15, 2023, 1:53am UTC](https://community.freefem.org/t/rate-of-change-in-temperature-at-everypoint-on-a-heated-circle/2708 "2023-09-15T01:53:52Z")\
**Posts on this page:** 13\
**Page:** 2

<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 19, 2023, 3:20am UTC](https://community.freefem.org/t/rate-of-change-in-temperature-at-everypoint-on-a-heated-circle/2708/21 "2023-09-19T03:20:16Z")

</div>

> [@cmd](#):
>
> HF

Thank you @cmd and @marchywka for your useful comments. I have a few doubts need to ask here!

1. There are too many zeros in HF, what does that represent?
2. How I can see from HF, flux values at a specific point say the flux at theta=0, theta=pi/4, etc…
3. I have seen the visualization ([Visualization](https://doc.freefem.org/documentation/visualization.html)), and I can plot 2D and contour plots. I haven’t plotted HF type data before and did not obtain any fruitful information from [Visualization](https://doc.freefem.org/documentation/visualization.html).
4. In addition, I can export 2D and contour plots using the .dat file later I plot it in tecplot. How does HF type data export using ofstream command or any other way?  
I am waiting for your positive response. Thanks

---

<div class="post-metadata">

**Author:** ![cmd](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/cmd/32/67_2.png) [@cmd](https://community.freefem.org/u/cmd)\
**Post date:** [September 19, 2023, 5:04am UTC](https://community.freefem.org/t/rate-of-change-in-temperature-at-everypoint-on-a-heated-circle/2708/22 "2023-09-19T05:04:39Z")

</div>

1. All the values at points that are not along the boundary.
2. The easiest way is probably to use a visualization software, unless the point of interest is a node of the mesh.  
3.&4. `HF[]` is just data on an `fespace`. The square brackets just let you access and output the data like a normal `real[int]` array.

---

<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 19, 2023, 6:56am UTC](https://community.freefem.org/t/rate-of-change-in-temperature-at-everypoint-on-a-heated-circle/2708/23 "2023-09-19T06:56:22Z")

</div>

Thank you Sir @cmd for your detailed response. Although I frequently used Tecplot (visualization software), I think the data HF is hard to tackle since it is not in the form (too much irrelevant data i.e., zeros) that Tecplot accepted. Therefore, could you please guide me to another easier way to find the flux (defined above ∂T/∂n) at any point on a curve boundary?

---

<div class="post-metadata">

**Author:** ![cmd](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/cmd/32/67_2.png) [@cmd](https://community.freefem.org/u/cmd)\
**Post date:** [September 19, 2023, 7:45am UTC](https://community.freefem.org/t/rate-of-change-in-temperature-at-everypoint-on-a-heated-circle/2708/24 "2023-09-19T07:45:11Z")

</div>

Why don’t you export the x and y coordinates along with HF, then you can discard the zero values in HF and create a scatter plot of the heat flux.

```auto
Vh xx = x, yy = y, HF;
HF[] = vHF(0,Vh,tgv=1);

```

---

<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 19, 2023, 2:38pm UTC](https://community.freefem.org/t/rate-of-change-in-temperature-at-everypoint-on-a-heated-circle/2708/25 "2023-09-19T14:38:53Z")

</div>

Thank you @cmd I exported the data using the following code:  
varf vHF(p,q) = on(C, p = N.x_dx(U) + N.y_dy(U));  
Vh HF;  
HF = vHF(0,Vh,tgv=1);  
//cout\<\<xxx\<\<" “\<\<HF\<\<endl;  
for(int i=0;i\<n;i++)  
{xx[i] = (2_pi_i)/(n-1);  
flux1[i]=HF(0.5+ra_cos(xx[i]),0.2_sqrt(3)+ra_sin(xx[i]));  
//cout\<\<ra_xx[i]\<\<” “\<\<flux1[i]\<\<endl;  
NusSq\<\<ra\*xx[i]\<\<” "\<\<flux1[i]\<\<endl;  
}

I used the parametric equation of x and y so I plotted the exported data for 0\<=xx[i]\<=2\*pi and the flux against each value of xx[i]. My way is correct???

---

<div class="post-metadata">

**Author:** ![cmd](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/cmd/32/67_2.png) [@cmd](https://community.freefem.org/u/cmd)\
**Post date:** [September 19, 2023, 2:53pm UTC](https://community.freefem.org/t/rate-of-change-in-temperature-at-everypoint-on-a-heated-circle/2708/26 "2023-09-19T14:53:08Z")

</div>

Your code looks like it could be correct for continuous data, provided nothing else is wrong with your code. But since the circle is approximated by triangles in the discretization, this approach may lead to significant errors when the mesh is not very fine.

---

<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 19, 2023, 2:57pm UTC](https://community.freefem.org/t/rate-of-change-in-temperature-at-everypoint-on-a-heated-circle/2708/27 "2023-09-19T14:57:16Z")

</div>

How I can overcome this deficiency using the same concept as:

varf vHF(p,q) = on(C, p = N.x_dx(U) + N.y_ dy(U));  
Vh HF;  
HF = vHF(0,Vh,tgv=1);  
//cout\<\<xxx\<\<" “\<\<HF\<\<endl;  
for(int i=0;i\<n;i++)  
{xx[i] = (2_pi_ i)/(n-1);  
flux1[i]=HF(0.5+ra_cos(xx[i]),0.2_ sqrt(3)+ra_sin(xx[i]));  
//cout\<\<ra_ xx[i]\<\<” “\<\<flux1[i]\<\<endl;  
NusSq\<\<ra\*xx[i]\<\<” "\<\<flux1[i]\<\<endl;

---

<div class="post-metadata">

**Author:** ![cmd](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/cmd/32/67_2.png) [@cmd](https://community.freefem.org/u/cmd)\
**Post date:** [September 19, 2023, 3:08pm UTC](https://community.freefem.org/t/rate-of-change-in-temperature-at-everypoint-on-a-heated-circle/2708/28 "2023-09-19T15:08:41Z")

</div>

Use my approach to fix the x and y on the actual nodes of the elements in the discretization. Or use a `fine enough’ mesh such that the interpolation errors aren’t significant. (Check convergence!)

---

<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 19, 2023, 3:17pm UTC](https://community.freefem.org/t/rate-of-change-in-temperature-at-everypoint-on-a-heated-circle/2708/29 "2023-09-19T15:17:17Z")

</div>

Many thanks for your positive response and sincere guidance.

---

<div class="post-metadata">

**Author:** ![jna1g18](https://avatars.discourse-cdn.com/v4/letter/j/77aa72/32.png) [@jna1g18](https://community.freefem.org/u/jna1g18)\
**Post date:** [September 29, 2023, 10:24am UTC](https://community.freefem.org/t/rate-of-change-in-temperature-at-everypoint-on-a-heated-circle/2708/30 "2023-09-29T10:24:24Z")

</div>

Hi Chris, so is the purpose of integrating the normal derivative over the boundary to circumvent the error present in the value of the point-wise normal derivative, the error being the result of the mesh coarseness? I’m still a little bit unsure of why you might suggest this as a means of testing the normal derivative at the boundary. Many thanks!

---

<div class="post-metadata">

**Author:** ![cmd](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/cmd/32/67_2.png) [@cmd](https://community.freefem.org/u/cmd)\
**Post date:** [September 29, 2023, 11:11am UTC](https://community.freefem.org/t/rate-of-change-in-temperature-at-everypoint-on-a-heated-circle/2708/31 "2023-09-29T11:11:40Z")

</div>

> [@cmd](#):
>
> ```auto
> varf vHF(p,q) = on(BoundaryLabel, p = N.x*dx(T) + N.y*dy(T));
> Vh HF;
> HF[] = vHF(0,Vh,tgv=1);
> 
> ```

Hi James, I’m not sure I follow your question exactly. There is no integral here. The point is that you have to use the `on` (or `int1d`) functions in order to access `N.x` and `N.y`.

---

<div class="post-metadata">

**Author:** ![jna1g18](https://avatars.discourse-cdn.com/v4/letter/j/77aa72/32.png) [@jna1g18](https://community.freefem.org/u/jna1g18)\
**Post date:** [October 2, 2023, 1:47pm UTC](https://community.freefem.org/t/rate-of-change-in-temperature-at-everypoint-on-a-heated-circle/2708/32 "2023-10-02T13:47:25Z")

</div>

Hi Chris, I was referring to your first response to this question. I was just wondering why you integrated over the normal derivative, but it seems you’ve now answered that question now. Would you recommend that we use the second method you posted instead as it gives the point-wise normal derivatives?

---

<div class="post-metadata">

**Author:** ![cmd](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/cmd/32/67_2.png) [@cmd](https://community.freefem.org/u/cmd)\
**Post date:** [October 2, 2023, 2:00pm UTC](https://community.freefem.org/t/rate-of-change-in-temperature-at-everypoint-on-a-heated-circle/2708/33 "2023-10-02T14:00:25Z")

</div>

I did not understand that the objective was to determine the pointwise values, and was offering a solution for the total heat flux. Yes, the second approach is the correct solution for point-wise values.

[Previous page](https://community.freefem.org/t/rate-of-change-in-temperature-at-everypoint-on-a-heated-circle/2708.md?page=1)
