|
[Sponsors] |
Gauss linear gradient calculation discrepancy |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
February 15, 2020, 13:31 |
Gauss linear gradient calculation discrepancy
|
#1 |
New Member
Join Date: Jun 2015
Posts: 16
Rep Power: 11 |
Hello everyone,
I am trying to calculate in OF301 the gradient of a volScalarField without using fvc::grad (I set Gauss linear as scheme in the case study). Also, I have fully orthogonal hexahedrons. So I try something like below: Code:
// this is in setField volVectorField gradT ( IOobject ( "gradT", runTime.timeName(), fluidRegions[i], IOobject::NO_READ, IOobject::NO_WRITE ), fluidRegions[i], dimensionedVector("gradT", dimensionSet(0,-1,0,1,0,0,0), vector::zero) ); // surfaceScalarField Tface = linearInterpolate(T); const fvMesh& mesh = Tface.mesh(); const labelList& own = mesh.owner(); const labelList& nei = mesh.neighbour(); const vectorField& Sf = mesh.Sf(); forAll(own, facei) { gradT[own[facei]] += Sf[facei]*Tface[facei]/mesh.V()[own[facei]]; gradT[nei[facei]] -= Sf[facei]*Tface[facei]/mesh.V()[nei[facei]]; } forAll(mesh.boundary(), patchi) { const labelList& pFaceCells = mesh.boundary()[patchi].faceCells(); const vectorField& pSf = mesh.Sf().boundaryField()[patchi]; const scalarField& pTface = Tface.boundaryField()[patchi]; forAll(mesh.boundary()[patchi], facei) { gradT[pFaceCells[facei]] += pSf[facei]*pTface[facei]/mesh.V()[pFaceCells[facei]]; } } gradT.correctBoundaryConditions(); Info<< "\nDIFFERENCE\n" << max(mag(fvc::grad(T)-gradT)) << "\n" << endl; However, if I try to compare the resulting gradient to the one calculated using the function fvc::grad, I see a considerable difference. Am I missing something? Maybe the surfaceScalarField is not calculated through the linearInterpolate function? Thank you very much Cheers |
|
Tags |
fvc::grad(), gauss gradient |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
2nd Order Convergence Problem for 3D Airfoil | turkmengokce | OpenFOAM Running, Solving & CFD | 1 | September 10, 2015 08:20 |
bounded Gauss upwind Scheme | deepinheart | OpenFOAM Running, Solving & CFD | 1 | February 23, 2015 06:57 |
BC for turbulent internal flow | yhoarau | OpenFOAM Running, Solving & CFD | 3 | January 22, 2015 09:02 |
2D isothermal cylinder not converging | UPengineer | OpenFOAM Running, Solving & CFD | 7 | March 13, 2014 06:17 |
solution diverges when linear upwind interpolation scheme is used | subash | OpenFOAM | 0 | May 29, 2010 02:23 |