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
787 additions
and
0 deletions
+787
-0
applications/solvers/multiphase/cavitatingFoam/CourantNo.H
applications/solvers/multiphase/cavitatingFoam/CourantNo.H
+64
-0
applications/solvers/multiphase/cavitatingFoam/Make/files
applications/solvers/multiphase/cavitatingFoam/Make/files
+3
-0
applications/solvers/multiphase/cavitatingFoam/Make/options
applications/solvers/multiphase/cavitatingFoam/Make/options
+20
-0
applications/solvers/multiphase/cavitatingFoam/UEqn.H
applications/solvers/multiphase/cavitatingFoam/UEqn.H
+15
-0
applications/solvers/multiphase/cavitatingFoam/alphavPsi.H
applications/solvers/multiphase/cavitatingFoam/alphavPsi.H
+20
-0
applications/solvers/multiphase/cavitatingFoam/cavitatingDyMFoam/Make/files
...rs/multiphase/cavitatingFoam/cavitatingDyMFoam/Make/files
+3
-0
applications/solvers/multiphase/cavitatingFoam/cavitatingDyMFoam/Make/options
.../multiphase/cavitatingFoam/cavitatingDyMFoam/Make/options
+25
-0
applications/solvers/multiphase/cavitatingFoam/cavitatingDyMFoam/cavitatingDyMFoam.C
...hase/cavitatingFoam/cavitatingDyMFoam/cavitatingDyMFoam.C
+136
-0
applications/solvers/multiphase/cavitatingFoam/cavitatingDyMFoam/correctPhi.H
.../multiphase/cavitatingFoam/cavitatingDyMFoam/correctPhi.H
+38
-0
applications/solvers/multiphase/cavitatingFoam/cavitatingDyMFoam/createControls.H
...tiphase/cavitatingFoam/cavitatingDyMFoam/createControls.H
+6
-0
applications/solvers/multiphase/cavitatingFoam/cavitatingDyMFoam/createPcorrTypes.H
...phase/cavitatingFoam/cavitatingDyMFoam/createPcorrTypes.H
+13
-0
applications/solvers/multiphase/cavitatingFoam/cavitatingDyMFoam/pEqn.H
...olvers/multiphase/cavitatingFoam/cavitatingDyMFoam/pEqn.H
+88
-0
applications/solvers/multiphase/cavitatingFoam/cavitatingDyMFoam/readControls.H
...ultiphase/cavitatingFoam/cavitatingDyMFoam/readControls.H
+4
-0
applications/solvers/multiphase/cavitatingFoam/cavitatingFoam.C
...ations/solvers/multiphase/cavitatingFoam/cavitatingFoam.C
+113
-0
applications/solvers/multiphase/cavitatingFoam/continuityErrs.H
...ations/solvers/multiphase/cavitatingFoam/continuityErrs.H
+22
-0
applications/solvers/multiphase/cavitatingFoam/createControls.H
...ations/solvers/multiphase/cavitatingFoam/createControls.H
+6
-0
applications/solvers/multiphase/cavitatingFoam/createFields.H
...ications/solvers/multiphase/cavitatingFoam/createFields.H
+96
-0
applications/solvers/multiphase/cavitatingFoam/pEqn.H
applications/solvers/multiphase/cavitatingFoam/pEqn.H
+85
-0
applications/solvers/multiphase/cavitatingFoam/readControls.H
...ications/solvers/multiphase/cavitatingFoam/readControls.H
+3
-0
applications/solvers/multiphase/cavitatingFoam/readThermodynamicProperties.H
...s/multiphase/cavitatingFoam/readThermodynamicProperties.H
+27
-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/multiphase/cavitatingFoam/CourantNo.H
0 → 100644
View file @
ea17556c
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-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
CourantNo
Description
Calculates and outputs the mean and maximum Courant Numbers.
\*---------------------------------------------------------------------------*/
scalar
CoNum
=
0
.
0
;
scalar
meanCoNum
=
0
.
0
;
scalar
acousticCoNum
=
0
.
0
;
if
(
mesh
.
nInternalFaces
())
{
scalarField
sumPhi
(
fvc
::
surfaceSum
(
mag
(
phi
))().
primitiveField
()
);
CoNum
=
0
.
5
*
gMax
(
sumPhi
/
mesh
.
V
().
field
())
*
runTime
.
deltaTValue
();
meanCoNum
=
0
.
5
*
(
gSum
(
sumPhi
)
/
gSum
(
mesh
.
V
().
field
()))
*
runTime
.
deltaTValue
();
acousticCoNum
=
0
.
5
*
gMax
(
fvc
::
surfaceSum
(
fvc
::
interpolate
(
scalar
(
1
)
/
sqrt
(
psi
))
*
mesh
.
magSf
()
)().
primitiveField
()
/
mesh
.
V
().
field
()
)
*
runTime
.
deltaTValue
();
}
Info
<<
"phi Courant Number mean: "
<<
meanCoNum
<<
" max: "
<<
CoNum
<<
" acoustic max: "
<<
acousticCoNum
<<
endl
;
// ************************************************************************* //
applications/solvers/multiphase/cavitatingFoam/Make/files
0 → 100644
View file @
ea17556c
cavitatingFoam.C
EXE = $(FOAM_APPBIN)/cavitatingFoam
applications/solvers/multiphase/cavitatingFoam/Make/options
0 → 100644
View file @
ea17556c
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/transportModels \
-I$(LIB_SRC)/transportModels/incompressible/lnInclude \
-I$(LIB_SRC)/transportModels/interfaceProperties/lnInclude \
-I$(LIB_SRC)/transportModels/twoPhaseMixture/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/incompressible/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/barotropicCompressibilityModel/lnInclude
EXE_LIBS = \
-lfiniteVolume \
-lfvOptions \
-lmeshTools \
-lincompressibleTransportModels \
-linterfaceProperties \
-lturbulenceModels \
-lincompressibleTurbulenceModels \
-lbarotropicCompressibilityModel
applications/solvers/multiphase/cavitatingFoam/UEqn.H
0 → 100644
View file @
ea17556c
fvVectorMatrix
UEqn
(
fvm
::
ddt
(
rho
,
U
)
+
fvm
::
div
(
rhoPhi
,
U
)
+
turbulence
->
divDevRhoReff
(
rho
,
U
)
);
UEqn
.
relax
();
if
(
pimple
.
momentumPredictor
())
{
solve
(
UEqn
==
-
fvc
::
grad
(
p
));
}
Info
<<
"max(U) "
<<
max
(
mag
(
U
)).
value
()
<<
endl
;
applications/solvers/multiphase/cavitatingFoam/alphavPsi.H
0 → 100644
View file @
ea17556c
{
alphav
=
max
(
min
(
(
rho
-
rholSat
)
/
(
rhovSat
-
rholSat
),
scalar
(
1
)
),
scalar
(
0
)
);
alphal
=
1
.
0
-
alphav
;
Info
<<
"max-min alphav: "
<<
max
(
alphav
).
value
()
<<
" "
<<
min
(
alphav
).
value
()
<<
endl
;
psiModel
->
correct
();
//Info<< "min a: " << 1.0/sqrt(max(psi)).value() << endl;
}
applications/solvers/multiphase/cavitatingFoam/cavitatingDyMFoam/Make/files
0 → 100644
View file @
ea17556c
cavitatingDyMFoam.C
EXE = $(FOAM_APPBIN)/cavitatingDyMFoam
applications/solvers/multiphase/cavitatingFoam/cavitatingDyMFoam/Make/options
0 → 100644
View file @
ea17556c
EXE_INC = \
-I.. \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/transportModels \
-I$(LIB_SRC)/transportModels/incompressible/lnInclude \
-I$(LIB_SRC)/transportModels/interfaceProperties/lnInclude \
-I$(LIB_SRC)/transportModels/twoPhaseMixture/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/incompressible/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/barotropicCompressibilityModel/lnInclude \
-I$(LIB_SRC)/dynamicMesh/lnInclude \
-I$(LIB_SRC)/dynamicFvMesh/lnInclude
EXE_LIBS = \
-lfiniteVolume \
-lfvOptions \
-lmeshTools \
-lincompressibleTransportModels \
-linterfaceProperties \
-lturbulenceModels \
-lincompressibleTurbulenceModels \
-lbarotropicCompressibilityModel \
-ldynamicMesh \
-ldynamicFvMesh
applications/solvers/multiphase/cavitatingFoam/cavitatingDyMFoam/cavitatingDyMFoam.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) 2012-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
cavitatingFoam
Group
grpMultiphaseSolvers grpMovingMeshSolvers
Description
Transient cavitation solver based on the homogeneous equilibrium model
from which the compressibility of the liquid/vapour 'mixture' is obtained,
with optional mesh motion and mesh topology changes.
Turbulence modelling is generic, i.e. laminar, RAS or LES may be selected.
\*---------------------------------------------------------------------------*/
#include "fvCFD.H"
#include "dynamicFvMesh.H"
#include "barotropicCompressibilityModel.H"
#include "incompressibleTwoPhaseMixture.H"
#include "turbulentTransportModel.H"
#include "CorrectPhi.H"
#include "pimpleControl.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int
main
(
int
argc
,
char
*
argv
[])
{
argList
::
addNote
(
"Transient cavitation solver based on the homogeneous equilibrium"
" model from which the compressibility of the liquid/vapour 'mixture'"
" is obtained.
\n
"
"With optional mesh motion and mesh topology changes."
);
#include "postProcess.H"
#include "setRootCaseLists.H"
#include "createTime.H"
#include "createDynamicFvMesh.H"
#include "createControls.H"
#include "createFields.H"
#include "createUf.H"
#include "createPcorrTypes.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
;
// Do any mesh changes
mesh
.
update
();
if
(
mesh
.
changing
()
&&
correctPhi
)
{
// Calculate absolute flux from the mapped surface velocity
phi
=
mesh
.
Sf
()
&
Uf
;
#include "correctPhi.H"
// Make the flux relative to the mesh motion
fvc
::
makeRelative
(
phi
,
U
);
}
}
// --- Pressure-velocity PIMPLE corrector loop
while
(
pimple
.
loop
())
{
#include "rhoEqn.H"
#include "alphavPsi.H"
#include "UEqn.H"
// --- Pressure corrector loop
while
(
pimple
.
correct
())
{
#include "pEqn.H"
}
if
(
pimple
.
turbCorr
())
{
turbulence
->
correct
();
}
}
runTime
.
write
();
runTime
.
printExecutionTime
(
Info
);
}
Info
<<
"End
\n
"
<<
endl
;
return
0
;
}
// ************************************************************************* //
applications/solvers/multiphase/cavitatingFoam/cavitatingDyMFoam/correctPhi.H
0 → 100644
View file @
ea17556c
correctUphiBCs
(
U
,
phi
);
{
volScalarField
pcorr
(
IOobject
(
"pcorr"
,
runTime
.
timeName
(),
mesh
,
IOobject
::
NO_READ
,
IOobject
::
NO_WRITE
),
mesh
,
dimensionedScalar
(
p
.
dimensions
(),
Zero
),
pcorrTypes
);
surfaceScalarField
rhof
(
fvc
::
interpolate
(
rho
,
"div(phi,rho)"
));
dimensionedScalar
rAUf
(
"rAUf"
,
dimTime
,
1
.
0
);
mesh
.
setFluxRequired
(
pcorr
.
name
());
while
(
pimple
.
correctNonOrthogonal
())
{
fvScalarMatrix
pcorrEqn
(
fvm
::
laplacian
(
rAUf
,
pcorr
)
==
fvc
::
ddt
(
rho
)
+
fvc
::
div
(
phi
*
rhof
)
);
pcorrEqn
.
solve
();
if
(
pimple
.
finalNonOrthogonalIter
())
{
phi
-=
pcorrEqn
.
flux
()
/
rhof
;
}
}
}
applications/solvers/multiphase/cavitatingFoam/cavitatingDyMFoam/createControls.H
0 → 100644
View file @
ea17556c
#include "createDyMControls.H"
scalar
maxAcousticCo
(
runTime
.
controlDict
().
get
<
scalar
>
(
"maxAcousticCo"
)
);
applications/solvers/multiphase/cavitatingFoam/cavitatingDyMFoam/createPcorrTypes.H
0 → 100644
View file @
ea17556c
wordList
pcorrTypes
(
p
.
boundaryField
().
size
(),
zeroGradientFvPatchScalarField
::
typeName
);
for
(
label
i
=
0
;
i
<
p
.
boundaryField
().
size
();
i
++
)
{
if
(
p
.
boundaryField
()[
i
].
fixesValue
())
{
pcorrTypes
[
i
]
=
fixedValueFvPatchScalarField
::
typeName
;
}
}
applications/solvers/multiphase/cavitatingFoam/cavitatingDyMFoam/pEqn.H
0 → 100644
View file @
ea17556c
{
if
(
pimple
.
nCorrPIMPLE
()
==
1
)
{
p
=
(
rho
-
alphal
*
rhol0
-
((
alphav
*
psiv
+
alphal
*
psil
)
-
psi
)
*
pSat
)
/
psi
;
}
surfaceScalarField
rhof
(
"rhof"
,
fvc
::
interpolate
(
rho
));
volScalarField
rAU
(
1
.
0
/
UEqn
.
A
());
surfaceScalarField
rhorAUf
(
"rhorAUf"
,
fvc
::
interpolate
(
rho
*
rAU
));
volVectorField
HbyA
(
constrainHbyA
(
rAU
*
UEqn
.
H
(),
U
,
p
));
phi
=
fvc
::
flux
(
HbyA
)
+
rhorAUf
*
fvc
::
ddtCorr
(
U
,
Uf
);
fvc
::
makeRelative
(
phi
,
U
);
surfaceScalarField
phiGradp
(
rhorAUf
*
mesh
.
magSf
()
*
fvc
::
snGrad
(
p
));
phi
-=
phiGradp
/
rhof
;
volScalarField
rho0
(
rho
-
psi
*
p
);
while
(
pimple
.
correctNonOrthogonal
())
{
fvScalarMatrix
pEqn
(
fvc
::
ddt
(
rho
)
+
psi
*
correction
(
fvm
::
ddt
(
p
))
+
fvc
::
div
(
phi
,
rho
)
+
fvc
::
div
(
phiGradp
)
-
fvm
::
laplacian
(
rhorAUf
,
p
)
);
pEqn
.
solve
(
mesh
.
solver
(
p
.
select
(
pimple
.
finalInnerIter
())));
if
(
pimple
.
finalNonOrthogonalIter
())
{
phi
+=
(
phiGradp
+
pEqn
.
flux
())
/
rhof
;
}
}
Info
<<
"Predicted p max-min : "
<<
max
(
p
).
value
()
<<
" "
<<
min
(
p
).
value
()
<<
endl
;
rho
==
max
(
rho0
+
psi
*
p
,
rhoMin
);
#include "alphavPsi.H"
p
=
(
rho
-
alphal
*
rhol0
-
((
alphav
*
psiv
+
alphal
*
psil
)
-
psi
)
*
pSat
)
/
psi
;
p
.
correctBoundaryConditions
();
Info
<<
"Phase-change corrected p max-min : "
<<
max
(
p
).
value
()
<<
" "
<<
min
(
p
).
value
()
<<
endl
;
// Correct velocity
U
=
HbyA
-
rAU
*
fvc
::
grad
(
p
);
// Remove the swirl component of velocity for "wedge" cases
if
(
pimple
.
dict
().
found
(
"removeSwirl"
))
{
label
swirlCmpt
(
pimple
.
dict
().
get
<
label
>
(
"removeSwirl"
));
Info
<<
"Removing swirl component-"
<<
swirlCmpt
<<
" of U"
<<
endl
;
U
.
field
().
replace
(
swirlCmpt
,
Zero
);
}
U
.
correctBoundaryConditions
();
Info
<<
"max(U) "
<<
max
(
mag
(
U
)).
value
()
<<
endl
;
{
Uf
=
fvc
::
interpolate
(
U
);
surfaceVectorField
n
(
mesh
.
Sf
()
/
mesh
.
magSf
());
Uf
+=
n
*
(
phi
/
mesh
.
magSf
()
-
(
n
&
Uf
));
}
}
applications/solvers/multiphase/cavitatingFoam/cavitatingDyMFoam/readControls.H
0 → 100644
View file @
ea17556c
#include "readDyMControls.H"
correctPhi
=
pimple
.
dict
().
getOrDefault
(
"correctPhi"
,
true
);
maxAcousticCo
=
runTime
.
controlDict
().
get
<
scalar
>
(
"maxAcousticCo"
);
applications/solvers/multiphase/cavitatingFoam/cavitatingFoam.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
cavitatingFoam
Group
grpMultiphaseSolvers
Description
Transient cavitation solver based on the homogeneous equilibrium model
from which the compressibility of the liquid/vapour 'mixture' is obtained.
Turbulence modelling is generic, i.e. laminar, RAS or LES may be selected.
\*---------------------------------------------------------------------------*/
#include "fvCFD.H"
#include "barotropicCompressibilityModel.H"
#include "incompressibleTwoPhaseMixture.H"
#include "turbulentTransportModel.H"
#include "pimpleControl.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int
main
(
int
argc
,
char
*
argv
[])
{
argList
::
addNote
(
"Transient cavitation solver based on the homogeneous equilibrium"
" model from which the compressibility of the liquid/vapour 'mixture'"
" is obtained."
);
#include "postProcess.H"
#include "addCheckCaseOptions.H"
#include "setRootCaseLists.H"
#include "createTime.H"
#include "createMesh.H"
#include "createControl.H"
#include "createControls.H"
#include "createFields.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
;
// --- Pressure-velocity PIMPLE corrector loop
while
(
pimple
.
loop
())
{
#include "rhoEqn.H"
#include "alphavPsi.H"
#include "UEqn.H"
// --- Pressure corrector loop
while
(
pimple
.
correct
())
{
#include "pEqn.H"
}
if
(
pimple
.
turbCorr
())
{
turbulence
->
correct
();
}
}
runTime
.
write
();
runTime
.
printExecutionTime
(
Info
);
}
Info
<<
"End
\n
"
<<
endl
;
return
0
;
}
// ************************************************************************* //
applications/solvers/multiphase/cavitatingFoam/continuityErrs.H
0 → 100644
View file @
ea17556c
{
volScalarField
thermoRho
=
psi
*
p
+
alphal
*
rhol0
;
dimensionedScalar
totalMass
=
fvc
::
domainIntegrate
(
rho
);
scalar
sumLocalContErr
=
(
fvc
::
domainIntegrate
(
mag
(
rho
-
thermoRho
))
/
totalMass
).
value
();
scalar
globalContErr
=
(
fvc
::
domainIntegrate
(
rho
-
thermoRho
)
/
totalMass
).
value
();
cumulativeContErr
+=
globalContErr
;
Info
<<
"time step continuity errors : sum local = "
<<
sumLocalContErr
<<
", global = "
<<
globalContErr
<<
", cumulative = "
<<
cumulativeContErr
<<
endl
;
}
applications/solvers/multiphase/cavitatingFoam/createControls.H
0 → 100644
View file @
ea17556c
#include "createTimeControls.H"
scalar
maxAcousticCo
(
runTime
.
controlDict
().
get
<
scalar
>
(
"maxAcousticCo"
)
);
applications/solvers/multiphase/cavitatingFoam/createFields.H
0 → 100644
View file @
ea17556c
#include "readThermodynamicProperties.H"
Info
<<
"Reading field p
\n
"
<<
endl
;
volScalarField
p
(
IOobject
(
"p"
,
runTime
.
timeName
(),
mesh
,
IOobject
::
MUST_READ
,
IOobject
::
AUTO_WRITE
),
mesh
);
volScalarField
rho
(
IOobject
(
"rho"
,
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"
mesh
.
setFluxRequired
(
p
.
name
());
// Mass flux (corrected by rhoEqn.H)
surfaceScalarField
rhoPhi
(
IOobject
(
"rhoPhi"
,
runTime
.
timeName
(),
mesh
,
IOobject
::
NO_READ
,
IOobject
::
NO_WRITE
),
fvc
::
interpolate
(
rho
)
*
phi
);
Info
<<
"Reading transportProperties
\n
"
<<
endl
;
incompressibleTwoPhaseMixture
mixture
(
U
,
phi
);
volScalarField
&
alphav
(
mixture
.
alpha1
());
alphav
.
oldTime
();
volScalarField
&
alphal
(
mixture
.
alpha2
());
Info
<<
"Creating compressibilityModel
\n
"
<<
endl
;
autoPtr
<
barotropicCompressibilityModel
>
psiModel
=
barotropicCompressibilityModel
::
New
(
thermodynamicProperties
,
alphav
);
const
volScalarField
&
psi
=
psiModel
->
psi
();
rho
==
max
(
psi
*
p
+
alphal
*
rhol0
+
((
alphav
*
psiv
+
alphal
*
psil
)
-
psi
)
*
pSat
,
rhoMin
);
mesh
.
setFluxRequired
(
p
.
name
());
mesh
.
setFluxRequired
(
rho
.
name
());
// Create incompressible turbulence model
autoPtr
<
incompressible
::
turbulenceModel
>
turbulence
(
incompressible
::
turbulenceModel
::
New
(
U
,
phi
,
mixture
)
);
applications/solvers/multiphase/cavitatingFoam/pEqn.H
0 → 100644
View file @
ea17556c
{
if
(
pimple
.
nCorrPIMPLE
()
==
1
)
{
p
=
(
rho
-
alphal
*
rhol0
-
((
alphav
*
psiv
+
alphal
*
psil
)
-
psi
)
*
pSat
)
/
psi
;
}
surfaceScalarField
rhof
(
"rhof"
,
fvc
::
interpolate
(
rho
));
volScalarField
rAU
(
1
.
0
/
UEqn
.
A
());
surfaceScalarField
rhorAUf
(
"rhorAUf"
,
fvc
::
interpolate
(
rho
*
rAU
));
volVectorField
HbyA
(
constrainHbyA
(
rAU
*
UEqn
.
H
(),
U
,
p
));
phi
=
fvc
::
flux
(
HbyA
)
+
rhorAUf
*
fvc
::
ddtCorr
(
U
,
phi
);
surfaceScalarField
phiGradp
(
rhorAUf
*
mesh
.
magSf
()
*
fvc
::
snGrad
(
p
));
phi
-=
phiGradp
/
rhof
;
while
(
pimple
.
correctNonOrthogonal
())
{
fvScalarMatrix
pEqn
(
fvm
::
ddt
(
psi
,
p
)
-
(
rhol0
+
(
psil
-
psiv
)
*
pSat
)
*
fvc
::
ddt
(
alphav
)
-
pSat
*
fvc
::
ddt
(
psi
)
+
fvc
::
div
(
phi
,
rho
)
+
fvc
::
div
(
phiGradp
)
-
fvm
::
laplacian
(
rhorAUf
,
p
)
);
pEqn
.
solve
(
mesh
.
solver
(
p
.
select
(
pimple
.
finalInnerIter
())));
if
(
pimple
.
finalNonOrthogonalIter
())
{
phi
+=
(
phiGradp
+
pEqn
.
flux
())
/
rhof
;
}
}
Info
<<
"Predicted p max-min : "
<<
max
(
p
).
value
()
<<
" "
<<
min
(
p
).
value
()
<<
endl
;
rho
==
max
(
psi
*
p
+
alphal
*
rhol0
+
((
alphav
*
psiv
+
alphal
*
psil
)
-
psi
)
*
pSat
,
rhoMin
);
#include "alphavPsi.H"
p
=
(
rho
-
alphal
*
rhol0
-
((
alphav
*
psiv
+
alphal
*
psil
)
-
psi
)
*
pSat
)
/
psi
;
p
.
correctBoundaryConditions
();
Info
<<
"Phase-change corrected p max-min : "
<<
max
(
p
).
value
()
<<
" "
<<
min
(
p
).
value
()
<<
endl
;
// Correct velocity
U
=
HbyA
-
rAU
*
fvc
::
grad
(
p
);
// Remove the swirl component of velocity for "wedge" cases
if
(
pimple
.
dict
().
found
(
"removeSwirl"
))
{
label
swirlCmpt
(
pimple
.
dict
().
get
<
label
>
(
"removeSwirl"
));
Info
<<
"Removing swirl component-"
<<
swirlCmpt
<<
" of U"
<<
endl
;
U
.
field
().
replace
(
swirlCmpt
,
Zero
);
}
U
.
correctBoundaryConditions
();
Info
<<
"max(U) "
<<
max
(
mag
(
U
)).
value
()
<<
endl
;
}
applications/solvers/multiphase/cavitatingFoam/readControls.H
0 → 100644
View file @
ea17556c
#include "readTimeControls.H"
maxAcousticCo
=
runTime
.
controlDict
().
get
<
scalar
>
(
"maxAcousticCo"
);
applications/solvers/multiphase/cavitatingFoam/readThermodynamicProperties.H
0 → 100644
View file @
ea17556c
Info
<<
"Reading thermodynamicProperties
\n
"
<<
endl
;
IOdictionary
thermodynamicProperties
(
IOobject
(
"thermodynamicProperties"
,
runTime
.
constant
(),
mesh
,
IOobject
::
MUST_READ_IF_MODIFIED
,
IOobject
::
NO_WRITE
)
);
dimensionedScalar
psil
(
"psil"
,
dimCompressibility
,
thermodynamicProperties
);
dimensionedScalar
rholSat
(
"rholSat"
,
dimDensity
,
thermodynamicProperties
);
dimensionedScalar
psiv
(
"psiv"
,
dimCompressibility
,
thermodynamicProperties
);
dimensionedScalar
pSat
(
"pSat"
,
dimPressure
,
thermodynamicProperties
);
dimensionedScalar
rhovSat
(
"rhovSat"
,
psiv
*
pSat
);
dimensionedScalar
rhol0
(
"rhol0"
,
rholSat
-
pSat
*
psil
);
const
dimensionedScalar
rhoMin
(
"rhoMin"
,
dimDensity
,
thermodynamicProperties
);
Prev
1
…
32
33
34
35
36
37
38
39
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