Added demonstration code for dynamic mesh
This commit is contained in:
parent
69479b46f8
commit
974746246f
26 changed files with 1036 additions and 0 deletions
|
@ -0,0 +1,35 @@
|
|||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 113
|
||||
/svnroot/openfoam-extend/!svn/ver/1591/trunk/Core/OpenFOAM-1.5-dev/applications/solvers/incompressible/icoDyMFoam
|
||||
END
|
||||
createFields.H
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 127
|
||||
/svnroot/openfoam-extend/!svn/ver/915/trunk/Core/OpenFOAM-1.5-dev/applications/solvers/incompressible/icoDyMFoam/createFields.H
|
||||
END
|
||||
readControls.H
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 127
|
||||
/svnroot/openfoam-extend/!svn/ver/915/trunk/Core/OpenFOAM-1.5-dev/applications/solvers/incompressible/icoDyMFoam/readControls.H
|
||||
END
|
||||
correctPhi.H
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 125
|
||||
/svnroot/openfoam-extend/!svn/ver/981/trunk/Core/OpenFOAM-1.5-dev/applications/solvers/incompressible/icoDyMFoam/correctPhi.H
|
||||
END
|
||||
icoDyMFoam.C
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 126
|
||||
/svnroot/openfoam-extend/!svn/ver/1591/trunk/Core/OpenFOAM-1.5-dev/applications/solvers/incompressible/icoDyMFoam/icoDyMFoam.C
|
||||
END
|
||||
UEqn.H
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 119
|
||||
/svnroot/openfoam-extend/!svn/ver/912/trunk/Core/OpenFOAM-1.5-dev/applications/solvers/incompressible/icoDyMFoam/UEqn.H
|
||||
END
|
|
@ -0,0 +1,7 @@
|
|||
K 10
|
||||
svn:ignore
|
||||
V 16
|
||||
lnInclude
|
||||
*.dep
|
||||
|
||||
END
|
201
applications/solvers/incompressible/icoDyMFoam/.svn/entries
Normal file
201
applications/solvers/incompressible/icoDyMFoam/.svn/entries
Normal file
|
@ -0,0 +1,201 @@
|
|||
9
|
||||
|
||||
dir
|
||||
1730
|
||||
https://openfoam-extend.svn.sourceforge.net/svnroot/openfoam-extend/trunk/Core/OpenFOAM-1.5-dev/applications/solvers/incompressible/icoDyMFoam
|
||||
https://openfoam-extend.svn.sourceforge.net/svnroot/openfoam-extend
|
||||
|
||||
|
||||
|
||||
2010-01-20T10:44:39.337304Z
|
||||
1591
|
||||
hjasak
|
||||
has-props
|
||||
|
||||
svn:special svn:externals svn:needs-lock
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
e4e07f05-0c2f-0410-a05a-b8ba57e0c909
|
||||
|
||||
createFields.H
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2009-08-11T21:05:38.000000Z
|
||||
00e915519b705cad0056a257a3fd2a92
|
||||
2009-01-20T00:30:44.740688Z
|
||||
915
|
||||
hjasak
|
||||
has-props
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
1874
|
||||
|
||||
readControls.H
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2009-08-11T21:05:38.000000Z
|
||||
eea361849937e2d7f8dcb00e72a34c00
|
||||
2009-01-20T00:30:44.740688Z
|
||||
915
|
||||
hjasak
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
362
|
||||
|
||||
correctPhi.H
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2009-08-11T21:05:38.000000Z
|
||||
074a2d4fbd974ca63d4207e2d816104f
|
||||
2009-02-06T16:17:03.879174Z
|
||||
981
|
||||
hjasak
|
||||
has-props
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
1048
|
||||
|
||||
icoDyMFoam.C
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2009-12-13T23:44:56.000000Z
|
||||
97fc42064b2254262c779f71eabc4991
|
||||
2010-01-20T10:44:39.337304Z
|
||||
1591
|
||||
hjasak
|
||||
has-props
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
4049
|
||||
|
||||
Make
|
||||
dir
|
||||
|
||||
UEqn.H
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2009-08-11T21:05:38.000000Z
|
||||
84ccfd4a6cf96222b86f76eaacb9f17c
|
||||
2008-06-19T13:53:26.834514Z
|
||||
684
|
||||
hjasak
|
||||
has-props
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
190
|
||||
|
|
@ -0,0 +1 @@
|
|||
9
|
|
@ -0,0 +1,5 @@
|
|||
K 12
|
||||
svn:keywords
|
||||
V 2
|
||||
Id
|
||||
END
|
|
@ -0,0 +1,5 @@
|
|||
K 12
|
||||
svn:keywords
|
||||
V 2
|
||||
Id
|
||||
END
|
|
@ -0,0 +1,5 @@
|
|||
K 12
|
||||
svn:keywords
|
||||
V 2
|
||||
Id
|
||||
END
|
|
@ -0,0 +1,5 @@
|
|||
K 12
|
||||
svn:keywords
|
||||
V 2
|
||||
Id
|
||||
END
|
|
@ -0,0 +1,11 @@
|
|||
fvVectorMatrix UEqn
|
||||
(
|
||||
fvm::ddt(U)
|
||||
+ fvm::div(phi, U)
|
||||
- fvm::laplacian(nu, U)
|
||||
);
|
||||
|
||||
if (momentumPredictor)
|
||||
{
|
||||
solve(UEqn == -fvc::grad(p));
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
{
|
||||
wordList pcorrTypes(p.boundaryField().types());
|
||||
|
||||
for (label i=0; i<p.boundaryField().size(); i++)
|
||||
{
|
||||
if (p.boundaryField()[i].fixesValue())
|
||||
{
|
||||
pcorrTypes[i] = fixedValueFvPatchScalarField::typeName;
|
||||
}
|
||||
}
|
||||
|
||||
volScalarField pcorr
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"pcorr",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar("pcorr", p.dimensions(), 0.0),
|
||||
pcorrTypes
|
||||
);
|
||||
|
||||
for(int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
|
||||
{
|
||||
fvScalarMatrix pcorrEqn
|
||||
(
|
||||
fvm::laplacian(rAU, pcorr) == fvc::div(phi)
|
||||
);
|
||||
|
||||
pcorrEqn.setReference(pRefCell, pRefValue);
|
||||
pcorrEqn.solve();
|
||||
|
||||
if (nonOrth == nNonOrthCorr)
|
||||
{
|
||||
phi -= pcorrEqn.flux();
|
||||
}
|
||||
|
||||
// Fluxes are corrected to absolute velocity and further corrected
|
||||
// later. HJ, 6/Feb/2009
|
||||
}
|
||||
}
|
||||
|
||||
#include "continuityErrs.H"
|
|
@ -0,0 +1,90 @@
|
|||
Info<< "Reading transportProperties\n" << endl;
|
||||
|
||||
IOdictionary transportProperties
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"transportProperties",
|
||||
runTime.constant(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
);
|
||||
|
||||
dimensionedScalar nu
|
||||
(
|
||||
transportProperties.lookup("nu")
|
||||
);
|
||||
|
||||
|
||||
Info<< "Reading field p\n" << endl;
|
||||
volScalarField p
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"p",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh
|
||||
);
|
||||
|
||||
|
||||
Info<< "Reading field U\n" << endl;
|
||||
volVectorField U
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"U",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh
|
||||
);
|
||||
|
||||
# include "createPhi.H"
|
||||
|
||||
|
||||
label pRefCell = 0;
|
||||
scalar pRefValue = 0.0;
|
||||
setRefCell(p, mesh.solutionDict().subDict("PISO"), pRefCell, pRefValue);
|
||||
|
||||
|
||||
Info<< "Reading field rAU if present\n" << endl;
|
||||
volScalarField rAU
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"rAU",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh,
|
||||
runTime.deltaT(),
|
||||
zeroGradientFvPatchScalarField::typeName
|
||||
);
|
||||
|
||||
|
||||
{
|
||||
const dictionary& piso = mesh.solutionDict().subDict("PISO");
|
||||
|
||||
bool momentumPredictor = true;
|
||||
if (piso.found("momentumPredictor"))
|
||||
{
|
||||
momentumPredictor = Switch(piso.lookup("momentumPredictor"));
|
||||
}
|
||||
|
||||
bool momentumPredictorSave = momentumPredictor;
|
||||
momentumPredictor = false;
|
||||
# include "UEqn.H"
|
||||
momentumPredictor = momentumPredictorSave;
|
||||
|
||||
rAU = 1.0/UEqn.A();
|
||||
}
|
|
@ -0,0 +1,144 @@
|
|||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2006-2007 Zeljko Tukovic
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM 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 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM 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 OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Application
|
||||
icoDyMFoam
|
||||
|
||||
Description
|
||||
Transient solver for incompressible, laminar flow of Newtonian fluids
|
||||
with dynamic mesh.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "fvCFD.H"
|
||||
#include "dynamicFvMesh.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
# include "setRootCase.H"
|
||||
# include "createTime.H"
|
||||
# include "createDynamicFvMesh.H"
|
||||
# include "initContinuityErrs.H"
|
||||
# include "initTotalVolume.H"
|
||||
# include "createFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Info<< "\nStarting time loop\n" << endl;
|
||||
|
||||
while (runTime.run())
|
||||
{
|
||||
# include "readControls.H"
|
||||
# include "checkTotalVolume.H"
|
||||
# include "CourantNo.H"
|
||||
|
||||
# include "setDeltaT.H"
|
||||
|
||||
// Make the fluxes absolute
|
||||
fvc::makeAbsolute(phi, U);
|
||||
|
||||
runTime++;
|
||||
|
||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||
|
||||
bool meshChanged = mesh.update();
|
||||
|
||||
# include "volContinuity.H"
|
||||
|
||||
if (correctPhi && meshChanged)
|
||||
{
|
||||
# include "correctPhi.H"
|
||||
}
|
||||
|
||||
// Make the fluxes relative to the mesh motion
|
||||
fvc::makeRelative(phi, U);
|
||||
|
||||
if (meshChanged)
|
||||
{
|
||||
# include "CourantNo.H"
|
||||
}
|
||||
|
||||
# include "UEqn.H"
|
||||
|
||||
// --- PISO loop
|
||||
|
||||
for (int corr=0; corr<nCorr; corr++)
|
||||
{
|
||||
rAU = 1.0/UEqn.A();
|
||||
|
||||
U = rAU*UEqn.H();
|
||||
phi = (fvc::interpolate(U) & mesh.Sf());
|
||||
//+ fvc::ddtPhiCorr(rAU, U, phi);
|
||||
|
||||
adjustPhi(phi, U, p);
|
||||
|
||||
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
|
||||
{
|
||||
fvScalarMatrix pEqn
|
||||
(
|
||||
fvm::laplacian(rAU, p) == fvc::div(phi)
|
||||
);
|
||||
|
||||
pEqn.setReference(pRefCell, pRefValue);
|
||||
|
||||
if (corr == nCorr - 1 && nonOrth == nNonOrthCorr)
|
||||
{
|
||||
pEqn.solve(mesh.solver(p.name() + "Final"));
|
||||
}
|
||||
else
|
||||
{
|
||||
pEqn.solve(mesh.solver(p.name()));
|
||||
}
|
||||
|
||||
if (nonOrth == nNonOrthCorr)
|
||||
{
|
||||
phi -= pEqn.flux();
|
||||
}
|
||||
}
|
||||
|
||||
# include "continuityErrs.H"
|
||||
|
||||
// Make the fluxes relative to the mesh motion
|
||||
fvc::makeRelative(phi, U);
|
||||
|
||||
U -= rAU*fvc::grad(p);
|
||||
U.correctBoundaryConditions();
|
||||
}
|
||||
|
||||
runTime.write();
|
||||
|
||||
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
|
||||
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
|
||||
<< nl << endl;
|
||||
}
|
||||
|
||||
Info<< "End\n" << endl;
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
|
@ -0,0 +1,14 @@
|
|||
# include "readTimeControls.H"
|
||||
# include "readPISOControls.H"
|
||||
|
||||
bool correctPhi = false;
|
||||
if (piso.found("correctPhi"))
|
||||
{
|
||||
correctPhi = Switch(piso.lookup("correctPhi"));
|
||||
}
|
||||
|
||||
bool checkMeshCourantNo = false;
|
||||
if (piso.found("checkMeshCourantNo"))
|
||||
{
|
||||
checkMeshCourantNo = Switch(piso.lookup("checkMeshCourantNo"));
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 117
|
||||
/svnroot/openfoam-extend/!svn/ver/912/trunk/Core/OpenFOAM-1.5-dev/applications/solvers/incompressible/icoDyMFoam/Make
|
||||
END
|
||||
files
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 123
|
||||
/svnroot/openfoam-extend/!svn/ver/912/trunk/Core/OpenFOAM-1.5-dev/applications/solvers/incompressible/icoDyMFoam/Make/files
|
||||
END
|
||||
options
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 125
|
||||
/svnroot/openfoam-extend/!svn/ver/912/trunk/Core/OpenFOAM-1.5-dev/applications/solvers/incompressible/icoDyMFoam/Make/options
|
||||
END
|
|
@ -0,0 +1,9 @@
|
|||
K 10
|
||||
svn:ignore
|
||||
V 28
|
||||
*Opt
|
||||
*Debug
|
||||
lnInclude
|
||||
*.dep
|
||||
|
||||
END
|
|
@ -0,0 +1,96 @@
|
|||
9
|
||||
|
||||
dir
|
||||
1730
|
||||
https://openfoam-extend.svn.sourceforge.net/svnroot/openfoam-extend/trunk/Core/OpenFOAM-1.5-dev/applications/solvers/incompressible/icoDyMFoam/Make
|
||||
https://openfoam-extend.svn.sourceforge.net/svnroot/openfoam-extend
|
||||
|
||||
|
||||
|
||||
2007-11-08T17:59:31.038014Z
|
||||
280
|
||||
hjasak
|
||||
has-props
|
||||
|
||||
svn:special svn:externals svn:needs-lock
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
e4e07f05-0c2f-0410-a05a-b8ba57e0c909
|
||||
|
||||
files
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2009-08-11T21:05:38.000000Z
|
||||
b327ba4ea7390a276aef34f189cc6ba6
|
||||
2007-06-05T22:18:47.316404Z
|
||||
3
|
||||
oforiginal
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
46
|
||||
|
||||
options
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2009-08-11T21:05:38.000000Z
|
||||
290d08439d3bdbe6dae9992a3d3d9f14
|
||||
2007-11-08T17:59:31.038014Z
|
||||
280
|
||||
hjasak
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
302
|
||||
|
|
@ -0,0 +1 @@
|
|||
9
|
|
@ -0,0 +1,3 @@
|
|||
icoDyMFoam.C
|
||||
|
||||
EXE = $(FOAM_APPBIN)/icoDyMFoam
|
|
@ -0,0 +1,13 @@
|
|||
EXE_INC = \
|
||||
-I$(LIB_SRC)/dynamicFvMesh/lnInclude \
|
||||
-I$(LIB_SRC)/dynamicMesh/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude
|
||||
|
||||
EXE_LIBS = \
|
||||
-ldynamicFvMesh \
|
||||
-ldynamicMesh \
|
||||
-lengine \
|
||||
-lmeshTools \
|
||||
-lfiniteVolume \
|
||||
-llduSolvers
|
|
@ -0,0 +1,3 @@
|
|||
icoDyMFoam.C
|
||||
|
||||
EXE = $(FOAM_APPBIN)/icoDyMFoam
|
13
applications/solvers/incompressible/icoDyMFoam/Make/options
Normal file
13
applications/solvers/incompressible/icoDyMFoam/Make/options
Normal file
|
@ -0,0 +1,13 @@
|
|||
EXE_INC = \
|
||||
-I$(LIB_SRC)/dynamicFvMesh/lnInclude \
|
||||
-I$(LIB_SRC)/dynamicMesh/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude
|
||||
|
||||
EXE_LIBS = \
|
||||
-ldynamicFvMesh \
|
||||
-ldynamicMesh \
|
||||
-lengine \
|
||||
-lmeshTools \
|
||||
-lfiniteVolume \
|
||||
-llduSolvers
|
11
applications/solvers/incompressible/icoDyMFoam/UEqn.H
Normal file
11
applications/solvers/incompressible/icoDyMFoam/UEqn.H
Normal file
|
@ -0,0 +1,11 @@
|
|||
fvVectorMatrix UEqn
|
||||
(
|
||||
fvm::ddt(U)
|
||||
+ fvm::div(phi, U)
|
||||
- fvm::laplacian(nu, U)
|
||||
);
|
||||
|
||||
if (momentumPredictor)
|
||||
{
|
||||
solve(UEqn == -fvc::grad(p));
|
||||
}
|
47
applications/solvers/incompressible/icoDyMFoam/correctPhi.H
Normal file
47
applications/solvers/incompressible/icoDyMFoam/correctPhi.H
Normal file
|
@ -0,0 +1,47 @@
|
|||
{
|
||||
wordList pcorrTypes(p.boundaryField().types());
|
||||
|
||||
for (label i=0; i<p.boundaryField().size(); i++)
|
||||
{
|
||||
if (p.boundaryField()[i].fixesValue())
|
||||
{
|
||||
pcorrTypes[i] = fixedValueFvPatchScalarField::typeName;
|
||||
}
|
||||
}
|
||||
|
||||
volScalarField pcorr
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"pcorr",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar("pcorr", p.dimensions(), 0.0),
|
||||
pcorrTypes
|
||||
);
|
||||
|
||||
for(int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
|
||||
{
|
||||
fvScalarMatrix pcorrEqn
|
||||
(
|
||||
fvm::laplacian(rAU, pcorr) == fvc::div(phi)
|
||||
);
|
||||
|
||||
pcorrEqn.setReference(pRefCell, pRefValue);
|
||||
pcorrEqn.solve();
|
||||
|
||||
if (nonOrth == nNonOrthCorr)
|
||||
{
|
||||
phi -= pcorrEqn.flux();
|
||||
}
|
||||
|
||||
// Fluxes are corrected to absolute velocity and further corrected
|
||||
// later. HJ, 6/Feb/2009
|
||||
}
|
||||
}
|
||||
|
||||
#include "continuityErrs.H"
|
|
@ -0,0 +1,90 @@
|
|||
Info<< "Reading transportProperties\n" << endl;
|
||||
|
||||
IOdictionary transportProperties
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"transportProperties",
|
||||
runTime.constant(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
);
|
||||
|
||||
dimensionedScalar nu
|
||||
(
|
||||
transportProperties.lookup("nu")
|
||||
);
|
||||
|
||||
|
||||
Info<< "Reading field p\n" << endl;
|
||||
volScalarField p
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"p",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh
|
||||
);
|
||||
|
||||
|
||||
Info<< "Reading field U\n" << endl;
|
||||
volVectorField U
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"U",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh
|
||||
);
|
||||
|
||||
# include "createPhi.H"
|
||||
|
||||
|
||||
label pRefCell = 0;
|
||||
scalar pRefValue = 0.0;
|
||||
setRefCell(p, mesh.solutionDict().subDict("PISO"), pRefCell, pRefValue);
|
||||
|
||||
|
||||
Info<< "Reading field rAU if present\n" << endl;
|
||||
volScalarField rAU
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"rAU",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh,
|
||||
runTime.deltaT(),
|
||||
zeroGradientFvPatchScalarField::typeName
|
||||
);
|
||||
|
||||
|
||||
{
|
||||
const dictionary& piso = mesh.solutionDict().subDict("PISO");
|
||||
|
||||
bool momentumPredictor = true;
|
||||
if (piso.found("momentumPredictor"))
|
||||
{
|
||||
momentumPredictor = Switch(piso.lookup("momentumPredictor"));
|
||||
}
|
||||
|
||||
bool momentumPredictorSave = momentumPredictor;
|
||||
momentumPredictor = false;
|
||||
# include "UEqn.H"
|
||||
momentumPredictor = momentumPredictorSave;
|
||||
|
||||
rAU = 1.0/UEqn.A();
|
||||
}
|
149
applications/solvers/incompressible/icoDyMFoam/icoDyMFoam.C
Normal file
149
applications/solvers/incompressible/icoDyMFoam/icoDyMFoam.C
Normal file
|
@ -0,0 +1,149 @@
|
|||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright held by original author
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM 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 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM 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 OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Application
|
||||
icoDyMFoam
|
||||
|
||||
Description
|
||||
Transient solver for incompressible, laminar flow of Newtonian fluids
|
||||
with dynamic mesh.
|
||||
|
||||
Author
|
||||
Hrvoje Jasak, Wikki Ltd. All rights reserved.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "fvCFD.H"
|
||||
#include "dynamicFvMesh.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
# include "setRootCase.H"
|
||||
# include "createTime.H"
|
||||
# include "createDynamicFvMesh.H"
|
||||
# include "initContinuityErrs.H"
|
||||
# include "initTotalVolume.H"
|
||||
# include "createFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Info<< "\nStarting time loop\n" << endl;
|
||||
|
||||
while (runTime.run())
|
||||
{
|
||||
# include "readControls.H"
|
||||
# include "checkTotalVolume.H"
|
||||
# include "CourantNo.H"
|
||||
|
||||
# include "setDeltaT.H"
|
||||
|
||||
// Make the fluxes absolute
|
||||
fvc::makeAbsolute(phi, U);
|
||||
|
||||
runTime++;
|
||||
|
||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||
|
||||
bool meshChanged = mesh.update();
|
||||
|
||||
# include "volContinuity.H"
|
||||
|
||||
if (correctPhi && meshChanged)
|
||||
{
|
||||
// Fluxes will be corrected to absolute velocity
|
||||
// HJ, 6/Feb/2009
|
||||
# include "correctPhi.H"
|
||||
}
|
||||
|
||||
// Make the fluxes relative to the mesh motion
|
||||
fvc::makeRelative(phi, U);
|
||||
|
||||
if (meshChanged)
|
||||
{
|
||||
# include "CourantNo.H"
|
||||
}
|
||||
|
||||
# include "UEqn.H"
|
||||
|
||||
// --- PISO loop
|
||||
|
||||
for (int corr=0; corr<nCorr; corr++)
|
||||
{
|
||||
rAU = 1.0/UEqn.A();
|
||||
|
||||
U = rAU*UEqn.H();
|
||||
phi = (fvc::interpolate(U) & mesh.Sf());
|
||||
//+ fvc::ddtPhiCorr(rAU, U, phi);
|
||||
|
||||
adjustPhi(phi, U, p);
|
||||
|
||||
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
|
||||
{
|
||||
fvScalarMatrix pEqn
|
||||
(
|
||||
fvm::laplacian(rAU, p) == fvc::div(phi)
|
||||
);
|
||||
|
||||
pEqn.setReference(pRefCell, pRefValue);
|
||||
|
||||
if (corr == nCorr - 1 && nonOrth == nNonOrthCorr)
|
||||
{
|
||||
pEqn.solve(mesh.solver(p.name() + "Final"));
|
||||
}
|
||||
else
|
||||
{
|
||||
pEqn.solve(mesh.solver(p.name()));
|
||||
}
|
||||
|
||||
if (nonOrth == nNonOrthCorr)
|
||||
{
|
||||
phi -= pEqn.flux();
|
||||
}
|
||||
}
|
||||
|
||||
# include "continuityErrs.H"
|
||||
|
||||
// Make the fluxes relative to the mesh motion
|
||||
fvc::makeRelative(phi, U);
|
||||
|
||||
U -= rAU*fvc::grad(p);
|
||||
U.correctBoundaryConditions();
|
||||
}
|
||||
|
||||
runTime.write();
|
||||
|
||||
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
|
||||
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
|
||||
<< nl << endl;
|
||||
}
|
||||
|
||||
Info<< "End\n" << endl;
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
|
@ -0,0 +1,14 @@
|
|||
# include "readTimeControls.H"
|
||||
# include "readPISOControls.H"
|
||||
|
||||
bool correctPhi = false;
|
||||
if (piso.found("correctPhi"))
|
||||
{
|
||||
correctPhi = Switch(piso.lookup("correctPhi"));
|
||||
}
|
||||
|
||||
bool checkMeshCourantNo = false;
|
||||
if (piso.found("checkMeshCourantNo"))
|
||||
{
|
||||
checkMeshCourantNo = Switch(piso.lookup("checkMeshCourantNo"));
|
||||
}
|
Reference in a new issue