How to calculate the gradient along the boundaries from a known volScalarFiled?
I first obtained a volScalarField in a calculation domain, and then I want to calculate the gradient along the domain boundaries.
Does anyone know how to obtain the gradient along domain boundaries from a known volScalarField?
Thank you very much!
I have the same problem with you ! I define a volScalrField first and the value is fixed for all the cells, but I want to caculate the gradient. Do you solve the problem, can you tell me? Thank you!
You can obtain the surface normal gradient at each boundary using snGrad function.
This will give you the surface normal gradient without any non-orthogonality or skewness corrections. If you need these corrections, use fvc::snGrad().
surfaceScalarField snGradP = fvc::snGrad(p);
Then access the value at the boundary with snGradP.boundaryField()[patchI].
If you are looking for a full gradient vector at the boundary, this is a little tricker. Here you will have to interpolate the field gradient (fvc::grad(p)) to the faces and then replace the surface normal component of this with the value coming from fvc::snGrad(p).
Hope this helps
|All times are GMT -4. The time now is 02:53.|