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
1228 additions
and
0 deletions
+1228
-0
applications/solvers/heatTransfer/buoyantPimpleFoam/EEqn.H
applications/solvers/heatTransfer/buoyantPimpleFoam/EEqn.H
+35
-0
applications/solvers/heatTransfer/buoyantPimpleFoam/Make/files
...cations/solvers/heatTransfer/buoyantPimpleFoam/Make/files
+3
-0
applications/solvers/heatTransfer/buoyantPimpleFoam/Make/options
...tions/solvers/heatTransfer/buoyantPimpleFoam/Make/options
+30
-0
applications/solvers/heatTransfer/buoyantPimpleFoam/UEqn.H
applications/solvers/heatTransfer/buoyantPimpleFoam/UEqn.H
+35
-0
applications/solvers/heatTransfer/buoyantPimpleFoam/buoyantPimpleFoam.C
...olvers/heatTransfer/buoyantPimpleFoam/buoyantPimpleFoam.C
+198
-0
applications/solvers/heatTransfer/buoyantPimpleFoam/createFieldRefs.H
.../solvers/heatTransfer/buoyantPimpleFoam/createFieldRefs.H
+1
-0
applications/solvers/heatTransfer/buoyantPimpleFoam/createFields.H
...ons/solvers/heatTransfer/buoyantPimpleFoam/createFields.H
+113
-0
applications/solvers/heatTransfer/buoyantPimpleFoam/overBuoyantPimpleDyMFoam/Make/files
...fer/buoyantPimpleFoam/overBuoyantPimpleDyMFoam/Make/files
+3
-0
applications/solvers/heatTransfer/buoyantPimpleFoam/overBuoyantPimpleDyMFoam/Make/options
...r/buoyantPimpleFoam/overBuoyantPimpleDyMFoam/Make/options
+30
-0
applications/solvers/heatTransfer/buoyantPimpleFoam/overBuoyantPimpleDyMFoam/correctPhi.H
...r/buoyantPimpleFoam/overBuoyantPimpleDyMFoam/correctPhi.H
+91
-0
applications/solvers/heatTransfer/buoyantPimpleFoam/overBuoyantPimpleDyMFoam/createFieldRefs.H
...yantPimpleFoam/overBuoyantPimpleDyMFoam/createFieldRefs.H
+1
-0
applications/solvers/heatTransfer/buoyantPimpleFoam/overBuoyantPimpleDyMFoam/createFields.H
...buoyantPimpleFoam/overBuoyantPimpleDyMFoam/createFields.H
+126
-0
applications/solvers/heatTransfer/buoyantPimpleFoam/overBuoyantPimpleDyMFoam/overBuoyantPimpleDyMFoam.C
...eFoam/overBuoyantPimpleDyMFoam/overBuoyantPimpleDyMFoam.C
+213
-0
applications/solvers/heatTransfer/buoyantPimpleFoam/overBuoyantPimpleDyMFoam/pEqn.H
...ransfer/buoyantPimpleFoam/overBuoyantPimpleDyMFoam/pEqn.H
+129
-0
applications/solvers/heatTransfer/buoyantPimpleFoam/overBuoyantPimpleDyMFoam/readControls.H
...buoyantPimpleFoam/overBuoyantPimpleDyMFoam/readControls.H
+9
-0
applications/solvers/heatTransfer/buoyantPimpleFoam/pEqn.H
applications/solvers/heatTransfer/buoyantPimpleFoam/pEqn.H
+120
-0
applications/solvers/heatTransfer/buoyantSimpleFoam/EEqn.H
applications/solvers/heatTransfer/buoyantSimpleFoam/EEqn.H
+29
-0
applications/solvers/heatTransfer/buoyantSimpleFoam/Make/files
...cations/solvers/heatTransfer/buoyantSimpleFoam/Make/files
+3
-0
applications/solvers/heatTransfer/buoyantSimpleFoam/Make/options
...tions/solvers/heatTransfer/buoyantSimpleFoam/Make/options
+24
-0
applications/solvers/heatTransfer/buoyantSimpleFoam/UEqn.H
applications/solvers/heatTransfer/buoyantSimpleFoam/UEqn.H
+35
-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/heatTransfer/buoyantPimpleFoam/EEqn.H
0 → 100644
View file @
ea17556c
{
volScalarField
&
he
=
thermo
.
he
();
fvScalarMatrix
EEqn
(
fvm
::
ddt
(
rho
,
he
)
+
fvm
::
div
(
phi
,
he
)
+
fvc
::
ddt
(
rho
,
K
)
+
fvc
::
div
(
phi
,
K
)
+
(
he
.
name
()
==
"e"
?
fvc
::
div
(
fvc
::
absolute
(
phi
/
fvc
::
interpolate
(
rho
),
U
),
p
,
"div(phiv,p)"
)
:
-
dpdt
)
-
fvm
::
laplacian
(
turbulence
->
alphaEff
(),
he
)
==
rho
*
(
U
&
g
)
+
radiation
->
Sh
(
thermo
,
he
)
+
fvOptions
(
rho
,
he
)
);
EEqn
.
relax
();
fvOptions
.
constrain
(
EEqn
);
EEqn
.
solve
();
fvOptions
.
correct
(
he
);
thermo
.
correct
();
radiation
->
correct
();
}
applications/solvers/heatTransfer/buoyantPimpleFoam/Make/files
0 → 100644
View file @
ea17556c
buoyantPimpleFoam.C
EXE = $(FOAM_APPBIN)/buoyantPimpleFoam
applications/solvers/heatTransfer/buoyantPimpleFoam/Make/options
0 → 100644
View file @
ea17556c
EXE_INC = \
-I../../compressible/rhoPimpleFoam \
-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)/thermophysicalModels/radiation/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)/regionFaModels\lnInclude
EXE_LIBS = \
-lfiniteVolume \
-lfvOptions \
-lmeshTools \
-lsampling \
-lcompressibleTransportModels \
-lfluidThermophysicalModels \
-lradiationModels \
-lspecie \
-lturbulenceModels \
-lcompressibleTurbulenceModels \
-latmosphericModels \
-ldynamicMesh \
-ldynamicFvMesh \
-ltopoChangerFvMesh \
-lregionFaModels
applications/solvers/heatTransfer/buoyantPimpleFoam/UEqn.H
0 → 100644
View file @
ea17556c
// Solve the Momentum equation
MRF
.
correctBoundaryVelocity
(
U
);
fvVectorMatrix
UEqn
(
fvm
::
ddt
(
rho
,
U
)
+
fvm
::
div
(
phi
,
U
)
+
MRF
.
DDt
(
rho
,
U
)
+
turbulence
->
divDevRhoReff
(
U
)
==
fvOptions
(
rho
,
U
)
);
UEqn
.
relax
();
fvOptions
.
constrain
(
UEqn
);
if
(
pimple
.
momentumPredictor
())
{
solve
(
UEqn
==
fvc
::
reconstruct
(
(
-
ghf
*
fvc
::
snGrad
(
rho
)
-
fvc
::
snGrad
(
p_rgh
)
)
*
mesh
.
magSf
()
)
);
fvOptions
.
correct
(
U
);
K
=
0
.
5
*
magSqr
(
U
);
}
applications/solvers/heatTransfer/buoyantPimpleFoam/buoyantPimpleFoam.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) 2021 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
buoyantPimpleFoam
Group
grpHeatTransferSolvers
Description
Transient solver for buoyant, turbulent flow of compressible fluids
for ventilation and heat-transfer, with optional mesh motion
and mesh topology changes.
Turbulence is modelled using a run-time selectable compressible RAS or
LES model.
\*---------------------------------------------------------------------------*/
#include "fvCFD.H"
#include "dynamicFvMesh.H"
#include "rhoThermo.H"
#include "turbulentFluidThermoModel.H"
#include "radiationModel.H"
#include "CorrectPhi.H"
#include "fvOptions.H"
#include "pimpleControl.H"
#include "pressureControl.H"
#include "localEulerDdtScheme.H"
#include "fvcSmooth.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int
main
(
int
argc
,
char
*
argv
[])
{
argList
::
addNote
(
"Transient solver for buoyant, turbulent fluid flow"
" of compressible fluids, including radiation,"
" 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
.
update
();
if
(
mesh
.
changing
())
{
gh
=
(
g
&
mesh
.
C
())
-
ghRef
;
ghf
=
(
g
&
mesh
.
Cf
())
-
ghRef
;
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
())
{
#include "pEqn.H"
}
if
(
pimple
.
turbCorr
())
{
turbulence
->
correct
();
}
}
rho
=
thermo
.
rho
();
runTime
.
write
();
runTime
.
printExecutionTime
(
Info
);
}
Info
<<
"End
\n
"
<<
endl
;
return
0
;
}
// ************************************************************************* //
applications/solvers/heatTransfer/buoyantPimpleFoam/createFieldRefs.H
0 → 100644
View file @
ea17556c
const
volScalarField
&
psi
=
thermo
.
psi
();
applications/solvers/heatTransfer/buoyantPimpleFoam/createFields.H
0 → 100644
View file @
ea17556c
#include "createRDeltaT.H"
Info
<<
"Reading thermophysical properties
\n
"
<<
endl
;
autoPtr
<
rhoThermo
>
pThermo
(
rhoThermo
::
New
(
mesh
));
rhoThermo
&
thermo
=
pThermo
();
thermo
.
validate
(
args
.
executable
(),
"h"
,
"e"
);
volScalarField
rho
(
IOobject
(
"rho"
,
runTime
.
timeName
(),
mesh
,
IOobject
::
NO_READ
,
IOobject
::
NO_WRITE
),
thermo
.
rho
()
);
volScalarField
&
p
=
thermo
.
p
();
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
,
pimple
.
dict
(),
false
);
Info
<<
"Creating turbulence model
\n
"
<<
endl
;
autoPtr
<
compressible
::
turbulenceModel
>
turbulence
(
compressible
::
turbulenceModel
::
New
(
rho
,
U
,
phi
,
thermo
)
);
#include "readGravitationalAcceleration.H"
#include "readhRef.H"
#include "gh.H"
Info
<<
"Reading field p_rgh
\n
"
<<
endl
;
volScalarField
p_rgh
(
IOobject
(
"p_rgh"
,
runTime
.
timeName
(),
mesh
,
IOobject
::
MUST_READ
,
IOobject
::
AUTO_WRITE
),
mesh
);
// Force p_rgh to be consistent with p
p_rgh
=
p
-
rho
*
gh
;
mesh
.
setFluxRequired
(
p_rgh
.
name
());
label
pRefCell
=
0
;
scalar
pRefValue
=
0
.
0
;
if
(
p_rgh
.
needReference
())
{
setRefCell
(
p
,
p_rgh
,
pimple
.
dict
(),
pRefCell
,
pRefValue
);
p
+=
dimensionedScalar
(
"p"
,
p
.
dimensions
(),
pRefValue
-
getRefCellValue
(
p
,
pRefCell
)
);
}
dimensionedScalar
initialMass
(
"initialMass"
,
fvc
::
domainIntegrate
(
rho
));
#include "createDpdt.H"
#include "createK.H"
#include "createMRF.H"
#include "createRadiationModel.H"
#include "createFvOptions.H"
const
dimensionedScalar
rhoMax
(
"rhoMax"
,
dimDensity
,
GREAT
,
pimple
.
dict
());
const
dimensionedScalar
rhoMin
(
"rhoMin"
,
dimDensity
,
Zero
,
pimple
.
dict
());
applications/solvers/heatTransfer/buoyantPimpleFoam/overBuoyantPimpleDyMFoam/Make/files
0 → 100644
View file @
ea17556c
overBuoyantPimpleDyMFoam.C
EXE = $(FOAM_APPBIN)/overBuoyantPimpleDyMFoam
applications/solvers/heatTransfer/buoyantPimpleFoam/overBuoyantPimpleDyMFoam/Make/options
0 → 100644
View file @
ea17556c
EXE_INC = \
-I$(FOAM_SOLVERS)/heatTransfer/buoyantPimpleFoam \
-I$(FOAM_SOLVERS)/compressible/rhoPimpleFoam/overRhoPimpleDyMFoam \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/sampling/lnInclude \
-I$(LIB_SRC)/dynamicFvMesh/lnInclude \
-I$(LIB_SRC)/dynamicMesh/lnInclude \
-I$(LIB_SRC)/overset/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/transportModels/compressible/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/radiation/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude
EXE_LIBS = \
-lfiniteVolume \
-lsampling \
-lmeshTools \
-lfvOptions \
-lcompressibleTransportModels \
-lfluidThermophysicalModels \
-lradiationModels \
-lspecie \
-lturbulenceModels \
-lcompressibleTurbulenceModels \
-latmosphericModels \
-loverset \
-ldynamicFvMesh \
-ltopoChangerFvMesh
applications/solvers/heatTransfer/buoyantPimpleFoam/overBuoyantPimpleDyMFoam/correctPhi.H
0 → 100644
View file @
ea17556c
if
(
mesh
.
changing
())
{
volVectorField
::
Boundary
&
bfld
=
U
.
boundaryFieldRef
();
forAll
(
bfld
,
patchi
)
{
if
(
bfld
[
patchi
].
fixesValue
())
{
bfld
[
patchi
].
initEvaluate
();
}
}
surfaceScalarField
::
Boundary
&
phiBfld
=
phi
.
boundaryFieldRef
();
forAll
(
bfld
,
patchi
)
{
if
(
bfld
[
patchi
].
fixesValue
())
{
bfld
[
patchi
].
evaluate
();
phiBfld
[
patchi
]
=
rho
.
boundaryField
()[
patchi
]
*
(
bfld
[
patchi
]
&
mesh
.
Sf
().
boundaryField
()[
patchi
]
);
}
}
}
// Initialize BCs list for pcorr to zero-gradient
wordList
pcorrTypes
(
p
.
boundaryField
().
size
(),
zeroGradientFvPatchScalarField
::
typeName
);
// Set BCs of pcorr to fixed-value for patches at which p is fixed
forAll
(
p
.
boundaryField
(),
patchi
)
{
if
(
p
.
boundaryField
()[
patchi
].
fixesValue
())
{
pcorrTypes
[
patchi
]
=
fixedValueFvPatchScalarField
::
typeName
;
}
}
volScalarField
pcorr
(
IOobject
(
"pcorr"
,
runTime
.
timeName
(),
mesh
,
IOobject
::
NO_READ
,
IOobject
::
NO_WRITE
),
mesh
,
dimensionedScalar
(
p
.
dimensions
(),
Zero
),
pcorrTypes
);
mesh
.
setFluxRequired
(
pcorr
.
name
());
{
dimensionedScalar
rAUf
(
"rAUf"
,
dimTime
,
1
.
0
);
while
(
pimple
.
correctNonOrthogonal
())
{
fvScalarMatrix
pcorrEqn
(
fvm
::
ddt
(
psi
,
pcorr
)
+
fvc
::
div
(
phi
)
-
fvm
::
laplacian
(
rAUf
,
pcorr
)
==
divrhoU
()
);
//pcorrEqn.solve(mesh.solver(pcorr.select(pimple.finalInnerIter())));
//Bypass virtual layer
const
dictionary
&
d
=
mesh
.
solver
(
pcorr
.
select
(
pimple
.
finalInnerIter
()
)
);
mesh
.
fvMesh
::
solve
(
pcorrEqn
,
d
);
if
(
pimple
.
finalNonOrthogonalIter
())
{
phi
+=
pcorrEqn
.
flux
();
}
}
}
applications/solvers/heatTransfer/buoyantPimpleFoam/overBuoyantPimpleDyMFoam/createFieldRefs.H
0 → 100644
View file @
ea17556c
const
volScalarField
&
psi
=
thermo
.
psi
();
applications/solvers/heatTransfer/buoyantPimpleFoam/overBuoyantPimpleDyMFoam/createFields.H
0 → 100644
View file @
ea17556c
Info
<<
"Reading thermophysical properties
\n
"
<<
endl
;
autoPtr
<
rhoThermo
>
pThermo
(
rhoThermo
::
New
(
mesh
));
rhoThermo
&
thermo
=
pThermo
();
thermo
.
validate
(
args
.
executable
(),
"h"
,
"e"
);
volScalarField
rho
(
IOobject
(
"rho"
,
runTime
.
timeName
(),
mesh
,
IOobject
::
NO_READ
,
IOobject
::
NO_WRITE
),
thermo
.
rho
()
);
volScalarField
&
p
=
thermo
.
p
();
Info
<<
"Reading field U
\n
"
<<
endl
;
volVectorField
U
(
IOobject
(
"U"
,
runTime
.
timeName
(),
mesh
,
IOobject
::
MUST_READ
,
IOobject
::
AUTO_WRITE
),
mesh
);
#include "compressibleCreatePhi.H"
Info
<<
"Creating turbulence model
\n
"
<<
endl
;
autoPtr
<
compressible
::
turbulenceModel
>
turbulence
(
compressible
::
turbulenceModel
::
New
(
rho
,
U
,
phi
,
thermo
)
);
#include "readGravitationalAcceleration.H"
#include "readhRef.H"
#include "gh.H"
Info
<<
"Reading field p_rgh
\n
"
<<
endl
;
volScalarField
p_rgh
(
IOobject
(
"p_rgh"
,
runTime
.
timeName
(),
mesh
,
IOobject
::
MUST_READ
,
IOobject
::
AUTO_WRITE
),
mesh
);
// Force p_rgh to be consistent with p
p_rgh
=
p
-
rho
*
gh
;
mesh
.
setFluxRequired
(
p_rgh
.
name
());
label
pRefCell
=
0
;
scalar
pRefValue
=
0
.
0
;
if
(
p_rgh
.
needReference
())
{
setRefCell
(
p
,
p_rgh
,
pimple
.
dict
(),
pRefCell
,
pRefValue
);
p
+=
dimensionedScalar
(
"p"
,
p
.
dimensions
(),
pRefValue
-
getRefCellValue
(
p
,
pRefCell
)
);
}
dimensionedScalar
initialMass
(
"initialMass"
,
fvc
::
domainIntegrate
(
rho
));
#include "createDpdt.H"
#include "createK.H"
#include "createMRF.H"
#include "createRadiationModel.H"
#include "createFvOptions.H"
//- Overset specific
// Add solver-specific interpolations
{
wordHashSet
&
nonInt
=
const_cast
<
wordHashSet
&>
(
Stencil
::
New
(
mesh
).
nonInterpolatedFields
());
nonInt
.
insert
(
"HbyA"
);
nonInt
.
insert
(
"grad(p_rgh)"
);
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"
applications/solvers/heatTransfer/buoyantPimpleFoam/overBuoyantPimpleDyMFoam/overBuoyantPimpleDyMFoam.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) 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
overBuoyantPimpleDymFoam
Group
grpHeatTransferSolvers
Description
Transient solver for buoyant, turbulent flow of compressible fluids for
ventilation and heat-transfer with overset feature
Turbulence is modelled using a run-time selectable compressible RAS or
LES model.
\*---------------------------------------------------------------------------*/
#include "fvCFD.H"
#include "dynamicFvMesh.H"
#include "rhoThermo.H"
#include "turbulentFluidThermoModel.H"
#include "radiationModel.H"
#include "fvOptions.H"
#include "pimpleControl.H"
#include "pressureControl.H"
#include "CorrectPhi.H"
#include "cellCellStencilObject.H"
#include "localMin.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int
main
(
int
argc
,
char
*
argv
[])
{
argList
::
addNote
(
"Transient solver for buoyant, turbulent fluid flow"
" of compressible fluids, including radiation."
);
#include "postProcess.H"
#include "addCheckCaseOptions.H"
#include "setRootCaseLists.H"
#include "createTime.H"
#include "createDynamicFvMesh.H"
#include "createDyMControls.H"
#include "createFields.H"
#include "createFieldRefs.H"
#include "initContinuityErrs.H"
#include "createRhoUfIfPresent.H"
#include "createControls.H"
#include "compressibleCourantNo.H"
#include "setInitialDeltaT.H"
turbulence
->
validate
();
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Info
<<
"
\n
Starting time loop
\n
"
<<
endl
;
while
(
runTime
.
run
())
{
#include "readTimeControls.H"
#include "readControls.H"
#include "readDyMControls.H"
#include "compressibleCourantNo.H"
#include "setDeltaT.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
))
)
);
}
++
runTime
;
Info
<<
"Time = "
<<
runTime
.
timeName
()
<<
nl
<<
endl
;
// --- Pressure-velocity PIMPLE corrector loop
while
(
pimple
.
loop
())
{
if
(
pimple
.
firstIter
()
||
moveMeshOuterCorrectors
)
{
// Do any mesh changes
mesh
.
update
();
if
(
mesh
.
changing
())
{
MRF
.
update
();
#include "setCellMask.H"
const
surfaceScalarField
faceMaskOld
(
localMin
<
scalar
>
(
mesh
).
interpolate
(
cellMask
.
oldTime
())
);
// Zero Uf on old faceMask (H-I)
rhoUf
()
*=
faceMaskOld
;
//fvc::correctRhoUf(rhoUfint, rho, U, phi);
surfaceVectorField
rhoUfint
(
fvc
::
interpolate
(
rho
*
U
));
// Update Uf and phi on new C-I faces
rhoUf
()
+=
(
1
-
faceMaskOld
)
*
rhoUfint
;
// Update Uf boundary
forAll
(
rhoUf
().
boundaryField
(),
patchI
)
{
rhoUf
().
boundaryFieldRef
()[
patchI
]
=
rhoUfint
.
boundaryField
()[
patchI
];
}
// Calculate absolute flux from the mapped surface velocity
phi
=
mesh
.
Sf
()
&
rhoUf
();
if
(
correctPhi
)
{
#include "correctPhi.H"
}
// Zero phi on current H-I
const
surfaceScalarField
faceMask
(
localMin
<
scalar
>
(
mesh
).
interpolate
(
cellMask
)
);
phi
*=
faceMask
;
U
*=
cellMask
;
// Make the fluxes relative to the mesh-motion
fvc
::
makeRelative
(
phi
,
rho
,
U
);
}
if
(
checkMeshCourantNo
)
{
#include "meshCourantNo.H"
}
}
if
(
pimple
.
firstIter
())
{
#include "rhoEqn.H"
}
#include "UEqn.H"
#include "EEqn.H"
// --- Pressure corrector loop
while
(
pimple
.
correct
())
{
#include "pEqn.H"
}
if
(
pimple
.
turbCorr
())
{
turbulence
->
correct
();
}
}
rho
=
thermo
.
rho
();
runTime
.
write
();
runTime
.
printExecutionTime
(
Info
);
}
Info
<<
"End
\n
"
<<
endl
;
return
0
;
}
// ************************************************************************* //
applications/solvers/heatTransfer/buoyantPimpleFoam/overBuoyantPimpleDyMFoam/pEqn.H
0 → 100644
View file @
ea17556c
dimensionedScalar
compressibility
=
fvc
::
domainIntegrate
(
psi
);
bool
compressible
=
(
compressibility
.
value
()
>
SMALL
);
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
());
mesh
.
interpolate
(
rAU
);
surfaceScalarField
rhorAUf
(
"rhorAUf"
,
fvc
::
interpolate
(
rho
*
rAU
));
volVectorField
HbyA
(
constrainHbyA
(
rAU
*
UEqn
.
H
(),
U
,
p_rgh
));
surfaceScalarField
phig
(
-
rhorAUf
*
ghf
*
fvc
::
snGrad
(
rho
)
*
mesh
.
magSf
());
surfaceScalarField
phiHbyA
(
"phiHbyA"
,
fvc
::
flux
(
rho
*
HbyA
)
+
phig
);
if
(
ddtCorr
)
{
surfaceScalarField
faceMaskOld
(
localMin
<
scalar
>
(
mesh
).
interpolate
(
cellMask
.
oldTime
())
);
phiHbyA
+=
faceMaskOld
*
MRF
.
zeroFilter
(
rhorAUf
*
fvc
::
ddtCorr
(
rho
,
U
,
phi
));
}
MRF
.
makeRelative
(
fvc
::
interpolate
(
rho
),
phiHbyA
);
// Update the pressure BCs to ensure flux consistency
constrainPressure
(
p_rgh
,
rho
,
U
,
phiHbyA
,
rhorAUf
,
MRF
);
fvScalarMatrix
p_rghDDtEqn
(
fvc
::
ddt
(
rho
)
+
psi
*
correction
(
fvm
::
ddt
(
p_rgh
))
+
fvc
::
div
(
phiHbyA
)
==
fvOptions
(
psi
,
p_rgh
,
rho
.
name
())
);
while
(
pimple
.
correctNonOrthogonal
())
{
fvScalarMatrix
p_rghEqn
(
p_rghDDtEqn
-
fvm
::
laplacian
(
rhorAUf
,
p_rgh
)
);
p_rghEqn
.
solve
(
mesh
.
solver
(
p_rgh
.
select
(
pimple
.
finalInnerIter
())));
if
(
pimple
.
finalNonOrthogonalIter
())
{
// Calculate the conservative fluxes
phi
=
phiHbyA
+
p_rghEqn
.
flux
();
// Explicitly relax pressure for momentum corrector
p_rgh
.
relax
();
// Correct the momentum source with the pressure gradient flux
// calculated from the relaxed pressure
U
=
cellMask
*
(
HbyA
+
rAU
*
fvc
::
reconstruct
((
phig
+
p_rghEqn
.
flux
())
/
rhorAUf
)
);
U
.
correctBoundaryConditions
();
fvOptions
.
correct
(
U
);
K
=
0
.
5
*
magSqr
(
U
);
}
}
p
=
p_rgh
+
rho
*
gh
;
#include "rhoEqn.H"
#include "compressibleContinuityErrs.H"
if
(
p_rgh
.
needReference
())
{
if
(
!
compressible
)
{
p
+=
dimensionedScalar
(
"p"
,
p
.
dimensions
(),
pRefValue
-
getRefCellValue
(
p
,
pRefCell
)
);
}
else
{
p
+=
(
initialMass
-
fvc
::
domainIntegrate
(
psi
*
p
))
/
compressibility
;
thermo
.
correctRho
(
psi
*
p
-
psip0
);
rho
=
thermo
.
rho
();
p_rgh
=
p
-
rho
*
gh
;
}
}
else
{
thermo
.
correctRho
(
psi
*
p
-
psip0
);
}
rho
=
thermo
.
rho
();
{
fvc
::
correctRhoUf
(
rhoUf
,
rho
,
U
,
phi
);
}
if
(
thermo
.
dpdt
())
{
dpdt
=
fvc
::
ddt
(
p
);
if
(
mesh
.
moving
())
{
dpdt
-=
fvc
::
div
(
fvc
::
meshPhi
(
rho
,
U
),
p
);
}
}
surfaceScalarField
faceMask
(
localMin
<
scalar
>
(
mesh
).
interpolate
(
cellMask
)
);
phi
*=
faceMask
;
applications/solvers/heatTransfer/buoyantPimpleFoam/overBuoyantPimpleDyMFoam/readControls.H
0 → 100644
View file @
ea17556c
#include "readTimeControls.H"
correctPhi
=
pimple
.
dict
().
getOrDefault
(
"correctPhi"
,
false
);
checkMeshCourantNo
=
pimple
.
dict
().
getOrDefault
(
"checkMeshCourantNo"
,
false
);
ddtCorr
=
pimple
.
dict
().
getOrDefault
(
"ddtCorr"
,
true
);
applications/solvers/heatTransfer/buoyantPimpleFoam/pEqn.H
0 → 100644
View file @
ea17556c
dimensionedScalar
compressibility
=
fvc
::
domainIntegrate
(
psi
);
bool
compressible
=
(
compressibility
.
value
()
>
SMALL
);
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
());
surfaceScalarField
rhorAUf
(
"rhorAUf"
,
fvc
::
interpolate
(
rho
*
rAU
));
volVectorField
HbyA
(
constrainHbyA
(
rAU
*
UEqn
.
H
(),
U
,
p_rgh
));
surfaceScalarField
phig
(
-
rhorAUf
*
ghf
*
fvc
::
snGrad
(
rho
)
*
mesh
.
magSf
());
surfaceScalarField
phiHbyA
(
"phiHbyA"
,
(
fvc
::
flux
(
rho
*
HbyA
)
+
MRF
.
zeroFilter
(
rhorAUf
*
fvc
::
ddtCorr
(
rho
,
U
,
phi
))
)
+
phig
);
MRF
.
makeRelative
(
fvc
::
interpolate
(
rho
),
phiHbyA
);
// Update the pressure BCs to ensure flux consistency
constrainPressure
(
p_rgh
,
rho
,
U
,
phiHbyA
,
rhorAUf
,
MRF
);
fvc
::
makeRelative
(
phiHbyA
,
rho
,
U
);
fvScalarMatrix
p_rghDDtEqn
(
fvc
::
ddt
(
rho
)
+
psi
*
correction
(
fvm
::
ddt
(
p_rgh
))
+
fvc
::
div
(
phiHbyA
)
==
fvOptions
(
psi
,
p_rgh
,
rho
.
name
())
);
while
(
pimple
.
correctNonOrthogonal
())
{
fvScalarMatrix
p_rghEqn
(
p_rghDDtEqn
-
fvm
::
laplacian
(
rhorAUf
,
p_rgh
)
);
p_rghEqn
.
setReference
(
pRefCell
,
compressible
?
getRefCellValue
(
p_rgh
,
pRefCell
)
:
pRefValue
);
p_rghEqn
.
solve
(
mesh
.
solver
(
p_rgh
.
select
(
pimple
.
finalInnerIter
())));
if
(
pimple
.
finalNonOrthogonalIter
())
{
// Calculate the conservative fluxes
phi
=
phiHbyA
+
p_rghEqn
.
flux
();
// Explicitly relax pressure for momentum corrector
p_rgh
.
relax
();
// Correct the momentum source with the pressure gradient flux
// calculated from the relaxed pressure
U
=
HbyA
+
rAU
*
fvc
::
reconstruct
((
phig
+
p_rghEqn
.
flux
())
/
rhorAUf
);
U
.
correctBoundaryConditions
();
fvOptions
.
correct
(
U
);
K
=
0
.
5
*
magSqr
(
U
);
}
}
p
=
p_rgh
+
rho
*
gh
;
pressureControl
.
limit
(
p
);
if
(
p_rgh
.
needReference
())
{
if
(
!
compressible
)
{
p
+=
dimensionedScalar
(
"p"
,
p
.
dimensions
(),
pRefValue
-
getRefCellValue
(
p
,
pRefCell
)
);
}
else
{
p
+=
(
initialMass
-
fvc
::
domainIntegrate
(
psi
*
p
))
/
compressibility
;
thermo
.
correctRho
(
psi
*
p
-
psip0
,
rhoMin
,
rhoMax
);
rho
=
thermo
.
rho
();
p_rgh
=
p
-
rho
*
gh
;
p_rgh
.
correctBoundaryConditions
();
}
}
else
{
thermo
.
correctRho
(
psi
*
p
-
psip0
,
rhoMin
,
rhoMax
);
}
#include "rhoEqn.H"
#include "compressibleContinuityErrs.H"
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/heatTransfer/buoyantSimpleFoam/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
)
==
rho
*
(
U
&
g
)
+
radiation
->
Sh
(
thermo
,
he
)
+
fvOptions
(
rho
,
he
)
);
EEqn
.
relax
();
fvOptions
.
constrain
(
EEqn
);
EEqn
.
solve
();
fvOptions
.
correct
(
he
);
thermo
.
correct
();
radiation
->
correct
();
}
applications/solvers/heatTransfer/buoyantSimpleFoam/Make/files
0 → 100644
View file @
ea17556c
buoyantSimpleFoam.C
EXE = $(FOAM_APPBIN)/buoyantSimpleFoam
applications/solvers/heatTransfer/buoyantSimpleFoam/Make/options
0 → 100644
View file @
ea17556c
EXE_INC = \
-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)/thermophysicalModels/radiation/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 \
-lradiationModels \
-lturbulenceModels \
-lcompressibleTurbulenceModels \
-latmosphericModels \
-lregionFaModels
applications/solvers/heatTransfer/buoyantSimpleFoam/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
==
fvc
::
reconstruct
(
(
-
ghf
*
fvc
::
snGrad
(
rho
)
-
fvc
::
snGrad
(
p_rgh
)
)
*
mesh
.
magSf
()
)
);
fvOptions
.
correct
(
U
);
}
Prev
1
…
15
16
17
18
19
20
21
22
23
…
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