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
1889 additions
and
0 deletions
+1889
-0
applications/solvers/compressible/rhoCentralFoam/BCs/T/smoluchowskiJumpTFvPatchScalarField.C
...hoCentralFoam/BCs/T/smoluchowskiJumpTFvPatchScalarField.C
+236
-0
applications/solvers/compressible/rhoCentralFoam/BCs/T/smoluchowskiJumpTFvPatchScalarField.H
...hoCentralFoam/BCs/T/smoluchowskiJumpTFvPatchScalarField.H
+176
-0
applications/solvers/compressible/rhoCentralFoam/BCs/U/maxwellSlipUFvPatchVectorField.C
...ble/rhoCentralFoam/BCs/U/maxwellSlipUFvPatchVectorField.C
+233
-0
applications/solvers/compressible/rhoCentralFoam/BCs/U/maxwellSlipUFvPatchVectorField.H
...ble/rhoCentralFoam/BCs/U/maxwellSlipUFvPatchVectorField.H
+168
-0
applications/solvers/compressible/rhoCentralFoam/BCs/rho/fixedRhoFvPatchScalarField.C
...sible/rhoCentralFoam/BCs/rho/fixedRhoFvPatchScalarField.C
+139
-0
applications/solvers/compressible/rhoCentralFoam/BCs/rho/fixedRhoFvPatchScalarField.H
...sible/rhoCentralFoam/BCs/rho/fixedRhoFvPatchScalarField.H
+188
-0
applications/solvers/compressible/rhoCentralFoam/Make/files
applications/solvers/compressible/rhoCentralFoam/Make/files
+3
-0
applications/solvers/compressible/rhoCentralFoam/Make/options
...ications/solvers/compressible/rhoCentralFoam/Make/options
+23
-0
applications/solvers/compressible/rhoCentralFoam/centralCourantNo.H
...ns/solvers/compressible/rhoCentralFoam/centralCourantNo.H
+47
-0
applications/solvers/compressible/rhoCentralFoam/createFieldRefs.H
...ons/solvers/compressible/rhoCentralFoam/createFieldRefs.H
+10
-0
applications/solvers/compressible/rhoCentralFoam/createFields.H
...ations/solvers/compressible/rhoCentralFoam/createFields.H
+102
-0
applications/solvers/compressible/rhoCentralFoam/directionInterpolate.H
...olvers/compressible/rhoCentralFoam/directionInterpolate.H
+32
-0
applications/solvers/compressible/rhoCentralFoam/readFluxScheme.H
...ions/solvers/compressible/rhoCentralFoam/readFluxScheme.H
+16
-0
applications/solvers/compressible/rhoCentralFoam/rhoCentralFoam.C
...ions/solvers/compressible/rhoCentralFoam/rhoCentralFoam.C
+302
-0
applications/solvers/compressible/rhoCentralFoam/setRDeltaT.H
...ications/solvers/compressible/rhoCentralFoam/setRDeltaT.H
+29
-0
applications/solvers/compressible/rhoPimpleAdiabaticFoam/EEqn.H
...ations/solvers/compressible/rhoPimpleAdiabaticFoam/EEqn.H
+49
-0
applications/solvers/compressible/rhoPimpleAdiabaticFoam/Make/files
...ns/solvers/compressible/rhoPimpleAdiabaticFoam/Make/files
+3
-0
applications/solvers/compressible/rhoPimpleAdiabaticFoam/Make/options
.../solvers/compressible/rhoPimpleAdiabaticFoam/Make/options
+20
-0
applications/solvers/compressible/rhoPimpleAdiabaticFoam/UEqn.H
...ations/solvers/compressible/rhoPimpleAdiabaticFoam/UEqn.H
+24
-0
applications/solvers/compressible/rhoPimpleAdiabaticFoam/createFields.H
...olvers/compressible/rhoPimpleAdiabaticFoam/createFields.H
+89
-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/compressible/rhoCentralFoam/BCs/T/smoluchowskiJumpTFvPatchScalarField.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-2015 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "smoluchowskiJumpTFvPatchScalarField.H"
#include "addToRunTimeSelectionTable.H"
#include "fvPatchFieldMapper.H"
#include "volFields.H"
#include "basicThermo.H"
#include "mathematicalConstants.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam
::
smoluchowskiJumpTFvPatchScalarField
::
smoluchowskiJumpTFvPatchScalarField
(
const
fvPatch
&
p
,
const
DimensionedField
<
scalar
,
volMesh
>&
iF
)
:
mixedFvPatchScalarField
(
p
,
iF
),
UName_
(
"U"
),
rhoName_
(
"rho"
),
psiName_
(
"thermo:psi"
),
muName_
(
"thermo:mu"
),
accommodationCoeff_
(
1
.
0
),
Twall_
(
p
.
size
(),
Zero
),
gamma_
(
1
.
4
)
{
refValue
()
=
0
.
0
;
refGrad
()
=
0
.
0
;
valueFraction
()
=
0
.
0
;
}
Foam
::
smoluchowskiJumpTFvPatchScalarField
::
smoluchowskiJumpTFvPatchScalarField
(
const
smoluchowskiJumpTFvPatchScalarField
&
ptf
,
const
fvPatch
&
p
,
const
DimensionedField
<
scalar
,
volMesh
>&
iF
,
const
fvPatchFieldMapper
&
mapper
)
:
mixedFvPatchScalarField
(
ptf
,
p
,
iF
,
mapper
),
UName_
(
ptf
.
UName_
),
rhoName_
(
ptf
.
rhoName_
),
psiName_
(
ptf
.
psiName_
),
muName_
(
ptf
.
muName_
),
accommodationCoeff_
(
ptf
.
accommodationCoeff_
),
Twall_
(
ptf
.
Twall_
),
gamma_
(
ptf
.
gamma_
)
{}
Foam
::
smoluchowskiJumpTFvPatchScalarField
::
smoluchowskiJumpTFvPatchScalarField
(
const
fvPatch
&
p
,
const
DimensionedField
<
scalar
,
volMesh
>&
iF
,
const
dictionary
&
dict
)
:
mixedFvPatchScalarField
(
p
,
iF
),
UName_
(
dict
.
getOrDefault
<
word
>
(
"U"
,
"U"
)),
rhoName_
(
dict
.
getOrDefault
<
word
>
(
"rho"
,
"rho"
)),
psiName_
(
dict
.
getOrDefault
<
word
>
(
"psi"
,
"thermo:psi"
)),
muName_
(
dict
.
getOrDefault
<
word
>
(
"mu"
,
"thermo:mu"
)),
accommodationCoeff_
(
dict
.
get
<
scalar
>
(
"accommodationCoeff"
)),
Twall_
(
"Twall"
,
dict
,
p
.
size
()),
gamma_
(
dict
.
getOrDefault
<
scalar
>
(
"gamma"
,
1
.
4
))
{
if
(
mag
(
accommodationCoeff_
)
<
SMALL
||
mag
(
accommodationCoeff_
)
>
2
.
0
)
{
FatalIOErrorInFunction
(
dict
)
<<
"unphysical accommodationCoeff specified"
<<
"(0 < accommodationCoeff <= 1)"
<<
endl
<<
exit
(
FatalIOError
);
}
if
(
dict
.
found
(
"value"
))
{
fvPatchField
<
scalar
>::
operator
=
(
scalarField
(
"value"
,
dict
,
p
.
size
())
);
}
else
{
fvPatchField
<
scalar
>::
operator
=
(
patchInternalField
());
}
refValue
()
=
*
this
;
refGrad
()
=
0
.
0
;
valueFraction
()
=
0
.
0
;
}
Foam
::
smoluchowskiJumpTFvPatchScalarField
::
smoluchowskiJumpTFvPatchScalarField
(
const
smoluchowskiJumpTFvPatchScalarField
&
ptpsf
,
const
DimensionedField
<
scalar
,
volMesh
>&
iF
)
:
mixedFvPatchScalarField
(
ptpsf
,
iF
),
accommodationCoeff_
(
ptpsf
.
accommodationCoeff_
),
Twall_
(
ptpsf
.
Twall_
),
gamma_
(
ptpsf
.
gamma_
)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
// Map from self
void
Foam
::
smoluchowskiJumpTFvPatchScalarField
::
autoMap
(
const
fvPatchFieldMapper
&
m
)
{
mixedFvPatchScalarField
::
autoMap
(
m
);
}
// Reverse-map the given fvPatchField onto this fvPatchField
void
Foam
::
smoluchowskiJumpTFvPatchScalarField
::
rmap
(
const
fvPatchField
<
scalar
>&
ptf
,
const
labelList
&
addr
)
{
mixedFvPatchField
<
scalar
>::
rmap
(
ptf
,
addr
);
}
// Update the coefficients associated with the patch field
void
Foam
::
smoluchowskiJumpTFvPatchScalarField
::
updateCoeffs
()
{
if
(
updated
())
{
return
;
}
const
fvPatchScalarField
&
pmu
=
patch
().
lookupPatchField
<
volScalarField
,
scalar
>
(
muName_
);
const
fvPatchScalarField
&
prho
=
patch
().
lookupPatchField
<
volScalarField
,
scalar
>
(
rhoName_
);
const
fvPatchField
<
scalar
>&
ppsi
=
patch
().
lookupPatchField
<
volScalarField
,
scalar
>
(
psiName_
);
const
fvPatchVectorField
&
pU
=
patch
().
lookupPatchField
<
volVectorField
,
vector
>
(
UName_
);
// Prandtl number reading consistent with rhoCentralFoam
const
dictionary
&
thermophysicalProperties
=
db
().
lookupObject
<
IOdictionary
>
(
basicThermo
::
dictName
);
dimensionedScalar
Pr
(
"Pr"
,
dimless
,
thermophysicalProperties
.
subDict
(
"mixture"
).
subDict
(
"transport"
)
);
Field
<
scalar
>
C2
(
pmu
/
prho
*
sqrt
(
ppsi
*
constant
::
mathematical
::
piByTwo
)
*
2
.
0
*
gamma_
/
Pr
.
value
()
/
(
gamma_
+
1
.
0
)
*
(
2
.
0
-
accommodationCoeff_
)
/
accommodationCoeff_
);
Field
<
scalar
>
aCoeff
(
prho
.
snGrad
()
-
prho
/
C2
);
Field
<
scalar
>
KEbyRho
(
0
.
5
*
magSqr
(
pU
));
valueFraction
()
=
(
1
.
0
/
(
1
.
0
+
patch
().
deltaCoeffs
()
*
C2
));
refValue
()
=
Twall_
;
refGrad
()
=
0
.
0
;
mixedFvPatchScalarField
::
updateCoeffs
();
}
// Write
void
Foam
::
smoluchowskiJumpTFvPatchScalarField
::
write
(
Ostream
&
os
)
const
{
fvPatchScalarField
::
write
(
os
);
os
.
writeEntryIfDifferent
<
word
>
(
"U"
,
"U"
,
UName_
);
os
.
writeEntryIfDifferent
<
word
>
(
"rho"
,
"rho"
,
rhoName_
);
os
.
writeEntryIfDifferent
<
word
>
(
"psi"
,
"thermo:psi"
,
psiName_
);
os
.
writeEntryIfDifferent
<
word
>
(
"mu"
,
"thermo:mu"
,
muName_
);
os
.
writeEntry
(
"accommodationCoeff"
,
accommodationCoeff_
);
Twall_
.
writeEntry
(
"Twall"
,
os
);
os
.
writeEntry
(
"gamma"
,
gamma_
);
writeEntry
(
"value"
,
os
);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace
Foam
{
makePatchTypeField
(
fvPatchScalarField
,
smoluchowskiJumpTFvPatchScalarField
);
}
// ************************************************************************* //
applications/solvers/compressible/rhoCentralFoam/BCs/T/smoluchowskiJumpTFvPatchScalarField.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-2012 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::smoluchowskiJumpTFvPatchScalarField
Description
Smoluchowski temperature jump boundary condition
SourceFiles
smoluchowskiJumpTFvPatchScalarField.C
\*---------------------------------------------------------------------------*/
#ifndef smoluchowskiJumpTFvPatchScalarField_H
#define smoluchowskiJumpTFvPatchScalarField_H
#include "mixedFvPatchFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace
Foam
{
/*---------------------------------------------------------------------------*\
Class smoluchowskiJumpTFvPatchScalarField Declaration
\*---------------------------------------------------------------------------*/
class
smoluchowskiJumpTFvPatchScalarField
:
public
mixedFvPatchScalarField
{
// Private data
//- Velocity field name, default = "U"
word
UName_
;
//- Density field name, default = "rho"
word
rhoName_
;
//- Compressibility field name, default = "thermo:psi"
word
psiName_
;
//- Dynamic viscosity field name, default = "thermo:mu"
word
muName_
;
//- Accommodation coefficient
scalar
accommodationCoeff_
;
//- Wall surface temperature
scalarField
Twall_
;
//- Heat capacity ratio (default 1.4)
scalar
gamma_
;
public:
//- Runtime type information
TypeName
(
"smoluchowskiJumpT"
);
// Constructors
//- Construct from patch and internal field
smoluchowskiJumpTFvPatchScalarField
(
const
fvPatch
&
,
const
DimensionedField
<
scalar
,
volMesh
>&
);
//- Construct from patch, internal field and dictionary
smoluchowskiJumpTFvPatchScalarField
(
const
fvPatch
&
,
const
DimensionedField
<
scalar
,
volMesh
>&
,
const
dictionary
&
);
//- Construct by mapping given smoluchowskiJumpTFvPatchScalarField
// onto a new patch
smoluchowskiJumpTFvPatchScalarField
(
const
smoluchowskiJumpTFvPatchScalarField
&
,
const
fvPatch
&
,
const
DimensionedField
<
scalar
,
volMesh
>&
,
const
fvPatchFieldMapper
&
);
//- Construct and return a clone
virtual
tmp
<
fvPatchScalarField
>
clone
()
const
{
return
tmp
<
fvPatchScalarField
>
(
new
smoluchowskiJumpTFvPatchScalarField
(
*
this
)
);
}
//- Construct as copy setting internal field reference
smoluchowskiJumpTFvPatchScalarField
(
const
smoluchowskiJumpTFvPatchScalarField
&
,
const
DimensionedField
<
scalar
,
volMesh
>&
);
//- Construct and return a clone setting internal field reference
virtual
tmp
<
fvPatchScalarField
>
clone
(
const
DimensionedField
<
scalar
,
volMesh
>&
iF
)
const
{
return
tmp
<
fvPatchScalarField
>
(
new
smoluchowskiJumpTFvPatchScalarField
(
*
this
,
iF
)
);
}
// Mapping functions
//- Map (and resize as needed) from self given a mapping object
virtual
void
autoMap
(
const
fvPatchFieldMapper
&
);
//- Reverse map the given fvPatchField onto this fvPatchField
virtual
void
rmap
(
const
fvPatchField
<
scalar
>&
,
const
labelList
&
);
// Evaluation functions
//- Update the coefficients associated with the patch field
virtual
void
updateCoeffs
();
//- Write
virtual
void
write
(
Ostream
&
)
const
;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
}
// End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //
applications/solvers/compressible/rhoCentralFoam/BCs/U/maxwellSlipUFvPatchVectorField.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-2015 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "maxwellSlipUFvPatchVectorField.H"
#include "addToRunTimeSelectionTable.H"
#include "mathematicalConstants.H"
#include "fvPatchFieldMapper.H"
#include "volFields.H"
#include "fvcGrad.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam
::
maxwellSlipUFvPatchVectorField
::
maxwellSlipUFvPatchVectorField
(
const
fvPatch
&
p
,
const
DimensionedField
<
vector
,
volMesh
>&
iF
)
:
partialSlipFvPatchVectorField
(
p
,
iF
),
TName_
(
"T"
),
rhoName_
(
"rho"
),
psiName_
(
"thermo:psi"
),
muName_
(
"thermo:mu"
),
tauMCName_
(
"tauMC"
),
accommodationCoeff_
(
1
.
0
),
Uwall_
(
p
.
size
(),
Zero
),
thermalCreep_
(
true
),
curvature_
(
true
)
{}
Foam
::
maxwellSlipUFvPatchVectorField
::
maxwellSlipUFvPatchVectorField
(
const
maxwellSlipUFvPatchVectorField
&
mspvf
,
const
fvPatch
&
p
,
const
DimensionedField
<
vector
,
volMesh
>&
iF
,
const
fvPatchFieldMapper
&
mapper
)
:
partialSlipFvPatchVectorField
(
mspvf
,
p
,
iF
,
mapper
),
TName_
(
mspvf
.
TName_
),
rhoName_
(
mspvf
.
rhoName_
),
psiName_
(
mspvf
.
psiName_
),
muName_
(
mspvf
.
muName_
),
tauMCName_
(
mspvf
.
tauMCName_
),
accommodationCoeff_
(
mspvf
.
accommodationCoeff_
),
Uwall_
(
mspvf
.
Uwall_
),
thermalCreep_
(
mspvf
.
thermalCreep_
),
curvature_
(
mspvf
.
curvature_
)
{}
Foam
::
maxwellSlipUFvPatchVectorField
::
maxwellSlipUFvPatchVectorField
(
const
fvPatch
&
p
,
const
DimensionedField
<
vector
,
volMesh
>&
iF
,
const
dictionary
&
dict
)
:
partialSlipFvPatchVectorField
(
p
,
iF
),
TName_
(
dict
.
getOrDefault
<
word
>
(
"T"
,
"T"
)),
rhoName_
(
dict
.
getOrDefault
<
word
>
(
"rho"
,
"rho"
)),
psiName_
(
dict
.
getOrDefault
<
word
>
(
"psi"
,
"thermo:psi"
)),
muName_
(
dict
.
getOrDefault
<
word
>
(
"mu"
,
"thermo:mu"
)),
tauMCName_
(
dict
.
getOrDefault
<
word
>
(
"tauMC"
,
"tauMC"
)),
accommodationCoeff_
(
dict
.
get
<
scalar
>
(
"accommodationCoeff"
)),
Uwall_
(
"Uwall"
,
dict
,
p
.
size
()),
thermalCreep_
(
dict
.
getOrDefault
(
"thermalCreep"
,
true
)),
curvature_
(
dict
.
getOrDefault
(
"curvature"
,
true
))
{
if
(
mag
(
accommodationCoeff_
)
<
SMALL
||
mag
(
accommodationCoeff_
)
>
2
.
0
)
{
FatalIOErrorInFunction
(
dict
)
<<
"unphysical accommodationCoeff_ specified"
<<
"(0 < accommodationCoeff_ <= 1)"
<<
endl
<<
exit
(
FatalIOError
);
}
if
(
dict
.
found
(
"value"
))
{
fvPatchField
<
vector
>::
operator
=
(
vectorField
(
"value"
,
dict
,
p
.
size
())
);
if
(
dict
.
found
(
"refValue"
)
&&
dict
.
found
(
"valueFraction"
))
{
this
->
refValue
()
=
vectorField
(
"refValue"
,
dict
,
p
.
size
());
this
->
valueFraction
()
=
scalarField
(
"valueFraction"
,
dict
,
p
.
size
());
}
else
{
this
->
refValue
()
=
*
this
;
this
->
valueFraction
()
=
scalar
(
1
);
}
}
}
Foam
::
maxwellSlipUFvPatchVectorField
::
maxwellSlipUFvPatchVectorField
(
const
maxwellSlipUFvPatchVectorField
&
mspvf
,
const
DimensionedField
<
vector
,
volMesh
>&
iF
)
:
partialSlipFvPatchVectorField
(
mspvf
,
iF
),
TName_
(
mspvf
.
TName_
),
rhoName_
(
mspvf
.
rhoName_
),
psiName_
(
mspvf
.
psiName_
),
muName_
(
mspvf
.
muName_
),
tauMCName_
(
mspvf
.
tauMCName_
),
accommodationCoeff_
(
mspvf
.
accommodationCoeff_
),
Uwall_
(
mspvf
.
Uwall_
),
thermalCreep_
(
mspvf
.
thermalCreep_
),
curvature_
(
mspvf
.
curvature_
)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void
Foam
::
maxwellSlipUFvPatchVectorField
::
updateCoeffs
()
{
if
(
updated
())
{
return
;
}
const
fvPatchScalarField
&
pmu
=
patch
().
lookupPatchField
<
volScalarField
,
scalar
>
(
muName_
);
const
fvPatchScalarField
&
prho
=
patch
().
lookupPatchField
<
volScalarField
,
scalar
>
(
rhoName_
);
const
fvPatchField
<
scalar
>&
ppsi
=
patch
().
lookupPatchField
<
volScalarField
,
scalar
>
(
psiName_
);
Field
<
scalar
>
C1
(
sqrt
(
ppsi
*
constant
::
mathematical
::
piByTwo
)
*
(
2
.
0
-
accommodationCoeff_
)
/
accommodationCoeff_
);
Field
<
scalar
>
pnu
(
pmu
/
prho
);
valueFraction
()
=
(
1
.
0
/
(
1
.
0
+
patch
().
deltaCoeffs
()
*
C1
*
pnu
));
refValue
()
=
Uwall_
;
if
(
thermalCreep_
)
{
const
volScalarField
&
vsfT
=
this
->
db
().
objectRegistry
::
lookupObject
<
volScalarField
>
(
TName_
);
label
patchi
=
this
->
patch
().
index
();
const
fvPatchScalarField
&
pT
=
vsfT
.
boundaryField
()[
patchi
];
Field
<
vector
>
gradpT
(
fvc
::
grad
(
vsfT
)().
boundaryField
()[
patchi
]);
vectorField
n
(
patch
().
nf
());
refValue
()
-=
3
.
0
*
pnu
/
(
4
.
0
*
pT
)
*
transform
(
I
-
n
*
n
,
gradpT
);
}
if
(
curvature_
)
{
const
fvPatchTensorField
&
ptauMC
=
patch
().
lookupPatchField
<
volTensorField
,
tensor
>
(
tauMCName_
);
vectorField
n
(
patch
().
nf
());
refValue
()
-=
C1
/
prho
*
transform
(
I
-
n
*
n
,
(
n
&
ptauMC
));
}
partialSlipFvPatchVectorField
::
updateCoeffs
();
}
void
Foam
::
maxwellSlipUFvPatchVectorField
::
write
(
Ostream
&
os
)
const
{
fvPatchVectorField
::
write
(
os
);
os
.
writeEntryIfDifferent
<
word
>
(
"T"
,
"T"
,
TName_
);
os
.
writeEntryIfDifferent
<
word
>
(
"rho"
,
"rho"
,
rhoName_
);
os
.
writeEntryIfDifferent
<
word
>
(
"psi"
,
"thermo:psi"
,
psiName_
);
os
.
writeEntryIfDifferent
<
word
>
(
"mu"
,
"thermo:mu"
,
muName_
);
os
.
writeEntryIfDifferent
<
word
>
(
"tauMC"
,
"tauMC"
,
tauMCName_
);
os
.
writeEntry
(
"accommodationCoeff"
,
accommodationCoeff_
);
Uwall_
.
writeEntry
(
"Uwall"
,
os
);
os
.
writeEntry
(
"thermalCreep"
,
thermalCreep_
);
os
.
writeEntry
(
"curvature"
,
curvature_
);
refValue
().
writeEntry
(
"refValue"
,
os
);
valueFraction
().
writeEntry
(
"valueFraction"
,
os
);
writeEntry
(
"value"
,
os
);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace
Foam
{
makePatchTypeField
(
fvPatchVectorField
,
maxwellSlipUFvPatchVectorField
);
}
// ************************************************************************* //
applications/solvers/compressible/rhoCentralFoam/BCs/U/maxwellSlipUFvPatchVectorField.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-2012 OpenFOAM Foundation
Copyright (C) 2017 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::maxwellSlipUFvPatchVectorField
Description
Maxwell slip boundary condition including thermal creep and surface
curvature terms that can be optionally switched off.
SourceFiles
fixedRhoFvPatchScalarField.C
\*---------------------------------------------------------------------------*/
#ifndef maxwellSlipUFvPatchVectorField_H
#define maxwellSlipUFvPatchVectorField_H
#include "partialSlipFvPatchFields.H"
#include "Switch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace
Foam
{
/*---------------------------------------------------------------------------*\
Class maxwellSlipUFvPatch Declaration
\*---------------------------------------------------------------------------*/
class
maxwellSlipUFvPatchVectorField
:
public
partialSlipFvPatchVectorField
{
// Private data
//- Temperature field name, default = "T"
word
TName_
;
//- Density field name, default = "rho"
word
rhoName_
;
//- Compressibility field name, default = "thermo:psi"
word
psiName_
;
//- Dynamic viscosity field name, default = "thermo:mu"
word
muName_
;
//- tauMC field name, default = "tauMC"
word
tauMCName_
;
// Accommodation coefficient
scalar
accommodationCoeff_
;
// Wall velocity
vectorField
Uwall_
;
// Include thermal creep term (default on)
Switch
thermalCreep_
;
// Include boundary curvature term (default on)
Switch
curvature_
;
public:
//- Runtime type information
TypeName
(
"maxwellSlipU"
);
// Constructors
//- Construct from patch and internal field
maxwellSlipUFvPatchVectorField
(
const
fvPatch
&
,
const
DimensionedField
<
vector
,
volMesh
>&
);
//- Construct from patch, internal field and dictionary
maxwellSlipUFvPatchVectorField
(
const
fvPatch
&
,
const
DimensionedField
<
vector
,
volMesh
>&
,
const
dictionary
&
);
//- Construct by mapping given
// maxwellSlipUFvPatchVectorField onto a new patch
maxwellSlipUFvPatchVectorField
(
const
maxwellSlipUFvPatchVectorField
&
,
const
fvPatch
&
,
const
DimensionedField
<
vector
,
volMesh
>&
,
const
fvPatchFieldMapper
&
);
//- Construct and return a clone
virtual
tmp
<
fvPatchVectorField
>
clone
()
const
{
return
tmp
<
fvPatchVectorField
>
(
new
maxwellSlipUFvPatchVectorField
(
*
this
)
);
}
//- Construct as copy setting internal field reference
maxwellSlipUFvPatchVectorField
(
const
maxwellSlipUFvPatchVectorField
&
,
const
DimensionedField
<
vector
,
volMesh
>&
);
//- Construct and return a clone setting internal field reference
virtual
tmp
<
fvPatchVectorField
>
clone
(
const
DimensionedField
<
vector
,
volMesh
>&
iF
)
const
{
return
tmp
<
fvPatchVectorField
>
(
new
maxwellSlipUFvPatchVectorField
(
*
this
,
iF
)
);
}
// Member functions
//- Update the coefficients associated with the patch field
virtual
void
updateCoeffs
();
//- Write
virtual
void
write
(
Ostream
&
)
const
;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
}
// End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //
applications/solvers/compressible/rhoCentralFoam/BCs/rho/fixedRhoFvPatchScalarField.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-2012 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "fixedRhoFvPatchScalarField.H"
#include "addToRunTimeSelectionTable.H"
#include "fvPatchFieldMapper.H"
#include "volFields.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam
::
fixedRhoFvPatchScalarField
::
fixedRhoFvPatchScalarField
(
const
fvPatch
&
p
,
const
DimensionedField
<
scalar
,
volMesh
>&
iF
)
:
fixedValueFvPatchScalarField
(
p
,
iF
),
pName_
(
"p"
),
psiName_
(
"thermo:psi"
)
{}
Foam
::
fixedRhoFvPatchScalarField
::
fixedRhoFvPatchScalarField
(
const
fixedRhoFvPatchScalarField
&
ptf
,
const
fvPatch
&
p
,
const
DimensionedField
<
scalar
,
volMesh
>&
iF
,
const
fvPatchFieldMapper
&
mapper
)
:
fixedValueFvPatchScalarField
(
ptf
,
p
,
iF
,
mapper
),
pName_
(
ptf
.
pName_
),
psiName_
(
ptf
.
psiName_
)
{}
Foam
::
fixedRhoFvPatchScalarField
::
fixedRhoFvPatchScalarField
(
const
fvPatch
&
p
,
const
DimensionedField
<
scalar
,
volMesh
>&
iF
,
const
dictionary
&
dict
)
:
fixedValueFvPatchScalarField
(
p
,
iF
,
dict
),
pName_
(
dict
.
getOrDefault
<
word
>
(
"p"
,
"p"
)),
psiName_
(
dict
.
getOrDefault
<
word
>
(
"psi"
,
"thermo:psi"
))
{}
Foam
::
fixedRhoFvPatchScalarField
::
fixedRhoFvPatchScalarField
(
const
fixedRhoFvPatchScalarField
&
frpsf
)
:
fixedValueFvPatchScalarField
(
frpsf
),
pName_
(
frpsf
.
pName_
),
psiName_
(
frpsf
.
psiName_
)
{}
Foam
::
fixedRhoFvPatchScalarField
::
fixedRhoFvPatchScalarField
(
const
fixedRhoFvPatchScalarField
&
frpsf
,
const
DimensionedField
<
scalar
,
volMesh
>&
iF
)
:
fixedValueFvPatchScalarField
(
frpsf
,
iF
),
pName_
(
frpsf
.
pName_
),
psiName_
(
frpsf
.
psiName_
)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void
Foam
::
fixedRhoFvPatchScalarField
::
updateCoeffs
()
{
if
(
updated
())
{
return
;
}
const
fvPatchField
<
scalar
>&
psip
=
patch
().
lookupPatchField
<
volScalarField
,
scalar
>
(
psiName_
);
const
fvPatchField
<
scalar
>&
pp
=
patch
().
lookupPatchField
<
volScalarField
,
scalar
>
(
pName_
);
operator
==
(
psip
*
pp
);
fixedValueFvPatchScalarField
::
updateCoeffs
();
}
void
Foam
::
fixedRhoFvPatchScalarField
::
write
(
Ostream
&
os
)
const
{
fvPatchScalarField
::
write
(
os
);
os
.
writeEntryIfDifferent
<
word
>
(
"p"
,
"p"
,
pName_
);
os
.
writeEntryIfDifferent
<
word
>
(
"psi"
,
"thermo:psi"
,
psiName_
);
writeEntry
(
"value"
,
os
);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace
Foam
{
makePatchTypeField
(
fvPatchScalarField
,
fixedRhoFvPatchScalarField
);
}
// ************************************************************************* //
applications/solvers/compressible/rhoCentralFoam/BCs/rho/fixedRhoFvPatchScalarField.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/>.
Class
Foam::fixedRhoFvPatchScalarField
Group
grpInletBoundaryConditions
Description
Foam::fixedRhoFvPatchScalarField
This boundary condition provides a fixed density inlet condition for
compressible solvers, where the density of calculated using:
\f[
\rho = \psi p
\f]
where
\vartable
p | pressure [Pa]
\rho | density [kg/m3]
\endvartable
Usage
\table
Property | Description | Required | Default value
p | Pressure field name | no | p
psi | Compressibility field name | no | thermo:psi
\endtable
Example of the boundary condition specification:
\verbatim
<patchName>
{
type fixedRho;
}
\endverbatim
SourceFiles
fixedRhoFvPatchScalarField.C
\*---------------------------------------------------------------------------*/
#ifndef fixedRhoFvPatchScalarField_H
#define fixedRhoFvPatchScalarField_H
#include "fixedValueFvPatchFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace
Foam
{
/*---------------------------------------------------------------------------*\
Class fixedRhoFvPatchScalarField Declaration
\*---------------------------------------------------------------------------*/
class
fixedRhoFvPatchScalarField
:
public
fixedValueFvPatchScalarField
{
private:
// Private data
//- Pressure field name, default = "p"
word
pName_
;
//- Compressibility field name, default = "thermo:psi"
word
psiName_
;
public:
//- Runtime type information
TypeName
(
"fixedRho"
);
// Constructors
//- Construct from patch and internal field
fixedRhoFvPatchScalarField
(
const
fvPatch
&
,
const
DimensionedField
<
scalar
,
volMesh
>&
);
//- Construct from patch, internal field and dictionary
fixedRhoFvPatchScalarField
(
const
fvPatch
&
,
const
DimensionedField
<
scalar
,
volMesh
>&
,
const
dictionary
&
);
//- Construct by mapping given fixedRhoFvPatchScalarField
// onto a new patch
fixedRhoFvPatchScalarField
(
const
fixedRhoFvPatchScalarField
&
,
const
fvPatch
&
,
const
DimensionedField
<
scalar
,
volMesh
>&
,
const
fvPatchFieldMapper
&
);
//- Construct as copy
fixedRhoFvPatchScalarField
(
const
fixedRhoFvPatchScalarField
&
);
//- Construct and return a clone
virtual
tmp
<
fvPatchScalarField
>
clone
()
const
{
return
tmp
<
fvPatchScalarField
>
(
new
fixedRhoFvPatchScalarField
(
*
this
)
);
}
//- Construct as copy setting internal field reference
fixedRhoFvPatchScalarField
(
const
fixedRhoFvPatchScalarField
&
,
const
DimensionedField
<
scalar
,
volMesh
>&
);
//- Construct and return a clone setting internal field reference
virtual
tmp
<
fvPatchScalarField
>
clone
(
const
DimensionedField
<
scalar
,
volMesh
>&
iF
)
const
{
return
tmp
<
fvPatchScalarField
>
(
new
fixedRhoFvPatchScalarField
(
*
this
,
iF
)
);
}
// Member functions
// Evaluation functions
//- Update the coefficients associated with the patch field
virtual
void
updateCoeffs
();
//- Write
virtual
void
write
(
Ostream
&
)
const
;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
}
// End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //
applications/solvers/compressible/rhoCentralFoam/Make/files
0 → 100644
View file @
ea17556c
rhoCentralFoam.C
EXE = $(FOAM_APPBIN)/rhoCentralFoam
applications/solvers/compressible/rhoCentralFoam/Make/options
0 → 100644
View file @
ea17556c
EXE_INC = \
-IBCs/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/transportModels/compressible/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \
-I$(LIB_SRC)/dynamicFvMesh/lnInclude
EXE_LIBS = \
-lfiniteVolume \
-lfvOptions \
-lmeshTools \
-lcompressibleTransportModels \
-lfluidThermophysicalModels \
-lspecie \
-lrhoCentralFoam \
-lturbulenceModels \
-lcompressibleTurbulenceModels \
-ldynamicFvMesh \
-ltopoChangerFvMesh
applications/solvers/compressible/rhoCentralFoam/centralCourantNo.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
centralCourantNo
Description
Calculates the mean and maximum wave speed based Courant Numbers.
\*---------------------------------------------------------------------------*/
if
(
mesh
.
nInternalFaces
())
{
scalarField
sumAmaxSf
(
fvc
::
surfaceSum
(
amaxSf
)().
primitiveField
());
CoNum
=
0
.
5
*
gMax
(
sumAmaxSf
/
mesh
.
V
().
field
())
*
runTime
.
deltaTValue
();
meanCoNum
=
0
.
5
*
(
gSum
(
sumAmaxSf
)
/
gSum
(
mesh
.
V
().
field
()))
*
runTime
.
deltaTValue
();
}
Info
<<
"Mean and max Courant Numbers = "
<<
meanCoNum
<<
" "
<<
CoNum
<<
endl
;
// ************************************************************************* //
applications/solvers/compressible/rhoCentralFoam/createFieldRefs.H
0 → 100644
View file @
ea17556c
volScalarField
&
p
=
thermo
.
p
();
const
volScalarField
&
T
=
thermo
.
T
();
const
volScalarField
&
psi
=
thermo
.
psi
();
const
volScalarField
&
mu
=
thermo
.
mu
();
bool
inviscid
(
true
);
if
(
max
(
mu
.
primitiveField
())
>
0
.
0
)
{
inviscid
=
false
;
}
applications/solvers/compressible/rhoCentralFoam/createFields.H
0 → 100644
View file @
ea17556c
#include "createRDeltaT.H"
Info
<<
"Reading thermophysical properties
\n
"
<<
endl
;
autoPtr
<
psiThermo
>
pThermo
(
psiThermo
::
New
(
mesh
)
);
psiThermo
&
thermo
=
pThermo
();
volScalarField
&
e
=
thermo
.
he
();
Info
<<
"Reading field U
\n
"
<<
endl
;
volVectorField
U
(
IOobject
(
"U"
,
runTime
.
timeName
(),
mesh
,
IOobject
::
MUST_READ
,
IOobject
::
AUTO_WRITE
),
mesh
);
volScalarField
rho
(
IOobject
(
"rho"
,
runTime
.
timeName
(),
mesh
,
IOobject
::
NO_READ
,
IOobject
::
AUTO_WRITE
),
thermo
.
rho
()
);
volVectorField
rhoU
(
IOobject
(
"rhoU"
,
runTime
.
timeName
(),
mesh
,
IOobject
::
NO_READ
,
IOobject
::
NO_WRITE
),
rho
*
U
);
volScalarField
rhoE
(
IOobject
(
"rhoE"
,
runTime
.
timeName
(),
mesh
,
IOobject
::
NO_READ
,
IOobject
::
NO_WRITE
),
rho
*
(
e
+
0
.
5
*
magSqr
(
U
))
);
surfaceScalarField
pos
(
IOobject
(
"pos"
,
runTime
.
timeName
(),
mesh
),
mesh
,
dimensionedScalar
(
"pos"
,
dimless
,
1
.
0
)
);
surfaceScalarField
neg
(
IOobject
(
"neg"
,
runTime
.
timeName
(),
mesh
),
mesh
,
dimensionedScalar
(
"neg"
,
dimless
,
-
1
.
0
)
);
surfaceScalarField
phi
(
"phi"
,
fvc
::
flux
(
rhoU
));
Info
<<
"Creating turbulence model
\n
"
<<
endl
;
autoPtr
<
compressible
::
turbulenceModel
>
turbulence
(
compressible
::
turbulenceModel
::
New
(
rho
,
U
,
phi
,
thermo
)
);
applications/solvers/compressible/rhoCentralFoam/directionInterpolate.H
0 → 100644
View file @
ea17556c
namespace
Foam
{
//- Interpolate field vf according to direction dir
template
<
class
Type
>
tmp
<
GeometricField
<
Type
,
fvsPatchField
,
surfaceMesh
>>
interpolate
(
const
GeometricField
<
Type
,
fvPatchField
,
volMesh
>&
vf
,
const
surfaceScalarField
&
dir
,
const
word
&
reconFieldName
=
word
::
null
)
{
tmp
<
GeometricField
<
Type
,
fvsPatchField
,
surfaceMesh
>>
tsf
(
fvc
::
interpolate
(
vf
,
dir
,
"reconstruct("
+
(
reconFieldName
!=
word
::
null
?
reconFieldName
:
vf
.
name
())
+
')'
)
);
GeometricField
<
Type
,
fvsPatchField
,
surfaceMesh
>&
sf
=
tsf
.
ref
();
sf
.
rename
(
vf
.
name
()
+
'_'
+
dir
.
name
());
return
tsf
;
}
}
applications/solvers/compressible/rhoCentralFoam/readFluxScheme.H
0 → 100644
View file @
ea17556c
word
fluxScheme
(
"Kurganov"
);
if
(
mesh
.
schemesDict
().
readIfPresent
(
"fluxScheme"
,
fluxScheme
))
{
if
((
fluxScheme
==
"Tadmor"
)
||
(
fluxScheme
==
"Kurganov"
))
{
Info
<<
"fluxScheme: "
<<
fluxScheme
<<
endl
;
}
else
{
FatalErrorInFunction
<<
"fluxScheme: "
<<
fluxScheme
<<
" is not a valid choice. "
<<
"Options are: Tadmor, Kurganov"
<<
abort
(
FatalError
);
}
}
applications/solvers/compressible/rhoCentralFoam/rhoCentralFoam.C
0 → 100644
View file @
ea17556c
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 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/>.
Application
rhoCentralFoam
Group
grpCompressibleSolvers
Description
Density-based compressible flow solver based on
central-upwind schemes of Kurganov and Tadmor with
support for mesh-motion and topology changes.
\*---------------------------------------------------------------------------*/
#include "fvCFD.H"
#include "dynamicFvMesh.H"
#include "psiThermo.H"
#include "turbulentFluidThermoModel.H"
#include "fixedRhoFvPatchScalarField.H"
#include "directionInterpolate.H"
#include "localEulerDdtScheme.H"
#include "fvcSmooth.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int
main
(
int
argc
,
char
*
argv
[])
{
argList
::
addNote
(
"Density-based compressible flow solver based on"
" central-upwind schemes of Kurganov and Tadmor with"
" support for mesh-motion and topology changes."
);
#define NO_CONTROL
#include "postProcess.H"
#include "addCheckCaseOptions.H"
#include "setRootCaseLists.H"
#include "createTime.H"
#include "createDynamicFvMesh.H"
#include "createFields.H"
#include "createFieldRefs.H"
#include "createTimeControls.H"
turbulence
->
validate
();
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "readFluxScheme.H"
const
dimensionedScalar
v_zero
(
dimVolume
/
dimTime
,
Zero
);
// Courant numbers used to adjust the time-step
scalar
CoNum
=
0
.
0
;
scalar
meanCoNum
=
0
.
0
;
Info
<<
"
\n
Starting time loop
\n
"
<<
endl
;
while
(
runTime
.
run
())
{
#include "readTimeControls.H"
if
(
!
LTS
)
{
#include "setDeltaT.H"
++
runTime
;
// Do any mesh changes
mesh
.
update
();
}
// --- Directed interpolation of primitive fields onto faces
surfaceScalarField
rho_pos
(
interpolate
(
rho
,
pos
));
surfaceScalarField
rho_neg
(
interpolate
(
rho
,
neg
));
surfaceVectorField
rhoU_pos
(
interpolate
(
rhoU
,
pos
,
U
.
name
()));
surfaceVectorField
rhoU_neg
(
interpolate
(
rhoU
,
neg
,
U
.
name
()));
volScalarField
rPsi
(
"rPsi"
,
1
.
0
/
psi
);
surfaceScalarField
rPsi_pos
(
interpolate
(
rPsi
,
pos
,
T
.
name
()));
surfaceScalarField
rPsi_neg
(
interpolate
(
rPsi
,
neg
,
T
.
name
()));
surfaceScalarField
e_pos
(
interpolate
(
e
,
pos
,
T
.
name
()));
surfaceScalarField
e_neg
(
interpolate
(
e
,
neg
,
T
.
name
()));
surfaceVectorField
U_pos
(
"U_pos"
,
rhoU_pos
/
rho_pos
);
surfaceVectorField
U_neg
(
"U_neg"
,
rhoU_neg
/
rho_neg
);
surfaceScalarField
p_pos
(
"p_pos"
,
rho_pos
*
rPsi_pos
);
surfaceScalarField
p_neg
(
"p_neg"
,
rho_neg
*
rPsi_neg
);
surfaceScalarField
phiv_pos
(
"phiv_pos"
,
U_pos
&
mesh
.
Sf
());
// Note: extracted out the orientation so becomes unoriented
phiv_pos
.
setOriented
(
false
);
surfaceScalarField
phiv_neg
(
"phiv_neg"
,
U_neg
&
mesh
.
Sf
());
phiv_neg
.
setOriented
(
false
);
// Make fluxes relative to mesh-motion
if
(
mesh
.
moving
())
{
surfaceScalarField
meshPhi
(
mesh
.
phi
());
meshPhi
.
setOriented
(
false
);
phiv_pos
-=
meshPhi
;
phiv_neg
-=
meshPhi
;
}
volScalarField
c
(
"c"
,
sqrt
(
thermo
.
Cp
()
/
thermo
.
Cv
()
*
rPsi
));
surfaceScalarField
cSf_pos
(
"cSf_pos"
,
interpolate
(
c
,
pos
,
T
.
name
())
*
mesh
.
magSf
()
);
surfaceScalarField
cSf_neg
(
"cSf_neg"
,
interpolate
(
c
,
neg
,
T
.
name
())
*
mesh
.
magSf
()
);
surfaceScalarField
ap
(
"ap"
,
max
(
max
(
phiv_pos
+
cSf_pos
,
phiv_neg
+
cSf_neg
),
v_zero
)
);
surfaceScalarField
am
(
"am"
,
min
(
min
(
phiv_pos
-
cSf_pos
,
phiv_neg
-
cSf_neg
),
v_zero
)
);
surfaceScalarField
a_pos
(
"a_pos"
,
ap
/
(
ap
-
am
));
surfaceScalarField
amaxSf
(
"amaxSf"
,
max
(
mag
(
am
),
mag
(
ap
)));
surfaceScalarField
aSf
(
"aSf"
,
am
*
a_pos
);
if
(
fluxScheme
==
"Tadmor"
)
{
aSf
=
-
0
.
5
*
amaxSf
;
a_pos
=
0
.
5
;
}
surfaceScalarField
a_neg
(
"a_neg"
,
1
.
0
-
a_pos
);
phiv_pos
*=
a_pos
;
phiv_neg
*=
a_neg
;
surfaceScalarField
aphiv_pos
(
"aphiv_pos"
,
phiv_pos
-
aSf
);
surfaceScalarField
aphiv_neg
(
"aphiv_neg"
,
phiv_neg
+
aSf
);
// Reuse amaxSf for the maximum positive and negative fluxes
// estimated by the central scheme
amaxSf
=
max
(
mag
(
aphiv_pos
),
mag
(
aphiv_neg
));
#include "centralCourantNo.H"
if
(
LTS
)
{
#include "setRDeltaT.H"
++
runTime
;
}
Info
<<
"Time = "
<<
runTime
.
timeName
()
<<
nl
<<
endl
;
phi
=
aphiv_pos
*
rho_pos
+
aphiv_neg
*
rho_neg
;
surfaceVectorField
phiU
(
aphiv_pos
*
rhoU_pos
+
aphiv_neg
*
rhoU_neg
);
// Note: reassembled orientation from the pos and neg parts so becomes
// oriented
phiU
.
setOriented
(
true
);
surfaceVectorField
phiUp
(
phiU
+
(
a_pos
*
p_pos
+
a_neg
*
p_neg
)
*
mesh
.
Sf
());
surfaceScalarField
phiEp
(
"phiEp"
,
aphiv_pos
*
(
rho_pos
*
(
e_pos
+
0
.
5
*
magSqr
(
U_pos
))
+
p_pos
)
+
aphiv_neg
*
(
rho_neg
*
(
e_neg
+
0
.
5
*
magSqr
(
U_neg
))
+
p_neg
)
+
aSf
*
p_pos
-
aSf
*
p_neg
);
// Make flux for pressure-work absolute
if
(
mesh
.
moving
())
{
surfaceScalarField
meshPhi
(
mesh
.
phi
());
meshPhi
.
setOriented
(
false
);
phiEp
+=
meshPhi
*
(
a_pos
*
p_pos
+
a_neg
*
p_neg
);
}
volScalarField
muEff
(
"muEff"
,
turbulence
->
muEff
());
volTensorField
tauMC
(
"tauMC"
,
muEff
*
dev2
(
Foam
::
T
(
fvc
::
grad
(
U
))));
// --- Solve density
solve
(
fvm
::
ddt
(
rho
)
+
fvc
::
div
(
phi
));
// --- Solve momentum
solve
(
fvm
::
ddt
(
rhoU
)
+
fvc
::
div
(
phiUp
));
U
.
ref
()
=
rhoU
()
/
rho
();
U
.
correctBoundaryConditions
();
rhoU
.
boundaryFieldRef
()
==
rho
.
boundaryField
()
*
U
.
boundaryField
();
if
(
!
inviscid
)
{
solve
(
fvm
::
ddt
(
rho
,
U
)
-
fvc
::
ddt
(
rho
,
U
)
-
fvm
::
laplacian
(
muEff
,
U
)
-
fvc
::
div
(
tauMC
)
);
rhoU
=
rho
*
U
;
}
// --- Solve energy
surfaceScalarField
sigmaDotU
(
"sigmaDotU"
,
(
fvc
::
interpolate
(
muEff
)
*
mesh
.
magSf
()
*
fvc
::
snGrad
(
U
)
+
fvc
::
dotInterpolate
(
mesh
.
Sf
(),
tauMC
)
)
&
(
a_pos
*
U_pos
+
a_neg
*
U_neg
)
);
solve
(
fvm
::
ddt
(
rhoE
)
+
fvc
::
div
(
phiEp
)
-
fvc
::
div
(
sigmaDotU
)
);
e
=
rhoE
/
rho
-
0
.
5
*
magSqr
(
U
);
e
.
correctBoundaryConditions
();
thermo
.
correct
();
rhoE
.
boundaryFieldRef
()
==
rho
.
boundaryField
()
*
(
e
.
boundaryField
()
+
0
.
5
*
magSqr
(
U
.
boundaryField
())
);
if
(
!
inviscid
)
{
solve
(
fvm
::
ddt
(
rho
,
e
)
-
fvc
::
ddt
(
rho
,
e
)
-
fvm
::
laplacian
(
turbulence
->
alphaEff
(),
e
)
);
thermo
.
correct
();
rhoE
=
rho
*
(
e
+
0
.
5
*
magSqr
(
U
));
}
p
.
ref
()
=
rho
()
/
psi
();
p
.
correctBoundaryConditions
();
rho
.
boundaryFieldRef
()
==
psi
.
boundaryField
()
*
p
.
boundaryField
();
turbulence
->
correct
();
runTime
.
write
();
runTime
.
printExecutionTime
(
Info
);
}
Info
<<
"End
\n
"
<<
endl
;
return
0
;
}
// ************************************************************************* //
applications/solvers/compressible/rhoCentralFoam/setRDeltaT.H
0 → 100644
View file @
ea17556c
{
volScalarField
&
rDeltaT
=
trDeltaT
.
ref
();
scalar
rDeltaTSmoothingCoeff
(
runTime
.
controlDict
().
getOrDefault
<
scalar
>
(
"rDeltaTSmoothingCoeff"
,
0
.
02
)
);
// Set the reciprocal time-step from the local Courant number
rDeltaT
.
ref
()
=
max
(
1
/
dimensionedScalar
(
"maxDeltaT"
,
dimTime
,
maxDeltaT
),
fvc
::
surfaceSum
(
amaxSf
)()()
/
((
2
*
maxCo
)
*
mesh
.
V
())
);
// Update tho boundary values of the reciprocal time-step
rDeltaT
.
correctBoundaryConditions
();
fvc
::
smooth
(
rDeltaT
,
rDeltaTSmoothingCoeff
);
Info
<<
"Flow time scale min/max = "
<<
gMin
(
1
/
rDeltaT
.
primitiveField
())
<<
", "
<<
gMax
(
1
/
rDeltaT
.
primitiveField
())
<<
endl
;
}
applications/solvers/compressible/rhoPimpleAdiabaticFoam/EEqn.H
0 → 100644
View file @
ea17556c
{
volScalarField
&
he
=
thermo
.
he
();
const
tmp
<
volScalarField
>&
tCp
=
thermo
.
Cp
();
const
tmp
<
volScalarField
>&
tCv
=
thermo
.
Cv
();
const
volScalarField
&
Cp
=
tCp
();
const
volScalarField
&
Cv
=
tCv
();
const
scalar
gamma
=
max
(
Cp
/
Cv
).
value
();
if
(
mag
(
gamma
-
min
(
Cp
/
Cv
).
value
())
>
VSMALL
)
{
notImplemented
(
"gamma not constant in space"
);
}
const
dictionary
&
thermoDict
=
thermo
.
subDict
(
"mixture"
);
const
dictionary
&
eosDict
=
thermoDict
.
subDict
(
"equationOfState"
);
bool
local
=
eosDict
.
getOrDefault
(
"local"
,
false
);
// Evolve T as:
//
// T_1 = T_0 \frac{p}{p_0}^{\frac{\gamma - 1}{\gamma}}
if
(
!
local
)
{
const
scalar
T0
=
eosDict
.
get
<
scalar
>
(
"T0"
);
const
scalar
p0
=
eosDict
.
get
<
scalar
>
(
"p0"
);
he
=
thermo
.
he
(
p
,
pow
(
p
/
p0
,
(
gamma
-
scalar
(
1
))
/
gamma
)
*
T0
);
}
else
{
const
volScalarField
&
T0
=
T
.
oldTime
();
const
volScalarField
&
p0
=
p
.
oldTime
();
he
=
thermo
.
he
(
p
,
pow
(
p
/
p0
,
(
gamma
-
scalar
(
1
))
/
gamma
)
*
T0
);
}
thermo
.
correct
();
psi
=
1
.
0
/
((
Cp
-
Cv
)
*
T
);
rho
=
thermo
.
rho
();
rho
.
relax
();
rho
.
writeMinMax
(
Info
);
}
applications/solvers/compressible/rhoPimpleAdiabaticFoam/Make/files
0 → 100644
View file @
ea17556c
rhoPimpleAdiabaticFoam.C
EXE = $(FOAM_APPBIN)/rhoPimpleAdiabaticFoam
applications/solvers/compressible/rhoPimpleAdiabaticFoam/Make/options
0 → 100644
View file @
ea17556c
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/cfdTools \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/sampling/lnInclude \
-I$(LIB_SRC)/transportModels/compressible/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \
EXE_LIBS = \
-lfiniteVolume \
-lfvOptions \
-lmeshTools \
-lsampling \
-lcompressibleTransportModels \
-lfluidThermophysicalModels \
-lspecie \
-lturbulenceModels \
-lcompressibleTurbulenceModels
applications/solvers/compressible/rhoPimpleAdiabaticFoam/UEqn.H
0 → 100644
View file @
ea17556c
// Solve the Momentum equation
MRF
.
correctBoundaryVelocity
(
U
);
tmp
<
fvVectorMatrix
>
tUEqn
(
fvm
::
ddt
(
rho
,
U
)
+
fvm
::
div
(
phi
,
U
)
+
MRF
.
DDt
(
rho
,
U
)
+
turbulence
->
divDevRhoReff
(
U
)
==
fvOptions
(
rho
,
U
)
);
fvVectorMatrix
&
UEqn
=
tUEqn
.
ref
();
UEqn
.
relax
();
fvOptions
.
constrain
(
UEqn
);
if
(
pimple
.
momentumPredictor
())
{
solve
(
UEqn
==
-
fvc
::
grad
(
p
));
fvOptions
.
correct
(
U
);
}
applications/solvers/compressible/rhoPimpleAdiabaticFoam/createFields.H
0 → 100644
View file @
ea17556c
Info
<<
"Reading thermophysical properties
\n
"
<<
endl
;
autoPtr
<
fluidThermo
>
pThermo
(
fluidThermo
::
New
(
mesh
)
);
fluidThermo
&
thermo
=
pThermo
();
thermo
.
validate
(
args
.
executable
(),
"h"
,
"e"
);
volScalarField
&
p
=
thermo
.
p
();
volScalarField
&
T
=
thermo
.
T
();
volScalarField
rho
(
IOobject
(
"rho"
,
runTime
.
timeName
(),
mesh
,
IOobject
::
READ_IF_PRESENT
,
IOobject
::
AUTO_WRITE
),
thermo
.
rho
()
);
Info
<<
"Reading field U
\n
"
<<
endl
;
volVectorField
U
(
IOobject
(
"U"
,
runTime
.
timeName
(),
mesh
,
IOobject
::
MUST_READ
,
IOobject
::
AUTO_WRITE
),
mesh
);
Info
<<
"Calculating face flux field phi
\n
"
<<
endl
;
surfaceScalarField
phi
(
IOobject
(
"phi"
,
runTime
.
timeName
(),
mesh
,
IOobject
::
READ_IF_PRESENT
,
IOobject
::
AUTO_WRITE
),
linearInterpolate
(
rho
)
*
linearInterpolate
(
U
)
&
mesh
.
Sf
()
);
Info
<<
"Calculating face flux field phiByRho
\n
"
<<
endl
;
surfaceScalarField
phiByRho
(
IOobject
(
"phiByRho"
,
runTime
.
timeName
(),
mesh
,
IOobject
::
READ_IF_PRESENT
,
IOobject
::
AUTO_WRITE
),
phi
/
linearInterpolate
(
rho
)
);
Info
<<
"Creating turbulence model
\n
"
<<
endl
;
autoPtr
<
compressible
::
turbulenceModel
>
turbulence
(
compressible
::
turbulenceModel
::
New
(
rho
,
U
,
phi
,
thermo
)
);
mesh
.
setFluxRequired
(
p
.
name
());
#include "createMRF.H"
Info
<<
"Creating compressibility field psi
\n
"
<<
endl
;
volScalarField
psi
(
"psi"
,
1
.
0
/
((
thermo
.
Cp
()
-
thermo
.
Cv
())
*
T
));
psi
.
oldTime
()
=
1
.
0
/
((
thermo
.
Cp
()
-
thermo
.
Cv
())
*
T
.
oldTime
());
psi
.
oldTime
().
oldTime
()
=
1
.
0
/
((
thermo
.
Cp
()
-
thermo
.
Cv
())
*
T
.
oldTime
().
oldTime
());
Prev
1
…
7
8
9
10
11
12
13
14
15
…
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