ec515b441f
Conflicts: applications/solvers/incompressible/channelFoam/channelFoam.C applications/solvers/incompressible/icoFoam/icoFoam.C applications/solvers/incompressible/nonNewtonianIcoFoam/nonNewtonianIcoFoam.C applications/solvers/incompressible/pimpleDyMFoam/UEqn.H applications/solvers/incompressible/pimpleDyMFoam/pimpleDyMFoam.C applications/solvers/incompressible/pimpleFoam/UEqn.H applications/solvers/incompressible/pimpleFoam/pEqn.H applications/solvers/incompressible/simpleFoam/UEqn.H applications/solvers/incompressible/simpleFoam/pEqn.H src/foam/fields/GeometricFields/GeometricTensorNFields/GeometricTensorNFields.H src/turbulenceModels/compressible/RAS/LRR/LRR.C src/turbulenceModels/compressible/RAS/LaunderSharmaKE/LaunderSharmaKE.C src/turbulenceModels/compressible/turbulenceModel/laminar/laminar.C src/turbulenceModels/incompressible/LES/GenEddyVisc/GenEddyVisc.C src/turbulenceModels/incompressible/LES/Smagorinsky2/Smagorinsky2.C src/turbulenceModels/incompressible/LES/SpalartAllmaras/SpalartAllmaras.C src/turbulenceModels/incompressible/LES/kOmegaSSTSAS/kOmegaSSTSAS.C src/turbulenceModels/incompressible/LES/laminar/laminar.C src/turbulenceModels/incompressible/RAS/LamBremhorstKE/LamBremhorstKE.C src/turbulenceModels/incompressible/RAS/LaunderSharmaKE/LaunderSharmaKE.C src/turbulenceModels/incompressible/RAS/LienCubicKE/LienCubicKE.C src/turbulenceModels/incompressible/RAS/NonlinearKEShih/NonlinearKEShih.C src/turbulenceModels/incompressible/RAS/RNGkEpsilon/RNGkEpsilon.C src/turbulenceModels/incompressible/RAS/SpalartAllmaras/SpalartAllmaras.C src/turbulenceModels/incompressible/RAS/coupledKEpsilon/coupledKEpsilon.C src/turbulenceModels/incompressible/RAS/kEpsilon/kEpsilon.C src/turbulenceModels/incompressible/RAS/kOmegaSST/kOmegaSST.C src/turbulenceModels/incompressible/RAS/laminar/laminar.C src/turbulenceModels/incompressible/RAS/qZeta/qZeta.C src/turbulenceModels/incompressible/RAS/realizableKE/realizableKE.C src/turbulenceModels/incompressible/turbulenceModel/laminar/laminar.C tutorials/basic/laplacianFoam/Case1.1_mixingPlane_sector_AB_60deg/system/fvSchemes tutorials/compressible/dbnsFoam/forwardStep/system/fvSchemes tutorials/compressible/dbnsFoam/shockTube/system/fvSchemes tutorials/compressible/dbnsTurbFoam/naca0012/system/fvSchemes tutorials/compressible/rhoPimpleFoam/angledDuct/system/fvSchemes tutorials/immersedBoundary/backwardStepShortTurbulentSimpleIbFoam/system/fvSchemes tutorials/immersedBoundary/pitzDailyBodyFitted/system/fvSchemes tutorials/immersedBoundary/pitzDailyLaminarSimpleIbFoam/system/fvSchemes tutorials/immersedBoundary/pitzDailyTurbulentSimpleIbFoam/system/fvSchemes tutorials/immersedBoundary/porousBumpChannelBodyFitted/system/fvSchemes tutorials/immersedBoundary/porousBumpChannelIb/system/fvSchemes tutorials/incompressible/MRFSimpleFoam/mixerVessel2D/system/fvSchemes tutorials/incompressible/boundaryFoam/boundaryLaunderSharma/system/fvSchemes tutorials/incompressible/boundaryFoam/boundaryTwoWallsFlowSolution/system/fvSchemes tutorials/incompressible/boundaryFoam/boundaryWallFunctions/system/fvSchemes tutorials/incompressible/channelFoam/channel395/system/fvSchemes tutorials/incompressible/icoFoam/elbow/constant/polyMesh/boundary tutorials/incompressible/pimpleDyMFoam/axialTurbine/system/fvSchemes tutorials/incompressible/pimpleDyMFoam/movingCone/system/fvSchemes tutorials/incompressible/pimpleDyMFoam/movingCone/system/fvSolution tutorials/incompressible/pimpleDyMFoam/movingCylinders/system/fvSchemes tutorials/incompressible/pimpleDyMFoam/wingMotion/wingMotion2D_pimpleDyMFoam/constant/polyMesh/boundary tutorials/incompressible/pimpleDyMFoam/wingMotion/wingMotion2D_pimpleDyMFoam/system/fvSchemes tutorials/incompressible/pimpleDyMFoam/wingMotion/wingMotion2D_simpleFoam/constant/polyMesh/boundary tutorials/incompressible/pimpleDyMFoam/wingMotion/wingMotion2D_simpleFoam/system/fvSchemes tutorials/incompressible/pimpleDyMFoam/wingMotion/wingMotion_snappyHexMesh/constant/polyMesh/boundary tutorials/incompressible/pimpleDyMFoam/wingMotion/wingMotion_snappyHexMesh/system/fvSchemes tutorials/incompressible/pimpleFoam/t-junction/system/fvSchemes tutorials/incompressible/pisoFoam/les/pitzDaily/system/fvSchemes tutorials/incompressible/pisoFoam/les/pitzDailyDirectMapped/system/fvSchemes tutorials/incompressible/pisoFoam/ras/cavity/system/fvSchemes tutorials/incompressible/porousSimpleFoam/angledDuctExplicit/system/fvSchemes tutorials/incompressible/porousSimpleFoam/angledDuctImplicit/system/fvSchemes tutorials/incompressible/porousSimpleFoam/beaverJoseph/system/fvSchemes tutorials/incompressible/porousSimpleFoam/porousPlug/system/fvSchemes tutorials/incompressible/simpleFoam/mixingPlaneAxial/system/fvSchemes tutorials/incompressible/simpleFoam/mixingPlaneDomADomB/system/fvSchemes tutorials/incompressible/simpleFoam/motorBike/system/fvSchemes tutorials/incompressible/simpleFoam/pitzDaily/system/fvSchemes tutorials/incompressible/simpleFoam/pitzDaily3Blocks/system/fvSchemes tutorials/incompressible/simpleFoam/pitzDailyExptInlet/system/fvSchemes tutorials/incompressible/simpleSRFFoam/mixer/system/fvSchemes Fixing compilation of DBNS
162 lines
4.7 KiB
C
162 lines
4.7 KiB
C
/*---------------------------------------------------------------------------*\
|
|
========= |
|
|
\\ / F ield | foam-extend: Open Source CFD
|
|
\\ / O peration | Version: 3.2
|
|
\\ / A nd | Web: http://www.foam-extend.org
|
|
\\/ M anipulation | For copyright notice see file Copyright
|
|
-------------------------------------------------------------------------------
|
|
License
|
|
This file is part of foam-extend.
|
|
|
|
foam-extend is free software: you can redistribute it and/or modify it
|
|
under the terms of the GNU General Public License as published by the
|
|
Free Software Foundation, either version 3 of the License, or (at your
|
|
option) any later version.
|
|
|
|
foam-extend is distributed in the hope that it will be useful, but
|
|
WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
Application
|
|
channelFoam
|
|
|
|
Description
|
|
Incompressible LES solver for flow in a channel.
|
|
Consistent formulation without time-step and relaxation dependence by Jasak
|
|
|
|
Author
|
|
Hrvoje Jasak, Wikki Ltd. All rights reserved
|
|
|
|
\*---------------------------------------------------------------------------*/
|
|
|
|
#include "fvCFD.H"
|
|
#include "singlePhaseTransportModel.H"
|
|
#include "LESModel.H"
|
|
#include "IFstream.H"
|
|
#include "OFstream.H"
|
|
#include "Random.H"
|
|
#include "pisoControl.H"
|
|
|
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
|
|
int main(int argc, char *argv[])
|
|
{
|
|
#include "setRootCase.H"
|
|
#include "createTime.H"
|
|
#include "createMesh.H"
|
|
|
|
pisoControl piso(mesh);
|
|
|
|
#include "readTransportProperties.H"
|
|
#include "createFields.H"
|
|
#include "initContinuityErrs.H"
|
|
#include "createGradP.H"
|
|
|
|
Info<< "\nStarting time loop\n" << endl;
|
|
|
|
while (runTime.loop())
|
|
{
|
|
Info<< "Time = " << runTime.timeName() << nl << endl;
|
|
|
|
#include "CourantNo.H"
|
|
|
|
sgsModel->correct();
|
|
|
|
// Convection-diffusion matrix
|
|
fvVectorMatrix HUEqn
|
|
(
|
|
fvm::div(phi, U)
|
|
+ sgsModel->divDevBeff(U)
|
|
==
|
|
flowDirection*gradP
|
|
);
|
|
|
|
// Time derivative matrix
|
|
fvVectorMatrix ddtUEqn(fvm::ddt(U));
|
|
|
|
if (piso.momentumPredictor())
|
|
{
|
|
solve(ddtUEqn + HUEqn == -fvc::grad(p));
|
|
}
|
|
|
|
// Prepare clean Ap without time derivative contribution
|
|
// HJ, 26/Oct/2015
|
|
volScalarField aU = HUEqn.A();
|
|
|
|
// --- PISO loop
|
|
|
|
while (piso.correct())
|
|
{
|
|
U = HUEqn.H()/aU;
|
|
phi = (fvc::interpolate(U) & mesh.Sf());
|
|
|
|
adjustPhi(phi, U, p);
|
|
|
|
while (piso.correctNonOrthogonal())
|
|
{
|
|
fvScalarMatrix pEqn
|
|
(
|
|
fvm::laplacian(1/aU, p) == fvc::div(phi)
|
|
);
|
|
|
|
pEqn.setReference(pRefCell, pRefValue);
|
|
pEqn.solve
|
|
(
|
|
mesh.solutionDict().solver(p.select(piso.finalInnerIter()))
|
|
);
|
|
|
|
if (piso.finalNonOrthogonalIter())
|
|
{
|
|
phi -= pEqn.flux();
|
|
}
|
|
}
|
|
|
|
# include "continuityErrs.H"
|
|
|
|
// Note: cannot call H(U) here because the velocity is not complete
|
|
// HJ, 22/Jan/2016
|
|
U = 1.0/(aU + ddtUEqn.A())*
|
|
(
|
|
U*aU - fvc::grad(p) + ddtUEqn.H()
|
|
);
|
|
U.correctBoundaryConditions();
|
|
}
|
|
|
|
// Correct driving force for a constant mass flow rate
|
|
|
|
// Extract the velocity in the flow direction
|
|
dimensionedScalar magUbarStar =
|
|
(flowDirection & U)().weightedAverage(mesh.V());
|
|
|
|
// Calculate the pressure gradient increment needed to
|
|
// adjust the average flow-rate to the correct value
|
|
dimensionedScalar gragPplus =
|
|
(magUbar - magUbarStar)*aU.weightedAverage(mesh.V());
|
|
|
|
U += gragPplus/aU*flowDirection;
|
|
|
|
gradP += gragPplus;
|
|
|
|
Info<< "Uncorrected Ubar = " << magUbarStar.value() << tab
|
|
<< "pressure gradient = " << gradP.value() << endl;
|
|
|
|
runTime.write();
|
|
|
|
#include "writeGradP.H"
|
|
|
|
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
|
|
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
|
|
<< nl << endl;
|
|
}
|
|
|
|
Info<< "End\n" << endl;
|
|
|
|
return 0;
|
|
}
|
|
|
|
|
|
// ************************************************************************* //
|