### Print value for temperature gradient

229
views
0
6 months ago by
Dear FEniCS community,

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?

Community: FEniCS Project

3
6 months ago by
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:
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

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

F = F1 + F2 + F3​