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
937 additions
and
0 deletions
+937
-0
applications/solvers/incompressible/pimpleFoam-GPU/UEqn.H
applications/solvers/incompressible/pimpleFoam-GPU/UEqn.H
+24
-0
applications/solvers/incompressible/pimpleFoam-GPU/correctPhi.H
...ations/solvers/incompressible/pimpleFoam-GPU/correctPhi.H
+11
-0
applications/solvers/incompressible/pimpleFoam-GPU/createFields.H
...ions/solvers/incompressible/pimpleFoam-GPU/createFields.H
+48
-0
applications/solvers/incompressible/pimpleFoam-GPU/gpumeshCourantNo.H
.../solvers/incompressible/pimpleFoam-GPU/gpumeshCourantNo.H
+52
-0
applications/solvers/incompressible/pimpleFoam-GPU/pEqn.H
applications/solvers/incompressible/pimpleFoam-GPU/pEqn.H
+69
-0
applications/solvers/incompressible/pimpleFoam-GPU/pimpleFoam.C
...ations/solvers/incompressible/pimpleFoam-GPU/pimpleFoam.C
+208
-0
applications/solvers/incompressible/pimpleFoam-GPU/setRDeltaT.H
...ations/solvers/incompressible/pimpleFoam-GPU/setRDeltaT.H
+69
-0
applications/solvers/incompressible/pimpleFoam/Make/files
applications/solvers/incompressible/pimpleFoam/Make/files
+3
-0
applications/solvers/incompressible/pimpleFoam/Make/options
applications/solvers/incompressible/pimpleFoam/Make/options
+25
-0
applications/solvers/incompressible/pimpleFoam/SRFPimpleFoam/Make/files
...olvers/incompressible/pimpleFoam/SRFPimpleFoam/Make/files
+3
-0
applications/solvers/incompressible/pimpleFoam/SRFPimpleFoam/Make/options
...vers/incompressible/pimpleFoam/SRFPimpleFoam/Make/options
+18
-0
applications/solvers/incompressible/pimpleFoam/SRFPimpleFoam/SRFPimpleFoam.C
...s/incompressible/pimpleFoam/SRFPimpleFoam/SRFPimpleFoam.C
+116
-0
applications/solvers/incompressible/pimpleFoam/SRFPimpleFoam/UrelEqn.H
...solvers/incompressible/pimpleFoam/SRFPimpleFoam/UrelEqn.H
+19
-0
applications/solvers/incompressible/pimpleFoam/SRFPimpleFoam/createFields.H
...rs/incompressible/pimpleFoam/SRFPimpleFoam/createFields.H
+75
-0
applications/solvers/incompressible/pimpleFoam/SRFPimpleFoam/pEqn.H
...ns/solvers/incompressible/pimpleFoam/SRFPimpleFoam/pEqn.H
+58
-0
applications/solvers/incompressible/pimpleFoam/UEqn.H
applications/solvers/incompressible/pimpleFoam/UEqn.H
+24
-0
applications/solvers/incompressible/pimpleFoam/correctPhi.H
applications/solvers/incompressible/pimpleFoam/correctPhi.H
+11
-0
applications/solvers/incompressible/pimpleFoam/createFields.H
...ications/solvers/incompressible/pimpleFoam/createFields.H
+48
-0
applications/solvers/incompressible/pimpleFoam/overPimpleDyMFoam/CourantNo.H
...s/incompressible/pimpleFoam/overPimpleDyMFoam/CourantNo.H
+53
-0
applications/solvers/incompressible/pimpleFoam/overPimpleDyMFoam/Make/files
...rs/incompressible/pimpleFoam/overPimpleDyMFoam/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/incompressible/pimpleFoam-GPU/UEqn.H
0 → 100644
View file @
ea17556c
// Solve the Momentum equation
MRF
.
correctBoundaryVelocity
(
U
);
tmp
<
gpufvVectorMatrix
>
tUEqn
(
fvm
::
ddt
(
U
)
+
fvm
::
div
(
phi
,
U
)
+
MRF
.
DDt
(
U
)
+
turbulence
->
divDevReff
(
U
)
==
fvOptions
(
U
)
);
gpufvVectorMatrix
&
UEqn
=
tUEqn
.
ref
();
UEqn
.
relax
();
fvOptions
.
constrain
(
UEqn
);
if
(
pimple
.
momentumPredictor
())
{
solve
(
UEqn
==
-
fvc
::
grad
(
p
));
fvOptions
.
correct
(
U
);
}
applications/solvers/incompressible/pimpleFoam-GPU/correctPhi.H
0 → 100644
View file @
ea17556c
CorrectPhi
(
U
,
phi
,
p
,
dimensionedScalar
(
"rAUf"
,
dimTime
,
1
),
geometricZeroField
(),
pimple
);
#include "gpucontinuityErrs.H"
applications/solvers/incompressible/pimpleFoam-GPU/createFields.H
0 → 100644
View file @
ea17556c
#include "gpucreateRDeltaT.H"
Info
<<
"Reading field p
\n
"
<<
endl
;
volScalargpuField
p
(
IOobject
(
"p"
,
runTime
.
timeName
(),
mesh
,
IOobject
::
MUST_READ
,
IOobject
::
AUTO_WRITE
),
devicemesh
);
Info
<<
"Reading field U
\n
"
<<
endl
;
volVectorgpuField
U
(
IOobject
(
"U"
,
runTime
.
timeName
(),
mesh
,
IOobject
::
MUST_READ
,
IOobject
::
AUTO_WRITE
),
devicemesh
);
#include "gpucreatePhi.H"
label
pRefCell
=
0
;
scalar
pRefValue
=
0
.
0
;
setRefCell
(
p
,
pimple
.
dict
(),
pRefCell
,
pRefValue
);
mesh
.
setFluxRequired
(
p
.
name
());
singlePhaseTransportModel
laminarTransport
(
U
,
phi
);
autoPtr
<
incompressible
::
turbulenceModel
>
turbulence
(
incompressible
::
turbulenceModel
::
New
(
U
,
phi
,
laminarTransport
)
);
#include "gpucreateMRF.H"
#include "gpucreateFvOptions.H"
applications/solvers/incompressible/pimpleFoam-GPU/gpumeshCourantNo.H
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
-------------------------------------------------------------------------------
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/>.
Global
meshCourantNo
Description
Calculates and outputs the mean and maximum Courant Numbers.
\*---------------------------------------------------------------------------*/
scalar
meshCoNum
=
0
.
0
;
scalar
meanMeshCoNum
=
0
.
0
;
{
scalargpuField
sumPhi
(
fvc
::
surfaceSum
(
mag
(
devicemesh
.
phi
()))().
primitiveField
()
);
meshCoNum
=
0
.
5
*
gMax
(
sumPhi
/
devicemesh
.
V
().
field
())
*
runTime
.
deltaTValue
();
meanMeshCoNum
=
0
.
5
*
(
gSum
(
sumPhi
)
/
gSum
(
devicemesh
.
V
().
field
()))
*
runTime
.
deltaTValue
();
}
Info
<<
"Mesh Courant Number mean: "
<<
meanMeshCoNum
<<
" max: "
<<
meshCoNum
<<
endl
;
// ************************************************************************* //
applications/solvers/incompressible/pimpleFoam-GPU/pEqn.H
0 → 100644
View file @
ea17556c
volScalargpuField
rAU
(
1
.
0
/
UEqn
.
A
());
volVectorgpuField
HbyA
(
constrainHbyA
(
rAU
*
UEqn
.
H
(),
U
,
p
));
surfaceScalargpuField
phiHbyA
(
"phiHbyA"
,
fvc
::
flux
(
HbyA
));
if
(
pimple
.
ddtCorr
())
{
phiHbyA
+=
MRF
.
zeroFilter
(
fvc
::
interpolate
(
rAU
)
*
fvc
::
ddtCorr
(
U
,
phi
,
Uf
));
}
MRF
.
makeRelative
(
phiHbyA
);
if
(
p
.
needReference
())
{
fvc
::
makeRelative
(
phiHbyA
,
U
);
adjustPhi
(
phiHbyA
,
U
,
p
);
fvc
::
makeAbsolute
(
phiHbyA
,
U
);
}
tmp
<
volScalargpuField
>
rAtU
(
rAU
);
if
(
pimple
.
consistent
())
{
rAtU
=
1
.
0
/
max
(
1
.
0
/
rAU
-
UEqn
.
H1
(),
0
.
1
/
rAU
);
phiHbyA
+=
fvc
::
interpolate
(
rAtU
()
-
rAU
)
*
fvc
::
snGrad
(
p
)
*
devicemesh
.
magSf
();
//todo?devicemesh
HbyA
-=
(
rAU
-
rAtU
())
*
fvc
::
grad
(
p
);
}
if
(
pimple
.
nCorrPISO
()
<=
1
)
{
tUEqn
.
clear
();
}
// Update the pressure BCs to ensure flux consistency
constrainPressure
(
p
,
U
,
phiHbyA
,
rAtU
(),
MRF
);
// Non-orthogonal pressure corrector loop
while
(
pimple
.
correctNonOrthogonal
())
{
gpufvScalarMatrix
pEqn
(
fvm
::
laplacian
(
rAtU
(),
p
)
==
fvc
::
div
(
phiHbyA
)
);
pEqn
.
setReference
(
pRefCell
,
pRefValue
);
pEqn
.
solve
(
mesh
.
solver
(
p
.
select
(
pimple
.
finalInnerIter
())));
if
(
pimple
.
finalNonOrthogonalIter
())
{
phi
=
phiHbyA
-
pEqn
.
flux
();
}
}
#include "gpucontinuityErrs.H"
// Explicitly relax pressure for momentum corrector
p
.
relax
();
U
=
HbyA
-
rAtU
*
fvc
::
grad
(
p
);
U
.
correctBoundaryConditions
();
fvOptions
.
correct
(
U
);
// Correct Uf if the mesh is moving
fvc
::
correctUf
(
Uf
,
U
,
phi
);
// Make the fluxes relative to the mesh motion
fvc
::
makeRelative
(
phi
,
U
);
applications/solvers/incompressible/pimpleFoam-GPU/pimpleFoam.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
pimpleFoam.C
Group
grpIncompressibleSolvers
Description
Transient solver for incompressible, turbulent flow of Newtonian fluids
on a moving mesh.
\heading Solver details
The solver uses the PIMPLE (merged PISO-SIMPLE) algorithm to solve the
continuity equation:
\f[
\div \vec{U} = 0
\f]
and momentum equation:
\f[
\ddt{\vec{U}} + \div \left( \vec{U} \vec{U} \right) - \div \gvec{R}
= - \grad p + \vec{S}_U
\f]
Where:
\vartable
\vec{U} | Velocity
p | Pressure
\vec{R} | Stress tensor
\vec{S}_U | Momentum source
\endvartable
Sub-models include:
- turbulence modelling, i.e. laminar, RAS or LES
- run-time selectable MRF and finite volume options, e.g. explicit porosity
\heading Required fields
\plaintable
U | Velocity [m/s]
p | Kinematic pressure, p/rho [m2/s2]
\<turbulence fields\> | As required by user selection
\endplaintable
Note
The motion frequency of this solver can be influenced by the presence
of "updateControl" and "updateInterval" in the dynamicMeshDict.
\*---------------------------------------------------------------------------*/
#include "gpufvCFD.H"
#include "dynamicFvMesh.H"
#include "singlePhaseTransportModel.H"
#include "turbulentTransportModel.H"
#include "pimpleControl.H"
#include "gpuCorrectPhi.H"
#include "gpufvOptions.H"
#include "gpulocalEulerDdtScheme.H"
#include "gpufvcSmooth.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int
main
(
int
argc
,
char
*
argv
[])
{
argList
::
addNote
(
"Transient solver for incompressible, turbulent flow"
" of Newtonian fluids on a moving mesh."
);
#include "gpupostProcess.H"
#include "addCheckCaseOptions.H"
#include "setRootCaseLists.H"
#include "createTime.H"
#include "createDynamicFvMesh.H"
Foam
::
gpufvMesh
devicemesh
(
mesh
);
#include "initContinuityErrs.H"
#include "createDyMControls.H"
#include "createFields.H"
#include "gpucreateUfIfPresent.H"
#include "gpuCourantNo.H"
#include "setInitialDeltaT.H"
turbulence
->
validate
();
if
(
!
LTS
)
{
#include "gpuCourantNo.H"
#include "setInitialDeltaT.H"
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Info
<<
"
\n
Starting time loop
\n
"
<<
endl
;
while
(
runTime
.
run
())
{
#include "readDyMControls.H"
if
(
LTS
)
{
#include "setRDeltaT.H"
}
else
{
#include "gpuCourantNo.H"
#include "setDeltaT.H"
}
++
runTime
;
Info
<<
"Time = "
<<
runTime
.
timeName
()
<<
nl
<<
endl
;
// --- Pressure-velocity PIMPLE corrector loop
while
(
pimple
.
loop
())
{
// todo in loop
if
(
pimple
.
firstIter
()
||
moveMeshOuterCorrectors
)
{
// Do any mesh changes
mesh
.
controlledUpdate
();
if
(
mesh
.
changing
())
{
//update mesh geometry
devicemesh
.
updateGpuGeom
();
U
.
correctBoundaryConditions
();
MRF
.
update
();
if
(
correctPhi
)
{
// Calculate absolute flux
// from the mapped surface velocity
phi
=
devicemesh
.
Sf
()
&
Uf
();
#include "correctPhi.H"
// Make the flux relative to the mesh motion
fvc
::
makeRelative
(
phi
,
U
);
}
if
(
checkMeshCourantNo
)
{
#include "gpumeshCourantNo.H" //todo
}
}
}
#include "UEqn.H"
// --- Pressure corrector loop
while
(
pimple
.
correct
())
{
#include "pEqn.H"
}
if
(
pimple
.
turbCorr
())
{
laminarTransport
.
correct
();
turbulence
->
correct
();
}
}
runTime
.
write
();
runTime
.
printExecutionTime
(
Info
);
}
Info
<<
"End
\n
"
<<
endl
;
return
0
;
}
// ************************************************************************* //
applications/solvers/incompressible/pimpleFoam-GPU/setRDeltaT.H
0 → 100644
View file @
ea17556c
{
volScalargpuField
&
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
)
);
volScalargpuField
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
)
*
devicemesh
.
V
())
);
// 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/incompressible/pimpleFoam/Make/files
0 → 100644
View file @
ea17556c
pimpleFoam.C
EXE = $(FOAM_APPBIN)/pimpleFoam
applications/solvers/incompressible/pimpleFoam/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)/TurbulenceModels/turbulenceModels/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/incompressible/lnInclude \
-I$(LIB_SRC)/transportModels \
-I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \
-I$(LIB_SRC)/dynamicMesh/lnInclude \
-I$(LIB_SRC)/dynamicFvMesh/lnInclude \
-I$(LIB_SRC)/regionFaModels\lnInclude
EXE_LIBS = \
-lfiniteVolume \
-lfvOptions \
-lmeshTools \
-lsampling \
-lturbulenceModels \
-lincompressibleTurbulenceModels \
-lincompressibleTransportModels \
-ldynamicMesh \
-ldynamicFvMesh \
-ltopoChangerFvMesh \
-latmosphericModels \
-lregionFaModels
applications/solvers/incompressible/pimpleFoam/SRFPimpleFoam/Make/files
0 → 100644
View file @
ea17556c
SRFPimpleFoam.C
EXE = $(FOAM_APPBIN)/SRFPimpleFoam
applications/solvers/incompressible/pimpleFoam/SRFPimpleFoam/Make/options
0 → 100644
View file @
ea17556c
EXE_INC = \
-I.. \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/sampling/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/incompressible/lnInclude \
-I$(LIB_SRC)/transportModels \
-I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel
EXE_LIBS = \
-lfiniteVolume \
-lfvOptions \
-lmeshTools \
-lsampling \
-lturbulenceModels \
-lincompressibleTurbulenceModels \
-lincompressibleTransportModels
applications/solvers/incompressible/pimpleFoam/SRFPimpleFoam/SRFPimpleFoam.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
-------------------------------------------------------------------------------
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
SRFPimpleFoam
Group
grpIncompressibleSolvers
Description
Large time-step transient solver for incompressible flow
in a single rotating frame.
Turbulence modelling is generic, i.e. laminar, RAS or LES may be selected.
\*---------------------------------------------------------------------------*/
#include "fvCFD.H"
#include "singlePhaseTransportModel.H"
#include "turbulentTransportModel.H"
#include "pimpleControl.H"
#include "SRFModel.H"
#include "fvOptions.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int
main
(
int
argc
,
char
*
argv
[])
{
argList
::
addNote
(
"Large time-step transient solver for incompressible flow"
" in a single rotating frame."
);
#include "postProcess.H"
#include "addCheckCaseOptions.H"
#include "setRootCaseLists.H"
#include "createTime.H"
#include "createMesh.H"
#include "createControl.H"
#include "createTimeControls.H"
#include "createFields.H"
#include "initContinuityErrs.H"
turbulence
->
validate
();
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Info
<<
"
\n
Starting time loop
\n
"
<<
endl
;
while
(
runTime
.
run
())
{
#include "readTimeControls.H"
#include "CourantNo.H"
#include "setDeltaT.H"
++
runTime
;
Info
<<
"Time = "
<<
runTime
.
timeName
()
<<
nl
<<
endl
;
// --- Pressure-velocity PIMPLE corrector loop
while
(
pimple
.
loop
())
{
#include "UrelEqn.H"
// --- Pressure corrector loop
while
(
pimple
.
correct
())
{
#include "pEqn.H"
}
// Update the absolute velocity
U
=
Urel
+
SRF
->
U
();
if
(
pimple
.
turbCorr
())
{
laminarTransport
.
correct
();
turbulence
->
correct
();
}
}
runTime
.
write
();
runTime
.
printExecutionTime
(
Info
);
}
Info
<<
"End
\n
"
<<
endl
;
return
0
;
}
// ************************************************************************* //
applications/solvers/incompressible/pimpleFoam/SRFPimpleFoam/UrelEqn.H
0 → 100644
View file @
ea17556c
// Relative momentum predictor
tmp
<
fvVectorMatrix
>
tUrelEqn
(
fvm
::
ddt
(
Urel
)
+
fvm
::
div
(
phi
,
Urel
)
+
turbulence
->
divDevReff
(
Urel
)
+
SRF
->
Su
()
==
fvOptions
(
Urel
)
);
fvVectorMatrix
&
UrelEqn
=
tUrelEqn
.
ref
();
UrelEqn
.
relax
();
fvOptions
.
constrain
(
UrelEqn
);
solve
(
UrelEqn
==
-
fvc
::
grad
(
p
));
fvOptions
.
correct
(
Urel
);
applications/solvers/incompressible/pimpleFoam/SRFPimpleFoam/createFields.H
0 → 100644
View file @
ea17556c
Info
<<
"Reading field p
\n
"
<<
endl
;
volScalarField
p
(
IOobject
(
"p"
,
runTime
.
timeName
(),
mesh
,
IOobject
::
MUST_READ
,
IOobject
::
AUTO_WRITE
),
mesh
);
Info
<<
"Reading field Urel
\n
"
<<
endl
;
volVectorField
Urel
(
IOobject
(
"Urel"
,
runTime
.
timeName
(),
mesh
,
IOobject
::
MUST_READ
,
IOobject
::
AUTO_WRITE
),
mesh
);
Info
<<
"Reading/calculating face flux field phi
\n
"
<<
endl
;
surfaceScalarField
phi
(
IOobject
(
"phi"
,
runTime
.
timeName
(),
mesh
,
IOobject
::
READ_IF_PRESENT
,
IOobject
::
AUTO_WRITE
),
linearInterpolate
(
Urel
)
&
mesh
.
Sf
()
);
label
pRefCell
=
0
;
scalar
pRefValue
=
0
.
0
;
setRefCell
(
p
,
pimple
.
dict
(),
pRefCell
,
pRefValue
);
mesh
.
setFluxRequired
(
p
.
name
());
Info
<<
"Creating SRF model
\n
"
<<
endl
;
autoPtr
<
SRF
::
SRFModel
>
SRF
(
SRF
::
SRFModel
::
New
(
Urel
)
);
// Create the absolute velocity
volVectorField
U
(
IOobject
(
"U"
,
runTime
.
timeName
(),
mesh
,
IOobject
::
NO_READ
,
IOobject
::
AUTO_WRITE
),
Urel
+
SRF
->
U
()
);
singlePhaseTransportModel
laminarTransport
(
U
,
phi
);
autoPtr
<
incompressible
::
turbulenceModel
>
turbulence
(
incompressible
::
turbulenceModel
::
New
(
U
,
phi
,
laminarTransport
)
);
#include "createFvOptions.H"
applications/solvers/incompressible/pimpleFoam/SRFPimpleFoam/pEqn.H
0 → 100644
View file @
ea17556c
volScalarField
rAUrel
(
1
.
0
/
UrelEqn
.
A
());
volVectorField
HbyA
(
"HbyA"
,
Urel
);
HbyA
=
rAUrel
*
UrelEqn
.
H
();
surfaceScalarField
phiHbyA
(
"phiHbyA"
,
fvc
::
flux
(
HbyA
)
+
fvc
::
interpolate
(
rAUrel
)
*
fvc
::
ddtCorr
(
Urel
,
phi
)
);
adjustPhi
(
phiHbyA
,
Urel
,
p
);
tmp
<
volScalarField
>
rAtUrel
(
rAUrel
);
if
(
pimple
.
consistent
())
{
rAtUrel
=
1
.
0
/
max
(
1
.
0
/
rAUrel
-
UrelEqn
.
H1
(),
0
.
1
/
rAUrel
);
phiHbyA
+=
fvc
::
interpolate
(
rAtUrel
()
-
rAUrel
)
*
fvc
::
snGrad
(
p
)
*
mesh
.
magSf
();
HbyA
-=
(
rAUrel
-
rAtUrel
())
*
fvc
::
grad
(
p
);
}
if
(
pimple
.
nCorrPISO
()
<=
1
)
{
tUrelEqn
.
clear
();
}
// Update the pressure BCs to ensure flux consistency
constrainPressure
(
p
,
Urel
,
phiHbyA
,
rAtUrel
());
// Non-orthogonal pressure corrector loop
while
(
pimple
.
correctNonOrthogonal
())
{
// Pressure corrector
fvScalarMatrix
pEqn
(
fvm
::
laplacian
(
rAtUrel
(),
p
)
==
fvc
::
div
(
phiHbyA
)
);
pEqn
.
setReference
(
pRefCell
,
pRefValue
);
pEqn
.
solve
(
mesh
.
solver
(
p
.
select
(
pimple
.
finalInnerIter
())));
if
(
pimple
.
finalNonOrthogonalIter
())
{
phi
=
phiHbyA
-
pEqn
.
flux
();
}
}
#include "continuityErrs.H"
p
.
relax
();
// Momentum corrector
Urel
=
HbyA
-
rAtUrel
()
*
fvc
::
grad
(
p
);
Urel
.
correctBoundaryConditions
();
fvOptions
.
correct
(
Urel
);
applications/solvers/incompressible/pimpleFoam/UEqn.H
0 → 100644
View file @
ea17556c
// Solve the Momentum equation
MRF
.
correctBoundaryVelocity
(
U
);
tmp
<
fvVectorMatrix
>
tUEqn
(
fvm
::
ddt
(
U
)
+
fvm
::
div
(
phi
,
U
)
+
MRF
.
DDt
(
U
)
+
turbulence
->
divDevReff
(
U
)
==
fvOptions
(
U
)
);
fvVectorMatrix
&
UEqn
=
tUEqn
.
ref
();
UEqn
.
relax
();
fvOptions
.
constrain
(
UEqn
);
if
(
pimple
.
momentumPredictor
())
{
solve
(
UEqn
==
-
fvc
::
grad
(
p
));
fvOptions
.
correct
(
U
);
}
applications/solvers/incompressible/pimpleFoam/correctPhi.H
0 → 100644
View file @
ea17556c
CorrectPhi
(
U
,
phi
,
p
,
dimensionedScalar
(
"rAUf"
,
dimTime
,
1
),
geometricZeroField
(),
pimple
);
#include "continuityErrs.H"
applications/solvers/incompressible/pimpleFoam/createFields.H
0 → 100644
View file @
ea17556c
#include "createRDeltaT.H"
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
,
pimple
.
dict
(),
pRefCell
,
pRefValue
);
mesh
.
setFluxRequired
(
p
.
name
());
singlePhaseTransportModel
laminarTransport
(
U
,
phi
);
autoPtr
<
incompressible
::
turbulenceModel
>
turbulence
(
incompressible
::
turbulenceModel
::
New
(
U
,
phi
,
laminarTransport
)
);
#include "createMRF.H"
#include "createFvOptions.H"
applications/solvers/incompressible/pimpleFoam/overPimpleDyMFoam/CourantNo.H
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 OpenFOAM Foundation
Copyright (C) 2016 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/>.
Global
CourantNo
Description
Calculates and outputs the mean and maximum Courant Numbers.
\*---------------------------------------------------------------------------*/
scalar
CoNum
=
0
.
0
;
scalar
meanCoNum
=
0
.
0
;
if
(
mesh
.
nInternalFaces
())
{
surfaceScalarField
phiMask
(
localMin
<
scalar
>
(
mesh
).
interpolate
(
cellMask
));
scalarField
sumPhi
(
fvc
::
surfaceSum
(
mag
(
phiMask
*
phi
))().
internalField
());
CoNum
=
0
.
5
*
gMax
(
sumPhi
/
mesh
.
V
().
field
())
*
runTime
.
deltaTValue
();
meanCoNum
=
0
.
5
*
(
gSum
(
sumPhi
)
/
gSum
(
mesh
.
V
().
field
()))
*
runTime
.
deltaTValue
();
}
Info
<<
"Courant Number mean: "
<<
meanCoNum
<<
" max: "
<<
CoNum
<<
endl
;
// ************************************************************************* //
applications/solvers/incompressible/pimpleFoam/overPimpleDyMFoam/Make/files
0 → 100644
View file @
ea17556c
overPimpleDyMFoam.C
EXE = $(FOAM_APPBIN)/overPimpleDyMFoam
Prev
1
…
21
22
23
24
25
26
27
28
29
…
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