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
961 additions
and
0 deletions
+961
-0
applications/solvers/incompressible/adjointShapeOptimizationFoam/createPhia.H
.../incompressible/adjointShapeOptimizationFoam/createPhia.H
+52
-0
applications/solvers/incompressible/adjointShapeOptimizationFoam/initAdjointContinuityErrs.H
.../adjointShapeOptimizationFoam/initAdjointContinuityErrs.H
+45
-0
applications/solvers/incompressible/boundaryFoam/Make/files
applications/solvers/incompressible/boundaryFoam/Make/files
+3
-0
applications/solvers/incompressible/boundaryFoam/Make/options
...ications/solvers/incompressible/boundaryFoam/Make/options
+17
-0
applications/solvers/incompressible/boundaryFoam/boundaryFoam.C
...ations/solvers/incompressible/boundaryFoam/boundaryFoam.C
+125
-0
applications/solvers/incompressible/boundaryFoam/createFields.H
...ations/solvers/incompressible/boundaryFoam/createFields.H
+51
-0
applications/solvers/incompressible/boundaryFoam/evaluateNearWall.H
...ns/solvers/incompressible/boundaryFoam/evaluateNearWall.H
+34
-0
applications/solvers/incompressible/boundaryFoam/interrogateWallPatches.H
...vers/incompressible/boundaryFoam/interrogateWallPatches.H
+76
-0
applications/solvers/incompressible/boundaryFoam/makeGraphs.H
...ications/solvers/incompressible/boundaryFoam/makeGraphs.H
+33
-0
applications/solvers/incompressible/icoFoam/Make/files
applications/solvers/incompressible/icoFoam/Make/files
+3
-0
applications/solvers/incompressible/icoFoam/Make/options
applications/solvers/incompressible/icoFoam/Make/options
+10
-0
applications/solvers/incompressible/icoFoam/createFields.H
applications/solvers/incompressible/icoFoam/createFields.H
+57
-0
applications/solvers/incompressible/icoFoam/icoFoam.C
applications/solvers/incompressible/icoFoam/icoFoam.C
+200
-0
applications/solvers/incompressible/incompressibleSolversDoc.H
...cations/solvers/incompressible/incompressibleSolversDoc.H
+32
-0
applications/solvers/incompressible/nonNewtonianIcoFoam/Make/files
...ons/solvers/incompressible/nonNewtonianIcoFoam/Make/files
+3
-0
applications/solvers/incompressible/nonNewtonianIcoFoam/Make/options
...s/solvers/incompressible/nonNewtonianIcoFoam/Make/options
+10
-0
applications/solvers/incompressible/nonNewtonianIcoFoam/createFields.H
...solvers/incompressible/nonNewtonianIcoFoam/createFields.H
+40
-0
applications/solvers/incompressible/nonNewtonianIcoFoam/nonNewtonianIcoFoam.C
.../incompressible/nonNewtonianIcoFoam/nonNewtonianIcoFoam.C
+142
-0
applications/solvers/incompressible/pimpleFoam-GPU/Make/files
...ications/solvers/incompressible/pimpleFoam-GPU/Make/files
+4
-0
applications/solvers/incompressible/pimpleFoam-GPU/Make/options
...ations/solvers/incompressible/pimpleFoam-GPU/Make/options
+24
-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/adjointShapeOptimizationFoam/createPhia.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-2016 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
createPhia
Description
Creates and initialises the face-flux field phia.
\*---------------------------------------------------------------------------*/
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Info
<<
"Reading/calculating face flux field phia
\n
"
<<
endl
;
surfaceScalarField
phia
(
IOobject
(
"phia"
,
runTime
.
timeName
(),
mesh
,
IOobject
::
READ_IF_PRESENT
,
IOobject
::
AUTO_WRITE
),
linearInterpolate
(
Ua
)
&
mesh
.
Sf
()
);
// ************************************************************************* //
applications/solvers/incompressible/adjointShapeOptimizationFoam/initAdjointContinuityErrs.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
-------------------------------------------------------------------------------
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
cumulativeAdjointContErr
Description
Declare and initialise the cumulative ddjoint continuity error.
\*---------------------------------------------------------------------------*/
#ifndef initAdjointContinuityErrs_H
#define initAdjointContinuityErrs_H
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
scalar
cumulativeAdjointContErr
=
0
;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //
applications/solvers/incompressible/boundaryFoam/Make/files
0 → 100644
View file @
ea17556c
boundaryFoam.C
EXE = $(FOAM_APPBIN)/boundaryFoam
applications/solvers/incompressible/boundaryFoam/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
EXE_LIBS = \
-lfiniteVolume \
-lfvOptions \
-lmeshTools \
-lsampling \
-lturbulenceModels \
-lincompressibleTurbulenceModels \
-lincompressibleTransportModels
applications/solvers/incompressible/boundaryFoam/boundaryFoam.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
boundaryFoam
Group
grpIncompressibleSolvers
Description
Steady-state solver for incompressible, 1D turbulent flow,
typically to generate boundary layer conditions at an inlet.
Boundary layer code to calculate the U, k and epsilon distributions.
Used to create inlet boundary conditions for experimental comparisons
for which U and k have not been measured.
Turbulence model is runtime selectable.
\*---------------------------------------------------------------------------*/
#include "fvCFD.H"
#include "singlePhaseTransportModel.H"
#include "turbulentTransportModel.H"
#include "fvOptions.H"
#include "wallFvPatch.H"
#include "makeGraph.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int
main
(
int
argc
,
char
*
argv
[])
{
argList
::
addNote
(
"Steady-state solver for incompressible, 1D turbulent flow,"
" typically to generate boundary layer conditions at an inlet."
);
argList
::
noParallel
();
#include "addCheckCaseOptions.H"
#include "setRootCaseLists.H"
#include "createTime.H"
#include "createMesh.H"
#include "createFields.H"
#include "interrogateWallPatches.H"
turbulence
->
validate
();
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Info
<<
"
\n
Starting time loop
\n
"
<<
endl
;
while
(
runTime
.
loop
())
{
Info
<<
"Time = "
<<
runTime
.
timeName
()
<<
nl
<<
endl
;
fvVectorMatrix
divR
(
turbulence
->
divDevReff
(
U
));
divR
.
source
()
=
flowMask
&
divR
.
source
();
fvVectorMatrix
UEqn
(
divR
==
gradP
+
fvOptions
(
U
)
);
UEqn
.
relax
();
fvOptions
.
constrain
(
UEqn
);
UEqn
.
solve
();
fvOptions
.
correct
(
U
);
// Correct driving force for a constant volume flow rate
dimensionedVector
UbarStar
=
flowMask
&
U
.
weightedAverage
(
mesh
.
V
());
U
+=
(
Ubar
-
UbarStar
);
gradP
+=
(
Ubar
-
UbarStar
)
/
(
1
.
0
/
UEqn
.
A
())().
weightedAverage
(
mesh
.
V
());
laminarTransport
.
correct
();
turbulence
->
correct
();
Info
<<
"Uncorrected Ubar = "
<<
(
flowDirection
&
UbarStar
.
value
())
<<
", pressure gradient = "
<<
(
flowDirection
&
gradP
.
value
())
<<
endl
;
#include "evaluateNearWall.H"
if
(
runTime
.
writeTime
())
{
#include "makeGraphs.H"
}
runTime
.
printExecutionTime
(
Info
);
}
Info
<<
"End
\n
"
<<
endl
;
return
0
;
}
// ************************************************************************* //
applications/solvers/incompressible/boundaryFoam/createFields.H
0 → 100644
View file @
ea17556c
Info
<<
"Reading field U
\n
"
<<
endl
;
volVectorField
U
(
IOobject
(
"U"
,
runTime
.
timeName
(),
mesh
,
IOobject
::
MUST_READ
,
IOobject
::
AUTO_WRITE
),
mesh
);
Info
<<
"Creating face flux
\n
"
<<
endl
;
surfaceScalarField
phi
(
IOobject
(
"phi"
,
runTime
.
timeName
(),
mesh
,
IOobject
::
NO_READ
,
IOobject
::
NO_WRITE
),
mesh
,
dimensionedScalar
(
mesh
.
Sf
().
dimensions
()
*
U
.
dimensions
(),
Zero
)
);
singlePhaseTransportModel
laminarTransport
(
U
,
phi
);
autoPtr
<
incompressible
::
turbulenceModel
>
turbulence
(
incompressible
::
turbulenceModel
::
New
(
U
,
phi
,
laminarTransport
)
);
dimensionedVector
Ubar
(
"Ubar"
,
dimVelocity
,
laminarTransport
);
vector
flowDirection
=
(
Ubar
/
mag
(
Ubar
)).
value
();
tensor
flowMask
=
sqr
(
flowDirection
);
dimensionedVector
gradP
(
"gradP"
,
dimensionSet
(
0
,
1
,
-
2
,
0
,
0
),
Zero
);
#include "createFvOptions.H"
applications/solvers/incompressible/boundaryFoam/evaluateNearWall.H
0 → 100644
View file @
ea17556c
{
// Evaluate near-wall behaviour
scalar
nu
=
turbulence
->
nu
()().
boundaryField
()[
patchId
][
faceId
];
scalar
nut
=
turbulence
->
nut
()().
boundaryField
()[
patchId
][
faceId
];
symmTensor
R
=
turbulence
->
devReff
()().
boundaryField
()[
patchId
][
faceId
];
scalar
epsilon
=
turbulence
->
epsilon
()()[
cellId
];
// scalar omega = turbulence->omega()()[cellId];
scalar
k
=
turbulence
->
k
()()[
cellId
];
scalar
magUp
=
mag
(
U
[
cellId
]
-
U
.
boundaryField
()[
patchId
][
faceId
]);
scalar
tauw
=
flowDirection
&
R
&
wallNormal
;
scalar
uTau
=
::
sqrt
(
mag
(
tauw
));
scalar
yPlus
=
uTau
*
y
[
cellId
]
/
(
nu
+
ROOTVSMALL
);
scalar
uPlus
=
magUp
/
(
uTau
+
ROOTVSMALL
);
scalar
nutPlus
=
nut
/
nu
;
scalar
kPlus
=
k
/
(
sqr
(
uTau
)
+
ROOTVSMALL
);
scalar
epsilonPlus
=
epsilon
*
nu
/
(
pow4
(
uTau
)
+
ROOTVSMALL
);
// scalar omegaPlus = omega*nu/(sqr(uTau) + ROOTVSMALL);
scalar
Rey
=
magUp
*
y
[
cellId
]
/
nu
;
Info
<<
"Rey = "
<<
Rey
<<
", uTau = "
<<
uTau
<<
", nut+ = "
<<
nutPlus
<<
", y+ = "
<<
yPlus
<<
", u+ = "
<<
uPlus
<<
", k+ = "
<<
kPlus
<<
", epsilon+ = "
<<
epsilonPlus
<<
endl
;
}
applications/solvers/incompressible/boundaryFoam/interrogateWallPatches.H
0 → 100644
View file @
ea17556c
// Search for wall patches faces and store normals
label
faceId
(
-
1
);
label
patchId
(
-
1
);
label
nWallFaces
(
0
);
vector
wallNormal
(
Zero
);
const
fvPatchList
&
patches
=
mesh
.
boundary
();
forAll
(
patches
,
patchi
)
{
const
fvPatch
&
currPatch
=
patches
[
patchi
];
if
(
isA
<
wallFvPatch
>
(
currPatch
))
{
const
vectorField
nf
(
currPatch
.
nf
());
forAll
(
nf
,
facei
)
{
nWallFaces
++
;
if
(
nWallFaces
==
1
)
{
wallNormal
=
-
nf
[
facei
];
faceId
=
facei
;
patchId
=
patchi
;
}
else
if
(
nWallFaces
==
2
)
{
const
vector
wallNormal2
=
-
nf
[
facei
];
//- Check that wall faces are parallel
if
(
mag
(
wallNormal
&
wallNormal2
)
>
1
.
01
||
mag
(
wallNormal
&
wallNormal2
)
<
0
.
99
)
{
FatalErrorInFunction
<<
"wall faces are not parallel for patches "
<<
patches
[
patchId
].
name
()
<<
" and "
<<
currPatch
.
name
()
<<
nl
<<
exit
(
FatalError
);
}
}
else
{
FatalErrorInFunction
<<
nl
<<
exit
(
FatalError
);
}
}
}
}
if
(
nWallFaces
==
0
)
{
FatalErrorInFunction
<<
exit
(
FatalError
);
}
else
{
Info
<<
"Generating wall data for patch: "
<<
patches
[
patchId
].
name
()
<<
endl
;
}
// store local id of near-wall cell to process
label
cellId
=
patches
[
patchId
].
faceCells
()[
faceId
];
// create position array for graph generation
scalarField
y
(
wallNormal
&
(
mesh
.
C
().
primitiveField
()
-
mesh
.
C
().
boundaryField
()[
patchId
][
faceId
])
);
Info
<<
" Height to first cell centre y0 = "
<<
y
[
cellId
]
<<
endl
;
applications/solvers/incompressible/boundaryFoam/makeGraphs.H
0 → 100644
View file @
ea17556c
volSymmTensorField
R
(
IOobject
(
"R"
,
runTime
.
timeName
(),
mesh
,
IOobject
::
NO_READ
,
IOobject
::
AUTO_WRITE
),
turbulence
->
R
()
);
runTime
.
write
();
const
word
&
gFormat
=
runTime
.
graphFormat
();
makeGraph
(
y
,
flowDirection
&
U
,
"Uf"
,
gFormat
);
makeGraph
(
y
,
turbulence
->
nu
(),
gFormat
);
makeGraph
(
y
,
turbulence
->
k
(),
gFormat
);
makeGraph
(
y
,
turbulence
->
epsilon
(),
gFormat
);
makeGraph
(
y
,
flowDirection
&
R
&
flowDirection
,
"Rff"
,
gFormat
);
makeGraph
(
y
,
wallNormal
&
R
&
wallNormal
,
"Rww"
,
gFormat
);
makeGraph
(
y
,
flowDirection
&
R
&
wallNormal
,
"Rfw"
,
gFormat
);
makeGraph
(
y
,
sqrt
(
mag
(
R
.
component
(
symmTensor
::
XX
))),
"u"
,
gFormat
);
makeGraph
(
y
,
sqrt
(
mag
(
R
.
component
(
symmTensor
::
YY
))),
"v"
,
gFormat
);
makeGraph
(
y
,
sqrt
(
mag
(
R
.
component
(
symmTensor
::
ZZ
))),
"w"
,
gFormat
);
makeGraph
(
y
,
R
.
component
(
symmTensor
::
XY
),
"uv"
,
gFormat
);
makeGraph
(
y
,
mag
(
fvc
::
grad
(
U
)),
"gammaDot"
,
gFormat
);
applications/solvers/incompressible/icoFoam/Make/files
0 → 100644
View file @
ea17556c
icoFoam.C
EXE = $(FOAM_APPBIN)/icoFoam
applications/solvers/incompressible/icoFoam/Make/options
0 → 100644
View file @
ea17556c
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
applications/solvers/incompressible/icoFoam/createFields.H
0 → 100644
View file @
ea17556c
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
());
applications/solvers/incompressible/icoFoam/icoFoam.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-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 "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
;
}
// ************************************************************************* //
applications/solvers/incompressible/incompressibleSolversDoc.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) 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.
@}
\*---------------------------------------------------------------------------*/
applications/solvers/incompressible/nonNewtonianIcoFoam/Make/files
0 → 100644
View file @
ea17556c
nonNewtonianIcoFoam.C
EXE = $(FOAM_APPBIN)/nonNewtonianIcoFoam
applications/solvers/incompressible/nonNewtonianIcoFoam/Make/options
0 → 100644
View file @
ea17556c
EXE_INC = \
-I$(LIB_SRC)/transportModels \
-I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude
EXE_LIBS = \
-lincompressibleTransportModels \
-lfiniteVolume \
-lmeshTools
applications/solvers/incompressible/nonNewtonianIcoFoam/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 U
\n
"
<<
endl
;
volVectorField
U
(
IOobject
(
"U"
,
runTime
.
timeName
(),
mesh
,
IOobject
::
MUST_READ
,
IOobject
::
AUTO_WRITE
),
mesh
);
#include "createPhi.H"
singlePhaseTransportModel
fluid
(
U
,
phi
);
label
pRefCell
=
0
;
scalar
pRefValue
=
0
.
0
;
setRefCell
(
p
,
mesh
.
solutionDict
().
subDict
(
"PISO"
),
pRefCell
,
pRefValue
);
mesh
.
setFluxRequired
(
p
.
name
());
applications/solvers/incompressible/nonNewtonianIcoFoam/nonNewtonianIcoFoam.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-2016 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
nonNewtonianIcoFoam
Group
grpIncompressibleSolvers
Description
Transient solver for incompressible, laminar flow of non-Newtonian fluids.
\*---------------------------------------------------------------------------*/
#include "fvCFD.H"
#include "singlePhaseTransportModel.H"
#include "pisoControl.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int
main
(
int
argc
,
char
*
argv
[])
{
argList
::
addNote
(
"Transient solver for incompressible laminar flow"
" of non-Newtonian fluids."
);
#include "postProcess.H"
#include "addCheckCaseOptions.H"
#include "setRootCaseLists.H"
#include "createTime.H"
#include "createMeshNoClear.H"
#include "createControl.H"
#include "createFields.H"
#include "initContinuityErrs.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Info
<<
"
\n
Starting time loop
\n
"
<<
endl
;
while
(
runTime
.
loop
())
{
Info
<<
"Time = "
<<
runTime
.
timeName
()
<<
nl
<<
endl
;
#include "CourantNo.H"
fluid
.
correct
();
// Momentum predictor
fvVectorMatrix
UEqn
(
fvm
::
ddt
(
U
)
+
fvm
::
div
(
phi
,
U
)
-
fvm
::
laplacian
(
fluid
.
nu
(),
U
)
-
(
fvc
::
grad
(
U
)
&
fvc
::
grad
(
fluid
.
nu
()))
);
if
(
piso
.
momentumPredictor
())
{
solve
(
UEqn
==
-
fvc
::
grad
(
p
));
}
// --- PISO loop
while
(
piso
.
correct
())
{
volScalarField
rAU
(
1
.
0
/
UEqn
.
A
());
volVectorField
HbyA
(
constrainHbyA
(
rAU
*
UEqn
.
H
(),
U
,
p
));
surfaceScalarField
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
fvScalarMatrix
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 "continuityErrs.H"
U
=
HbyA
-
rAU
*
fvc
::
grad
(
p
);
U
.
correctBoundaryConditions
();
}
runTime
.
write
();
runTime
.
printExecutionTime
(
Info
);
}
Info
<<
"End
\n
"
<<
endl
;
return
0
;
}
// ************************************************************************* //
applications/solvers/incompressible/pimpleFoam-GPU/Make/files
0 → 100644
View file @
ea17556c
pimpleFoam.C
EXE = $(FOAM_APPBIN)/pimpleFoam_GPU
\ No newline at end of file
applications/solvers/incompressible/pimpleFoam-GPU/Make/options
0 → 100644
View file @
ea17556c
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
Prev
1
…
20
21
22
23
24
25
26
27
28
…
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