From 4031066a5ac0ad0b298cf6a8bd9fad1c530eff72 Mon Sep 17 00:00:00 2001 From: Vuko Vukcevic Date: Wed, 4 Jan 2017 16:22:27 +0100 Subject: [PATCH] Changes in solutionControl::reconstructTransientVelocity The function now takes care of making the flux relative if the mesh is moving. This is necessary in order to consistently reconstruct the face velocity from the flux and then call correctBoundaryConditions on U. --- .../solvers/incompressible/icoFoam/icoFoam.C | 2 +- .../solutionControl/solutionControl.C | 14 ++++++++++---- .../solutionControl/solutionControl.H | 4 ++-- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/applications/solvers/incompressible/icoFoam/icoFoam.C b/applications/solvers/incompressible/icoFoam/icoFoam.C index fe76be763..9b10b4130 100644 --- a/applications/solvers/incompressible/icoFoam/icoFoam.C +++ b/applications/solvers/incompressible/icoFoam/icoFoam.C @@ -119,7 +119,7 @@ int main(int argc, char *argv[]) # include "continuityErrs.H" // Consistently reconstruct velocity after pressure equation - piso.reconstructTransientVelocity(U, ddtUEqn, rAU, p, phi); + piso.reconstructTransientVelocity(U, phi, ddtUEqn, rAU, p); } runTime.write(); diff --git a/src/finiteVolume/cfdTools/general/solutionControl/solutionControl/solutionControl.C b/src/finiteVolume/cfdTools/general/solutionControl/solutionControl/solutionControl.C index cd8ae3cb5..a34ae2e4d 100644 --- a/src/finiteVolume/cfdTools/general/solutionControl/solutionControl/solutionControl.C +++ b/src/finiteVolume/cfdTools/general/solutionControl/solutionControl/solutionControl.C @@ -529,10 +529,10 @@ void Foam::solutionControl::calcSteadyConsistentFlux void Foam::solutionControl::reconstructTransientVelocity ( volVectorField& U, + surfaceScalarField& phi, const fvVectorMatrix& ddtUEqn, const volScalarField& rAU, - const volScalarField& p, - const surfaceScalarField& phi + const volScalarField& p ) const { // Reconstruct the velocity using all the components from original equation @@ -540,10 +540,9 @@ void Foam::solutionControl::reconstructTransientVelocity ( U/rAU + ddtUEqn.H() - fvc::grad(p) ); - U.correctBoundaryConditions(); // Update divergence free face velocity field, whose value will be used in - // the next time step + // the next time step. Note that we need to have absolute flux here. if (!faceUPtr_) { FatalErrorIn @@ -576,6 +575,13 @@ void Foam::solutionControl::reconstructTransientVelocity // Now that the normal component is zero, add the normal component from // conservative flux faceU += phi*rSf; + + // If the mesh is moving, flux needs to be relative before boundary + // conditions for velocity are corrected. VV and IG, 4/Jan/2016. + fvc::makeRelative(phi, U); + + // Correct boundary conditions with relative flux + U.correctBoundaryConditions(); } diff --git a/src/finiteVolume/cfdTools/general/solutionControl/solutionControl/solutionControl.H b/src/finiteVolume/cfdTools/general/solutionControl/solutionControl/solutionControl.H index 6a61e1908..3f62c3a53 100644 --- a/src/finiteVolume/cfdTools/general/solutionControl/solutionControl/solutionControl.H +++ b/src/finiteVolume/cfdTools/general/solutionControl/solutionControl/solutionControl.H @@ -286,10 +286,10 @@ public: void reconstructTransientVelocity ( volVectorField& U, + surfaceScalarField& phi, const fvVectorMatrix& ddtUEqn, const volScalarField& rAU, - const volScalarField& p, - const surfaceScalarField& phi + const volScalarField& p ) const; //- Reconstruct velocity for steady state solvers (after pressure