### Print value for temperature gradient

229

views

0

Dear FEniCS community,

Currently I am working on free convective flow in vector form where I collect the results of velocity and temperature.

Thank you for your help.

Currently I am working on free convective flow in vector form where I collect the results of velocity and temperature.

However, is there any coding to get the values of temperature gradient for particular point?

Thank you for your help.

Community: FEniCS Project

### 1 Answer

3

Not directly. You'll have to create a function 'grad_T' and project the gradient onto it, then evaluate it at a point.

Take a look at page 21 of the FEniCS book:

https://launchpadlibrarian.net/83776282/fenics-book-2011-10-27-final.pdf

for the former, and poke around the AllAnswered forum, and the old FEniCS QA to learn how to evaluate a function at a point.

Take a look at page 21 of the FEniCS book:

https://launchpadlibrarian.net/83776282/fenics-book-2011-10-27-final.pdf

for the former, and poke around the AllAnswered forum, and the old FEniCS QA to learn how to evaluate a function at a point.

Can i find the grad_T in same coding where I find u and T?

written
6 months ago by
raihan asimoni

grad(T) (or grad(u) as on page 21, is an expression that FEniCS can work with (symbolically, and then evaluate when you assemble your system). It is not yet a calculated quantity. When you say

`grad_u = project(grad(u), VectorFunctionSpace(mesh, "Lagrange", 1))`

you are actually making it a function that you can evaluate.

As for 'when' you can find it, that is up to you...

written
6 months ago by
Mike Welland

Thank you for your explaination.

For my case above, i have test function u, p, T and trial functions v, q, s. So for the grad_T, do I need to make grad_T as test function and new trial function for it?

For my case above, i have test function u, p, T and trial functions v, q, s. So for the grad_T, do I need to make grad_T as test function and new trial function for it?

written
6 months ago by
raihan asimoni

Take a look at the demo in the link above and give it a try yourself.

written
6 months ago by
Mike Welland

This is my variational problem after doing nondimensionless equation:

```
#define variational problem
F1 = div(u)*q*dx
F2 = dot(dot(u,nabla_grad(u)),v)*dx + dot(grad(p),v)*dx + pow(Re,1)*inner(nabla_grad(u),nabla_grad(v))*dx + T*dot(omega,v)*dx
F3 = dot(u,grad(T))*s*dx + pow(Re,-1)*pow(Pr,-1)*dot(grad(T),grad(s))*dx
F = F1 + F2 + F3
```

written
6 months ago by
raihan asimoni

Please login to add an answer/comment or follow this question.