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
2001 additions
and
0 deletions
+2001
-0
applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/alphaSuSp.H
...ompressibleInterFoam/compressibleInterDyMFoam/alphaSuSp.H
+43
-0
applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/compressibleInterDyMFoam.C
...rFoam/compressibleInterDyMFoam/compressibleInterDyMFoam.C
+190
-0
applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/correctPhi.H
...mpressibleInterFoam/compressibleInterDyMFoam/correctPhi.H
+13
-0
applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/pEqn.H
...ase/compressibleInterFoam/compressibleInterDyMFoam/pEqn.H
+145
-0
applications/solvers/multiphase/compressibleInterFoam/compressibleInterFilmFoam/Make/files
...ompressibleInterFoam/compressibleInterFilmFoam/Make/files
+6
-0
applications/solvers/multiphase/compressibleInterFoam/compressibleInterFilmFoam/Make/options
...pressibleInterFoam/compressibleInterFilmFoam/Make/options
+44
-0
applications/solvers/multiphase/compressibleInterFoam/compressibleInterFilmFoam/TEqn.H
...se/compressibleInterFoam/compressibleInterFilmFoam/TEqn.H
+36
-0
applications/solvers/multiphase/compressibleInterFoam/compressibleInterFilmFoam/VoFPatchTransfer/VoFPatchTransfer.C
...ressibleInterFilmFoam/VoFPatchTransfer/VoFPatchTransfer.C
+326
-0
applications/solvers/multiphase/compressibleInterFoam/compressibleInterFilmFoam/VoFPatchTransfer/VoFPatchTransfer.H
...ressibleInterFilmFoam/VoFPatchTransfer/VoFPatchTransfer.H
+146
-0
applications/solvers/multiphase/compressibleInterFoam/compressibleInterFilmFoam/VoFSolidificationMeltingSource/VoFSolidificationMeltingSource.C
...idificationMeltingSource/VoFSolidificationMeltingSource.C
+219
-0
applications/solvers/multiphase/compressibleInterFoam/compressibleInterFilmFoam/VoFSolidificationMeltingSource/VoFSolidificationMeltingSource.H
...idificationMeltingSource/VoFSolidificationMeltingSource.H
+220
-0
applications/solvers/multiphase/compressibleInterFoam/compressibleInterFilmFoam/VoFSolidificationMeltingSource/VoFSolidificationMeltingSourceIO.C
...ificationMeltingSource/VoFSolidificationMeltingSourceIO.C
+49
-0
applications/solvers/multiphase/compressibleInterFoam/compressibleInterFilmFoam/VoFSolidificationMeltingSource/VoFSolidificationMeltingSourceTemplates.C
...onMeltingSource/VoFSolidificationMeltingSourceTemplates.C
+68
-0
applications/solvers/multiphase/compressibleInterFoam/compressibleInterFilmFoam/compressibleInterFilmFoam.C
...oam/compressibleInterFilmFoam/compressibleInterFilmFoam.C
+151
-0
applications/solvers/multiphase/compressibleInterFoam/compressibleInterFilmFoam/createSurfaceFilmModel.H
...erFoam/compressibleInterFilmFoam/createSurfaceFilmModel.H
+7
-0
applications/solvers/multiphase/compressibleInterFoam/compressibleInterFilmFoam/pEqn.H
...se/compressibleInterFoam/compressibleInterFilmFoam/pEqn.H
+145
-0
applications/solvers/multiphase/compressibleInterFoam/compressibleInterFoam.C
.../multiphase/compressibleInterFoam/compressibleInterFoam.C
+148
-0
applications/solvers/multiphase/compressibleInterFoam/compressibleInterIsoFoam/Make/files
...compressibleInterFoam/compressibleInterIsoFoam/Make/files
+3
-0
applications/solvers/multiphase/compressibleInterFoam/compressibleInterIsoFoam/Make/options
...mpressibleInterFoam/compressibleInterIsoFoam/Make/options
+39
-0
applications/solvers/multiphase/compressibleInterFoam/compressibleInterIsoFoam/alphaControls.H
...essibleInterFoam/compressibleInterIsoFoam/alphaControls.H
+3
-0
No files found.
Too many changes to show.
To preserve performance only
798 of 798+
files are displayed.
Plain diff
Email patch
applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/alphaSuSp.H
0 → 100644
View file @
ea17556c
volScalarField
::
Internal
Sp
(
IOobject
(
"Sp"
,
runTime
.
timeName
(),
mesh
),
mesh
,
dimensionedScalar
(
dgdt
.
dimensions
(),
Zero
)
);
volScalarField
::
Internal
Su
(
IOobject
(
"Su"
,
runTime
.
timeName
(),
mesh
),
mesh
,
dimensionedScalar
(
dgdt
.
dimensions
(),
Zero
)
);
forAll
(
dgdt
,
celli
)
{
if
(
dgdt
[
celli
]
>
0
.
0
&&
alpha1
[
celli
]
>
0
.
0
)
{
Sp
[
celli
]
-=
dgdt
[
celli
]
*
alpha1
[
celli
];
Su
[
celli
]
+=
dgdt
[
celli
]
*
alpha1
[
celli
];
}
else
if
(
dgdt
[
celli
]
<
0
.
0
&&
alpha1
[
celli
]
<
1
.
0
)
{
Sp
[
celli
]
+=
dgdt
[
celli
]
*
(
1
.
0
-
alpha1
[
celli
]);
}
}
volScalarField
::
Internal
divU
(
mesh
.
moving
()
?
fvc
::
div
(
phiCN
()
+
mesh
.
phi
())
:
fvc
::
div
(
phiCN
())
);
applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/compressibleInterDyMFoam.C
0 → 100644
View file @
ea17556c
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Application
compressibleInterDyMFoam
Description
Solver for two compressible, non-isothermal immiscible fluids using a VOF
(volume of fluid) phase-fraction based interface capturing approach,
with optional mesh motion and mesh topology changes including adaptive
re-meshing.
The momentum and other fluid properties are of the "mixture" and a single
momentum equation is solved.
Turbulence modelling is generic, i.e. laminar, RAS or LES may be selected.
\*---------------------------------------------------------------------------*/
#include "fvCFD.H"
#include "dynamicFvMesh.H"
#include "CMULES.H"
#include "EulerDdtScheme.H"
#include "localEulerDdtScheme.H"
#include "CrankNicolsonDdtScheme.H"
#include "subCycle.H"
#include "compressibleInterPhaseTransportModel.H"
#include "pimpleControl.H"
#include "fvOptions.H"
#include "CorrectPhi.H"
#include "fvcSmooth.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int
main
(
int
argc
,
char
*
argv
[])
{
argList
::
addNote
(
"Solver for two compressible, non-isothermal immiscible fluids"
" using VOF phase-fraction based interface capturing.
\n
"
"With optional mesh motion and mesh topology changes including"
" adaptive re-meshing."
);
#include "postProcess.H"
#include "setRootCaseLists.H"
#include "createTime.H"
#include "createDynamicFvMesh.H"
#include "initContinuityErrs.H"
#include "createDyMControls.H"
#include "createFields.H"
#include "createUf.H"
#include "CourantNo.H"
#include "setInitialDeltaT.H"
volScalarField
&
p
=
mixture
.
p
();
volScalarField
&
T
=
mixture
.
T
();
const
volScalarField
&
psi1
=
mixture
.
thermo1
().
psi
();
const
volScalarField
&
psi2
=
mixture
.
thermo2
().
psi
();
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Info
<<
"
\n
Starting time loop
\n
"
<<
endl
;
while
(
runTime
.
run
())
{
#include "readDyMControls.H"
// Store divU and divUp from the previous mesh so that it can be mapped
// and used in correctPhi to ensure the corrected phi has the
// same divergence
volScalarField
divU
(
"divU0"
,
fvc
::
div
(
fvc
::
absolute
(
phi
,
U
)));
volScalarField
divUp
(
"divUp"
,
fvc
::
div
(
fvc
::
absolute
(
phi
,
U
),
p
));
if
(
LTS
)
{
#include "setRDeltaT.H"
}
else
{
#include "CourantNo.H"
#include "alphaCourantNo.H"
#include "setDeltaT.H"
}
++
runTime
;
Info
<<
"Time = "
<<
runTime
.
timeName
()
<<
nl
<<
endl
;
// --- Pressure-velocity PIMPLE corrector loop
while
(
pimple
.
loop
())
{
if
(
pimple
.
firstIter
()
||
moveMeshOuterCorrectors
)
{
scalar
timeBeforeMeshUpdate
=
runTime
.
elapsedCpuTime
();
mesh
.
update
();
if
(
mesh
.
changing
())
{
MRF
.
update
();
Info
<<
"Execution time for mesh.update() = "
<<
runTime
.
elapsedCpuTime
()
-
timeBeforeMeshUpdate
<<
" s"
<<
endl
;
gh
=
(
g
&
mesh
.
C
())
-
ghRef
;
ghf
=
(
g
&
mesh
.
Cf
())
-
ghRef
;
}
if
((
mesh
.
changing
()
&&
correctPhi
))
{
// Calculate absolute flux from the mapped surface velocity
phi
=
mesh
.
Sf
()
&
Uf
;
#include "correctPhi.H"
// Make the fluxes relative to the mesh motion
fvc
::
makeRelative
(
phi
,
U
);
mixture
.
correct
();
}
if
(
mesh
.
changing
()
&&
checkMeshCourantNo
)
{
#include "meshCourantNo.H"
}
}
#include "alphaControls.H"
#include "compressibleAlphaEqnSubCycle.H"
turbulence
.
correctPhasePhi
();
#include "UEqn.H"
#include "TEqn.H"
// --- Pressure corrector loop
while
(
pimple
.
correct
())
{
#include "pEqn.H"
}
if
(
pimple
.
turbCorr
())
{
turbulence
.
correct
();
}
}
rho
=
alpha1
*
rho1
+
alpha2
*
rho2
;
// Correct p_rgh for consistency with p and the updated densities
p_rgh
=
p
-
rho
*
gh
;
p_rgh
.
correctBoundaryConditions
();
runTime
.
write
();
runTime
.
printExecutionTime
(
Info
);
}
Info
<<
"End
\n
"
<<
endl
;
return
0
;
}
// ************************************************************************* //
applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/correctPhi.H
0 → 100644
View file @
ea17556c
CorrectPhi
(
U
,
phi
,
p
,
dimensionedScalar
(
"rAUf"
,
dimTime
/
rho
.
dimensions
(),
1
),
divU
,
pimple
);
//***HGW phi.oldTime() = phi;
#include "continuityErrs.H"
applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/pEqn.H
0 → 100644
View file @
ea17556c
{
volScalarField
rAU
(
"rAU"
,
1
.
0
/
UEqn
.
A
());
surfaceScalarField
rAUf
(
"rAUf"
,
fvc
::
interpolate
(
rAU
));
volVectorField
HbyA
(
constrainHbyA
(
rAU
*
UEqn
.
H
(),
U
,
p_rgh
));
surfaceScalarField
phiHbyA
(
"phiHbyA"
,
fvc
::
flux
(
HbyA
)
+
MRF
.
zeroFilter
(
fvc
::
interpolate
(
rho
*
rAU
)
*
fvc
::
ddtCorr
(
U
,
Uf
))
);
MRF
.
makeRelative
(
phiHbyA
);
surfaceScalarField
phig
(
(
mixture
.
surfaceTensionForce
()
-
ghf
*
fvc
::
snGrad
(
rho
)
)
*
rAUf
*
mesh
.
magSf
()
);
phiHbyA
+=
phig
;
// Update the pressure BCs to ensure flux consistency
constrainPressure
(
p_rgh
,
U
,
phiHbyA
,
rAUf
,
MRF
);
// Make the fluxes relative to the mesh motion
fvc
::
makeRelative
(
phiHbyA
,
U
);
tmp
<
fvScalarMatrix
>
p_rghEqnComp1
;
tmp
<
fvScalarMatrix
>
p_rghEqnComp2
;
if
(
pimple
.
transonic
())
{
#include "rhofs.H"
surfaceScalarField
phid1
(
"phid1"
,
fvc
::
interpolate
(
psi1
)
*
phi
);
surfaceScalarField
phid2
(
"phid2"
,
fvc
::
interpolate
(
psi2
)
*
phi
);
p_rghEqnComp1
=
pos
(
alpha1
)
*
(
(
fvc
::
ddt
(
alpha1
,
rho1
)
+
fvc
::
div
(
alphaPhi1
*
rho1f
)
-
(
fvOptions
(
alpha1
,
mixture
.
thermo1
().
rho
())
&
rho1
)
)
/
rho1
-
fvc
::
ddt
(
alpha1
)
-
fvc
::
div
(
alphaPhi1
)
+
(
alpha1
/
rho1
)
*
correction
(
psi1
*
fvm
::
ddt
(
p_rgh
)
+
fvm
::
div
(
phid1
,
p_rgh
)
-
fvm
::
Sp
(
fvc
::
div
(
phid1
),
p_rgh
)
)
);
p_rghEqnComp1
.
ref
().
relax
();
p_rghEqnComp2
=
pos
(
alpha2
)
*
(
(
fvc
::
ddt
(
alpha2
,
rho2
)
+
fvc
::
div
(
alphaPhi2
*
rho2f
)
-
(
fvOptions
(
alpha2
,
mixture
.
thermo2
().
rho
())
&
rho2
)
)
/
rho2
-
fvc
::
ddt
(
alpha2
)
-
fvc
::
div
(
alphaPhi2
)
+
(
alpha2
/
rho2
)
*
correction
(
psi2
*
fvm
::
ddt
(
p_rgh
)
+
fvm
::
div
(
phid2
,
p_rgh
)
-
fvm
::
Sp
(
fvc
::
div
(
phid2
),
p_rgh
)
)
);
p_rghEqnComp2
.
ref
().
relax
();
}
else
{
p_rghEqnComp1
=
fvc
::
ddt
(
rho1
)
+
psi1
*
correction
(
fvm
::
ddt
(
p_rgh
))
+
fvc
::
div
(
phi
,
rho1
)
-
fvc
::
Sp
(
fvc
::
div
(
phi
),
rho1
);
p_rghEqnComp2
=
fvc
::
ddt
(
rho2
)
+
psi2
*
correction
(
fvm
::
ddt
(
p_rgh
))
+
fvc
::
div
(
phi
,
rho2
)
-
fvc
::
Sp
(
fvc
::
div
(
phi
),
rho2
);
}
// Cache p_rgh prior to solve for density update
volScalarField
p_rgh_0
(
p_rgh
);
while
(
pimple
.
correctNonOrthogonal
())
{
fvScalarMatrix
p_rghEqnIncomp
(
fvc
::
div
(
phiHbyA
)
-
fvm
::
laplacian
(
rAUf
,
p_rgh
)
);
solve
(
(
(
max
(
alpha1
,
scalar
(
0
))
/
rho1
)
*
p_rghEqnComp1
()
+
(
max
(
alpha2
,
scalar
(
0
))
/
rho2
)
*
p_rghEqnComp2
()
)
+
p_rghEqnIncomp
,
mesh
.
solver
(
p_rgh
.
select
(
pimple
.
finalInnerIter
()))
);
if
(
pimple
.
finalNonOrthogonalIter
())
{
p
=
max
(
p_rgh
+
(
alpha1
*
rho1
+
alpha2
*
rho2
)
*
gh
,
pMin
);
p_rgh
=
p
-
(
alpha1
*
rho1
+
alpha2
*
rho2
)
*
gh
;
dgdt
=
(
pos
(
alpha2
)
*
(
p_rghEqnComp2
&
p_rgh
)
/
rho2
-
pos
(
alpha1
)
*
(
p_rghEqnComp1
&
p_rgh
)
/
rho1
);
phi
=
phiHbyA
+
p_rghEqnIncomp
.
flux
();
U
=
HbyA
+
rAU
*
fvc
::
reconstruct
((
phig
+
p_rghEqnIncomp
.
flux
())
/
rAUf
);
U
.
correctBoundaryConditions
();
fvOptions
.
correct
(
U
);
}
}
{
Uf
=
fvc
::
interpolate
(
U
);
surfaceVectorField
n
(
mesh
.
Sf
()
/
mesh
.
magSf
());
Uf
+=
n
*
(
fvc
::
absolute
(
phi
,
U
)
/
mesh
.
magSf
()
-
(
n
&
Uf
));
}
// Update densities from change in p_rgh
mixture
.
thermo1
().
correctRho
(
psi1
*
(
p_rgh
-
p_rgh_0
));
mixture
.
thermo2
().
correctRho
(
psi2
*
(
p_rgh
-
p_rgh_0
));
rho
=
alpha1
*
rho1
+
alpha2
*
rho2
;
// Correct p_rgh for consistency with p and the updated densities
p
=
max
(
p_rgh
+
rho
*
gh
,
pMin
);
p_rgh
=
p
-
rho
*
gh
;
p_rgh
.
correctBoundaryConditions
();
K
=
0
.
5
*
magSqr
(
U
);
}
applications/solvers/multiphase/compressibleInterFoam/compressibleInterFilmFoam/Make/files
0 → 100644
View file @
ea17556c
VoFPatchTransfer/VoFPatchTransfer.C
VoFSolidificationMeltingSource/VoFSolidificationMeltingSource.C
VoFSolidificationMeltingSource/VoFSolidificationMeltingSourceIO.C
compressibleInterFilmFoam.C
EXE = $(FOAM_APPBIN)/compressibleInterFilmFoam
applications/solvers/multiphase/compressibleInterFoam/compressibleInterFilmFoam/Make/options
0 → 100644
View file @
ea17556c
EXE_INC = \
-I.. \
-I../../VoF \
-I../twoPhaseMixtureThermo \
-I../VoFphaseCompressibleTurbulenceModels/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/fvOptions/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/transportModels/compressible/lnInclude \
-I$(LIB_SRC)/transportModels/twoPhaseMixture/lnInclude \
-I$(LIB_SRC)/transportModels/interfaceProperties/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/phaseCompressible/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/thermophysicalProperties/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/SLGThermo/lnInclude \
-I$(LIB_SRC)/regionModels/regionModel/lnInclude \
-I$(LIB_SRC)/regionModels/surfaceFilmModels/lnInclude \
-I$(LIB_SRC)/dynamicMesh/lnInclude \
-I$(LIB_SRC)/dynamicFvMesh/lnInclude
EXE_LIBS = \
-lfiniteVolume \
-lfvOptions \
-lmeshTools \
-ltwoPhaseMixtureThermo \
-ltwoPhaseSurfaceTension \
-lcompressibleTransportModels \
-lfluidThermophysicalModels \
-lspecie \
-ltwoPhaseMixture \
-ltwoPhaseProperties \
-linterfaceProperties \
-lturbulenceModels \
-lcompressibleTurbulenceModels \
-lVoFphaseCompressibleTurbulenceModels \
-lSLGThermo \
-lsurfaceFilmModels \
-lsurfaceFilmDerivedFvPatchFields \
-ldynamicMesh \
-ldynamicFvMesh
applications/solvers/multiphase/compressibleInterFoam/compressibleInterFilmFoam/TEqn.H
0 → 100644
View file @
ea17556c
{
fvScalarMatrix
TEqn
(
fvm
::
ddt
(
rho
,
T
)
+
fvm
::
div
(
rhoPhi
,
T
)
-
fvm
::
Sp
(
contErr
,
T
)
-
fvm
::
laplacian
(
turbulence
.
alphaEff
(),
T
)
+
(
(
fvc
::
div
(
fvc
::
absolute
(
phi
,
U
),
p
)
+
fvc
::
ddt
(
rho
,
K
)
+
fvc
::
div
(
rhoPhi
,
K
)
)()()
-
contErr
*
K
)
*
(
alpha1
/
mixture
.
thermo1
().
Cv
()
+
alpha2
/
mixture
.
thermo2
().
Cv
()
)()()
==
fvOptions
(
rho
,
T
)
+
pos
(
Srho
)
*
(
surfaceFilm
.
Sh
()()
/
mixture
.
thermo1
().
Cp
()()
+
surfaceFilm
.
Tref
*
Srho
)
);
TEqn
.
relax
();
fvOptions
.
constrain
(
TEqn
);
TEqn
.
solve
();
fvOptions
.
correct
(
T
);
mixture
.
correctThermo
();
mixture
.
correct
();
}
applications/solvers/multiphase/compressibleInterFoam/compressibleInterFilmFoam/VoFPatchTransfer/VoFPatchTransfer.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) 2017 OpenFOAM Foundation
Copyright (C) 2018-2021 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/>.
\*---------------------------------------------------------------------------*/
#include "VoFPatchTransfer.H"
#include "twoPhaseMixtureThermo.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace
Foam
{
namespace
regionModels
{
namespace
surfaceFilmModels
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug
(
VoFPatchTransfer
,
0
);
addToRunTimeSelectionTable
(
transferModel
,
VoFPatchTransfer
,
dictionary
);
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
VoFPatchTransfer
::
VoFPatchTransfer
(
surfaceFilmRegionModel
&
film
,
const
dictionary
&
dict
)
:
transferModel
(
type
(),
film
,
dict
),
deltaFactorToVoF_
(
coeffDict_
.
getOrDefault
<
scalar
>
(
"deltaFactorToVoF"
,
1
.
0
)
),
deltaFactorToFilm_
(
coeffDict_
.
getOrDefault
<
scalar
>
(
"deltaFactorToFilm"
,
0
.
5
)
),
alphaToVoF_
(
coeffDict_
.
getOrDefault
<
scalar
>
(
"alphaToVoF"
,
0
.
5
)
),
alphaToFilm_
(
coeffDict_
.
getOrDefault
<
scalar
>
(
"alphaToFilm"
,
0
.
1
)
),
transferRateCoeff_
(
coeffDict_
.
getOrDefault
<
scalar
>
(
"transferRateCoeff"
,
0
.
1
)
),
patchIDs_
(),
patchTransferredMasses_
()
{
const
polyBoundaryMesh
&
pbm
=
film
.
regionMesh
().
boundaryMesh
();
const
label
nPatches
(
pbm
.
size
()
-
film
.
regionMesh
().
globalData
().
processorPatches
().
size
()
);
wordRes
patchNames
;
if
(
coeffDict_
.
readIfPresent
(
"patches"
,
patchNames
))
{
patchIDs_
=
pbm
.
patchSet
(
patchNames
).
sortedToc
();
Info
<<
" applying to "
<<
patchIDs_
.
size
()
<<
" patches:"
<<
nl
;
for
(
const
label
patchi
:
patchIDs_
)
{
Info
<<
" "
<<
pbm
[
patchi
].
name
()
<<
endl
;
}
}
else
{
Info
<<
" applying to all patches"
<<
endl
;
patchIDs_
=
identity
(
nPatches
);
}
patchTransferredMasses_
.
resize
(
patchIDs_
.
size
(),
Zero
);
if
(
patchIDs_
.
empty
())
{
FatalErrorInFunction
<<
"No patches selected"
<<
exit
(
FatalError
);
}
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
VoFPatchTransfer
::~
VoFPatchTransfer
()
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
void
VoFPatchTransfer
::
correct
(
scalarField
&
availableMass
,
scalarField
&
massToTransfer
)
{
NotImplemented
;
}
void
VoFPatchTransfer
::
correct
(
scalarField
&
availableMass
,
scalarField
&
massToTransfer
,
scalarField
&
energyToTransfer
)
{
// Do not correct if no patches selected
if
(
!
patchIDs_
.
size
())
return
;
const
scalarField
&
delta
=
film
().
delta
();
const
scalarField
&
rho
=
film
().
rho
();
const
scalarField
&
magSf
=
film
().
magSf
();
const
polyBoundaryMesh
&
pbm
=
film
().
regionMesh
().
boundaryMesh
();
const
twoPhaseMixtureThermo
&
thermo
(
film
().
primaryMesh
().
lookupObject
<
twoPhaseMixtureThermo
>
(
twoPhaseMixtureThermo
::
dictName
)
);
const
volScalarField
&
heVoF
=
thermo
.
thermo1
().
he
();
const
volScalarField
&
TVoF
=
thermo
.
thermo1
().
T
();
const
volScalarField
CpVoF
(
thermo
.
thermo1
().
Cp
());
const
volScalarField
&
rhoVoF
=
thermo
.
thermo1
().
rho
()();
const
volScalarField
&
alphaVoF
=
thermo
.
alpha1
();
forAll
(
patchIDs_
,
pidi
)
{
const
label
patchi
=
patchIDs_
[
pidi
];
label
primaryPatchi
=
-
1
;
forAll
(
film
().
intCoupledPatchIDs
(),
i
)
{
const
label
filmPatchi
=
film
().
intCoupledPatchIDs
()[
i
];
if
(
filmPatchi
==
patchi
)
{
primaryPatchi
=
film
().
primaryPatchIDs
()[
i
];
}
}
if
(
primaryPatchi
!=
-
1
)
{
scalarField
deltaCoeffs
(
film
().
primaryMesh
().
boundary
()[
primaryPatchi
].
deltaCoeffs
()
);
film
().
toRegion
(
patchi
,
deltaCoeffs
);
scalarField
hp
(
heVoF
.
boundaryField
()[
primaryPatchi
]);
film
().
toRegion
(
patchi
,
hp
);
scalarField
Tp
(
TVoF
.
boundaryField
()[
primaryPatchi
]);
film
().
toRegion
(
patchi
,
Tp
);
scalarField
Cpp
(
CpVoF
.
boundaryField
()[
primaryPatchi
]);
film
().
toRegion
(
patchi
,
Cpp
);
scalarField
rhop
(
rhoVoF
.
boundaryField
()[
primaryPatchi
]);
film
().
toRegion
(
patchi
,
rhop
);
scalarField
alphap
(
alphaVoF
.
boundaryField
()[
primaryPatchi
]);
film
().
toRegion
(
patchi
,
alphap
);
scalarField
Vp
(
film
().
primaryMesh
().
boundary
()[
primaryPatchi
]
.
patchInternalField
(
film
().
primaryMesh
().
V
())
);
film
().
toRegion
(
patchi
,
Vp
);
const
polyPatch
&
pp
=
pbm
[
patchi
];
const
labelList
&
faceCells
=
pp
.
faceCells
();
// Accumulate the total mass removed from patch
scalar
dMassPatch
=
0
;
forAll
(
faceCells
,
facei
)
{
const
label
celli
=
faceCells
[
facei
];
scalar
dMass
=
0
;
if
(
delta
[
celli
]
>
2
*
deltaFactorToVoF_
/
deltaCoeffs
[
facei
]
||
alphap
[
facei
]
>
alphaToVoF_
)
{
dMass
=
transferRateCoeff_
*
delta
[
celli
]
*
rho
[
celli
]
*
magSf
[
celli
];
massToTransfer
[
celli
]
+=
dMass
;
energyToTransfer
[
celli
]
+=
dMass
*
film
().
hs
()[
celli
];
}
if
(
alphap
[
facei
]
>
0
&&
delta
[
celli
]
>
0
&&
delta
[
celli
]
<
2
*
deltaFactorToFilm_
/
deltaCoeffs
[
facei
]
&&
alphap
[
facei
]
<
alphaToFilm_
)
{
dMass
=
-
transferRateCoeff_
*
alphap
[
facei
]
*
rhop
[
facei
]
*
Vp
[
facei
];
massToTransfer
[
celli
]
+=
dMass
;
energyToTransfer
[
celli
]
+=
dMass
*
hp
[
facei
];
}
availableMass
[
celli
]
-=
dMass
;
dMassPatch
+=
dMass
;
}
patchTransferredMasses_
[
pidi
]
+=
dMassPatch
;
addToTransferredMass
(
dMassPatch
);
}
}
transferModel
::
correct
();
if
(
writeTime
())
{
scalarField
patchTransferredMasses0
(
getModelProperty
<
scalarField
>
(
"patchTransferredMasses"
,
scalarField
(
patchTransferredMasses_
.
size
(),
Zero
)
)
);
scalarField
patchTransferredMassTotals
(
patchTransferredMasses_
);
Pstream
::
listCombineGather
(
patchTransferredMassTotals
,
plusEqOp
<
scalar
>
()
);
patchTransferredMasses0
+=
patchTransferredMassTotals
;
setModelProperty
<
scalarField
>
(
"patchTransferredMasses"
,
patchTransferredMasses0
);
patchTransferredMasses_
=
0
;
}
}
void
VoFPatchTransfer
::
patchTransferredMassTotals
(
scalarField
&
patchMasses
)
const
{
// Do not correct if no patches selected
if
(
!
patchIDs_
.
size
())
return
;
scalarField
patchTransferredMasses
(
getModelProperty
<
scalarField
>
(
"patchTransferredMasses"
,
scalarField
(
patchTransferredMasses_
.
size
(),
Zero
)
)
);
scalarField
patchTransferredMassTotals
(
patchTransferredMasses_
);
Pstream
::
listCombineGather
(
patchTransferredMassTotals
,
plusEqOp
<
scalar
>
());
forAll
(
patchIDs_
,
pidi
)
{
const
label
patchi
=
patchIDs_
[
pidi
];
patchMasses
[
patchi
]
+=
patchTransferredMasses
[
pidi
]
+
patchTransferredMassTotals
[
pidi
];
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
}
// End namespace surfaceFilmModels
}
// End namespace regionModels
}
// End namespace Foam
// ************************************************************************* //
applications/solvers/multiphase/compressibleInterFoam/compressibleInterFilmFoam/VoFPatchTransfer/VoFPatchTransfer.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) 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/>.
Class
Foam::regionModels::surfaceFilmModels::VoFPatchTransfer
Description
Transfer mass between the film and the VoF in the continuous phase.
SourceFiles
VoFPatchTransfer.C
\*---------------------------------------------------------------------------*/
#ifndef VoFPatchTransfer_H
#define VoFPatchTransfer_H
#include "transferModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace
Foam
{
namespace
regionModels
{
namespace
surfaceFilmModels
{
/*---------------------------------------------------------------------------*\
Class VoFPatchTransfer Declaration
\*---------------------------------------------------------------------------*/
class
VoFPatchTransfer
:
public
transferModel
{
// Private member functions
//- No copy construct
VoFPatchTransfer
(
const
VoFPatchTransfer
&
)
=
delete
;
//- No copy assignment
void
operator
=
(
const
VoFPatchTransfer
&
)
=
delete
;
protected:
//- Factor of the cell height above which the film is transferred
// to the VoF
scalar
deltaFactorToVoF_
;
//- Factor of the cell height below which the VoF may be transferred
// to the film
scalar
deltaFactorToFilm_
;
//- VoF limit above which all of the film is transferred to the VoF
scalar
alphaToVoF_
;
//- VoF limit below which the VoF may be transferred to the film
scalar
alphaToFilm_
;
//- Transfer rate coefficient
scalar
transferRateCoeff_
;
//- List of patch IDs at which the film is removed
labelList
patchIDs_
;
//- Transferred mass for each patch at which the film is removed
scalarField
patchTransferredMasses_
;
public:
//- Runtime type information
TypeName
(
"VoFPatchTransfer"
);
// Constructors
//- Construct from surface film model
VoFPatchTransfer
(
surfaceFilmRegionModel
&
film
,
const
dictionary
&
dict
);
//- Destructor
virtual
~
VoFPatchTransfer
();
// Member Functions
//- Correct
virtual
void
correct
(
scalarField
&
availableMass
,
scalarField
&
massToTransfer
);
//- Correct kinematic and thermodynamic transfers
virtual
void
correct
(
scalarField
&
availableMass
,
scalarField
&
massToTransfer
,
scalarField
&
energyToTransfer
);
//- Accumulate the total mass injected for the patches into the
// scalarField provided
virtual
void
patchTransferredMassTotals
(
scalarField
&
patchMasses
)
const
;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
}
// End namespace surfaceFilmModels
}
// End namespace regionModels
}
// End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //
applications/solvers/multiphase/compressibleInterFoam/compressibleInterFilmFoam/VoFSolidificationMeltingSource/VoFSolidificationMeltingSource.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) 2017 OpenFOAM Foundation
Copyright (C) 2020-2021 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/>.
\*---------------------------------------------------------------------------*/
#include "VoFSolidificationMeltingSource.H"
#include "twoPhaseMixtureThermo.H"
#include "zeroGradientFvPatchFields.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
namespace
Foam
{
namespace
fv
{
defineTypeNameAndDebug
(
VoFSolidificationMeltingSource
,
0
);
addToRunTimeSelectionTable
(
option
,
VoFSolidificationMeltingSource
,
dictionary
);
}
}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void
Foam
::
fv
::
VoFSolidificationMeltingSource
::
update
()
{
if
(
curTimeIndex_
==
mesh_
.
time
().
timeIndex
())
{
return
;
}
if
(
debug
)
{
Info
<<
type
()
<<
": "
<<
name_
<<
" - updating solid phase fraction"
<<
endl
;
}
alphaSolid_
.
oldTime
();
const
twoPhaseMixtureThermo
&
thermo
(
mesh_
.
lookupObject
<
twoPhaseMixtureThermo
>
(
twoPhaseMixtureThermo
::
dictName
)
);
const
volScalarField
&
TVoF
=
thermo
.
thermo1
().
T
();
const
volScalarField
CpVoF
(
thermo
.
thermo1
().
Cp
());
const
volScalarField
&
alphaVoF
=
thermo
.
alpha1
();
forAll
(
cells_
,
i
)
{
const
label
celli
=
cells_
[
i
];
alphaSolid_
[
celli
]
=
min
(
relax_
*
alphaVoF
[
celli
]
*
alphaSolidT_
->
value
(
TVoF
[
celli
])
+
(
1
-
relax_
)
*
alphaSolid_
[
celli
],
alphaVoF
[
celli
]
);
}
alphaSolid_
.
correctBoundaryConditions
();
curTimeIndex_
=
mesh_
.
time
().
timeIndex
();
}
Foam
::
word
Foam
::
fv
::
VoFSolidificationMeltingSource
::
alphaSolidName
()
const
{
const
twoPhaseMixtureThermo
&
thermo
(
mesh_
.
lookupObject
<
twoPhaseMixtureThermo
>
(
twoPhaseMixtureThermo
::
dictName
)
);
const
volScalarField
&
alphaVoF
=
thermo
.
alpha1
();
return
IOobject
::
groupName
(
alphaVoF
.
name
(),
"solid"
);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam
::
fv
::
VoFSolidificationMeltingSource
::
VoFSolidificationMeltingSource
(
const
word
&
sourceName
,
const
word
&
modelType
,
const
dictionary
&
dict
,
const
fvMesh
&
mesh
)
:
fv
::
cellSetOption
(
sourceName
,
modelType
,
dict
,
mesh
),
alphaSolidT_
(
Function1
<
scalar
>::
New
(
"alphaSolidT"
,
coeffs_
,
&
mesh
)),
L_
(
"L"
,
dimEnergy
/
dimMass
,
coeffs_
),
relax_
(
coeffs_
.
getOrDefault
(
"relax"
,
0
.
9
)),
Cu_
(
coeffs_
.
getOrDefault
<
scalar
>
(
"Cu"
,
100000
)),
q_
(
coeffs_
.
getOrDefault
<
scalar
>
(
"q"
,
0
.
001
)),
alphaSolid_
(
IOobject
(
alphaSolidName
(),
mesh
.
time
().
timeName
(),
mesh
,
IOobject
::
READ_IF_PRESENT
,
IOobject
::
AUTO_WRITE
),
mesh
,
dimensionedScalar
(
dimless
,
Zero
),
zeroGradientFvPatchScalarField
::
typeName
),
curTimeIndex_
(
-
1
)
{
fieldNames_
.
resize
(
2
);
fieldNames_
[
0
]
=
"U"
;
fieldNames_
[
1
]
=
"T"
;
fv
::
option
::
resetApplied
();
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void
Foam
::
fv
::
VoFSolidificationMeltingSource
::
addSup
(
fvMatrix
<
scalar
>&
eqn
,
const
label
fieldi
)
{
apply
(
geometricOneField
(),
eqn
);
}
void
Foam
::
fv
::
VoFSolidificationMeltingSource
::
addSup
(
const
volScalarField
&
rho
,
fvMatrix
<
scalar
>&
eqn
,
const
label
fieldi
)
{
apply
(
rho
,
eqn
);
}
void
Foam
::
fv
::
VoFSolidificationMeltingSource
::
addSup
(
fvMatrix
<
vector
>&
eqn
,
const
label
fieldi
)
{
if
(
debug
)
{
Info
<<
type
()
<<
": applying source to "
<<
eqn
.
psi
().
name
()
<<
endl
;
}
update
();
scalarField
&
Sp
=
eqn
.
diag
();
const
scalarField
&
V
=
mesh_
.
V
();
forAll
(
cells_
,
i
)
{
const
label
celli
=
cells_
[
i
];
const
scalar
Vc
=
V
[
celli
];
const
scalar
alphaFluid
=
1
-
alphaSolid_
[
celli
];
const
scalar
S
=
Cu_
*
sqr
(
1
-
alphaFluid
)
/
(
pow3
(
alphaFluid
)
+
q_
);
Sp
[
celli
]
-=
Vc
*
S
;
}
}
void
Foam
::
fv
::
VoFSolidificationMeltingSource
::
addSup
(
const
volScalarField
&
rho
,
fvMatrix
<
vector
>&
eqn
,
const
label
fieldi
)
{
// Momentum source uses a Boussinesq approximation - redirect
addSup
(
eqn
,
fieldi
);
}
// ************************************************************************* //
applications/solvers/multiphase/compressibleInterFoam/compressibleInterFilmFoam/VoFSolidificationMeltingSource/VoFSolidificationMeltingSource.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) 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/>.
Class
Foam::fv::VoFSolidificationMeltingSource
Description
Solidification and melting model for VoF simulations.
The presence of the solid phase in the flow field is incorporated into the
model as a momentum porosity contribution; the energy associated with the
phase change is added as an enthalpy contribution. The solid fraction as a
function of temperature \c alphaSolidT is specified as a Foam::Function1.
The model writes the field \c alpha[01].solid which can be visualised to to
show the solid distribution.
Usage
Example usage:
\verbatim
VoFSolidificationMeltingSource1
{
type VoFSolidificationMeltingSource;
active yes;
selectionMode cellZone;
cellZone solidZone;
alphaSolidT table
(
(330 1)
(335 0)
);
L 334000;
}
\endverbatim
Where:
\table
Property | Description | Required | Default value
alphaSolidT | Solid fraction as function of temperature | yes |
L | Latent heat of fusion [J/kg] | yes |
relax | Relaxation coefficient [0-1] | no | 0.9
Cu | Model coefficient | no | 100000
q | Model coefficient | no | 0.001
\endtable
See also
Foam::fv::solidificationMeltingSource
Foam::Function1
SourceFiles
VoFSolidificationMeltingSource.C
VoFSolidificationMeltingSourceIO.C
\*---------------------------------------------------------------------------*/
#ifndef VoFSolidificationMeltingSource_H
#define VoFSolidificationMeltingSource_H
#include "fvMesh.H"
#include "volFields.H"
#include "cellSetOption.H"
#include "Function1.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace
Foam
{
namespace
fv
{
/*---------------------------------------------------------------------------*\
Class VoFSolidificationMeltingSource Declaration
\*---------------------------------------------------------------------------*/
class
VoFSolidificationMeltingSource
:
public
fv
::
cellSetOption
{
// Private data
//- Solid fraction as a function of temperature
autoPtr
<
Function1
<
scalar
>>
alphaSolidT_
;
//- Latent heat of fusion [J/kg]
dimensionedScalar
L_
;
//- Phase fraction under-relaxation coefficient
scalar
relax_
;
//- Mushy region momentum sink coefficient [1/s]; default = 10^5
scalar
Cu_
;
//- Coefficient used in porosity calc - default = 0.001
scalar
q_
;
//- Solid phase fraction
volScalarField
alphaSolid_
;
//- Current time index (used for updating)
label
curTimeIndex_
;
// Private Member Functions
//- Return the name of the solid phase fraction
word
alphaSolidName
()
const
;
//- Update the model
void
update
();
//- Helper function to apply to the energy equation
template
<
class
RhoFieldType
>
void
apply
(
const
RhoFieldType
&
rho
,
fvMatrix
<
scalar
>&
eqn
);
//- No copy construct
VoFSolidificationMeltingSource
(
const
VoFSolidificationMeltingSource
&
)
=
delete
;
//- No copy assignment
void
operator
=
(
const
VoFSolidificationMeltingSource
&
)
=
delete
;
public:
//- Runtime type information
TypeName
(
"VoFSolidificationMeltingSource"
);
// Constructors
//- Construct from explicit source name and mesh
VoFSolidificationMeltingSource
(
const
word
&
sourceName
,
const
word
&
modelType
,
const
dictionary
&
dict
,
const
fvMesh
&
mesh
);
// Member Functions
// Add explicit and implicit contributions
//- Add explicit contribution to enthalpy equation
virtual
void
addSup
(
fvMatrix
<
scalar
>&
eqn
,
const
label
fieldi
);
//- Add implicit contribution to momentum equation
virtual
void
addSup
(
fvMatrix
<
vector
>&
eqn
,
const
label
fieldi
);
// Add explicit and implicit contributions to compressible equation
//- Add explicit contribution to compressible enthalpy equation
virtual
void
addSup
(
const
volScalarField
&
rho
,
fvMatrix
<
scalar
>&
eqn
,
const
label
fieldi
);
//- Add implicit contribution to compressible momentum equation
virtual
void
addSup
(
const
volScalarField
&
rho
,
fvMatrix
<
vector
>&
eqn
,
const
label
fieldi
);
// IO
//- Read source dictionary
virtual
bool
read
(
const
dictionary
&
dict
);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
}
// End namespace fv
}
// End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
#include "VoFSolidificationMeltingSourceTemplates.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //
applications/solvers/multiphase/compressibleInterFoam/compressibleInterFilmFoam/VoFSolidificationMeltingSource/VoFSolidificationMeltingSourceIO.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) 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/>.
\*---------------------------------------------------------------------------*/
#include "VoFSolidificationMeltingSource.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
bool
Foam
::
fv
::
VoFSolidificationMeltingSource
::
read
(
const
dictionary
&
dict
)
{
if
(
fv
::
cellSetOption
::
read
(
dict
))
{
alphaSolidT_
=
Function1
<
scalar
>::
New
(
"alphaSolidT"
,
coeffs_
,
&
mesh_
);
coeffs_
.
readEntry
(
"L"
,
L_
);
coeffs_
.
readIfPresent
(
"relax"
,
relax_
);
coeffs_
.
readIfPresent
(
"Cu"
,
Cu_
);
coeffs_
.
readIfPresent
(
"q"
,
q_
);
return
true
;
}
return
false
;
}
// ************************************************************************* //
applications/solvers/multiphase/compressibleInterFoam/compressibleInterFilmFoam/VoFSolidificationMeltingSource/VoFSolidificationMeltingSourceTemplates.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) 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/>.
\*---------------------------------------------------------------------------*/
#include "fvcDdt.H"
#include "twoPhaseMixtureThermo.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template
<
class
RhoFieldType
>
void
Foam
::
fv
::
VoFSolidificationMeltingSource
::
apply
(
const
RhoFieldType
&
rho
,
fvMatrix
<
scalar
>&
eqn
)
{
if
(
debug
)
{
Info
<<
type
()
<<
": applying source to "
<<
eqn
.
psi
().
name
()
<<
endl
;
}
update
();
const
twoPhaseMixtureThermo
&
thermo
(
mesh_
.
lookupObject
<
twoPhaseMixtureThermo
>
(
twoPhaseMixtureThermo
::
dictName
)
);
const
volScalarField
CpVoF
(
thermo
.
thermo1
().
Cp
());
if
(
eqn
.
psi
().
dimensions
()
==
dimTemperature
)
{
eqn
+=
L_
/
CpVoF
*
(
fvc
::
ddt
(
rho
,
alphaSolid_
));
}
else
{
eqn
+=
L_
*
(
fvc
::
ddt
(
rho
,
alphaSolid_
));
}
}
// ************************************************************************* //
applications/solvers/multiphase/compressibleInterFoam/compressibleInterFilmFoam/compressibleInterFilmFoam.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
compressibleInterFoam
Description
Solver for two compressible, non-isothermal immiscible fluids using a VOF
(volume of fluid) phase-fraction based interface capturing approach.
The momentum and other fluid properties are of the "mixture" and a single
momentum equation is solved.
Turbulence modelling is generic, i.e. laminar, RAS or LES may be selected.
\*---------------------------------------------------------------------------*/
#include "fvCFD.H"
#include "CMULES.H"
#include "EulerDdtScheme.H"
#include "localEulerDdtScheme.H"
#include "CrankNicolsonDdtScheme.H"
#include "subCycle.H"
#include "compressibleInterPhaseTransportModel.H"
#include "pimpleControl.H"
#include "SLGThermo.H"
#include "surfaceFilmModel.H"
#include "pimpleControl.H"
#include "fvOptions.H"
#include "fvcSmooth.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int
main
(
int
argc
,
char
*
argv
[])
{
argList
::
addNote
(
"Solver for two compressible, non-isothermal immiscible fluids"
" using VOF phase-fraction based interface capturing."
);
#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 "createSurfaceFilmModel.H"
volScalarField
&
p
=
mixture
.
p
();
volScalarField
&
T
=
mixture
.
T
();
const
volScalarField
&
psi1
=
mixture
.
thermo1
().
psi
();
const
volScalarField
&
psi2
=
mixture
.
thermo2
().
psi
();
regionModels
::
surfaceFilmModel
&
surfaceFilm
=
tsurfaceFilm
();
if
(
!
LTS
)
{
#include "readTimeControls.H"
#include "CourantNo.H"
#include "setInitialDeltaT.H"
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Info
<<
"
\n
Starting time loop
\n
"
<<
endl
;
while
(
runTime
.
run
())
{
#include "readTimeControls.H"
if
(
LTS
)
{
#include "setRDeltaT.H"
}
else
{
#include "CourantNo.H"
#include "alphaCourantNo.H"
#include "setDeltaT.H"
}
++
runTime
;
Info
<<
"Time = "
<<
runTime
.
timeName
()
<<
nl
<<
endl
;
surfaceFilm
.
evolve
();
// --- Pressure-velocity PIMPLE corrector loop
while
(
pimple
.
loop
())
{
#include "alphaControls.H"
#include "compressibleAlphaEqnSubCycle.H"
turbulence
.
correctPhasePhi
();
volScalarField
::
Internal
Srho
(
surfaceFilm
.
Srho
());
contErr
-=
posPart
(
Srho
);
#include "UEqn.H"
#include "TEqn.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/compressibleInterFoam/compressibleInterFilmFoam/createSurfaceFilmModel.H
0 → 100644
View file @
ea17556c
Info
<<
"
\n
Constructing surface film model"
<<
endl
;
SLGThermo
slgThermo
(
mesh
,
mixture
.
thermo1
());
autoPtr
<
regionModels
::
surfaceFilmModel
>
tsurfaceFilm
(
regionModels
::
surfaceFilmModel
::
New
(
mesh
,
g
)
);
applications/solvers/multiphase/compressibleInterFoam/compressibleInterFilmFoam/pEqn.H
0 → 100644
View file @
ea17556c
{
volScalarField
rAU
(
"rAU"
,
1
.
0
/
UEqn
.
A
());
surfaceScalarField
rAUf
(
"rAUf"
,
fvc
::
interpolate
(
rAU
));
volVectorField
HbyA
(
constrainHbyA
(
rAU
*
UEqn
.
H
(),
U
,
p_rgh
));
surfaceScalarField
phiHbyA
(
"phiHbyA"
,
fvc
::
flux
(
HbyA
)
+
MRF
.
zeroFilter
(
fvc
::
interpolate
(
rho
*
rAU
)
*
fvc
::
ddtCorr
(
U
,
phi
))
);
MRF
.
makeRelative
(
phiHbyA
);
surfaceScalarField
phig
(
(
mixture
.
surfaceTensionForce
()
-
ghf
*
fvc
::
snGrad
(
rho
)
)
*
rAUf
*
mesh
.
magSf
()
);
phiHbyA
+=
phig
;
// Update the pressure BCs to ensure flux consistency
constrainPressure
(
p_rgh
,
U
,
phiHbyA
,
rAUf
,
MRF
);
tmp
<
fvScalarMatrix
>
p_rghEqnComp1
;
tmp
<
fvScalarMatrix
>
p_rghEqnComp2
;
if
(
pimple
.
transonic
())
{
#include "rhofs.H"
surfaceScalarField
phid1
(
"phid1"
,
fvc
::
interpolate
(
psi1
)
*
phi
);
surfaceScalarField
phid2
(
"phid2"
,
fvc
::
interpolate
(
psi2
)
*
phi
);
p_rghEqnComp1
=
pos
(
alpha1
)
*
(
(
fvc
::
ddt
(
alpha1
,
rho1
)
+
fvc
::
div
(
alphaPhi1
*
rho1f
)
-
(
fvOptions
(
alpha1
,
mixture
.
thermo1
().
rho
())
&
rho1
)
)
/
rho1
-
fvc
::
ddt
(
alpha1
)
-
fvc
::
div
(
alphaPhi1
)
+
(
alpha1
/
rho1
)
*
correction
(
psi1
*
fvm
::
ddt
(
p_rgh
)
+
fvm
::
div
(
phid1
,
p_rgh
)
-
fvm
::
Sp
(
fvc
::
div
(
phid1
),
p_rgh
)
)
);
p_rghEqnComp1
.
ref
().
relax
();
p_rghEqnComp2
=
pos
(
alpha2
)
*
(
(
fvc
::
ddt
(
alpha2
,
rho2
)
+
fvc
::
div
(
alphaPhi2
*
rho2f
)
-
(
fvOptions
(
alpha2
,
mixture
.
thermo2
().
rho
())
&
rho2
)
)
/
rho2
-
fvc
::
ddt
(
alpha2
)
-
fvc
::
div
(
alphaPhi2
)
+
(
alpha2
/
rho2
)
*
correction
(
psi2
*
fvm
::
ddt
(
p_rgh
)
+
fvm
::
div
(
phid2
,
p_rgh
)
-
fvm
::
Sp
(
fvc
::
div
(
phid2
),
p_rgh
)
)
);
p_rghEqnComp2
.
ref
().
relax
();
}
else
{
#include "rhofs.H"
p_rghEqnComp1
=
pos
(
alpha1
)
*
(
(
fvc
::
ddt
(
alpha1
,
rho1
)
+
fvc
::
div
(
alphaPhi1
*
rho1f
)
-
(
fvOptions
(
alpha1
,
mixture
.
thermo1
().
rho
())
&
rho1
)
)
/
rho1
-
fvc
::
ddt
(
alpha1
)
-
fvc
::
div
(
alphaPhi1
)
+
(
alpha1
*
psi1
/
rho1
)
*
correction
(
fvm
::
ddt
(
p_rgh
))
)
-
surfaceFilm
.
Srho
()
/
rho1
;
p_rghEqnComp2
=
pos
(
alpha2
)
*
(
(
fvc
::
ddt
(
alpha2
,
rho2
)
+
fvc
::
div
(
alphaPhi2
*
rho2f
)
-
(
fvOptions
(
alpha2
,
mixture
.
thermo2
().
rho
())
&
rho2
)
)
/
rho2
-
fvc
::
ddt
(
alpha2
)
-
fvc
::
div
(
alphaPhi2
)
+
(
alpha2
*
psi2
/
rho2
)
*
correction
(
fvm
::
ddt
(
p_rgh
))
);
}
// Cache p_rgh prior to solve for density update
volScalarField
p_rgh_0
(
p_rgh
);
while
(
pimple
.
correctNonOrthogonal
())
{
fvScalarMatrix
p_rghEqnIncomp
(
fvc
::
div
(
phiHbyA
)
-
fvm
::
laplacian
(
rAUf
,
p_rgh
)
);
solve
(
p_rghEqnComp1
()
+
p_rghEqnComp2
()
+
p_rghEqnIncomp
,
mesh
.
solver
(
p_rgh
.
select
(
pimple
.
finalInnerIter
()))
);
if
(
pimple
.
finalNonOrthogonalIter
())
{
p
=
max
(
p_rgh
+
(
alpha1
*
rho1
+
alpha2
*
rho2
)
*
gh
,
pMin
);
p_rgh
=
p
-
(
alpha1
*
rho1
+
alpha2
*
rho2
)
*
gh
;
dgdt
=
(
alpha1
*
(
p_rghEqnComp2
&
p_rgh
)
-
alpha2
*
(
p_rghEqnComp1
&
p_rgh
)
);
phi
=
phiHbyA
+
p_rghEqnIncomp
.
flux
();
U
=
HbyA
+
rAU
*
fvc
::
reconstruct
((
phig
+
p_rghEqnIncomp
.
flux
())
/
rAUf
);
U
.
correctBoundaryConditions
();
fvOptions
.
correct
(
U
);
}
}
// Update densities from change in p_rgh
mixture
.
thermo1
().
correctRho
(
psi1
*
(
p_rgh
-
p_rgh_0
));
mixture
.
thermo2
().
correctRho
(
psi2
*
(
p_rgh
-
p_rgh_0
));
rho
=
alpha1
*
rho1
+
alpha2
*
rho2
;
// Correct p_rgh for consistency with p and the updated densities
p_rgh
=
p
-
rho
*
gh
;
p_rgh
.
correctBoundaryConditions
();
K
=
0
.
5
*
magSqr
(
U
);
}
applications/solvers/multiphase/compressibleInterFoam/compressibleInterFoam.C
0 → 100644
View file @
ea17556c
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) OpenCFD 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
compressibleInterFoam
Group
grpMultiphaseSolvers
Description
Solver for two compressible, non-isothermal immiscible fluids using a VOF
(volume of fluid) phase-fraction based interface capturing approach.
The momentum and other fluid properties are of the "mixture" and a single
momentum equation is solved.
Either mixture or two-phase transport modelling may be selected. In the
mixture approach a single laminar, RAS or LES model is selected to model the
momentum stress. In the Euler-Euler two-phase approach separate laminar,
RAS or LES selected models are selected for each of the phases.
\*---------------------------------------------------------------------------*/
#include "fvCFD.H"
#include "CMULES.H"
#include "EulerDdtScheme.H"
#include "localEulerDdtScheme.H"
#include "CrankNicolsonDdtScheme.H"
#include "subCycle.H"
#include "compressibleInterPhaseTransportModel.H"
#include "pimpleControl.H"
#include "fvOptions.H"
#include "fvcSmooth.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int
main
(
int
argc
,
char
*
argv
[])
{
argList
::
addNote
(
"Solver for two compressible, non-isothermal immiscible fluids"
" using VOF phase-fraction based interface capturing."
);
#include "postProcess.H"
#include "addCheckCaseOptions.H"
#include "setRootCaseLists.H"
#include "createTime.H"
#include "createMesh.H"
#include "createControl.H"
#include "createTimeControls.H"
#include "createFields.H"
volScalarField
&
p
=
mixture
.
p
();
volScalarField
&
T
=
mixture
.
T
();
const
volScalarField
&
psi1
=
mixture
.
thermo1
().
psi
();
const
volScalarField
&
psi2
=
mixture
.
thermo2
().
psi
();
if
(
!
LTS
)
{
#include "readTimeControls.H"
#include "CourantNo.H"
#include "setInitialDeltaT.H"
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Info
<<
"
\n
Starting time loop
\n
"
<<
endl
;
while
(
runTime
.
run
())
{
#include "readTimeControls.H"
if
(
LTS
)
{
#include "setRDeltaT.H"
}
else
{
#include "CourantNo.H"
#include "alphaCourantNo.H"
#include "setDeltaT.H"
}
++
runTime
;
Info
<<
"Time = "
<<
runTime
.
timeName
()
<<
nl
<<
endl
;
// --- Pressure-velocity PIMPLE corrector loop
while
(
pimple
.
loop
())
{
#include "alphaControls.H"
#include "compressibleAlphaEqnSubCycle.H"
turbulence
.
correctPhasePhi
();
#include "UEqn.H"
volScalarField
divUp
(
"divUp"
,
fvc
::
div
(
fvc
::
absolute
(
phi
,
U
),
p
));
#include "TEqn.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/compressibleInterFoam/compressibleInterIsoFoam/Make/files
0 → 100644
View file @
ea17556c
compressibleInterIsoFoam.C
EXE = $(FOAM_APPBIN)/compressibleInterIsoFoam
applications/solvers/multiphase/compressibleInterFoam/compressibleInterIsoFoam/Make/options
0 → 100644
View file @
ea17556c
EXE_INC = \
-I.. \
-I../../VoF \
-I../twoPhaseMixtureThermo \
-I../VoFphaseCompressibleTurbulenceModels \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/fvOptions/lnInclude \
-I$(LIB_SRC)/surfMesh/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/dynamicMesh/lnInclude \
-I$(LIB_SRC)/dynamicFvMesh/lnInclude \
-I$(LIB_SRC)/transportModels/compressible/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/transportModels/twoPhaseMixture/lnInclude \
-I$(LIB_SRC)/transportModels/interfaceProperties/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/phaseCompressible/lnInclude \
-I$(LIB_SRC)/transportModels/geometricVoF/lnInclude
EXE_LIBS = \
-lfiniteVolume \
-lfvOptions \
-lsurfMesh \
-lmeshTools \
-ldynamicMesh \
-ldynamicFvMesh \
-ltwoPhaseMixtureThermo \
-ltwoPhaseSurfaceTension \
-lcompressibleTransportModels \
-lfluidThermophysicalModels \
-lspecie \
-ltwoPhaseMixture \
-ltwoPhaseProperties \
-linterfaceProperties \
-lturbulenceModels \
-lcompressibleTurbulenceModels \
-lVoFphaseCompressibleTurbulenceModels \
-lgeometricVoF
applications/solvers/multiphase/compressibleInterFoam/compressibleInterIsoFoam/alphaControls.H
0 → 100644
View file @
ea17556c
const
dictionary
&
alphaControls
=
mesh
.
solverDict
(
alpha1
.
name
());
label
nAlphaSubCycles
(
alphaControls
.
get
<
label
>
(
"nAlphaSubCycles"
));
Prev
1
…
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