From e100e4d0841a75c017401d4243fe605104d6800f Mon Sep 17 00:00:00 2001 From: Mattijs Janssens Date: Wed, 22 Oct 2025 15:46:53 +0000 Subject: [PATCH] Feature grad update --- .../LeastSquaresGrad/LeastSquaresGrad.C | 86 ++++++---- .../LeastSquaresGrad/LeastSquaresGrad.H | 8 + .../gradSchemes/fourthGrad/fourthGrad.C | 147 +++++++++++++----- .../gradSchemes/fourthGrad/fourthGrad.H | 26 ++++ .../gradSchemes/gaussGrad/gaussGrad.C | 61 ++++++++ .../gradSchemes/gaussGrad/gaussGrad.H | 8 + .../gradSchemes/gradScheme/gradScheme.C | 28 +++- .../gradSchemes/gradScheme/gradScheme.H | 8 + .../cellLimitedGrad/cellLimitedGrad.C | 84 ++++++---- .../cellLimitedGrad/cellLimitedGrad.H | 8 + src/fused/finiteVolume/fusedGaussGrad.C | 88 +++++++++++ src/fused/finiteVolume/fusedGaussGrad.H | 8 + .../simpleFoam/pitzDaily_fused/Allrun | 8 + .../pitzDaily_fused/system/controlDict | 9 ++ .../pitzDaily_fused/system/fvSolution | 6 + .../system/fvSolution.template | 65 ++++++++ 16 files changed, 543 insertions(+), 105 deletions(-) create mode 100644 tutorials/incompressible/simpleFoam/pitzDaily_fused/system/fvSolution.template diff --git a/src/finiteVolume/finiteVolume/gradSchemes/LeastSquaresGrad/LeastSquaresGrad.C b/src/finiteVolume/finiteVolume/gradSchemes/LeastSquaresGrad/LeastSquaresGrad.C index 1376f122ff..d43022de5e 100644 --- a/src/finiteVolume/finiteVolume/gradSchemes/LeastSquaresGrad/LeastSquaresGrad.C +++ b/src/finiteVolume/finiteVolume/gradSchemes/LeastSquaresGrad/LeastSquaresGrad.C @@ -1,4 +1,4 @@ -/*---------------------------------------------------------------------------*\ + /*---------------------------------------------------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | @@ -36,23 +36,18 @@ License // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // template -Foam::tmp -< - Foam::GeometricField - < - typename Foam::outerProduct::type, - Foam::fvPatchField, - Foam::volMesh - > -> -Foam::fv::LeastSquaresGrad::calcGrad +void Foam::fv::LeastSquaresGrad::calcGrad ( - const GeometricField& vtf, - const word& name + GeometricField + < + typename outerProduct::type, + fvPatchField, + volMesh + >& lsGrad, + const GeometricField& vtf ) const { typedef typename outerProduct::type GradType; - typedef GeometricField GradFieldType; const fvMesh& mesh = vtf.mesh(); @@ -62,24 +57,7 @@ Foam::fv::LeastSquaresGrad::calcGrad mesh ); - tmp tlsGrad - ( - new GradFieldType - ( - IOobject - ( - name, - vtf.instance(), - mesh, - IOobject::NO_READ, - IOobject::NO_WRITE - ), - mesh, - dimensioned(vtf.dimensions()/dimLength, Zero), - fvPatchFieldBase::extrapolatedCalculatedType() - ) - ); - GradFieldType& lsGrad = tlsGrad.ref(); + lsGrad = dimensioned(vtf.dimensions()/dimLength, Zero); Field& lsGradIf = lsGrad; const extendedCentredCellToCellStencil& stencil = lsv.stencil(); @@ -131,6 +109,50 @@ Foam::fv::LeastSquaresGrad::calcGrad // Correct the boundary conditions lsGrad.correctBoundaryConditions(); gaussGrad::correctBoundaryConditions(vtf, lsGrad); +} + + +template +Foam::tmp +< + Foam::GeometricField + < + typename Foam::outerProduct::type, + Foam::fvPatchField, + Foam::volMesh + > +> +Foam::fv::LeastSquaresGrad::calcGrad +( + const GeometricField& vtf, + const word& name +) const +{ + typedef typename outerProduct::type GradType; + typedef GeometricField GradFieldType; + + const fvMesh& mesh = vtf.mesh(); + + tmp tlsGrad + ( + new GradFieldType + ( + IOobject + ( + name, + vtf.instance(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh, + vtf.dimensions()/dimLength, + fvPatchFieldBase::extrapolatedCalculatedType() + ) + ); + GradFieldType& lsGrad = tlsGrad.ref(); + + calcGrad(lsGrad, vtf); return tlsGrad; } diff --git a/src/finiteVolume/finiteVolume/gradSchemes/LeastSquaresGrad/LeastSquaresGrad.H b/src/finiteVolume/finiteVolume/gradSchemes/LeastSquaresGrad/LeastSquaresGrad.H index 83d926ae31..38d4a31c7b 100644 --- a/src/finiteVolume/finiteVolume/gradSchemes/LeastSquaresGrad/LeastSquaresGrad.H +++ b/src/finiteVolume/finiteVolume/gradSchemes/LeastSquaresGrad/LeastSquaresGrad.H @@ -132,6 +132,14 @@ public: const GeometricField& vsf, const word& name ) const; + + //- Calculate the grad of the given field into supplied field + virtual void calcGrad + ( + GeometricField + ::type, fvPatchField, volMesh>& res, + const GeometricField& + ) const; }; diff --git a/src/finiteVolume/finiteVolume/gradSchemes/fourthGrad/fourthGrad.C b/src/finiteVolume/finiteVolume/gradSchemes/fourthGrad/fourthGrad.C index f07c4dd06e..e76a0fbf56 100644 --- a/src/finiteVolume/finiteVolume/gradSchemes/fourthGrad/fourthGrad.C +++ b/src/finiteVolume/finiteVolume/gradSchemes/fourthGrad/fourthGrad.C @@ -38,19 +38,21 @@ License // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // template -Foam::tmp -< - Foam::GeometricField - < - typename Foam::outerProduct::type, - Foam::fvPatchField, - Foam::volMesh - > -> -Foam::fv::fourthGrad::calcGrad +void Foam::fv::fourthGrad::calcGrad ( + GeometricField + < + typename outerProduct::type, + fvPatchField, + volMesh + >& fGrad, const GeometricField& vsf, - const word& name + const GeometricField + < + typename outerProduct::type, + fvPatchField, + volMesh + >& secondfGrad ) const { // The fourth-order gradient is calculated in two passes. First, @@ -59,37 +61,11 @@ Foam::fv::fourthGrad::calcGrad // gradient to complete the accuracy. typedef typename outerProduct::type GradType; - typedef GeometricField GradFieldType; const fvMesh& mesh = vsf.mesh(); - // Assemble the second-order least-square gradient - // Calculate the second-order least-square gradient - tmp tsecondfGrad - = leastSquaresGrad(mesh).grad - ( - vsf, - "leastSquaresGrad(" + vsf.name() + ")" - ); - const GradFieldType& secondfGrad = - tsecondfGrad(); - - tmp tfGrad - ( - new GradFieldType - ( - IOobject - ( - name, - vsf.instance(), - mesh, - IOobject::NO_READ, - IOobject::NO_WRITE - ), - secondfGrad - ) - ); - GradFieldType& fGrad = tfGrad.ref(); + // Initialise to gradient + fGrad = secondfGrad; const vectorField& C = mesh.C(); @@ -158,9 +134,102 @@ Foam::fv::fourthGrad::calcGrad fGrad.correctBoundaryConditions(); gaussGrad::correctBoundaryConditions(vsf, fGrad); +} + + +template +Foam::tmp +< + Foam::GeometricField + < + typename Foam::outerProduct::type, + Foam::fvPatchField, + Foam::volMesh + > +> +Foam::fv::fourthGrad::calcGrad +( + const GeometricField& vsf, + const word& name +) const +{ + // The fourth-order gradient is calculated in two passes. First, + // the standard least-square gradient is assembled. Then, the + // fourth-order correction is added to the second-order accurate + // gradient to complete the accuracy. + + typedef typename outerProduct::type GradType; + typedef GeometricField GradFieldType; + + const fvMesh& mesh = vsf.mesh(); + + // Assemble the second-order least-square gradient + // Calculate the second-order least-square gradient + tmp tsecondfGrad + = leastSquaresGrad(mesh).grad + ( + vsf, + "leastSquaresGrad(" + vsf.name() + ")" + ); + const GradFieldType& secondfGrad = tsecondfGrad(); + + tmp tfGrad + ( + new GradFieldType + ( + IOobject + ( + name, + vsf.instance(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh, + vsf.dimensions()/dimLength, + fvPatchFieldBase::extrapolatedCalculatedType() + ) + ); + + calcGrad(tfGrad.ref(), vsf, secondfGrad); return tfGrad; } +template +void Foam::fv::fourthGrad::calcGrad +( + GeometricField + < + typename outerProduct::type, + fvPatchField, + volMesh + >& fGrad, + const GeometricField& vsf +) const +{ + // The fourth-order gradient is calculated in two passes. First, + // the standard least-square gradient is assembled. Then, the + // fourth-order correction is added to the second-order accurate + // gradient to complete the accuracy. + + typedef typename outerProduct::type GradType; + typedef GeometricField GradFieldType; + + const fvMesh& mesh = vsf.mesh(); + + // Assemble the second-order least-square gradient + // Calculate the second-order least-square gradient + tmp tsecondfGrad + = leastSquaresGrad(mesh).grad + ( + vsf, + "leastSquaresGrad(" + vsf.name() + ")" + ); + + calcGrad(fGrad, vsf, tsecondfGrad()); +} + + // ************************************************************************* // diff --git a/src/finiteVolume/finiteVolume/gradSchemes/fourthGrad/fourthGrad.H b/src/finiteVolume/finiteVolume/gradSchemes/fourthGrad/fourthGrad.H index 9b79c19c9c..3dab42debf 100644 --- a/src/finiteVolume/finiteVolume/gradSchemes/fourthGrad/fourthGrad.H +++ b/src/finiteVolume/finiteVolume/gradSchemes/fourthGrad/fourthGrad.H @@ -99,6 +99,32 @@ public: const GeometricField& vsf, const word& name ) const; + + //- Calculate the grad of the given field into supplied field + virtual void calcGrad + ( + GeometricField + ::type, fvPatchField, volMesh>& res, + const GeometricField& + ) const; + + //- Helper : calculate the grad of the given field into supplied field + void calcGrad + ( + GeometricField + < + typename outerProduct::type, + fvPatchField, + volMesh + >& fGrad, + const GeometricField& vsf, + const GeometricField + < + typename outerProduct::type, + fvPatchField, + volMesh + >& secondfGrad + ) const; }; diff --git a/src/finiteVolume/finiteVolume/gradSchemes/gaussGrad/gaussGrad.C b/src/finiteVolume/finiteVolume/gradSchemes/gaussGrad/gaussGrad.C index 5ca762df67..32d2a13c45 100644 --- a/src/finiteVolume/finiteVolume/gradSchemes/gaussGrad/gaussGrad.C +++ b/src/finiteVolume/finiteVolume/gradSchemes/gaussGrad/gaussGrad.C @@ -140,6 +140,67 @@ Foam::fv::gaussGrad::calcGrad } +template +void Foam::fv::gaussGrad::calcGrad +( + GeometricField + < + typename outerProduct::type, + fvPatchField, + volMesh + >& gGrad, + const GeometricField& vsf +) const +{ + typedef typename outerProduct::type GradType; + + DebugPout<< "gaussGrad::calcGrad on " << vsf.name() + << " into " << gGrad.name() << endl; + + const fvMesh& mesh = vsf.mesh(); + const labelUList& owner = mesh.owner(); + const labelUList& neighbour = mesh.neighbour(); + const vectorField& Sf = mesh.Sf(); + + const auto tssf(tinterpScheme_().interpolate(vsf)); + const auto& ssf = tssf(); + + gGrad = dimensioned(vsf.dimensions()/dimLength, Zero); + + Field& igGrad = gGrad; + const Field& issf = ssf; + + forAll(owner, facei) + { + const GradType Sfssf = Sf[facei]*issf[facei]; + + igGrad[owner[facei]] += Sfssf; + igGrad[neighbour[facei]] -= Sfssf; + } + + forAll(mesh.boundary(), patchi) + { + const labelUList& pFaceCells = + mesh.boundary()[patchi].faceCells(); + + const vectorField& pSf = mesh.Sf().boundaryField()[patchi]; + + const fvsPatchField& pssf = ssf.boundaryField()[patchi]; + + forAll(mesh.boundary()[patchi], facei) + { + igGrad[pFaceCells[facei]] += pSf[facei]*pssf[facei]; + } + } + + igGrad /= mesh.V(); + + gGrad.correctBoundaryConditions(); + + correctBoundaryConditions(vsf, gGrad); +} + + template void Foam::fv::gaussGrad::correctBoundaryConditions ( diff --git a/src/finiteVolume/finiteVolume/gradSchemes/gaussGrad/gaussGrad.H b/src/finiteVolume/finiteVolume/gradSchemes/gaussGrad/gaussGrad.H index 3b4b306f61..ca0c2faca9 100644 --- a/src/finiteVolume/finiteVolume/gradSchemes/gaussGrad/gaussGrad.H +++ b/src/finiteVolume/finiteVolume/gradSchemes/gaussGrad/gaussGrad.H @@ -145,6 +145,14 @@ public: const word& name ) const; + //- Calculate the grad of the given field into supplied field + virtual void calcGrad + ( + GeometricField + ::type, fvPatchField, volMesh>& res, + const GeometricField& + ) const; + //- Correct the boundary values of the gradient using the patchField //- snGrad functions static void correctBoundaryConditions diff --git a/src/finiteVolume/finiteVolume/gradSchemes/gradScheme/gradScheme.C b/src/finiteVolume/finiteVolume/gradSchemes/gradScheme/gradScheme.C index 37bd371ff8..f2cb7bbbcf 100644 --- a/src/finiteVolume/finiteVolume/gradSchemes/gradScheme/gradScheme.C +++ b/src/finiteVolume/finiteVolume/gradSchemes/gradScheme/gradScheme.C @@ -96,7 +96,7 @@ Foam::fv::gradScheme::grad GradFieldType* pgGrad = mesh().objectRegistry::template getObjectPtr(name); - if (!this->mesh().cache(name) || this->mesh().changing()) + if (!this->mesh().cache(name) || this->mesh().topoChanging()) { // Delete any old occurrences to avoid double registration if (pgGrad && pgGrad->ownedByRegistry()) @@ -119,17 +119,14 @@ Foam::fv::gradScheme::grad } else { - if (pgGrad->upToDate(vsf)) + if (pgGrad->upToDate(vsf) && this->mesh().upToDatePoints(*pgGrad)) { solution::cachePrintMessage("Reusing", name, vsf); } else { solution::cachePrintMessage("Updating", name, vsf); - delete pgGrad; - - pgGrad = calcGrad(vsf, name).ptr(); - regIOobject::store(pgGrad); + calcGrad(*pgGrad, vsf); } } @@ -180,4 +177,23 @@ Foam::fv::gradScheme::grad } +template +void Foam::fv::gradScheme::calcGrad +( + GeometricField + < + typename outerProduct::type, + fvPatchField, + volMesh + >& result, + const GeometricField& vsf +) const +{ + DebugPout<< "gradScheme::calcGrad on " << vsf.name() + << " into " << result.name() << endl; + + result = calcGrad(vsf, result.name()); +} + + // ************************************************************************* // diff --git a/src/finiteVolume/finiteVolume/gradSchemes/gradScheme/gradScheme.H b/src/finiteVolume/finiteVolume/gradSchemes/gradScheme/gradScheme.H index 0c048b0e8b..d612d98af1 100644 --- a/src/finiteVolume/finiteVolume/gradSchemes/gradScheme/gradScheme.H +++ b/src/finiteVolume/finiteVolume/gradSchemes/gradScheme/gradScheme.H @@ -142,6 +142,14 @@ public: const word& name ) const = 0; + //- Calculate the grad of the given field into supplied field + virtual void calcGrad + ( + GeometricField + ::type, fvPatchField, volMesh>& res, + const GeometricField& + ) const; + //- Calculate and return the grad of the given field //- which may have been cached tmp diff --git a/src/finiteVolume/finiteVolume/gradSchemes/limitedGradSchemes/cellLimitedGrad/cellLimitedGrad.C b/src/finiteVolume/finiteVolume/gradSchemes/limitedGradSchemes/cellLimitedGrad/cellLimitedGrad.C index 0d6605cbfc..8b5c8e9662 100644 --- a/src/finiteVolume/finiteVolume/gradSchemes/limitedGradSchemes/cellLimitedGrad/cellLimitedGrad.C +++ b/src/finiteVolume/finiteVolume/gradSchemes/limitedGradSchemes/cellLimitedGrad/cellLimitedGrad.C @@ -62,40 +62,25 @@ void Foam::fv::cellLimitedGrad::limitGradient template -Foam::tmp -< - Foam::GeometricField - < - typename Foam::outerProduct::type, - Foam::fvPatchField, - Foam::volMesh - > -> -Foam::fv::cellLimitedGrad::calcGrad +void Foam::fv::cellLimitedGrad::calcGrad ( - const GeometricField& vsf, - const word& name -) const -{ - const fvMesh& mesh = vsf.mesh(); - - tmp - < - GeometricField - ::type, fvPatchField, volMesh> - > tGrad = basicGradScheme_().calcGrad(vsf, name); - - if (k_ < SMALL) - { - return tGrad; - } - GeometricField < typename outerProduct::type, fvPatchField, volMesh - >& g = tGrad.ref(); + >& g, + const GeometricField& vsf +) const +{ + const fvMesh& mesh = vsf.mesh(); + + basicGradScheme_().calcGrad(g, vsf); + + if (k_ < SMALL) + { + return; + } const labelUList& owner = mesh.owner(); const labelUList& neighbour = mesh.neighbour(); @@ -227,6 +212,49 @@ Foam::fv::cellLimitedGrad::calcGrad limitGradient(limiter, g); g.correctBoundaryConditions(); gaussGrad::correctBoundaryConditions(vsf, g); +} + + +template +Foam::tmp +< + Foam::GeometricField + < + typename Foam::outerProduct::type, + Foam::fvPatchField, + Foam::volMesh + > +> +Foam::fv::cellLimitedGrad::calcGrad +( + const GeometricField& vsf, + const word& name +) const +{ + typedef typename outerProduct::type GradType; + typedef GeometricField GradFieldType; + + const fvMesh& mesh = vsf.mesh(); + + tmp tGrad + ( + new GradFieldType + ( + IOobject + ( + name, + vsf.instance(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh, + vsf.dimensions()/dimLength, + fvPatchFieldBase::extrapolatedCalculatedType() + ) + ); + + calcGrad(tGrad.ref(), vsf); return tGrad; } diff --git a/src/finiteVolume/finiteVolume/gradSchemes/limitedGradSchemes/cellLimitedGrad/cellLimitedGrad.H b/src/finiteVolume/finiteVolume/gradSchemes/limitedGradSchemes/cellLimitedGrad/cellLimitedGrad.H index 21837847f4..c7db353e09 100644 --- a/src/finiteVolume/finiteVolume/gradSchemes/limitedGradSchemes/cellLimitedGrad/cellLimitedGrad.H +++ b/src/finiteVolume/finiteVolume/gradSchemes/limitedGradSchemes/cellLimitedGrad/cellLimitedGrad.H @@ -150,6 +150,14 @@ public: const GeometricField& vsf, const word& name ) const; + + //- Calculate the grad of the given field into supplied field + virtual void calcGrad + ( + GeometricField + ::type, fvPatchField, volMesh>& res, + const GeometricField& + ) const; }; diff --git a/src/fused/finiteVolume/fusedGaussGrad.C b/src/fused/finiteVolume/fusedGaussGrad.C index 5954e5804c..802fd57efb 100644 --- a/src/fused/finiteVolume/fusedGaussGrad.C +++ b/src/fused/finiteVolume/fusedGaussGrad.C @@ -226,6 +226,94 @@ Foam::fv::fusedGaussGrad::calcGrad } +template +void Foam::fv::fusedGaussGrad::calcGrad +( + GeometricField + < + typename outerProduct::type, + fvPatchField, + volMesh + >& gGrad, + const GeometricField& vf +) const +{ + typedef typename outerProduct::type GradType; + + const fvMesh& mesh = vf.mesh(); + + DebugPout<< "fusedGaussGrad::calcGrad on " << vf.name() + << " into " << gGrad.name() << endl; + + gGrad = dimensioned(vf.dimensions()/dimLength, Zero); + + if (this->tinterpScheme_().corrected()) + { + const auto tfaceCorr(this->tinterpScheme_().correction(vf)); + auto& faceCorr = tfaceCorr(); + + DebugPout<< "fusedGaussGrad::calcGrad corrected interpScheme " + << this->tinterpScheme_().type() << endl; + + const auto interpolate = [&] + ( + const vector& area, + const scalar lambda, + + const Type& ownVal, + const Type& neiVal, + + const Type& correction + + ) -> GradType + { + return area*((lambda*(ownVal - neiVal) + neiVal) + correction); + }; + + fvc::surfaceSum + ( + this->tinterpScheme_().weights(vf), + vf, + faceCorr, + interpolate, + gGrad, + false + ); + } + else + { + DebugPout<< "fusedGaussGrad::calcGrad uncorrected interpScheme " + << this->tinterpScheme_().type() << endl; + + const auto interpolate = [&] + ( + const vector& area, + const scalar lambda, + const Type& ownVal, + const Type& neiVal + ) -> GradType + { + return area*(lambda*(ownVal - neiVal) + neiVal); + }; + + fvc::surfaceSum + ( + tinterpScheme_().weights(vf), + vf, + interpolate, + gGrad, + false + ); + } + + gGrad.primitiveFieldRef() /= mesh.V(); + + gGrad.correctBoundaryConditions(); + + correctBoundaryConditions(vf, gGrad); +} + + template template void Foam::fv::fusedGaussGrad::correctBoundaryConditions diff --git a/src/fused/finiteVolume/fusedGaussGrad.H b/src/fused/finiteVolume/fusedGaussGrad.H index 233ecdc577..925fbac595 100644 --- a/src/fused/finiteVolume/fusedGaussGrad.H +++ b/src/fused/finiteVolume/fusedGaussGrad.H @@ -145,6 +145,14 @@ public: const word& name ) const; + //- Calculate the grad of the given field into supplied field + virtual void calcGrad + ( + GeometricField + ::type, fvPatchField, volMesh>& res, + const GeometricField& + ) const; + //- Correct the boundary values of the gradient using the patchField //- snGrad functions template diff --git a/tutorials/incompressible/simpleFoam/pitzDaily_fused/Allrun b/tutorials/incompressible/simpleFoam/pitzDaily_fused/Allrun index d9527fe9de..3d776b667f 100755 --- a/tutorials/incompressible/simpleFoam/pitzDaily_fused/Allrun +++ b/tutorials/incompressible/simpleFoam/pitzDaily_fused/Allrun @@ -19,4 +19,12 @@ sed "s/GAUSS/fusedGauss/g" system/fvSchemes.template > system/fvSchemes runParallel -s fusedGauss $(getApplication) +echo "Updating fvSolution to cache gradients" +sed 's/GRADIENT/"grad(.*)"/g' system/fvSolution.template > system/fvSolution + +runParallel -s fusedGaussCached $(getApplication) + +# Restore +cp system/fvSolution.template system/fvSolution + #------------------------------------------------------------------------------ diff --git a/tutorials/incompressible/simpleFoam/pitzDaily_fused/system/controlDict b/tutorials/incompressible/simpleFoam/pitzDaily_fused/system/controlDict index bade598a23..2191cf5fbf 100644 --- a/tutorials/incompressible/simpleFoam/pitzDaily_fused/system/controlDict +++ b/tutorials/incompressible/simpleFoam/pitzDaily_fused/system/controlDict @@ -16,6 +16,15 @@ FoamFile libs (fusedFiniteVolume); +/* +DebugSwitches +{ + fusedGauss 1; + Gauss 1; + solution 1; +} +*/ + application simpleFoam; startFrom startTime; diff --git a/tutorials/incompressible/simpleFoam/pitzDaily_fused/system/fvSolution b/tutorials/incompressible/simpleFoam/pitzDaily_fused/system/fvSolution index 6cf985f78a..def08d43e7 100644 --- a/tutorials/incompressible/simpleFoam/pitzDaily_fused/system/fvSolution +++ b/tutorials/incompressible/simpleFoam/pitzDaily_fused/system/fvSolution @@ -55,5 +55,11 @@ relaxationFactors } } +cache +{ + // Cache all grads + GRADIENT; +} + // ************************************************************************* // diff --git a/tutorials/incompressible/simpleFoam/pitzDaily_fused/system/fvSolution.template b/tutorials/incompressible/simpleFoam/pitzDaily_fused/system/fvSolution.template new file mode 100644 index 0000000000..def08d43e7 --- /dev/null +++ b/tutorials/incompressible/simpleFoam/pitzDaily_fused/system/fvSolution.template @@ -0,0 +1,65 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v2506 | +| \\ / A nd | Website: www.openfoam.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object fvSolution; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +solvers +{ + p + { + solver GAMG; + tolerance 1e-06; + relTol 0.1; + smoother GaussSeidel; + } + + "(U|k|epsilon|omega|f|v2)" + { + solver smoothSolver; + smoother symGaussSeidel; + tolerance 1e-05; + relTol 0.1; + } +} + +SIMPLE +{ + nNonOrthogonalCorrectors 0; + consistent yes; + + residualControl + { + p 1e-2; + U 1e-3; + "(k|epsilon|omega|f|v2)" 1e-3; + } +} + +relaxationFactors +{ + equations + { + U 0.9; // 0.9 is more stable but 0.95 more convergent + ".*" 0.9; // 0.9 is more stable but 0.95 more convergent + } +} + +cache +{ + // Cache all grads + GRADIENT; +} + + +// ************************************************************************* //