What is the value of fvc::grad(U) at boundaries?
Hello
I am working on a elastic solver in which I need to calculate grad(U) at boundaries. I just read the code of gaussGrad.C and concluded that value of grad(U) at boundaries must be equal to patchInternalField value of grad(U), since it is zeroGradientType. But I got different experience. I need to know how grad(U) works at boundaries. Any help will be appreciated |
I found the reason!
gradScheme class uses a function named "correctBoundaryCondition(vf,fGrad)" using which the gGrad at boundary is corrected by snGrad at boundaries. I hope it can be of use for fellows. |
Quote:
I need to calculate tangential component of grad(U) at boundaries more accurately. I guess that at boundary, it uses zero gradient condition for this component. Am I right? Is there any way to handle that or I have to develop a code by myself? Thanks |
Gradient along the boundary
Let say You got T a parameter at boundary , or volScalarField or If you want Grad on surface as surfaceScalarField
surfaceScalarField SnGrad ( fvc::snGrad(T) /// Normal component of Grad T ); volScalarField SnVolGrad ( IOobject ( "SnVolGrad", runTime.timeName(), mesh ), mesh, dimensionedScalar("SnVolGrad", T.dimensions()/dimLength, 0.0) ); forAll(T.boundaryField(), patchi) { SnVolGrad.boundaryFieldRef()[patchi] = SnGrad.boundaryField()[patchi]; } SnVolGrad.write(); ///////////////////////////////////////////////////////////////////////////////////////////////////// volVectorField GradientY ( IOobject ( "GradientY", runTime.timeName(), mesh ), fvc::grad(T) ); GradientY.write(); volScalarField GradientX ( IOobject ( "GradientX", runTime.timeName(), mesh ), fvc::grad(T)().component(0) ); GradientX.write(); volScalarField Grad_T ( IOobject ( "Grad_T", runTime.timeName(), mesh ), mesh, dimensionedScalar("Grad_T", T.dimensions()/dimLength, 0.0) ); forAll(SnVolGrad.boundaryField(),patchi) { Grad_T.boundaryFieldRef()[patchi] = GradientX.boundaryFieldRef()[patchi] + SnVolGrad.boundaryFieldRef()[patchi]; } Grad_T.write(); Find suitable way any of above should work |
All times are GMT -4. The time now is 21:19. |