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
55e5a777
Commit
55e5a777
authored
Oct 17, 2024
by
shunbo
Browse files
initial commit
parents
Changes
1000
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
1134 additions
and
0 deletions
+1134
-0
OpenFOAM-v2112/applications/solvers/combustion/reactingFoam/setRDeltaT.H
...applications/solvers/combustion/reactingFoam/setRDeltaT.H
+189
-0
OpenFOAM-v2112/applications/solvers/doc/solver.dox
OpenFOAM-v2112/applications/solvers/doc/solver.dox
+48
-0
OpenFOAM-v2112/applications/solvers/doc/solversDoc.H
OpenFOAM-v2112/applications/solvers/doc/solversDoc.H
+46
-0
OpenFOAM-v2112/applications/solvers/incompressible/icoFoam/Make/files
...12/applications/solvers/incompressible/icoFoam/Make/files
+3
-0
OpenFOAM-v2112/applications/solvers/incompressible/icoFoam/Make/options
.../applications/solvers/incompressible/icoFoam/Make/options
+10
-0
OpenFOAM-v2112/applications/solvers/incompressible/icoFoam/createFields.H
...pplications/solvers/incompressible/icoFoam/createFields.H
+57
-0
OpenFOAM-v2112/applications/solvers/incompressible/icoFoam/icoFoam.C
...112/applications/solvers/incompressible/icoFoam/icoFoam.C
+201
-0
OpenFOAM-v2112/applications/solvers/incompressible/incompressibleSolversDoc.H
...cations/solvers/incompressible/incompressibleSolversDoc.H
+32
-0
OpenFOAM-v2112/applications/solvers/incompressible/pimpleFoam/Make/files
...applications/solvers/incompressible/pimpleFoam/Make/files
+4
-0
OpenFOAM-v2112/applications/solvers/incompressible/pimpleFoam/Make/options
...plications/solvers/incompressible/pimpleFoam/Make/options
+24
-0
OpenFOAM-v2112/applications/solvers/incompressible/pimpleFoam/UEqn.H
...112/applications/solvers/incompressible/pimpleFoam/UEqn.H
+24
-0
OpenFOAM-v2112/applications/solvers/incompressible/pimpleFoam/correctPhi.H
...plications/solvers/incompressible/pimpleFoam/correctPhi.H
+11
-0
OpenFOAM-v2112/applications/solvers/incompressible/pimpleFoam/createFields.H
...ications/solvers/incompressible/pimpleFoam/createFields.H
+48
-0
OpenFOAM-v2112/applications/solvers/incompressible/pimpleFoam/pEqn.H
...112/applications/solvers/incompressible/pimpleFoam/pEqn.H
+69
-0
OpenFOAM-v2112/applications/solvers/incompressible/pimpleFoam/pimpleFoam.C
...plications/solvers/incompressible/pimpleFoam/pimpleFoam.C
+207
-0
OpenFOAM-v2112/applications/solvers/incompressible/pimpleFoam/setRDeltaT.H
...plications/solvers/incompressible/pimpleFoam/setRDeltaT.H
+69
-0
OpenFOAM-v2112/applications/solvers/incompressible/simpleFoam/Make/files
...applications/solvers/incompressible/simpleFoam/Make/files
+3
-0
OpenFOAM-v2112/applications/solvers/incompressible/simpleFoam/Make/options
...plications/solvers/incompressible/simpleFoam/Make/options
+19
-0
OpenFOAM-v2112/applications/solvers/incompressible/simpleFoam/UEqn.H
...112/applications/solvers/incompressible/simpleFoam/UEqn.H
+24
-0
OpenFOAM-v2112/applications/solvers/incompressible/simpleFoam/createFields.H
...ications/solvers/incompressible/simpleFoam/createFields.H
+46
-0
No files found.
Too many changes to show.
To preserve performance only
1000 of 1000+
files are displayed.
Plain diff
Email patch
OpenFOAM-v2112/applications/solvers/combustion/reactingFoam/setRDeltaT.H
0 → 100644
View file @
55e5a777
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2013-2016 OpenFOAM Foundation
Copyright (C) 2020 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/>.
\*---------------------------------------------------------------------------*/
{
volScalargpuField
&
rDeltaT
=
trDeltaT
.
ref
();
const
dictionary
&
pimpleDict
=
pimple
.
dict
();
// Maximum flow Courant number
scalar
maxCo
(
pimpleDict
.
get
<
scalar
>
(
"maxCo"
));
// Maximum time scale
scalar
maxDeltaT
(
pimpleDict
.
getOrDefault
<
scalar
>
(
"maxDeltaT"
,
GREAT
));
// Smoothing parameter (0-1) when smoothing iterations > 0
scalar
rDeltaTSmoothingCoeff
(
pimpleDict
.
getOrDefault
<
scalar
>
(
"rDeltaTSmoothingCoeff"
,
0
.
1
)
);
// Damping coefficient (1-0)
scalar
rDeltaTDampingCoeff
(
pimpleDict
.
getOrDefault
<
scalar
>
(
"rDeltaTDampingCoeff"
,
1
.
0
)
);
// Maximum change in cell temperature per iteration
// (relative to previous value)
scalar
alphaTemp
(
pimpleDict
.
getOrDefault
<
scalar
>
(
"alphaTemp"
,
0
.
05
));
// Maximum change in cell concentration per iteration
// (relative to reference value)
scalar
alphaY
(
pimpleDict
.
getOrDefault
<
scalar
>
(
"alphaY"
,
1
.
0
));
Info
<<
"Time scales min/max:"
<<
endl
;
// Cache old reciprocal time scale field
volScalargpuField
rDeltaT0
(
"rDeltaT0"
,
rDeltaT
);
// Flow time scale
{
rDeltaT
.
ref
()
=
(
fvc
::
surfaceSum
(
mag
(
phi
))()()
/
((
2
*
maxCo
)
*
devicemesh
.
V
()
*
rho
())
);
// Limit the largest time scale
rDeltaT
.
max
(
1
/
maxDeltaT
);
Info
<<
" Flow = "
<<
1
/
gMax
(
rDeltaT
.
primitiveField
())
<<
", "
<<
1
/
gMin
(
rDeltaT
.
primitiveField
())
<<
endl
;
}
// Heat release rate time scale
if
(
alphaTemp
<
1
)
{
volScalargpuField
::
Internal
rDeltaTT
(
mag
(
Qdot
)
/
(
alphaTemp
*
rho
*
thermo
.
Cp
()
*
T
)
);
Info
<<
" Temperature = "
<<
1
/
(
gMax
(
rDeltaTT
.
field
())
+
VSMALL
)
<<
", "
<<
1
/
(
gMin
(
rDeltaTT
.
field
())
+
VSMALL
)
<<
endl
;
rDeltaT
.
ref
()
=
max
(
rDeltaT
(),
rDeltaTT
);
}
// Reaction rate time scale
if
(
alphaY
<
1
)
{
dictionary
Yref
(
pimpleDict
.
subDict
(
"Yref"
));
volScalargpuField
::
Internal
rDeltaTY
(
IOobject
(
"rDeltaTY"
,
runTime
.
timeName
(),
mesh
),
devicemesh
,
dimensionedScalar
(
rDeltaT
.
dimensions
(),
Zero
)
);
bool
foundY
=
false
;
forAll
(
Y
,
i
)
{
if
(
i
!=
inertIndex
&&
composition
.
active
(
i
))
{
volScalargpuField
&
Yi
=
Y
[
i
];
if
(
Yref
.
found
(
Yi
.
name
()))
{
foundY
=
true
;
const
scalar
Yrefi
=
Yref
.
get
<
scalar
>
(
Yi
.
name
());
rDeltaTY
.
field
()
=
max
(
mag
(
reaction
->
R
(
Yi
)().
source
()
/
((
Yrefi
*
alphaY
)
*
(
rho
*
devicemesh
.
V
()))
),
rDeltaTY
);
}
}
}
if
(
foundY
)
{
Info
<<
" Composition = "
<<
1
/
(
gMax
(
rDeltaTY
.
field
())
+
VSMALL
)
<<
", "
<<
1
/
(
gMin
(
rDeltaTY
.
field
())
+
VSMALL
)
<<
endl
;
rDeltaT
.
ref
()
=
max
(
rDeltaT
(),
rDeltaTY
);
}
else
{
IOWarningIn
(
args
.
executable
().
c_str
(),
Yref
)
<<
"Cannot find any active species in Yref "
<<
Yref
<<
endl
;
}
}
// Update tho boundary values of the reciprocal time-step
rDeltaT
.
correctBoundaryConditions
();
// Spatially smooth the time scale field
if
(
rDeltaTSmoothingCoeff
<
1
)
{
fvc
::
smooth
(
rDeltaT
,
rDeltaTSmoothingCoeff
);
}
// Limit rate of change of time scale
// - reduce as much as required
// - only increase at a fraction of old time scale
if
(
rDeltaTDampingCoeff
<
1
&&
runTime
.
timeIndex
()
>
runTime
.
startTimeIndex
()
+
1
)
{
rDeltaT
=
max
(
rDeltaT
,
(
scalar
(
1
)
-
rDeltaTDampingCoeff
)
*
rDeltaT0
);
}
// Update tho boundary values of the reciprocal time-step
rDeltaT
.
correctBoundaryConditions
();
Info
<<
" Overall = "
<<
1
/
gMax
(
rDeltaT
.
primitiveField
())
<<
", "
<<
1
/
gMin
(
rDeltaT
.
primitiveField
())
<<
endl
;
}
// ************************************************************************* //
OpenFOAM-v2112/applications/solvers/doc/solver.dox
0 → 100644
View file @
55e5a777
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2015 OpenFOAM Foundation
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/>.
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
\page pageSolvers Solvers
\section secSolvers Overview
The available solvers are grouped into the following categories:
- \ref grpBasicSolvers
- \ref grpCombustionSolvers
- \ref grpCompressibleSolvers
- \ref grpDiscreteMethodsSolvers
- \ref grpDNSSolvers
- \ref grpElectroMagneticsSolvers
- \ref grpFinancialSolvers
- \ref grpHeatTransferSolvers
- \ref grpIncompressibleSolvers
- \ref grpLagrangianSolvers
- \ref grpMultiphaseSolvers
- \ref grpStressAnalysisSolvers
- \ref grpFiniteAreaSolvers
\*---------------------------------------------------------------------------*/
OpenFOAM-v2112/applications/solvers/doc/solversDoc.H
0 → 100644
View file @
55e5a777
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2015 OpenFOAM Foundation
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/>.
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
\defgroup grpSolvers Solvers
@{
This group contains solvers
@}
\defgroup grpMovingMeshSolvers Moving mesh solvers
@{
\ingroup grpSolvers
This group contains moving mesh solvers solvers
@}
\defgroup grpFiniteAreaSolvers Finite area solvers
@{
\ingroup grpSolvers
This group contains finite area solvers
@}
\*---------------------------------------------------------------------------*/
OpenFOAM-v2112/applications/solvers/incompressible/icoFoam/Make/files
0 → 100644
View file @
55e5a777
icoFoam.C
EXE = $(FOAM_APPBIN)/icoFoam
OpenFOAM-v2112/applications/solvers/incompressible/icoFoam/Make/options
0 → 100644
View file @
55e5a777
EXE_INC = \
-I$(LIB_SRC)/gpufiniteVolume/lnInclude \
-I$(LIB_SRC)/gpuOpenFOAM/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude
EXE_LIBS = \
-lgpuOpenFOAM \
-lgpufiniteVolume \
-lmeshTools
OpenFOAM-v2112/applications/solvers/incompressible/icoFoam/createFields.H
0 → 100644
View file @
55e5a777
Info
<<
"Reading transportProperties
\n
"
<<
endl
;
IOdictionary
transportProperties
(
IOobject
(
"transportProperties"
,
runTime
.
constant
(),
mesh
,
IOobject
::
MUST_READ_IF_MODIFIED
,
IOobject
::
NO_WRITE
)
);
dimensionedScalar
nu
(
"nu"
,
dimViscosity
,
transportProperties
);
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
,
mesh
.
solutionDict
().
subDict
(
"PISO"
),
pRefCell
,
pRefValue
);
mesh
.
setFluxRequired
(
p
.
name
());
OpenFOAM-v2112/applications/solvers/incompressible/icoFoam/icoFoam.C
0 → 100644
View file @
55e5a777
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 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
icoFoam
Group
grpIncompressibleSolvers
Description
Transient solver for incompressible, laminar flow of Newtonian fluids.
\heading Solver details
The solver uses the PISO 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 \left(\nu \grad \vec{U} \right)
= - \grad p
\f]
Where:
\vartable
\vec{U} | Velocity
p | Pressure
\endvartable
\heading Required fields
\plaintable
U | Velocity [m/s]
p | Kinematic pressure, p/rho [m2/s2]
\endplaintable
\*---------------------------------------------------------------------------*/
#include "gpufvCFD.H"
#include "pisoControl.H"
#include <sys/time.h>
struct
my_timer
{
struct
timeval
start_time
,
end_time
;
double
time_use
;
void
start
()
{
gettimeofday
(
&
start_time
,
NULL
);
}
void
stop
()
{
gettimeofday
(
&
end_time
,
NULL
);
time_use
=
(
end_time
.
tv_sec
-
start_time
.
tv_sec
)
+
(
double
)(
end_time
.
tv_usec
-
start_time
.
tv_usec
)
/
1000000
.
0
;
}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int
main
(
int
argc
,
char
*
argv
[])
{
my_timer
tm
;
tm
.
start
();
argList
::
addNote
(
"Transient solver for incompressible, laminar flow"
" of Newtonian fluids."
);
#include "gpupostProcess.H"
#include "addCheckCaseOptions.H"
#include "setRootCaseLists.H"
#include "createTime.H"
#include "createMesh.H"
#include "gpucreateMesh.H"
pisoControl
piso
(
mesh
);
#include "createFields.H"
#include "initContinuityErrs.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Info
<<
"
\n
Starting time loop
\n
"
<<
endl
;
while
(
runTime
.
loop
())
{
Info
<<
"Time = "
<<
runTime
.
timeName
()
<<
nl
<<
endl
;
my_timer
tm1
;
tm1
.
start
();
#include "gpuCourantNo.H"
// Momentum predictor
gpufvVectorMatrix
UEqn
(
fvm
::
ddt
(
U
)
+
fvm
::
div
(
phi
,
U
)
-
fvm
::
laplacian
(
nu
,
U
)
);
if
(
piso
.
momentumPredictor
())
{
solve
(
UEqn
==
-
fvc
::
grad
(
p
));
}
// --- PISO loop
while
(
piso
.
correct
())
{
volScalargpuField
rAU
(
1
.
0
/
UEqn
.
A
());
volVectorgpuField
HbyA
(
constrainHbyA
(
rAU
*
UEqn
.
H
(),
U
,
p
));
surfaceScalargpuField
phiHbyA
(
"phiHbyA"
,
fvc
::
flux
(
HbyA
)
+
fvc
::
interpolate
(
rAU
)
*
fvc
::
ddtCorr
(
U
,
phi
)
);
adjustPhi
(
phiHbyA
,
U
,
p
);
// Update the pressure BCs to ensure flux consistency
constrainPressure
(
p
,
U
,
phiHbyA
,
rAU
);
// Non-orthogonal pressure corrector loop
while
(
piso
.
correctNonOrthogonal
())
{
// Pressure corrector
gpufvScalarMatrix
pEqn
(
fvm
::
laplacian
(
rAU
,
p
)
==
fvc
::
div
(
phiHbyA
)
);
pEqn
.
setReference
(
pRefCell
,
pRefValue
);
pEqn
.
solve
(
mesh
.
solver
(
p
.
select
(
piso
.
finalInnerIter
())));
if
(
piso
.
finalNonOrthogonalIter
())
{
phi
=
phiHbyA
-
pEqn
.
flux
();
}
}
#include "gpucontinuityErrs.H"
U
=
HbyA
-
rAU
*
fvc
::
grad
(
p
);
U
.
correctBoundaryConditions
();
}
runTime
.
write
();
runTime
.
printExecutionTime
(
Info
);
tm1
.
stop
();
Info
<<
"------Time Step = "
<<
tm1
.
time_use
<<
"s-------------------"
<<
endl
;
}
tm
.
stop
();
Info
<<
"------all the time = "
<<
tm
.
time_use
<<
" s--------------------"
<<
endl
;
Info
<<
"End
\n
"
<<
endl
;
return
0
;
}
// ************************************************************************* //
OpenFOAM-v2112/applications/solvers/incompressible/incompressibleSolversDoc.H
0 → 100644
View file @
55e5a777
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2015 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/>.
\defgroup grpIncompressibleSolvers Incompressible flow solvers
@{
\ingroup grpSolvers
This group contains incompressible flow solvers.
@}
\*---------------------------------------------------------------------------*/
OpenFOAM-v2112/applications/solvers/incompressible/pimpleFoam/Make/files
0 → 100644
View file @
55e5a777
pimpleFoam.C
EXE = $(FOAM_APPBIN)/pimpleFoam
\ No newline at end of file
OpenFOAM-v2112/applications/solvers/incompressible/pimpleFoam/Make/options
0 → 100644
View file @
55e5a777
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/gpufiniteVolume/lnInclude \
-I$(LIB_SRC)/gpuOpenFOAM/lnInclude \
-I$(LIB_SRC)/sampling/lnInclude \
-I$(LIB_SRC)/TurbulenceModels-GPU/turbulenceModels/lnInclude \
-I$(LIB_SRC)/TurbulenceModels-GPU/incompressible/lnInclude \
-I$(LIB_SRC)/transportModels-GPU \
-I$(LIB_SRC)/transportModels-GPU/incompressible/singlePhaseTransportModel \
-I$(LIB_SRC)/dynamicMesh/lnInclude \
-I$(LIB_SRC)/dynamicFvMesh/lnInclude
EXE_LIBS = \
-lgpufiniteVolume \
-lgpuOpenFOAM \
-lmeshTools \
-lsampling \
-lturbulenceModels-GPU \
-lincompressibleTurbulenceModels-GPU \
-lincompressibleTransportModels-GPU \
-ldynamicMesh \
-ldynamicFvMesh \
-ltopoChangerFvMesh
OpenFOAM-v2112/applications/solvers/incompressible/pimpleFoam/UEqn.H
0 → 100644
View file @
55e5a777
// 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
);
}
OpenFOAM-v2112/applications/solvers/incompressible/pimpleFoam/correctPhi.H
0 → 100644
View file @
55e5a777
CorrectPhi
(
U
,
phi
,
p
,
dimensionedScalar
(
"rAUf"
,
dimTime
,
1
),
geometricZeroField
(),
pimple
);
#include "gpucontinuityErrs.H"
OpenFOAM-v2112/applications/solvers/incompressible/pimpleFoam/createFields.H
0 → 100644
View file @
55e5a777
#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"
OpenFOAM-v2112/applications/solvers/incompressible/pimpleFoam/pEqn.H
0 → 100644
View file @
55e5a777
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
();
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
);
OpenFOAM-v2112/applications/solvers/incompressible/pimpleFoam/pimpleFoam.C
0 → 100644
View file @
55e5a777
/*---------------------------------------------------------------------------*\
========= |
\\ / 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"
#include "gpucreateMesh.H"
#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
())
{
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"
}
}
}
#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
;
}
// ************************************************************************* //
OpenFOAM-v2112/applications/solvers/incompressible/pimpleFoam/setRDeltaT.H
0 → 100644
View file @
55e5a777
{
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
;
}
}
OpenFOAM-v2112/applications/solvers/incompressible/simpleFoam/Make/files
0 → 100644
View file @
55e5a777
simpleFoam.C
EXE = $(FOAM_APPBIN)/simpleFoam
OpenFOAM-v2112/applications/solvers/incompressible/simpleFoam/Make/options
0 → 100644
View file @
55e5a777
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/gpufiniteVolume/lnInclude \
-I$(LIB_SRC)/gpuOpenFOAM/lnInclude \
-I$(LIB_SRC)/sampling/lnInclude \
-I$(LIB_SRC)/TurbulenceModels-GPU/turbulenceModels/lnInclude \
-I$(LIB_SRC)/TurbulenceModels-GPU/incompressible/lnInclude \
-I$(LIB_SRC)/transportModels-GPU \
-I$(LIB_SRC)/transportModels-GPU/incompressible/singlePhaseTransportModel
EXE_LIBS = \
-lgpufiniteVolume \
-lgpuOpenFOAM \
-lmeshTools \
-lsampling \
-lturbulenceModels-GPU \
-lincompressibleTurbulenceModels-GPU \
-lincompressibleTransportModels-GPU
OpenFOAM-v2112/applications/solvers/incompressible/simpleFoam/UEqn.H
0 → 100644
View file @
55e5a777
// Momentum predictor
MRF
.
correctBoundaryVelocity
(
U
);
tmp
<
gpufvVectorMatrix
>
tUEqn
(
fvm
::
div
(
phi
,
U
)
+
MRF
.
DDt
(
U
)
+
turbulence
->
divDevReff
(
U
)
==
fvOptions
(
U
)
);
gpufvVectorMatrix
&
UEqn
=
tUEqn
.
ref
();
UEqn
.
relax
();
fvOptions
.
constrain
(
UEqn
);
if
(
simple
.
momentumPredictor
())
{
solve
(
UEqn
==
-
fvc
::
grad
(
p
));
fvOptions
.
correct
(
U
);
}
OpenFOAM-v2112/applications/solvers/incompressible/simpleFoam/createFields.H
0 → 100644
View file @
55e5a777
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
,
simple
.
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"
Prev
1
2
3
4
5
6
…
50
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