Skip to content
Snippets Groups Projects
Commit 8ac29612 authored by Henry's avatar Henry
Browse files

advectionDiffusionPatchDistMethod: Only run the predictor method on first call

Improves efficiency for moving-mesh cases
parent 5dff7076
Branches
Tags
No related merge requests found
...@@ -68,7 +68,8 @@ Foam::patchDistMethods::advectionDiffusion::advectionDiffusion ...@@ -68,7 +68,8 @@ Foam::patchDistMethods::advectionDiffusion::advectionDiffusion
), ),
epsilon_(coeffs_.lookupOrDefault<scalar>("epsilon", 0.1)), epsilon_(coeffs_.lookupOrDefault<scalar>("epsilon", 0.1)),
tolerance_(coeffs_.lookupOrDefault<scalar>("tolerance", 1e-3)), tolerance_(coeffs_.lookupOrDefault<scalar>("tolerance", 1e-3)),
maxIter_(coeffs_.lookupOrDefault<int>("maxIter", 10)) maxIter_(coeffs_.lookupOrDefault<int>("maxIter", 10)),
predicted_(false)
{} {}
...@@ -86,7 +87,11 @@ bool Foam::patchDistMethods::advectionDiffusion::correct ...@@ -86,7 +87,11 @@ bool Foam::patchDistMethods::advectionDiffusion::correct
volVectorField& n volVectorField& n
) )
{ {
pdmPredictor_->correct(y); if (!predicted_)
{
pdmPredictor_->correct(y);
predicted_ = true;
}
volVectorField ny volVectorField ny
( (
...@@ -97,7 +102,7 @@ bool Foam::patchDistMethods::advectionDiffusion::correct ...@@ -97,7 +102,7 @@ bool Foam::patchDistMethods::advectionDiffusion::correct
mesh_ mesh_
), ),
mesh_, mesh_,
dimensionedVector("nWall", dimless, vector::zero), dimensionedVector("ny", dimless, vector::zero),
patchTypes<vector>(mesh_, patchIDs_) patchTypes<vector>(mesh_, patchIDs_)
); );
...@@ -133,6 +138,7 @@ bool Foam::patchDistMethods::advectionDiffusion::correct ...@@ -133,6 +138,7 @@ bool Foam::patchDistMethods::advectionDiffusion::correct
yEqn.relax(); yEqn.relax();
initialResidual = yEqn.solve().initialResidual(); initialResidual = yEqn.solve().initialResidual();
} while (initialResidual > tolerance_ && ++iter < maxIter_); } while (initialResidual > tolerance_ && ++iter < maxIter_);
// Only calculate n if the field is defined // Only calculate n if the field is defined
......
...@@ -162,6 +162,9 @@ class advectionDiffusion ...@@ -162,6 +162,9 @@ class advectionDiffusion
// to correct the distance-to-patch and normal-to-patch fields // to correct the distance-to-patch and normal-to-patch fields
int maxIter_; int maxIter_;
//- Flag to indicate the predictor step has been executed
bool predicted_;
// Private Member Functions // Private Member Functions
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment