Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
HPCAPPs
OpenFOAM-GPU-v2.0
Commits
ea17556c
Commit
ea17556c
authored
Mar 07, 2024
by
shunbo
Browse files
Initial commit
parents
Changes
798
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
1174 additions
and
0 deletions
+1174
-0
applications/solvers/compressible/rhoPimpleFoam/pcEqn.H
applications/solvers/compressible/rhoPimpleFoam/pcEqn.H
+132
-0
applications/solvers/compressible/rhoPimpleFoam/rhoPimpleFoam.C
...ations/solvers/compressible/rhoPimpleFoam/rhoPimpleFoam.C
+204
-0
applications/solvers/compressible/rhoPimpleFoam/setRDeltaT.H
applications/solvers/compressible/rhoPimpleFoam/setRDeltaT.H
+85
-0
applications/solvers/compressible/rhoSimpleFoam/EEqn.H
applications/solvers/compressible/rhoSimpleFoam/EEqn.H
+26
-0
applications/solvers/compressible/rhoSimpleFoam/Make/files
applications/solvers/compressible/rhoSimpleFoam/Make/files
+3
-0
applications/solvers/compressible/rhoSimpleFoam/Make/options
applications/solvers/compressible/rhoSimpleFoam/Make/options
+23
-0
applications/solvers/compressible/rhoSimpleFoam/UEqn.H
applications/solvers/compressible/rhoSimpleFoam/UEqn.H
+21
-0
applications/solvers/compressible/rhoSimpleFoam/createFieldRefs.H
...ions/solvers/compressible/rhoSimpleFoam/createFieldRefs.H
+1
-0
applications/solvers/compressible/rhoSimpleFoam/createFields.H
...cations/solvers/compressible/rhoSimpleFoam/createFields.H
+60
-0
applications/solvers/compressible/rhoSimpleFoam/overRhoSimpleFoam/Make/files
...s/compressible/rhoSimpleFoam/overRhoSimpleFoam/Make/files
+3
-0
applications/solvers/compressible/rhoSimpleFoam/overRhoSimpleFoam/Make/options
...compressible/rhoSimpleFoam/overRhoSimpleFoam/Make/options
+27
-0
applications/solvers/compressible/rhoSimpleFoam/overRhoSimpleFoam/UEqn.H
...lvers/compressible/rhoSimpleFoam/overRhoSimpleFoam/UEqn.H
+23
-0
applications/solvers/compressible/rhoSimpleFoam/overRhoSimpleFoam/createFieldRefs.H
...essible/rhoSimpleFoam/overRhoSimpleFoam/createFieldRefs.H
+6
-0
applications/solvers/compressible/rhoSimpleFoam/overRhoSimpleFoam/createFields.H
...mpressible/rhoSimpleFoam/overRhoSimpleFoam/createFields.H
+82
-0
applications/solvers/compressible/rhoSimpleFoam/overRhoSimpleFoam/createUpdatedDynamicFvMesh.H
...SimpleFoam/overRhoSimpleFoam/createUpdatedDynamicFvMesh.H
+22
-0
applications/solvers/compressible/rhoSimpleFoam/overRhoSimpleFoam/overRhoSimpleFoam.C
...sible/rhoSimpleFoam/overRhoSimpleFoam/overRhoSimpleFoam.C
+97
-0
applications/solvers/compressible/rhoSimpleFoam/overRhoSimpleFoam/pEqn.H
...lvers/compressible/rhoSimpleFoam/overRhoSimpleFoam/pEqn.H
+123
-0
applications/solvers/compressible/rhoSimpleFoam/pEqn.H
applications/solvers/compressible/rhoSimpleFoam/pEqn.H
+110
-0
applications/solvers/compressible/rhoSimpleFoam/pcEqn.H
applications/solvers/compressible/rhoSimpleFoam/pcEqn.H
+123
-0
applications/solvers/compressible/rhoSimpleFoam/rhoPorousSimpleFoam/Make/files
...compressible/rhoSimpleFoam/rhoPorousSimpleFoam/Make/files
+3
-0
No files found.
Too many changes to show.
To preserve performance only
798 of 798+
files are displayed.
Plain diff
Email patch
applications/solvers/compressible/rhoPimpleFoam/pcEqn.H
0 → 100644
View file @
ea17556c
if
(
!
pimple
.
SIMPLErho
())
{
rho
=
thermo
.
rho
();
}
// Thermodynamic density needs to be updated by psi*d(p) after the
// pressure solution
const
volScalarField
psip0
(
psi
*
p
);
volScalarField
rAU
(
1
.
0
/
UEqn
.
A
());
volScalarField
rAtU
(
1
.
0
/
(
1
.
0
/
rAU
-
UEqn
.
H1
()));
volVectorField
HbyA
(
constrainHbyA
(
rAU
*
UEqn
.
H
(),
U
,
p
));
if
(
pimple
.
nCorrPISO
()
<=
1
)
{
tUEqn
.
clear
();
}
surfaceScalarField
phiHbyA
(
"phiHbyA"
,
(
fvc
::
interpolate
(
rho
)
*
fvc
::
flux
(
HbyA
)
+
MRF
.
zeroFilter
(
fvc
::
interpolate
(
rho
*
rAU
)
*
fvc
::
ddtCorr
(
rho
,
U
,
phi
,
rhoUf
)
)
)
);
fvc
::
makeRelative
(
phiHbyA
,
rho
,
U
);
MRF
.
makeRelative
(
fvc
::
interpolate
(
rho
),
phiHbyA
);
volScalarField
rhorAtU
(
"rhorAtU"
,
rho
*
rAtU
);
// Update the pressure BCs to ensure flux consistency
constrainPressure
(
p
,
rho
,
U
,
phiHbyA
,
rhorAtU
,
MRF
);
if
(
pimple
.
transonic
())
{
surfaceScalarField
phid
(
"phid"
,
(
fvc
::
interpolate
(
psi
)
/
fvc
::
interpolate
(
rho
))
*
phiHbyA
);
phiHbyA
+=
fvc
::
interpolate
(
rho
*
(
rAtU
-
rAU
))
*
fvc
::
snGrad
(
p
)
*
mesh
.
magSf
()
-
fvc
::
interpolate
(
psi
*
p
)
*
phiHbyA
/
fvc
::
interpolate
(
rho
);
HbyA
-=
(
rAU
-
rAtU
)
*
fvc
::
grad
(
p
);
fvScalarMatrix
pDDtEqn
(
fvc
::
ddt
(
rho
)
+
psi
*
correction
(
fvm
::
ddt
(
p
))
+
fvc
::
div
(
phiHbyA
)
+
fvm
::
div
(
phid
,
p
)
==
fvOptions
(
psi
,
p
,
rho
.
name
())
);
while
(
pimple
.
correctNonOrthogonal
())
{
fvScalarMatrix
pEqn
(
pDDtEqn
-
fvm
::
laplacian
(
rhorAtU
,
p
));
// Relax the pressure equation to ensure diagonal-dominance
pEqn
.
relax
();
pEqn
.
solve
(
mesh
.
solver
(
p
.
select
(
pimple
.
finalInnerIter
())));
if
(
pimple
.
finalNonOrthogonalIter
())
{
phi
=
phiHbyA
+
pEqn
.
flux
();
}
}
}
else
{
phiHbyA
+=
fvc
::
interpolate
(
rho
*
(
rAtU
-
rAU
))
*
fvc
::
snGrad
(
p
)
*
mesh
.
magSf
();
HbyA
-=
(
rAU
-
rAtU
)
*
fvc
::
grad
(
p
);
fvScalarMatrix
pDDtEqn
(
fvc
::
ddt
(
rho
)
+
psi
*
correction
(
fvm
::
ddt
(
p
))
+
fvc
::
div
(
phiHbyA
)
==
fvOptions
(
psi
,
p
,
rho
.
name
())
);
while
(
pimple
.
correctNonOrthogonal
())
{
fvScalarMatrix
pEqn
(
pDDtEqn
-
fvm
::
laplacian
(
rhorAtU
,
p
));
pEqn
.
solve
(
mesh
.
solver
(
p
.
select
(
pimple
.
finalInnerIter
())));
if
(
pimple
.
finalNonOrthogonalIter
())
{
phi
=
phiHbyA
+
pEqn
.
flux
();
}
}
}
#include "rhoEqn.H"
#include "compressibleContinuityErrs.H"
// Explicitly relax pressure for momentum corrector
p
.
relax
();
U
=
HbyA
-
rAtU
*
fvc
::
grad
(
p
);
U
.
correctBoundaryConditions
();
fvOptions
.
correct
(
U
);
K
=
0
.
5
*
magSqr
(
U
);
if
(
pressureControl
.
limit
(
p
))
{
p
.
correctBoundaryConditions
();
}
thermo
.
correctRho
(
psi
*
p
-
psip0
,
rhoMin
,
rhoMax
)
;
rho
=
thermo
.
rho
();
// Correct rhoUf if the mesh is moving
fvc
::
correctRhoUf
(
rhoUf
,
rho
,
U
,
phi
);
if
(
thermo
.
dpdt
())
{
dpdt
=
fvc
::
ddt
(
p
);
if
(
mesh
.
moving
())
{
dpdt
-=
fvc
::
div
(
fvc
::
meshPhi
(
rho
,
U
),
p
);
}
}
applications/solvers/compressible/rhoPimpleFoam/rhoPimpleFoam.C
0 → 100644
View file @
ea17556c
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd.
-------------------------------------------------------------------------------
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 3 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, see <http://www.gnu.org/licenses/>.
Application
rhoPimpleFoam
Group
grpCompressibleSolvers
Description
Transient solver for turbulent flow of compressible fluids for HVAC and
similar applications, with optional mesh motion and mesh topology changes.
Uses the flexible PIMPLE (PISO-SIMPLE) solution for time-resolved and
pseudo-transient simulations.
Note
The motion frequency of this solver can be influenced by the presence
of "updateControl" and "updateInterval" in the dynamicMeshDict.
\*---------------------------------------------------------------------------*/
#include "fvCFD.H"
#include "dynamicFvMesh.H"
#include "fluidThermo.H"
#include "turbulentFluidThermoModel.H"
#include "bound.H"
#include "pimpleControl.H"
#include "pressureControl.H"
#include "CorrectPhi.H"
#include "fvOptions.H"
#include "localEulerDdtScheme.H"
#include "fvcSmooth.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int
main
(
int
argc
,
char
*
argv
[])
{
argList
::
addNote
(
"Transient solver for compressible turbulent flow.
\n
"
"With optional mesh motion and mesh topology changes."
);
#include "postProcess.H"
#include "addCheckCaseOptions.H"
#include "setRootCaseLists.H"
#include "createTime.H"
#include "createDynamicFvMesh.H"
#include "createDyMControls.H"
#include "initContinuityErrs.H"
#include "createFields.H"
#include "createFieldRefs.H"
#include "createRhoUfIfPresent.H"
turbulence
->
validate
();
if
(
!
LTS
)
{
#include "compressibleCourantNo.H"
#include "setInitialDeltaT.H"
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Info
<<
"
\n
Starting time loop
\n
"
<<
endl
;
while
(
runTime
.
run
())
{
#include "readDyMControls.H"
// Store divrhoU from the previous mesh so that it can be mapped
// and used in correctPhi to ensure the corrected phi has the
// same divergence
autoPtr
<
volScalarField
>
divrhoU
;
if
(
correctPhi
)
{
divrhoU
.
reset
(
new
volScalarField
(
"divrhoU"
,
fvc
::
div
(
fvc
::
absolute
(
phi
,
rho
,
U
))
)
);
}
if
(
LTS
)
{
#include "setRDeltaT.H"
}
else
{
#include "compressibleCourantNo.H"
#include "setDeltaT.H"
}
++
runTime
;
Info
<<
"Time = "
<<
runTime
.
timeName
()
<<
nl
<<
endl
;
// --- Pressure-velocity PIMPLE corrector loop
while
(
pimple
.
loop
())
{
if
(
pimple
.
firstIter
()
||
moveMeshOuterCorrectors
)
{
// Store momentum to set rhoUf for introduced faces.
autoPtr
<
volVectorField
>
rhoU
;
if
(
rhoUf
.
valid
())
{
rhoU
.
reset
(
new
volVectorField
(
"rhoU"
,
rho
*
U
));
}
// Do any mesh changes
mesh
.
controlledUpdate
();
if
(
mesh
.
changing
())
{
MRF
.
update
();
if
(
correctPhi
)
{
// Calculate absolute flux
// from the mapped surface velocity
phi
=
mesh
.
Sf
()
&
rhoUf
();
#include "correctPhi.H"
// Make the fluxes relative to the mesh-motion
fvc
::
makeRelative
(
phi
,
rho
,
U
);
}
if
(
checkMeshCourantNo
)
{
#include "meshCourantNo.H"
}
}
}
if
(
pimple
.
firstIter
()
&&
!
pimple
.
SIMPLErho
())
{
#include "rhoEqn.H"
}
#include "UEqn.H"
#include "EEqn.H"
// --- Pressure corrector loop
while
(
pimple
.
correct
())
{
if
(
pimple
.
consistent
())
{
#include "pcEqn.H"
}
else
{
#include "pEqn.H"
}
}
if
(
pimple
.
turbCorr
())
{
turbulence
->
correct
();
}
}
rho
=
thermo
.
rho
();
runTime
.
write
();
runTime
.
printExecutionTime
(
Info
);
}
Info
<<
"End
\n
"
<<
endl
;
return
0
;
}
// ************************************************************************* //
applications/solvers/compressible/rhoPimpleFoam/setRDeltaT.H
0 → 100644
View file @
ea17556c
{
volScalarField
&
rDeltaT
=
trDeltaT
.
ref
();
const
dictionary
&
pimpleDict
=
pimple
.
dict
();
scalar
maxCo
(
pimpleDict
.
getOrDefault
<
scalar
>
(
"maxCo"
,
0
.
8
)
);
scalar
rDeltaTSmoothingCoeff
(
pimpleDict
.
getOrDefault
<
scalar
>
(
"rDeltaTSmoothingCoeff"
,
0
.
02
)
);
scalar
rDeltaTDampingCoeff
(
pimpleDict
.
getOrDefault
<
scalar
>
(
"rDeltaTDampingCoeff"
,
1
.
0
)
);
scalar
maxDeltaT
(
pimpleDict
.
getOrDefault
<
scalar
>
(
"maxDeltaT"
,
GREAT
)
);
volScalarField
rDeltaT0
(
"rDeltaT0"
,
rDeltaT
);
// Set the reciprocal time-step from the local Courant number
rDeltaT
.
ref
()
=
max
(
1
/
dimensionedScalar
(
"maxDeltaT"
,
dimTime
,
maxDeltaT
),
fvc
::
surfaceSum
(
mag
(
phi
))()()
/
((
2
*
maxCo
)
*
mesh
.
V
()
*
rho
())
);
if
(
pimple
.
transonic
())
{
surfaceScalarField
phid
(
"phid"
,
fvc
::
interpolate
(
psi
)
*
fvc
::
flux
(
U
)
);
rDeltaT
.
ref
()
=
max
(
rDeltaT
(),
fvc
::
surfaceSum
(
mag
(
phid
))()()
/
((
2
*
maxCo
)
*
mesh
.
V
()
*
psi
())
);
}
// Update the boundary values of the reciprocal time-step
rDeltaT
.
correctBoundaryConditions
();
Info
<<
"Flow time scale min/max = "
<<
gMin
(
1
/
rDeltaT
.
primitiveField
())
<<
", "
<<
gMax
(
1
/
rDeltaT
.
primitiveField
())
<<
endl
;
if
(
rDeltaTSmoothingCoeff
<
1
.
0
)
{
fvc
::
smooth
(
rDeltaT
,
rDeltaTSmoothingCoeff
);
}
Info
<<
"Smoothed flow time scale min/max = "
<<
gMin
(
1
/
rDeltaT
.
primitiveField
())
<<
", "
<<
gMax
(
1
/
rDeltaT
.
primitiveField
())
<<
endl
;
// Limit rate of change of time scale
// - reduce as much as required
// - only increase at a fraction of old time scale
if
(
rDeltaTDampingCoeff
<
1
.
0
&&
runTime
.
timeIndex
()
>
runTime
.
startTimeIndex
()
+
1
)
{
rDeltaT
=
rDeltaT0
*
max
(
rDeltaT
/
rDeltaT0
,
scalar
(
1
)
-
rDeltaTDampingCoeff
);
Info
<<
"Damped flow time scale min/max = "
<<
gMin
(
1
/
rDeltaT
.
primitiveField
())
<<
", "
<<
gMax
(
1
/
rDeltaT
.
primitiveField
())
<<
endl
;
}
}
applications/solvers/compressible/rhoSimpleFoam/EEqn.H
0 → 100644
View file @
ea17556c
{
volScalarField
&
he
=
thermo
.
he
();
fvScalarMatrix
EEqn
(
fvm
::
div
(
phi
,
he
)
+
(
he
.
name
()
==
"e"
?
fvc
::
div
(
phi
,
volScalarField
(
"Ekp"
,
0
.
5
*
magSqr
(
U
)
+
p
/
rho
))
:
fvc
::
div
(
phi
,
volScalarField
(
"K"
,
0
.
5
*
magSqr
(
U
)))
)
-
fvm
::
laplacian
(
turbulence
->
alphaEff
(),
he
)
==
fvOptions
(
rho
,
he
)
);
EEqn
.
relax
();
fvOptions
.
constrain
(
EEqn
);
EEqn
.
solve
();
fvOptions
.
correct
(
he
);
thermo
.
correct
();
}
applications/solvers/compressible/rhoSimpleFoam/Make/files
0 → 100644
View file @
ea17556c
rhoSimpleFoam.C
EXE = $(FOAM_APPBIN)/rhoSimpleFoam
applications/solvers/compressible/rhoSimpleFoam/Make/options
0 → 100644
View file @
ea17556c
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/cfdTools \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/sampling/lnInclude \
-I$(LIB_SRC)/transportModels/compressible/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \
-I$(LIB_SRC)/regionFaModels\lnInclude
EXE_LIBS = \
-lfiniteVolume \
-lfvOptions \
-lmeshTools \
-lsampling \
-lcompressibleTransportModels \
-lfluidThermophysicalModels \
-lspecie \
-lturbulenceModels \
-lcompressibleTurbulenceModels \
-latmosphericModels \
-lregionFaModels
applications/solvers/compressible/rhoSimpleFoam/UEqn.H
0 → 100644
View file @
ea17556c
// Solve the Momentum equation
MRF
.
correctBoundaryVelocity
(
U
);
tmp
<
fvVectorMatrix
>
tUEqn
(
fvm
::
div
(
phi
,
U
)
+
MRF
.
DDt
(
rho
,
U
)
+
turbulence
->
divDevRhoReff
(
U
)
==
fvOptions
(
rho
,
U
)
);
fvVectorMatrix
&
UEqn
=
tUEqn
.
ref
();
UEqn
.
relax
();
fvOptions
.
constrain
(
UEqn
);
solve
(
UEqn
==
-
fvc
::
grad
(
p
));
fvOptions
.
correct
(
U
);
applications/solvers/compressible/rhoSimpleFoam/createFieldRefs.H
0 → 100644
View file @
ea17556c
const
volScalarField
&
psi
=
thermo
.
psi
();
applications/solvers/compressible/rhoSimpleFoam/createFields.H
0 → 100644
View file @
ea17556c
Info
<<
"Reading thermophysical properties
\n
"
<<
endl
;
autoPtr
<
fluidThermo
>
pThermo
(
fluidThermo
::
New
(
mesh
)
);
fluidThermo
&
thermo
=
pThermo
();
thermo
.
validate
(
args
.
executable
(),
"h"
,
"e"
);
volScalarField
&
p
=
thermo
.
p
();
volScalarField
rho
(
IOobject
(
"rho"
,
runTime
.
timeName
(),
mesh
,
IOobject
::
READ_IF_PRESENT
,
IOobject
::
AUTO_WRITE
),
thermo
.
rho
()
);
Info
<<
"Reading field U
\n
"
<<
endl
;
volVectorField
U
(
IOobject
(
"U"
,
runTime
.
timeName
(),
mesh
,
IOobject
::
MUST_READ
,
IOobject
::
AUTO_WRITE
),
mesh
);
#include "compressibleCreatePhi.H"
pressureControl
pressureControl
(
p
,
rho
,
simple
.
dict
());
mesh
.
setFluxRequired
(
p
.
name
());
Info
<<
"Creating turbulence model
\n
"
<<
endl
;
autoPtr
<
compressible
::
turbulenceModel
>
turbulence
(
compressible
::
turbulenceModel
::
New
(
rho
,
U
,
phi
,
thermo
)
);
dimensionedScalar
initialMass
=
fvc
::
domainIntegrate
(
rho
);
#include "createMRF.H"
#include "createFvOptions.H"
applications/solvers/compressible/rhoSimpleFoam/overRhoSimpleFoam/Make/files
0 → 100644
View file @
ea17556c
overRhoSimpleFoam.C
EXE = $(FOAM_APPBIN)/overRhoSimpleFoam
applications/solvers/compressible/rhoSimpleFoam/overRhoSimpleFoam/Make/options
0 → 100644
View file @
ea17556c
EXE_INC = \
-I.. \
-I$(LIB_SRC)/finiteVolume/cfdTools \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/transportModels/compressible/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \
-I$(LIB_SRC)/dynamicMesh/lnInclude \
-I$(LIB_SRC)/dynamicFvMesh/lnInclude \
-I$(LIB_SRC)/sampling/lnInclude \
-I$(LIB_SRC)/overset/lnInclude
EXE_LIBS = \
-lfiniteVolume \
-lfvOptions \
-lmeshTools \
-lcompressibleTransportModels \
-lfluidThermophysicalModels \
-lspecie \
-lturbulenceModels \
-lcompressibleTurbulenceModels \
-ldynamicFvMesh \
-ltopoChangerFvMesh \
-lsampling \
-loverset
applications/solvers/compressible/rhoSimpleFoam/overRhoSimpleFoam/UEqn.H
0 → 100644
View file @
ea17556c
// Solve the Momentum equation
MRF
.
correctBoundaryVelocity
(
U
);
tmp
<
fvVectorMatrix
>
tUEqn
(
fvm
::
div
(
phi
,
U
)
+
MRF
.
DDt
(
rho
,
U
)
+
turbulence
->
divDevRhoReff
(
U
)
==
fvOptions
(
rho
,
U
)
);
fvVectorMatrix
&
UEqn
=
tUEqn
.
ref
();
UEqn
.
relax
();
fvOptions
.
constrain
(
UEqn
);
if
(
simple
.
momentumPredictor
())
{
solve
(
UEqn
==
-
cellMask
*
fvc
::
grad
(
p
));
}
fvOptions
.
correct
(
U
);
applications/solvers/compressible/rhoSimpleFoam/overRhoSimpleFoam/createFieldRefs.H
0 → 100644
View file @
ea17556c
const
volScalarField
&
psi
=
thermo
.
psi
();
bool
adjustFringe
(
simple
.
dict
().
getOrDefault
(
"oversetAdjustPhi"
,
false
)
);
applications/solvers/compressible/rhoSimpleFoam/overRhoSimpleFoam/createFields.H
0 → 100644
View file @
ea17556c
Info
<<
"Reading thermophysical properties
\n
"
<<
endl
;
autoPtr
<
fluidThermo
>
pThermo
(
fluidThermo
::
New
(
mesh
)
);
fluidThermo
&
thermo
=
pThermo
();
thermo
.
validate
(
args
.
executable
(),
"h"
,
"e"
);
volScalarField
&
p
=
thermo
.
p
();
volScalarField
rho
(
IOobject
(
"rho"
,
runTime
.
timeName
(),
mesh
,
IOobject
::
READ_IF_PRESENT
,
IOobject
::
AUTO_WRITE
),
thermo
.
rho
()
);
Info
<<
"Reading field U
\n
"
<<
endl
;
volVectorField
U
(
IOobject
(
"U"
,
runTime
.
timeName
(),
mesh
,
IOobject
::
MUST_READ
,
IOobject
::
AUTO_WRITE
),
mesh
);
#include "compressibleCreatePhi.H"
pressureControl
pressureControl
(
p
,
rho
,
simple
.
dict
());
mesh
.
setFluxRequired
(
p
.
name
());
Info
<<
"Creating turbulence model
\n
"
<<
endl
;
autoPtr
<
compressible
::
turbulenceModel
>
turbulence
(
compressible
::
turbulenceModel
::
New
(
rho
,
U
,
phi
,
thermo
)
);
dimensionedScalar
initialMass
=
fvc
::
domainIntegrate
(
rho
);
#include "createMRF.H"
//- Overset specific
// Add solver-specific interpolations
{
wordHashSet
&
nonInt
=
const_cast
<
wordHashSet
&>
(
Stencil
::
New
(
mesh
).
nonInterpolatedFields
());
nonInt
.
insert
(
"HbyA"
);
nonInt
.
insert
(
"grad(p)"
);
nonInt
.
insert
(
"surfaceIntegrate(phi)"
);
nonInt
.
insert
(
"surfaceIntegrate(phiHbyA)"
);
nonInt
.
insert
(
"cellMask"
);
nonInt
.
insert
(
"cellDisplacement"
);
nonInt
.
insert
(
"interpolatedCells"
);
nonInt
.
insert
(
"cellInterpolationWeight"
);
}
// Mask field for zeroing out contributions on hole cells
#include "createCellMask.H"
#include "createInterpolatedCells.H"
applications/solvers/compressible/rhoSimpleFoam/overRhoSimpleFoam/createUpdatedDynamicFvMesh.H
0 → 100644
View file @
ea17556c
Info
<<
"Create dynamic mesh for time = "
<<
runTime
.
timeName
()
<<
nl
<<
endl
;
autoPtr
<
dynamicFvMesh
>
meshPtr
(
dynamicFvMesh
::
New
(
IOobject
(
polyMesh
::
defaultRegion
,
runTime
.
timeName
(),
runTime
,
IOobject
::
MUST_READ
)
)
);
dynamicFvMesh
&
mesh
=
meshPtr
();
// Calculate initial mesh-to-mesh mapping. Note that this should be
// done under the hood, e.g. as a MeshObject
mesh
.
update
();
applications/solvers/compressible/rhoSimpleFoam/overRhoSimpleFoam/overRhoSimpleFoam.C
0 → 100644
View file @
ea17556c
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017 OpenCFD Ltd
-------------------------------------------------------------------------------
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 3 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, see <http://www.gnu.org/licenses/>.
Application
overRhoSimpleFoam
Group
grpCompressibleSolvers
Description
Overset steady-state solver for compressible turbulent flow.
\*---------------------------------------------------------------------------*/
#include "fvCFD.H"
#include "dynamicFvMesh.H"
#include "fluidThermo.H"
#include "turbulentFluidThermoModel.H"
#include "simpleControl.H"
#include "pressureControl.H"
#include "fvOptions.H"
#include "cellCellStencilObject.H"
#include "localMin.H"
#include "oversetAdjustPhi.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int
main
(
int
argc
,
char
*
argv
[])
{
argList
::
addNote
(
"Overset steady-state solver for compressible turbulent flow"
);
#define CREATE_MESH createUpdatedDynamicFvMesh.H
#include "postProcess.H"
#include "setRootCaseLists.H"
#include "createTime.H"
#include "createUpdatedDynamicFvMesh.H"
#include "createControl.H"
#include "createFields.H"
#include "createFieldRefs.H"
#include "createFvOptions.H"
#include "initContinuityErrs.H"
turbulence
->
validate
();
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Info
<<
"
\n
Starting time loop
\n
"
<<
endl
;
while
(
simple
.
loop
())
{
Info
<<
"Time = "
<<
runTime
.
timeName
()
<<
nl
<<
endl
;
// Pressure-velocity SIMPLE corrector
#include "UEqn.H"
#include "EEqn.H"
#include "pEqn.H"
turbulence
->
correct
();
runTime
.
write
();
runTime
.
printExecutionTime
(
Info
);
}
Info
<<
"End
\n
"
<<
endl
;
return
0
;
}
// ************************************************************************* //
applications/solvers/compressible/rhoSimpleFoam/overRhoSimpleFoam/pEqn.H
0 → 100644
View file @
ea17556c
{
surfaceScalarField
faceMask
(
localMin
<
scalar
>
(
mesh
).
interpolate
(
cellMask
));
volScalarField
rAU
(
1
.
0
/
UEqn
.
A
());
surfaceScalarField
rhorAUf
(
"rhorAUf"
,
faceMask
*
fvc
::
interpolate
(
rho
*
rAU
));
volVectorField
HbyA
(
"HbyA"
,
U
);
HbyA
=
constrainHbyA
(
cellMask
*
rAU
*
UEqn
.
H
(),
U
,
p
);
tUEqn
.
clear
();
bool
closedVolume
=
false
;
surfaceScalarField
phiHbyA
(
"phiHbyA"
,
fvc
::
interpolate
(
rho
)
*
fvc
::
flux
(
HbyA
));
MRF
.
makeRelative
(
fvc
::
interpolate
(
rho
),
phiHbyA
);
// Update the pressure BCs to ensure flux consistency
constrainPressure
(
p
,
rho
,
U
,
phiHbyA
,
rhorAUf
,
MRF
);
if
(
simple
.
transonic
())
{
surfaceScalarField
phid
(
"phid"
,
(
fvc
::
interpolate
(
psi
)
/
fvc
::
interpolate
(
rho
))
*
phiHbyA
);
phiHbyA
-=
fvc
::
interpolate
(
psi
*
p
)
*
phiHbyA
/
fvc
::
interpolate
(
rho
);
while
(
simple
.
correctNonOrthogonal
())
{
fvScalarMatrix
pEqn
(
fvc
::
div
(
phiHbyA
)
+
fvm
::
div
(
phid
,
p
)
-
fvm
::
laplacian
(
rhorAUf
,
p
)
==
fvOptions
(
psi
,
p
,
rho
.
name
())
);
// Relax the pressure equation to ensure diagonal-dominance
pEqn
.
relax
();
pEqn
.
setReference
(
pressureControl
.
refCell
(),
pressureControl
.
refValue
()
);
pEqn
.
solve
();
if
(
simple
.
finalNonOrthogonalIter
())
{
phi
=
phiHbyA
+
pEqn
.
flux
();
}
}
}
else
{
closedVolume
=
adjustPhi
(
phiHbyA
,
U
,
p
);
if
(
adjustFringe
)
{
oversetAdjustPhi
(
phiHbyA
,
U
);
}
while
(
simple
.
correctNonOrthogonal
())
{
fvScalarMatrix
pEqn
(
fvc
::
div
(
phiHbyA
)
-
fvm
::
laplacian
(
rhorAUf
,
p
)
==
fvOptions
(
psi
,
p
,
rho
.
name
())
);
pEqn
.
setReference
(
pressureControl
.
refCell
(),
pressureControl
.
refValue
()
);
pEqn
.
solve
();
if
(
simple
.
finalNonOrthogonalIter
())
{
phi
=
phiHbyA
+
pEqn
.
flux
();
}
}
}
#include "incompressible/continuityErrs.H"
// Explicitly relax pressure for momentum corrector
p
.
relax
();
volVectorField
gradP
(
fvc
::
grad
(
p
));
U
=
HbyA
-
rAU
*
cellMask
*
gradP
;
U
.
correctBoundaryConditions
();
fvOptions
.
correct
(
U
);
bool
pLimited
=
pressureControl
.
limit
(
p
);
// For closed-volume cases adjust the pressure and density levels
// to obey overall mass continuity
if
(
closedVolume
)
{
p
+=
(
initialMass
-
fvc
::
domainIntegrate
(
psi
*
p
))
/
fvc
::
domainIntegrate
(
psi
);
}
if
(
pLimited
||
closedVolume
)
{
p
.
correctBoundaryConditions
();
}
rho
=
thermo
.
rho
();
if
(
!
simple
.
transonic
())
{
rho
.
relax
();
}
}
applications/solvers/compressible/rhoSimpleFoam/pEqn.H
0 → 100644
View file @
ea17556c
volScalarField
rAU
(
1
.
0
/
UEqn
.
A
());
surfaceScalarField
rhorAUf
(
"rhorAUf"
,
fvc
::
interpolate
(
rho
*
rAU
));
volVectorField
HbyA
(
constrainHbyA
(
rAU
*
UEqn
.
H
(),
U
,
p
));
tUEqn
.
clear
();
bool
closedVolume
=
false
;
surfaceScalarField
phiHbyA
(
"phiHbyA"
,
fvc
::
interpolate
(
rho
)
*
fvc
::
flux
(
HbyA
));
MRF
.
makeRelative
(
fvc
::
interpolate
(
rho
),
phiHbyA
);
// Update the pressure BCs to ensure flux consistency
constrainPressure
(
p
,
rho
,
U
,
phiHbyA
,
rhorAUf
,
MRF
);
if
(
simple
.
transonic
())
{
surfaceScalarField
phid
(
"phid"
,
(
fvc
::
interpolate
(
psi
)
/
fvc
::
interpolate
(
rho
))
*
phiHbyA
);
phiHbyA
-=
fvc
::
interpolate
(
psi
*
p
)
*
phiHbyA
/
fvc
::
interpolate
(
rho
);
while
(
simple
.
correctNonOrthogonal
())
{
fvScalarMatrix
pEqn
(
fvc
::
div
(
phiHbyA
)
+
fvm
::
div
(
phid
,
p
)
-
fvm
::
laplacian
(
rhorAUf
,
p
)
==
fvOptions
(
psi
,
p
,
rho
.
name
())
);
// Relax the pressure equation to ensure diagonal-dominance
pEqn
.
relax
();
pEqn
.
setReference
(
pressureControl
.
refCell
(),
pressureControl
.
refValue
()
);
pEqn
.
solve
();
if
(
simple
.
finalNonOrthogonalIter
())
{
phi
=
phiHbyA
+
pEqn
.
flux
();
}
}
}
else
{
closedVolume
=
adjustPhi
(
phiHbyA
,
U
,
p
);
while
(
simple
.
correctNonOrthogonal
())
{
fvScalarMatrix
pEqn
(
fvc
::
div
(
phiHbyA
)
-
fvm
::
laplacian
(
rhorAUf
,
p
)
==
fvOptions
(
psi
,
p
,
rho
.
name
())
);
pEqn
.
setReference
(
pressureControl
.
refCell
(),
pressureControl
.
refValue
()
);
pEqn
.
solve
();
if
(
simple
.
finalNonOrthogonalIter
())
{
phi
=
phiHbyA
+
pEqn
.
flux
();
}
}
}
#include "incompressible/continuityErrs.H"
// Explicitly relax pressure for momentum corrector
p
.
relax
();
U
=
HbyA
-
rAU
*
fvc
::
grad
(
p
);
U
.
correctBoundaryConditions
();
fvOptions
.
correct
(
U
);
bool
pLimited
=
pressureControl
.
limit
(
p
);
// For closed-volume cases adjust the pressure and density levels
// to obey overall mass continuity
if
(
closedVolume
)
{
p
+=
(
initialMass
-
fvc
::
domainIntegrate
(
psi
*
p
))
/
fvc
::
domainIntegrate
(
psi
);
}
if
(
pLimited
||
closedVolume
)
{
p
.
correctBoundaryConditions
();
}
rho
=
thermo
.
rho
();
if
(
!
simple
.
transonic
())
{
rho
.
relax
();
}
applications/solvers/compressible/rhoSimpleFoam/pcEqn.H
0 → 100644
View file @
ea17556c
rho
=
thermo
.
rho
();
volScalarField
rAU
(
1
.
0
/
UEqn
.
A
());
volScalarField
rAtU
(
1
.
0
/
(
1
.
0
/
rAU
-
UEqn
.
H1
()));
volVectorField
HbyA
(
constrainHbyA
(
rAU
*
UEqn
.
H
(),
U
,
p
));
tUEqn
.
clear
();
bool
closedVolume
=
false
;
surfaceScalarField
phiHbyA
(
"phiHbyA"
,
fvc
::
interpolate
(
rho
)
*
fvc
::
flux
(
HbyA
));
MRF
.
makeRelative
(
fvc
::
interpolate
(
rho
),
phiHbyA
);
volScalarField
rhorAtU
(
"rhorAtU"
,
rho
*
rAtU
);
// Update the pressure BCs to ensure flux consistency
constrainPressure
(
p
,
rho
,
U
,
phiHbyA
,
rhorAtU
,
MRF
);
if
(
simple
.
transonic
())
{
surfaceScalarField
phid
(
"phid"
,
(
fvc
::
interpolate
(
psi
)
/
fvc
::
interpolate
(
rho
))
*
phiHbyA
);
phiHbyA
+=
fvc
::
interpolate
(
rho
*
(
rAtU
-
rAU
))
*
fvc
::
snGrad
(
p
)
*
mesh
.
magSf
()
-
fvc
::
interpolate
(
psi
*
p
)
*
phiHbyA
/
fvc
::
interpolate
(
rho
);
HbyA
-=
(
rAU
-
rAtU
)
*
fvc
::
grad
(
p
);
while
(
simple
.
correctNonOrthogonal
())
{
fvScalarMatrix
pEqn
(
fvc
::
div
(
phiHbyA
)
+
fvm
::
div
(
phid
,
p
)
-
fvm
::
laplacian
(
rhorAtU
,
p
)
==
fvOptions
(
psi
,
p
,
rho
.
name
())
);
// Relax the pressure equation to maintain diagonal dominance
pEqn
.
relax
();
pEqn
.
setReference
(
pressureControl
.
refCell
(),
pressureControl
.
refValue
()
);
pEqn
.
solve
();
if
(
simple
.
finalNonOrthogonalIter
())
{
phi
=
phiHbyA
+
pEqn
.
flux
();
}
}
}
else
{
closedVolume
=
adjustPhi
(
phiHbyA
,
U
,
p
);
phiHbyA
+=
fvc
::
interpolate
(
rho
*
(
rAtU
-
rAU
))
*
fvc
::
snGrad
(
p
)
*
mesh
.
magSf
();
HbyA
-=
(
rAU
-
rAtU
)
*
fvc
::
grad
(
p
);
while
(
simple
.
correctNonOrthogonal
())
{
fvScalarMatrix
pEqn
(
fvc
::
div
(
phiHbyA
)
-
fvm
::
laplacian
(
rhorAtU
,
p
)
==
fvOptions
(
psi
,
p
,
rho
.
name
())
);
pEqn
.
setReference
(
pressureControl
.
refCell
(),
pressureControl
.
refValue
()
);
pEqn
.
solve
();
if
(
simple
.
finalNonOrthogonalIter
())
{
phi
=
phiHbyA
+
pEqn
.
flux
();
}
}
}
// The incompressible form of the continuity error check is appropriate for
// steady-state compressible also.
#include "incompressible/continuityErrs.H"
// Explicitly relax pressure for momentum corrector
p
.
relax
();
U
=
HbyA
-
rAtU
*
fvc
::
grad
(
p
);
U
.
correctBoundaryConditions
();
fvOptions
.
correct
(
U
);
bool
pLimited
=
pressureControl
.
limit
(
p
);
// For closed-volume cases adjust the pressure and density levels
// to obey overall mass continuity
if
(
closedVolume
)
{
p
+=
(
initialMass
-
fvc
::
domainIntegrate
(
psi
*
p
))
/
fvc
::
domainIntegrate
(
psi
);
}
if
(
pLimited
||
closedVolume
)
{
p
.
correctBoundaryConditions
();
}
rho
=
thermo
.
rho
();
if
(
!
simple
.
transonic
())
{
rho
.
relax
();
}
applications/solvers/compressible/rhoSimpleFoam/rhoPorousSimpleFoam/Make/files
0 → 100644
View file @
ea17556c
rhoPorousSimpleFoam.C
EXE = $(FOAM_APPBIN)/rhoPorousSimpleFoam
Prev
1
…
9
10
11
12
13
14
15
16
17
…
40
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment