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
649c29f9
Commit
649c29f9
authored
Aug 30, 2023
by
quant
Browse files
Initial commit
parent
89db0b5a
Changes
789
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
1316 additions
and
0 deletions
+1316
-0
OpenFOAM-v2112/applications/solvers/incompressible/pimpleFoam/SRFPimpleFoam/Make/files
...olvers/incompressible/pimpleFoam/SRFPimpleFoam/Make/files
+3
-0
OpenFOAM-v2112/applications/solvers/incompressible/pimpleFoam/SRFPimpleFoam/Make/options
...vers/incompressible/pimpleFoam/SRFPimpleFoam/Make/options
+18
-0
OpenFOAM-v2112/applications/solvers/incompressible/pimpleFoam/SRFPimpleFoam/SRFPimpleFoam.C
...s/incompressible/pimpleFoam/SRFPimpleFoam/SRFPimpleFoam.C
+116
-0
OpenFOAM-v2112/applications/solvers/incompressible/pimpleFoam/SRFPimpleFoam/UrelEqn.H
...solvers/incompressible/pimpleFoam/SRFPimpleFoam/UrelEqn.H
+19
-0
OpenFOAM-v2112/applications/solvers/incompressible/pimpleFoam/SRFPimpleFoam/createFields.H
...rs/incompressible/pimpleFoam/SRFPimpleFoam/createFields.H
+75
-0
OpenFOAM-v2112/applications/solvers/incompressible/pimpleFoam/SRFPimpleFoam/pEqn.H
...ns/solvers/incompressible/pimpleFoam/SRFPimpleFoam/pEqn.H
+58
-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/overPimpleDyMFoam/CourantNo.H
...s/incompressible/pimpleFoam/overPimpleDyMFoam/CourantNo.H
+53
-0
OpenFOAM-v2112/applications/solvers/incompressible/pimpleFoam/overPimpleDyMFoam/Make/files
...rs/incompressible/pimpleFoam/overPimpleDyMFoam/Make/files
+3
-0
OpenFOAM-v2112/applications/solvers/incompressible/pimpleFoam/overPimpleDyMFoam/Make/options
.../incompressible/pimpleFoam/overPimpleDyMFoam/Make/options
+24
-0
OpenFOAM-v2112/applications/solvers/incompressible/pimpleFoam/overPimpleDyMFoam/UEqn.H
...olvers/incompressible/pimpleFoam/overPimpleDyMFoam/UEqn.H
+24
-0
OpenFOAM-v2112/applications/solvers/incompressible/pimpleFoam/overPimpleDyMFoam/continuityErrs.H
...ompressible/pimpleFoam/overPimpleDyMFoam/continuityErrs.H
+51
-0
OpenFOAM-v2112/applications/solvers/incompressible/pimpleFoam/overPimpleDyMFoam/correctPhi.H
.../incompressible/pimpleFoam/overPimpleDyMFoam/correctPhi.H
+124
-0
OpenFOAM-v2112/applications/solvers/incompressible/pimpleFoam/overPimpleDyMFoam/createControls.H
...ompressible/pimpleFoam/overPimpleDyMFoam/createControls.H
+26
-0
OpenFOAM-v2112/applications/solvers/incompressible/pimpleFoam/overPimpleDyMFoam/createFields.H
...ncompressible/pimpleFoam/overPimpleDyMFoam/createFields.H
+79
-0
OpenFOAM-v2112/applications/solvers/incompressible/pimpleFoam/overPimpleDyMFoam/interpolatedFaces.H
...ressible/pimpleFoam/overPimpleDyMFoam/interpolatedFaces.H
+273
-0
OpenFOAM-v2112/applications/solvers/incompressible/pimpleFoam/overPimpleDyMFoam/overPimpleDyMFoam.C
...ressible/pimpleFoam/overPimpleDyMFoam/overPimpleDyMFoam.C
+170
-0
OpenFOAM-v2112/applications/solvers/incompressible/pimpleFoam/overPimpleDyMFoam/pEqn.H
...olvers/incompressible/pimpleFoam/overPimpleDyMFoam/pEqn.H
+117
-0
No files found.
Too many changes to show.
To preserve performance only
789 of 789+
files are displayed.
Plain diff
Email patch
OpenFOAM-v2112/applications/solvers/incompressible/pimpleFoam/SRFPimpleFoam/Make/files
0 → 100644
View file @
649c29f9
SRFPimpleFoam.C
EXE = $(FOAM_APPBIN)/SRFPimpleFoam
OpenFOAM-v2112/applications/solvers/incompressible/pimpleFoam/SRFPimpleFoam/Make/options
0 → 100644
View file @
649c29f9
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
OpenFOAM-v2112/applications/solvers/incompressible/pimpleFoam/SRFPimpleFoam/SRFPimpleFoam.C
0 → 100644
View file @
649c29f9
/*---------------------------------------------------------------------------*\
========= |
\\ / 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
;
}
// ************************************************************************* //
OpenFOAM-v2112/applications/solvers/incompressible/pimpleFoam/SRFPimpleFoam/UrelEqn.H
0 → 100644
View file @
649c29f9
// 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
);
OpenFOAM-v2112/applications/solvers/incompressible/pimpleFoam/SRFPimpleFoam/createFields.H
0 → 100644
View file @
649c29f9
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"
OpenFOAM-v2112/applications/solvers/incompressible/pimpleFoam/SRFPimpleFoam/pEqn.H
0 → 100644
View file @
649c29f9
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
);
OpenFOAM-v2112/applications/solvers/incompressible/pimpleFoam/UEqn.H
0 → 100644
View file @
649c29f9
// 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
);
}
OpenFOAM-v2112/applications/solvers/incompressible/pimpleFoam/correctPhi.H
0 → 100644
View file @
649c29f9
CorrectPhi
(
U
,
phi
,
p
,
dimensionedScalar
(
"rAUf"
,
dimTime
,
1
),
geometricZeroField
(),
pimple
);
#include "continuityErrs.H"
OpenFOAM-v2112/applications/solvers/incompressible/pimpleFoam/createFields.H
0 → 100644
View file @
649c29f9
#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"
OpenFOAM-v2112/applications/solvers/incompressible/pimpleFoam/overPimpleDyMFoam/CourantNo.H
0 → 100644
View file @
649c29f9
/*---------------------------------------------------------------------------*\
========= |
\\ / 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
;
// ************************************************************************* //
OpenFOAM-v2112/applications/solvers/incompressible/pimpleFoam/overPimpleDyMFoam/Make/files
0 → 100644
View file @
649c29f9
overPimpleDyMFoam.C
EXE = $(FOAM_APPBIN)/overPimpleDyMFoam
OpenFOAM-v2112/applications/solvers/incompressible/pimpleFoam/overPimpleDyMFoam/Make/options
0 → 100644
View file @
649c29f9
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 \
-I$(LIB_SRC)/dynamicMesh/lnInclude \
-I$(LIB_SRC)/dynamicFvMesh/lnInclude \
-I$(LIB_SRC)/overset/lnInclude
EXE_LIBS = \
-lfiniteVolume \
-lfvOptions \
-lsampling \
-lturbulenceModels \
-lincompressibleTurbulenceModels \
-lincompressibleTransportModels \
-ldynamicMesh \
-ldynamicFvMesh \
-ltopoChangerFvMesh \
-loverset
OpenFOAM-v2112/applications/solvers/incompressible/pimpleFoam/overPimpleDyMFoam/UEqn.H
0 → 100644
View file @
649c29f9
// 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
==
-
cellMask
*
fvc
::
grad
(
p
));
fvOptions
.
correct
(
U
);
}
OpenFOAM-v2112/applications/solvers/incompressible/pimpleFoam/overPimpleDyMFoam/continuityErrs.H
0 → 100644
View file @
649c29f9
/*---------------------------------------------------------------------------*\
========= |
\\ / 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
continuityErrs
Description
Calculates and prints the continuity errors.
\*---------------------------------------------------------------------------*/
{
volScalarField
contErr
(
interpolatedCells
*
cellMask
*
fvc
::
div
(
phi
));
scalar
sumLocalContErr
=
runTime
.
deltaTValue
()
*
mag
(
contErr
)().
weightedAverage
(
mesh
.
V
()).
value
();
scalar
globalContErr
=
runTime
.
deltaTValue
()
*
contErr
.
weightedAverage
(
mesh
.
V
()).
value
();
cumulativeContErr
+=
globalContErr
;
Info
<<
"time step continuity errors : sum local = "
<<
sumLocalContErr
<<
", global = "
<<
globalContErr
<<
", cumulative = "
<<
cumulativeContErr
<<
endl
;
}
// ************************************************************************* //
OpenFOAM-v2112/applications/solvers/incompressible/pimpleFoam/overPimpleDyMFoam/correctPhi.H
0 → 100644
View file @
649c29f9
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
]
=
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
);
{
dimensionedScalar
rAUf
(
"rAUf"
,
dimTime
,
1
.
0
);
const
cellCellStencilObject
&
overlap
=
Stencil
::
New
(
mesh
);
const
labelList
&
cellTypes
=
overlap
.
cellTypes
();
const
labelIOList
&
zoneIDs
=
overlap
.
zoneID
();
while
(
pimple
.
correctNonOrthogonal
())
{
label
nZones
=
gMax
(
zoneIDs
)
+
1
;
//label refCellI2 = -1;
labelList
refCells
(
nZones
,
-
1
);
labelList
refZones
(
nZones
,
-
1
);
forAll
(
zoneIDs
,
cellI
)
{
label
zoneId
=
zoneIDs
[
cellI
];
if
(
refCells
[
zoneId
]
==
-
1
&&
cellTypes
[
cellI
]
==
cellCellStencil
::
CALCULATED
&&
refZones
[
zoneId
]
==
-
1
)
{
refCells
[
zoneId
]
=
cellI
;
refZones
[
zoneId
]
=
zoneId
;
}
}
fvScalarMatrix
pcorrEqn
(
fvm
::
laplacian
(
rAUf
,
pcorr
)
==
fvc
::
div
(
phi
)
);
// Only set reference for cells that are CALCULATED
{
DynamicList
<
label
>
validCells
(
refCells
.
size
());
forAll
(
refCells
,
zoneId
)
{
if
(
refCells
[
zoneId
]
!=
-
1
)
{
validCells
.
append
(
refCells
[
zoneId
]);
}
}
pcorrEqn
.
setReferences
(
validCells
,
scalar
(
0
),
true
);
}
const
dictionary
&
d
=
mesh
.
solver
(
pcorr
.
select
(
pimple
.
finalInnerIter
()
)
);
//Bypass virtual layer
mesh
.
fvMesh
::
solve
(
pcorrEqn
,
d
);
if
(
pimple
.
finalNonOrthogonalIter
())
{
phi
-=
pcorrEqn
.
flux
();
}
}
}
OpenFOAM-v2112/applications/solvers/incompressible/pimpleFoam/overPimpleDyMFoam/createControls.H
0 → 100644
View file @
649c29f9
#include "createTimeControls.H"
bool
correctPhi
(
pimple
.
dict
().
getOrDefault
(
"correctPhi"
,
false
)
);
bool
checkMeshCourantNo
(
pimple
.
dict
().
getOrDefault
(
"checkMeshCourantNo"
,
false
)
);
bool
massFluxInterpolation
(
pimple
.
dict
().
getOrDefault
(
"massFluxInterpolation"
,
false
)
);
bool
adjustFringe
(
pimple
.
dict
().
getOrDefault
(
"oversetAdjustPhi"
,
false
)
);
bool
ddtCorr
(
pimple
.
dict
().
getOrDefault
(
"ddtCorr"
,
true
)
);
OpenFOAM-v2112/applications/solvers/incompressible/pimpleFoam/overPimpleDyMFoam/createFields.H
0 → 100644
View file @
649c29f9
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
());
//- Overset specific
// Add solver-specific interpolations
{
wordHashSet
&
nonInt
=
const_cast
<
wordHashSet
&>
(
Stencil
::
New
(
mesh
).
nonInterpolatedFields
());
nonInt
.
insert
(
"HbyA"
);
nonInt
.
insert
(
"grad(p)"
);
nonInt
.
insert
(
"surfaceIntegrate(phi)"
);
nonInt
.
insert
(
"surfaceIntegrate(phiHbyA)"
);
nonInt
.
insert
(
"cellMask"
);
nonInt
.
insert
(
"cellDisplacement"
);
nonInt
.
insert
(
"interpolatedCells"
);
nonInt
.
insert
(
"cellInterpolationWeight"
);
}
// Mask field for zeroing out contributions on hole cells
#include "createCellMask.H"
// Create bool field with interpolated cells
#include "createInterpolatedCells.H"
singlePhaseTransportModel
laminarTransport
(
U
,
phi
);
autoPtr
<
incompressible
::
turbulenceModel
>
turbulence
(
incompressible
::
turbulenceModel
::
New
(
U
,
phi
,
laminarTransport
)
);
surfaceScalarField
phiHbyA
(
IOobject
(
"phiHbyA"
,
runTime
.
timeName
(),
mesh
,
IOobject
::
NO_READ
,
IOobject
::
AUTO_WRITE
),
fvc
::
flux
(
U
)
);
OpenFOAM-v2112/applications/solvers/incompressible/pimpleFoam/overPimpleDyMFoam/interpolatedFaces.H
0 → 100644
View file @
649c29f9
// Interpolation used
interpolationCellPoint
<
vector
>
UInterpolator
(
HbyA
);
// Determine faces on outside of interpolated cells
bitSet
isOwnerInterpolatedFace
(
mesh
.
nInternalFaces
());
bitSet
isNeiInterpolatedFace
(
mesh
.
nInternalFaces
());
// Determine donor cells
labelListList
donorCell
(
mesh
.
nInternalFaces
());
scalarListList
weightCellCells
(
mesh
.
nInternalFaces
());
// Interpolated HbyA faces
vectorField
UIntFaces
(
mesh
.
nInternalFaces
(),
Zero
);
// Determine receptor neighbour cells
labelList
receptorNeigCell
(
mesh
.
nInternalFaces
(),
-
1
);
{
const
cellCellStencilObject
&
overlap
=
Stencil
::
New
(
mesh
);
const
labelList
&
cellTypes
=
overlap
.
cellTypes
();
const
labelIOList
&
zoneID
=
overlap
.
zoneID
();
label
nZones
=
gMax
(
zoneID
)
+
1
;
PtrList
<
fvMeshSubset
>
meshParts
(
nZones
);
labelList
nCellsPerZone
(
nZones
,
Zero
);
// A mesh subset for each zone
forAll
(
meshParts
,
zonei
)
{
meshParts
.
set
(
zonei
,
// Select cells where the zoneID == zonei
new
fvMeshSubset
(
mesh
,
zonei
,
zoneID
)
);
}
for
(
label
faceI
=
0
;
faceI
<
mesh
.
nInternalFaces
();
faceI
++
)
{
label
ownType
=
cellTypes
[
mesh
.
faceOwner
()[
faceI
]];
label
neiType
=
cellTypes
[
mesh
.
faceNeighbour
()[
faceI
]];
if
(
ownType
==
cellCellStencil
::
INTERPOLATED
&&
neiType
==
cellCellStencil
::
CALCULATED
)
{
isOwnerInterpolatedFace
.
set
(
faceI
);
const
vector
&
fc
=
mesh
.
faceCentres
()[
faceI
];
for
(
label
zoneI
=
0
;
zoneI
<
nZones
;
zoneI
++
)
{
if
(
zoneI
!=
zoneID
[
mesh
.
faceOwner
()[
faceI
]])
{
const
fvMesh
&
partMesh
=
meshParts
[
zoneI
].
subMesh
();
const
labelList
&
cellMap
=
meshParts
[
zoneI
].
cellMap
();
label
cellI
=
partMesh
.
findCell
(
fc
);
if
(
cellI
!=
-
1
)
{
// Determine weights
labelList
stencil
(
partMesh
.
cellCells
()[
cellI
]);
stencil
.
append
(
cellI
);
label
st
=
stencil
.
size
();
donorCell
[
faceI
].
setSize
(
st
);
weightCellCells
[
faceI
].
setSize
(
st
);
scalarField
weights
(
st
);
forAll
(
stencil
,
i
)
{
scalar
d
=
mag
(
partMesh
.
cellCentres
()[
stencil
[
i
]]
-
fc
);
weights
[
i
]
=
1
.
0
/
d
;
donorCell
[
faceI
][
i
]
=
cellMap
[
stencil
[
i
]];
}
weights
/=
sum
(
weights
);
weightCellCells
[
faceI
]
=
weights
;
forAll
(
stencil
,
i
)
{
UIntFaces
[
faceI
]
+=
weightCellCells
[
faceI
][
i
]
*
UInterpolator
.
interpolate
(
fc
,
donorCell
[
faceI
][
i
]
);
}
break
;
}
}
}
receptorNeigCell
[
faceI
]
=
mesh
.
faceNeighbour
()[
faceI
];
}
else
if
(
ownType
==
cellCellStencil
::
CALCULATED
&&
neiType
==
cellCellStencil
::
INTERPOLATED
)
{
isNeiInterpolatedFace
.
set
(
faceI
);
const
vector
&
fc
=
mesh
.
faceCentres
()[
faceI
];
for
(
label
zoneI
=
0
;
zoneI
<
nZones
;
zoneI
++
)
{
if
(
zoneI
!=
zoneID
[
mesh
.
faceNeighbour
()[
faceI
]])
{
const
fvMesh
&
partMesh
=
meshParts
[
zoneI
].
subMesh
();
const
labelList
&
cellMap
=
meshParts
[
zoneI
].
cellMap
();
label
cellI
=
partMesh
.
findCell
(
fc
);
if
(
cellI
!=
-
1
)
{
// Determine weights
labelList
stencil
(
partMesh
.
cellCells
()[
cellI
]);
stencil
.
append
(
cellI
);
label
st
=
stencil
.
size
();
donorCell
[
faceI
].
setSize
(
st
);
weightCellCells
[
faceI
].
setSize
(
st
);
scalarField
weights
(
st
);
forAll
(
stencil
,
i
)
{
scalar
d
=
mag
(
partMesh
.
cellCentres
()[
stencil
[
i
]]
-
fc
);
weights
[
i
]
=
1
.
0
/
d
;
donorCell
[
faceI
][
i
]
=
cellMap
[
stencil
[
i
]];
}
weights
/=
sum
(
weights
);
weightCellCells
[
faceI
]
=
weights
;
forAll
(
stencil
,
i
)
{
UIntFaces
[
faceI
]
+=
weightCellCells
[
faceI
][
i
]
*
UInterpolator
.
interpolate
(
fc
,
donorCell
[
faceI
][
i
]
);
}
break
;
}
}
}
receptorNeigCell
[
faceI
]
=
mesh
.
faceOwner
()[
faceI
];
}
}
}
// contravariant U
vectorField
U1Contrav
(
mesh
.
nInternalFaces
(),
Zero
);
surfaceVectorField
faceNormals
(
mesh
.
Sf
()
/
mesh
.
magSf
());
forAll
(
isNeiInterpolatedFace
,
faceI
)
{
label
cellId
=
-
1
;
if
(
isNeiInterpolatedFace
.
test
(
faceI
))
{
cellId
=
mesh
.
faceNeighbour
()[
faceI
];
}
else
if
(
isOwnerInterpolatedFace
.
test
(
faceI
))
{
cellId
=
mesh
.
faceOwner
()[
faceI
];
}
if
(
cellId
!=
-
1
)
{
const
vector
&
n
=
faceNormals
[
faceI
];
vector
n1
(
Zero
);
// 2-D cases
if
(
mesh
.
nSolutionD
()
==
2
)
{
for
(
direction
cmpt
=
0
;
cmpt
<
vector
::
nComponents
;
cmpt
++
)
{
if
(
mesh
.
geometricD
()[
cmpt
]
==
-
1
)
{
switch
(
cmpt
)
{
case
vector
:
:
X
:
{
n1
=
vector
(
0
,
n
.
z
(),
-
n
.
y
());
break
;
}
case
vector
:
:
Y
:
{
n1
=
vector
(
n
.
z
(),
0
,
-
n
.
x
());
break
;
}
case
vector
:
:
Z
:
{
n1
=
vector
(
n
.
y
(),
-
n
.
x
(),
0
);
break
;
}
}
}
}
}
else
if
(
mesh
.
nSolutionD
()
==
3
)
{
//Determine which is the primary direction
if
(
mag
(
n
.
x
())
>
mag
(
n
.
y
())
&&
mag
(
n
.
x
())
>
mag
(
n
.
z
()))
{
n1
=
vector
(
n
.
y
(),
-
n
.
x
(),
0
);
}
else
if
(
mag
(
n
.
y
())
>
mag
(
n
.
z
()))
{
n1
=
vector
(
0
,
n
.
z
(),
-
n
.
y
());
}
else
{
n1
=
vector
(
-
n
.
z
(),
0
,
n
.
x
());
}
}
n1
.
normalise
();
const
vector
n2
=
normalised
(
n
^
n1
);
tensor
rot
=
tensor
(
n
.
x
()
,
n
.
y
(),
n
.
z
(),
n1
.
x
()
,
n1
.
y
(),
n1
.
z
(),
n2
.
x
()
,
n2
.
y
(),
n2
.
z
()
);
// tensor rot =
// tensor
// (
// n & x ,n & y, n & z,
// n1 & x ,n1 & y, n1 & z,
// n2 & x ,n2 & y, n2 & z
// );
U1Contrav
[
faceI
].
x
()
=
2
*
transform
(
rot
,
UIntFaces
[
faceI
]).
x
()
-
transform
(
rot
,
HbyA
[
receptorNeigCell
[
faceI
]]).
x
();
U1Contrav
[
faceI
].
y
()
=
transform
(
rot
,
HbyA
[
cellId
]).
y
();
U1Contrav
[
faceI
].
z
()
=
transform
(
rot
,
HbyA
[
cellId
]).
z
();
HbyA
[
cellId
]
=
transform
(
inv
(
rot
),
U1Contrav
[
faceI
]);
}
}
OpenFOAM-v2112/applications/solvers/incompressible/pimpleFoam/overPimpleDyMFoam/overPimpleDyMFoam.C
0 → 100644
View file @
649c29f9
/*---------------------------------------------------------------------------*\
========= |
\\ / 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) 2016-2018 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
overPimpleDyMFoam
Group
grpIncompressibleSolvers grpMovingMeshSolvers
Description
Transient solver for incompressible flow of Newtonian fluids
on a moving mesh using the PIMPLE (merged PISO-SIMPLE) algorithm.
Turbulence modelling is generic, i.e. laminar, RAS or LES may be selected.
\*---------------------------------------------------------------------------*/
#include "fvCFD.H"
#include "dynamicFvMesh.H"
#include "singlePhaseTransportModel.H"
#include "turbulentTransportModel.H"
#include "pimpleControl.H"
#include "fvOptions.H"
#include "cellCellStencilObject.H"
#include "zeroGradientFvPatchFields.H"
#include "localMin.H"
#include "interpolationCellPoint.H"
#include "transform.H"
#include "fvMeshSubset.H"
#include "oversetAdjustPhi.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int
main
(
int
argc
,
char
*
argv
[])
{
argList
::
addNote
(
"Transient solver for incompressible, turbulent flow"
" on a moving mesh."
);
#include "postProcess.H"
#include "setRootCaseLists.H"
#include "createTime.H"
#include "createDynamicFvMesh.H"
#include "initContinuityErrs.H"
pimpleControl
pimple
(
mesh
);
#include "createFields.H"
#include "createUf.H"
#include "createMRF.H"
#include "createFvOptions.H"
#include "createControls.H"
#include "CourantNo.H"
#include "setInitialDeltaT.H"
turbulence
->
validate
();
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Info
<<
"
\n
Starting time loop
\n
"
<<
endl
;
while
(
runTime
.
run
())
{
#include "readControls.H"
#include "CourantNo.H"
#include "setDeltaT.H"
++
runTime
;
Info
<<
"Time = "
<<
runTime
.
timeName
()
<<
nl
<<
endl
;
bool
changed
=
mesh
.
update
();
if
(
changed
)
{
#include "setCellMask.H"
#include "setInterpolatedCells.H"
surfaceScalarField
faceMaskOld
(
localMin
<
scalar
>
(
mesh
).
interpolate
(
cellMask
.
oldTime
())
);
// Zero Uf on old faceMask (H-I)
Uf
*=
faceMaskOld
;
// Update Uf and phi on new C-I faces
Uf
+=
(
1
-
faceMaskOld
)
*
fvc
::
interpolate
(
U
);
phi
=
mesh
.
Sf
()
&
Uf
;
// Zero phi on current H-I
surfaceScalarField
faceMask
(
localMin
<
scalar
>
(
mesh
).
interpolate
(
cellMask
)
);
phi
*=
faceMask
;
}
if
(
mesh
.
changing
()
&&
correctPhi
)
{
// Calculate absolute flux from the mapped surface velocity
#include "correctPhi.H"
}
// Make the flux relative to the mesh motion
fvc
::
makeRelative
(
phi
,
U
);
if
(
mesh
.
changing
()
&&
checkMeshCourantNo
)
{
#include "meshCourantNo.H"
}
// --- Pressure-velocity PIMPLE corrector loop
while
(
pimple
.
loop
())
{
#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/overPimpleDyMFoam/pEqn.H
0 → 100644
View file @
649c29f9
// Option 1: interpolate rAU, do not block out rAU on blocked cells
volScalarField
rAU
(
"rAU"
,
1
.
0
/
UEqn
.
A
());
mesh
.
interpolate
(
rAU
);
// Option 2: do not interpolate rAU but block out rAU
//surfaceScalarField rAUf("rAUf", fvc::interpolate(blockedCells*rAU));
// Option 3: do not interpolate rAU but zero out rAUf on faces on holes
// But what about:
//
// H
// H I C C C C
// H
//
surfaceScalarField
rAUf
(
"rAUf"
,
fvc
::
interpolate
(
rAU
));
volVectorField
H
(
"H"
,
UEqn
.
H
());
volVectorField
HbyA
(
"HbyA"
,
U
);
HbyA
=
constrainHbyA
(
rAU
*
H
,
U
,
p
);
if
(
massFluxInterpolation
)
{
#include "interpolatedFaces.H"
}
if
(
runTime
.
outputTime
())
{
H
.
write
();
rAU
.
write
();
HbyA
.
write
();
}
if
(
pimple
.
nCorrPISO
()
<=
1
)
{
tUEqn
.
clear
();
}
phiHbyA
=
fvc
::
flux
(
HbyA
);
if
(
ddtCorr
)
{
surfaceScalarField
faceMaskOld
(
localMin
<
scalar
>
(
mesh
).
interpolate
(
cellMask
.
oldTime
())
);
phiHbyA
+=
rAUf
*
faceMaskOld
*
fvc
::
ddtCorr
(
U
,
Uf
);
}
MRF
.
makeRelative
(
phiHbyA
);
// WIP
if
(
p
.
needReference
())
{
fvc
::
makeRelative
(
phiHbyA
,
U
);
adjustPhi
(
phiHbyA
,
U
,
p
);
fvc
::
makeAbsolute
(
phiHbyA
,
U
);
}
if
(
adjustFringe
)
{
fvc
::
makeRelative
(
phiHbyA
,
U
);
oversetAdjustPhi
(
phiHbyA
,
U
);
fvc
::
makeAbsolute
(
phiHbyA
,
U
);
}
while
(
pimple
.
correctNonOrthogonal
())
{
fvScalarMatrix
pEqn
(
fvm
::
laplacian
(
rAUf
,
p
)
==
fvc
::
div
(
phiHbyA
)
);
pEqn
.
setReference
(
pRefCell
,
pRefValue
);
pEqn
.
solve
(
mesh
.
solver
(
p
.
select
(
pimple
.
finalInnerIter
())));
if
(
pimple
.
finalNonOrthogonalIter
())
{
phi
=
phiHbyA
-
pEqn
.
flux
();
// option 2:
// rAUf*fvc::snGrad(p)*mesh.magSf();
}
}
#include "continuityErrs.H"
// Explicitly relax pressure for momentum corrector
p
.
relax
();
volVectorField
gradP
(
fvc
::
grad
(
p
));
// Option 2: zero out velocity on blocked out cells
//U = HbyA - rAU*cellMask*gradP;
// Option 3: zero out velocity on blocked out cells
// This is needed for the scalar Eq (k,epsilon, etc)
// which can use U as source term
U
=
cellMask
*
(
HbyA
-
rAU
*
gradP
);
U
.
correctBoundaryConditions
();
fvOptions
.
correct
(
U
);
{
Uf
=
fvc
::
interpolate
(
U
);
surfaceVectorField
n
(
mesh
.
Sf
()
/
mesh
.
magSf
());
Uf
+=
n
*
(
phi
/
mesh
.
magSf
()
-
(
n
&
Uf
));
}
// Make the fluxes relative to the mesh motion
fvc
::
makeRelative
(
phi
,
U
);
surfaceScalarField
faceMask
(
localMin
<
scalar
>
(
mesh
).
interpolate
(
cellMask
)
);
phi
*=
faceMask
;
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