Adding new rhoCentralFoam solver
This commit is contained in:
parent
c3ebc46ff0
commit
87f4d027bc
5
applications/solvers/compressible/rhoCentralFoam/Allwclean
Executable file
5
applications/solvers/compressible/rhoCentralFoam/Allwclean
Executable file
@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
|
||||
wclean libso BCs
|
||||
wclean
|
||||
|
5
applications/solvers/compressible/rhoCentralFoam/Allwmake
Executable file
5
applications/solvers/compressible/rhoCentralFoam/Allwmake
Executable file
@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
|
||||
wmake libso BCs
|
||||
wmake
|
||||
|
@ -0,0 +1,6 @@
|
||||
mixedFixedValueSlip/mixedFixedValueSlipFvPatchFields.C
|
||||
U/maxwellSlipUFvPatchVectorField.C
|
||||
T/smoluchowskiJumpTFvPatchScalarField.C
|
||||
rho/fixedRhoFvPatchScalarField.C
|
||||
|
||||
LIB = $(FOAM_USER_LIBBIN)/librhoCentralFoam
|
@ -0,0 +1,10 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude
|
||||
|
||||
EXE_LIBS = \
|
||||
-lfiniteVolume \
|
||||
-lbasicThermophysicalModels \
|
||||
-lspecie
|
||||
|
@ -0,0 +1,230 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2004 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
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 2 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "smoluchowskiJumpTFvPatchScalarField.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "fvPatchFieldMapper.H"
|
||||
#include "volFields.H"
|
||||
#include "mathematicalConstants.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
smoluchowskiJumpTFvPatchScalarField::smoluchowskiJumpTFvPatchScalarField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
mixedFvPatchScalarField(p, iF),
|
||||
accommodationCoeff_(1.0),
|
||||
Twall_(p.size(), 0.0),
|
||||
gamma_(1.4)
|
||||
{
|
||||
refValue() = 0.0;
|
||||
refGrad() = 0.0;
|
||||
valueFraction() = 0.0;
|
||||
}
|
||||
|
||||
smoluchowskiJumpTFvPatchScalarField::smoluchowskiJumpTFvPatchScalarField
|
||||
(
|
||||
const smoluchowskiJumpTFvPatchScalarField& ptf,
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF,
|
||||
const fvPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
mixedFvPatchScalarField(ptf, p, iF, mapper),
|
||||
accommodationCoeff_(ptf.accommodationCoeff_),
|
||||
Twall_(ptf.Twall_),
|
||||
gamma_(ptf.gamma_)
|
||||
{}
|
||||
|
||||
|
||||
smoluchowskiJumpTFvPatchScalarField::smoluchowskiJumpTFvPatchScalarField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
mixedFvPatchScalarField(p, iF),
|
||||
accommodationCoeff_(readScalar(dict.lookup("accommodationCoeff"))),
|
||||
Twall_("Twall", dict, p.size())
|
||||
{
|
||||
if
|
||||
(
|
||||
mag(accommodationCoeff_) < SMALL
|
||||
||
|
||||
mag(accommodationCoeff_) > 2.0
|
||||
)
|
||||
{
|
||||
FatalIOErrorIn
|
||||
(
|
||||
"smoluchowskiJumpTFvPatchScalarField::"
|
||||
"smoluchowskiJumpTFvPatchScalarField"
|
||||
"("
|
||||
" const fvPatch&,"
|
||||
" const DimensionedField<scalar, volMesh>&,"
|
||||
" const dictionary&"
|
||||
")",
|
||||
dict
|
||||
) << "unphysical accommodationCoeff_ specified"
|
||||
<< "(0 < accommodationCoeff_ <= 1)" << endl
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
if (dict.found("value"))
|
||||
{
|
||||
fvPatchField<scalar>::operator=
|
||||
(
|
||||
scalarField("value", dict, p.size())
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
fvPatchField<scalar>::operator=(patchInternalField());
|
||||
}
|
||||
|
||||
if (dict.found("gamma"))
|
||||
{
|
||||
gamma_ = readScalar(dict.lookup("gamma"));
|
||||
}
|
||||
else
|
||||
{
|
||||
gamma_ = 1.4;
|
||||
}
|
||||
|
||||
refValue() = *this;
|
||||
refGrad() = 0.0;
|
||||
valueFraction() = 0.0;
|
||||
}
|
||||
|
||||
|
||||
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 smoluchowskiJumpTFvPatchScalarField::autoMap
|
||||
(
|
||||
const fvPatchFieldMapper& m
|
||||
)
|
||||
{
|
||||
mixedFvPatchScalarField::autoMap(m);
|
||||
}
|
||||
|
||||
|
||||
// Reverse-map the given fvPatchField onto this fvPatchField
|
||||
void smoluchowskiJumpTFvPatchScalarField::rmap
|
||||
(
|
||||
const fvPatchField<scalar>& ptf,
|
||||
const labelList& addr
|
||||
)
|
||||
{
|
||||
mixedFvPatchField<scalar>::rmap(ptf, addr);
|
||||
}
|
||||
|
||||
|
||||
// Update the coefficients associated with the patch field
|
||||
void smoluchowskiJumpTFvPatchScalarField::updateCoeffs()
|
||||
{
|
||||
if (updated())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const fvPatchScalarField& pmu =
|
||||
patch().lookupPatchField<volScalarField, scalar>("mu");
|
||||
const fvPatchScalarField& prho =
|
||||
patch().lookupPatchField<volScalarField, scalar>("rho");
|
||||
const fvPatchField<scalar>& ppsi =
|
||||
patch().lookupPatchField<volScalarField, scalar>("psi");
|
||||
const fvPatchVectorField& pU =
|
||||
patch().lookupPatchField<volVectorField, vector>("U");
|
||||
|
||||
// Prandtl number reading consistent with rhoCentralFoam
|
||||
const dictionary& thermophysicalProperties =
|
||||
db().lookupObject<IOdictionary>("thermophysicalProperties");
|
||||
dimensionedScalar Pr = dimensionedScalar("Pr", dimless, 1.0);
|
||||
if (thermophysicalProperties.found("Pr"))
|
||||
{
|
||||
Pr = thermophysicalProperties.lookup("Pr");
|
||||
}
|
||||
|
||||
Field<scalar> C2 = pmu/prho
|
||||
*sqrt(ppsi*mathematicalConstant::pi/2.0)
|
||||
*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 smoluchowskiJumpTFvPatchScalarField::write(Ostream& os) const
|
||||
{
|
||||
fvPatchScalarField::write(os);
|
||||
os.writeKeyword("accommodationCoeff")
|
||||
<< accommodationCoeff_ << token::END_STATEMENT << nl;
|
||||
Twall_.writeEntry("Twall", os);
|
||||
os.writeKeyword("gamma")
|
||||
<< gamma_ << token::END_STATEMENT << nl;
|
||||
writeEntry("value", os);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
makePatchTypeField(fvPatchScalarField, smoluchowskiJumpTFvPatchScalarField);
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
@ -0,0 +1,162 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2004 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
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 2 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
Foam::smoluchowskiJumpTFvPatchScalarField
|
||||
|
||||
Description
|
||||
Smoluchowski temperature jump boundary condition
|
||||
|
||||
SourceFiles
|
||||
smoluchowskiJumpTFvPatchScalarField.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef smoluchowskiJumpTFvPatchScalarFields_H
|
||||
#define smoluchowskiJumpTFvPatchScalarFields_H
|
||||
|
||||
#include "mixedFvPatchFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class smoluchowskiJumpTFvPatch Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class smoluchowskiJumpTFvPatchScalarField
|
||||
:
|
||||
public mixedFvPatchScalarField
|
||||
{
|
||||
|
||||
// Private data
|
||||
|
||||
// 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
|
||||
|
||||
// ************************************************************************* //
|
@ -0,0 +1,212 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2004 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
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 2 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "maxwellSlipUFvPatchVectorField.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "mathematicalConstants.H"
|
||||
#include "fvPatchFieldMapper.H"
|
||||
#include "volFields.H"
|
||||
#include "surfaceFields.H"
|
||||
#include "fvCFD.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
maxwellSlipUFvPatchVectorField::maxwellSlipUFvPatchVectorField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<vector, volMesh>& iF
|
||||
)
|
||||
:
|
||||
mixedFixedValueSlipFvPatchVectorField(p, iF),
|
||||
accommodationCoeff_(1.0),
|
||||
Uwall_(p.size(), vector(0.0, 0.0, 0.0)),
|
||||
thermalCreep_(true),
|
||||
curvature_(true)
|
||||
{}
|
||||
|
||||
|
||||
maxwellSlipUFvPatchVectorField::maxwellSlipUFvPatchVectorField
|
||||
(
|
||||
const maxwellSlipUFvPatchVectorField& tdpvf,
|
||||
const fvPatch& p,
|
||||
const DimensionedField<vector, volMesh>& iF,
|
||||
const fvPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
mixedFixedValueSlipFvPatchVectorField(tdpvf, p, iF, mapper),
|
||||
accommodationCoeff_(tdpvf.accommodationCoeff_),
|
||||
Uwall_(tdpvf.Uwall_),
|
||||
thermalCreep_(tdpvf.thermalCreep_),
|
||||
curvature_(tdpvf.curvature_)
|
||||
{}
|
||||
|
||||
|
||||
maxwellSlipUFvPatchVectorField::maxwellSlipUFvPatchVectorField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<vector, volMesh>& iF,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
mixedFixedValueSlipFvPatchVectorField(p, iF),
|
||||
accommodationCoeff_(readScalar(dict.lookup("accommodationCoeff"))),
|
||||
Uwall_("Uwall", dict, p.size()),
|
||||
thermalCreep_(dict.lookupOrDefault("thermalCreep", true)),
|
||||
curvature_(dict.lookupOrDefault("curvature", true))
|
||||
{
|
||||
if
|
||||
(
|
||||
mag(accommodationCoeff_) < SMALL
|
||||
||
|
||||
mag(accommodationCoeff_) > 2.0
|
||||
)
|
||||
{
|
||||
FatalIOErrorIn
|
||||
(
|
||||
"maxwellSlipUFvPatchScalarField::"
|
||||
"maxwellSlipUFvPatchScalarField"
|
||||
"(const fvPatch&, const scalarField&, const dictionary&)",
|
||||
dict
|
||||
) << "unphysical accommodationCoeff_ specified"
|
||||
<< "(0 < accommodationCoeff_ <= 1)" << endl
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
if (dict.found("value"))
|
||||
{
|
||||
fvPatchField<vector>::operator=
|
||||
(
|
||||
vectorField("value", dict, p.size())
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
mixedFixedValueSlipFvPatchVectorField::evaluate();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
maxwellSlipUFvPatchVectorField::maxwellSlipUFvPatchVectorField
|
||||
(
|
||||
const maxwellSlipUFvPatchVectorField& tdpvf,
|
||||
const DimensionedField<vector, volMesh>& iF
|
||||
)
|
||||
:
|
||||
mixedFixedValueSlipFvPatchVectorField(tdpvf, iF),
|
||||
accommodationCoeff_(tdpvf.accommodationCoeff_),
|
||||
Uwall_(tdpvf.Uwall_),
|
||||
thermalCreep_(tdpvf.thermalCreep_),
|
||||
curvature_(tdpvf.curvature_)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
// Update the coefficients associated with the patch field
|
||||
void maxwellSlipUFvPatchVectorField::updateCoeffs()
|
||||
{
|
||||
if (updated())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const fvPatchScalarField& pmu =
|
||||
patch().lookupPatchField<volScalarField, scalar>("mu");
|
||||
const fvPatchScalarField& prho =
|
||||
patch().lookupPatchField<volScalarField, scalar>("rho");
|
||||
const fvPatchField<scalar>& ppsi =
|
||||
patch().lookupPatchField<volScalarField, scalar>("psi");
|
||||
|
||||
Field<scalar> C1 = sqrt(ppsi*mathematicalConstant::pi/2.0)
|
||||
*(2.0 - accommodationCoeff_)/accommodationCoeff_;
|
||||
|
||||
Field<scalar> pnu = pmu/prho;
|
||||
valueFraction() = (1.0/(1.0 + patch().deltaCoeffs()*C1*pnu));
|
||||
|
||||
refValue() = Uwall_;
|
||||
|
||||
if(thermalCreep_)
|
||||
{
|
||||
const GeometricField<scalar, fvPatchField, volMesh>& vsfT =
|
||||
this->db().objectRegistry::
|
||||
lookupObject<GeometricField<scalar, fvPatchField, volMesh> >("T");
|
||||
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>("tauMC");
|
||||
vectorField n = patch().nf();
|
||||
|
||||
refValue() -= C1/prho*transform(I - n*n, (n & ptauMC));
|
||||
}
|
||||
|
||||
mixedFixedValueSlipFvPatchVectorField::updateCoeffs();
|
||||
}
|
||||
|
||||
|
||||
// Write
|
||||
void maxwellSlipUFvPatchVectorField::write(Ostream& os) const
|
||||
{
|
||||
fvPatchVectorField::write(os);
|
||||
os.writeKeyword("accommodationCoeff")
|
||||
<< accommodationCoeff_ << token::END_STATEMENT << nl;
|
||||
Uwall_.writeEntry("Uwall", os);
|
||||
os.writeKeyword("thermalCreep")
|
||||
<< thermalCreep_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("curvature") << curvature_ << token::END_STATEMENT << nl;
|
||||
|
||||
os.writeKeyword("refValue")
|
||||
<< refValue() << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("valueFraction")
|
||||
<< valueFraction() << token::END_STATEMENT << nl;
|
||||
|
||||
writeEntry("value", os);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
makePatchTypeField(fvPatchVectorField, maxwellSlipUFvPatchVectorField);
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
@ -0,0 +1,150 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
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 2 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
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 "mixedFixedValueSlipFvPatchFields.H"
|
||||
#include "Switch.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class maxwellSlipUFvPatch Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class maxwellSlipUFvPatchVectorField
|
||||
:
|
||||
public mixedFixedValueSlipFvPatchVectorField
|
||||
{
|
||||
|
||||
// Private data
|
||||
|
||||
// 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
|
||||
|
||||
// ************************************************************************* //
|
@ -0,0 +1,204 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
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 2 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "mixedFixedValueSlipFvPatchField.H"
|
||||
#include "symmTransformField.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
mixedFixedValueSlipFvPatchField<Type>::mixedFixedValueSlipFvPatchField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<Type, volMesh>& iF
|
||||
)
|
||||
:
|
||||
transformFvPatchField<Type>(p, iF),
|
||||
refValue_(p.size()),
|
||||
valueFraction_(p.size(), 1.0)
|
||||
{}
|
||||
|
||||
|
||||
template<class Type>
|
||||
mixedFixedValueSlipFvPatchField<Type>::mixedFixedValueSlipFvPatchField
|
||||
(
|
||||
const mixedFixedValueSlipFvPatchField<Type>& ptf,
|
||||
const fvPatch& p,
|
||||
const DimensionedField<Type, volMesh>& iF,
|
||||
const fvPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
transformFvPatchField<Type>(ptf, p, iF, mapper),
|
||||
refValue_(ptf.refValue_, mapper),
|
||||
valueFraction_(ptf.valueFraction_, mapper)
|
||||
{}
|
||||
|
||||
|
||||
template<class Type>
|
||||
mixedFixedValueSlipFvPatchField<Type>::mixedFixedValueSlipFvPatchField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<Type, volMesh>& iF,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
transformFvPatchField<Type>(p, iF),
|
||||
refValue_("refValue", dict, p.size()),
|
||||
valueFraction_("valueFraction", dict, p.size())
|
||||
{}
|
||||
|
||||
|
||||
template<class Type>
|
||||
mixedFixedValueSlipFvPatchField<Type>::mixedFixedValueSlipFvPatchField
|
||||
(
|
||||
const mixedFixedValueSlipFvPatchField<Type>& ptf
|
||||
)
|
||||
:
|
||||
transformFvPatchField<Type>(ptf),
|
||||
refValue_(ptf.refValue_),
|
||||
valueFraction_(ptf.valueFraction_)
|
||||
{}
|
||||
|
||||
template<class Type>
|
||||
mixedFixedValueSlipFvPatchField<Type>::mixedFixedValueSlipFvPatchField
|
||||
(
|
||||
const mixedFixedValueSlipFvPatchField<Type>& ptf,
|
||||
const DimensionedField<Type, volMesh>& iF
|
||||
)
|
||||
:
|
||||
transformFvPatchField<Type>(ptf, iF),
|
||||
refValue_(ptf.refValue_),
|
||||
valueFraction_(ptf.valueFraction_)
|
||||
{}
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
// Map from self
|
||||
template<class Type>
|
||||
void mixedFixedValueSlipFvPatchField<Type>::autoMap
|
||||
(
|
||||
const fvPatchFieldMapper& m
|
||||
)
|
||||
{
|
||||
Field<Type>::autoMap(m);
|
||||
refValue_.autoMap(m);
|
||||
valueFraction_.autoMap(m);
|
||||
}
|
||||
|
||||
|
||||
// Reverse-map the given fvPatchField onto this fvPatchField
|
||||
template<class Type>
|
||||
void mixedFixedValueSlipFvPatchField<Type>::rmap
|
||||
(
|
||||
const fvPatchField<Type>& ptf,
|
||||
const labelList& addr
|
||||
)
|
||||
{
|
||||
transformFvPatchField<Type>::rmap(ptf, addr);
|
||||
|
||||
const mixedFixedValueSlipFvPatchField<Type>& dmptf =
|
||||
refCast<const mixedFixedValueSlipFvPatchField<Type> >(ptf);
|
||||
|
||||
refValue_.rmap(dmptf.refValue_, addr);
|
||||
valueFraction_.rmap(dmptf.valueFraction_, addr);
|
||||
}
|
||||
|
||||
|
||||
// Return gradient at boundary
|
||||
template<class Type>
|
||||
tmp<Field<Type> > mixedFixedValueSlipFvPatchField<Type>::snGrad() const
|
||||
{
|
||||
vectorField nHat = this->patch().nf();
|
||||
Field<Type> pif = this->patchInternalField();
|
||||
|
||||
return
|
||||
(
|
||||
valueFraction_*refValue_
|
||||
+ (1.0 - valueFraction_)*transform(I - sqr(nHat), pif) - pif
|
||||
)*this->patch().deltaCoeffs();
|
||||
}
|
||||
|
||||
|
||||
// Evaluate the field on the patch
|
||||
template<class Type>
|
||||
void mixedFixedValueSlipFvPatchField<Type>::evaluate(const Pstream::commsTypes)
|
||||
{
|
||||
if (!this->updated())
|
||||
{
|
||||
this->updateCoeffs();
|
||||
}
|
||||
|
||||
vectorField nHat = this->patch().nf();
|
||||
|
||||
Field<Type>::operator=
|
||||
(
|
||||
valueFraction_*refValue_
|
||||
+
|
||||
(1.0 - valueFraction_)
|
||||
*transform(I - nHat*nHat, this->patchInternalField())
|
||||
);
|
||||
|
||||
transformFvPatchField<Type>::evaluate();
|
||||
}
|
||||
|
||||
|
||||
// Return defining fields
|
||||
template<class Type>
|
||||
tmp<Field<Type> > mixedFixedValueSlipFvPatchField<Type>::snGradTransformDiag() const
|
||||
{
|
||||
vectorField nHat = this->patch().nf();
|
||||
vectorField diag(nHat.size());
|
||||
|
||||
diag.replace(vector::X, mag(nHat.component(vector::X)));
|
||||
diag.replace(vector::Y, mag(nHat.component(vector::Y)));
|
||||
diag.replace(vector::Z, mag(nHat.component(vector::Z)));
|
||||
|
||||
return
|
||||
valueFraction_*Type(pTraits<Type>::one)
|
||||
+ (1.0 - valueFraction_)*transformFieldMask<Type>(pow<vector, pTraits<Type>::rank>(diag));
|
||||
}
|
||||
|
||||
|
||||
// Write
|
||||
template<class Type>
|
||||
void mixedFixedValueSlipFvPatchField<Type>::write(Ostream& os) const
|
||||
{
|
||||
transformFvPatchField<Type>::write(os);
|
||||
refValue_.writeEntry("refValue", os);
|
||||
valueFraction_.writeEntry("valueFraction", os);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
@ -0,0 +1,228 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
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 2 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
Foam::mixedFixedValueSlipFvPatchField
|
||||
|
||||
Description
|
||||
A mixed boundary type that blends between fixedValue and slip, as opposed
|
||||
to the standard mixed condition that blends between fixedValue and
|
||||
fixedGradient; required to implement maxwellSlipU condition.
|
||||
|
||||
SourceFiles
|
||||
mixedFixedValueSlipFvPatchField.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef mixedFixedValueSlipFvPatchField_H
|
||||
#define mixedFixedValueSlipFvPatchField_H
|
||||
|
||||
#include "transformFvPatchField.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class mixedFixedValueSlipFvPatch Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class Type>
|
||||
class mixedFixedValueSlipFvPatchField
|
||||
:
|
||||
public transformFvPatchField<Type>
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Value field used for boundary condition
|
||||
Field<Type> refValue_;
|
||||
|
||||
//- Fraction (0-1) of value used for boundary condition
|
||||
scalarField valueFraction_;
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("mixedFixedValueSlip");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from patch and internal field
|
||||
mixedFixedValueSlipFvPatchField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<Type, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct from patch, internal field and dictionary
|
||||
mixedFixedValueSlipFvPatchField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<Type, volMesh>&,
|
||||
const dictionary&
|
||||
);
|
||||
|
||||
//- Construct by mapping given mixedFixedValueSlipFvPatchField
|
||||
//- onto a new patch
|
||||
mixedFixedValueSlipFvPatchField
|
||||
(
|
||||
const mixedFixedValueSlipFvPatchField<Type>&,
|
||||
const fvPatch&,
|
||||
const DimensionedField<Type, volMesh>&,
|
||||
const fvPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Construct as copy
|
||||
mixedFixedValueSlipFvPatchField
|
||||
(
|
||||
const mixedFixedValueSlipFvPatchField<Type>&
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual tmp<fvPatchField<Type> > clone() const
|
||||
{
|
||||
return tmp<fvPatchField<Type> >
|
||||
(
|
||||
new mixedFixedValueSlipFvPatchField<Type>(*this)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
mixedFixedValueSlipFvPatchField
|
||||
(
|
||||
const mixedFixedValueSlipFvPatchField<Type>&,
|
||||
const DimensionedField<Type, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct and return a clone setting internal field reference
|
||||
virtual tmp<fvPatchField<Type> > clone
|
||||
(
|
||||
const DimensionedField<Type, volMesh>& iF
|
||||
) const
|
||||
{
|
||||
return tmp<fvPatchField<Type> >
|
||||
(
|
||||
new mixedFixedValueSlipFvPatchField<Type>(*this, iF)
|
||||
);
|
||||
}
|
||||
|
||||
// Member functions
|
||||
|
||||
// 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<Type>&,
|
||||
const labelList&
|
||||
);
|
||||
|
||||
// Return defining fields
|
||||
|
||||
virtual Field<Type>& refValue()
|
||||
{
|
||||
return refValue_;
|
||||
}
|
||||
|
||||
virtual const Field<Type>& refValue() const
|
||||
{
|
||||
return refValue_;
|
||||
}
|
||||
|
||||
virtual scalarField& valueFraction()
|
||||
{
|
||||
return valueFraction_;
|
||||
}
|
||||
|
||||
virtual const scalarField& valueFraction() const
|
||||
{
|
||||
return valueFraction_;
|
||||
}
|
||||
|
||||
// Evaluation functions
|
||||
|
||||
//- Return gradient at boundary
|
||||
virtual tmp<Field<Type> > snGrad() const;
|
||||
|
||||
//- Evaluate the patch field
|
||||
virtual void evaluate
|
||||
(
|
||||
const Pstream::commsTypes commsType=Pstream::blocking
|
||||
);
|
||||
|
||||
//- Return face-gradient transform diagonal
|
||||
virtual tmp<Field<Type> > snGradTransformDiag() const;
|
||||
|
||||
|
||||
//- Write
|
||||
virtual void write(Ostream&) const;
|
||||
|
||||
|
||||
// Member operators
|
||||
|
||||
virtual void operator=(const UList<Type>&) {}
|
||||
|
||||
virtual void operator=(const fvPatchField<Type>&) {}
|
||||
virtual void operator+=(const fvPatchField<Type>&) {}
|
||||
virtual void operator-=(const fvPatchField<Type>&) {}
|
||||
virtual void operator*=(const fvPatchField<scalar>&) {}
|
||||
virtual void operator/=(const fvPatchField<scalar>&) {}
|
||||
|
||||
virtual void operator+=(const Field<Type>&) {}
|
||||
virtual void operator-=(const Field<Type>&) {}
|
||||
|
||||
virtual void operator*=(const Field<scalar>&) {}
|
||||
virtual void operator/=(const Field<scalar>&) {}
|
||||
|
||||
virtual void operator=(const Type&) {}
|
||||
virtual void operator+=(const Type&) {}
|
||||
virtual void operator-=(const Type&) {}
|
||||
virtual void operator*=(const scalar) {}
|
||||
virtual void operator/=(const scalar) {}
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
# include "mixedFixedValueSlipFvPatchField.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
@ -0,0 +1,46 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
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 2 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, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "mixedFixedValueSlipFvPatchFields.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "volFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
makePatchFields(mixedFixedValueSlip);
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
@ -0,0 +1,50 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
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 2 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, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef mixedFixedValueSlipFvPatchFields_H
|
||||
#define mixedFixedValueSlipFvPatchFields_H
|
||||
|
||||
#include "mixedFixedValueSlipFvPatchField.H"
|
||||
#include "fieldTypes.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
makePatchTypeFieldTypedefs(mixedFixedValueSlip)
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
@ -0,0 +1,51 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
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 2 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef mixedFixedValueSlipFvPatchFieldsFwd_H
|
||||
#define mixedFixedValueSlipFvPatchFieldsFwd_H
|
||||
|
||||
#include "fieldTypes.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type> class mixedFixedValueSlipFvPatchField;
|
||||
|
||||
makePatchTypeFieldTypedefs(mixedFixedValueSlip)
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
@ -0,0 +1,122 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
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 2 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "fixedRhoFvPatchScalarField.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "fvPatchFieldMapper.H"
|
||||
#include "volFields.H"
|
||||
#include "surfaceFields.H"
|
||||
#include "fvCFD.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
fixedRhoFvPatchScalarField::fixedRhoFvPatchScalarField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(p, iF)
|
||||
{}
|
||||
|
||||
|
||||
fixedRhoFvPatchScalarField::fixedRhoFvPatchScalarField
|
||||
(
|
||||
const fixedRhoFvPatchScalarField& ptf,
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF,
|
||||
const fvPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(ptf, p, iF, mapper)
|
||||
{}
|
||||
|
||||
|
||||
fixedRhoFvPatchScalarField::fixedRhoFvPatchScalarField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(p, iF, dict)
|
||||
{}
|
||||
|
||||
|
||||
fixedRhoFvPatchScalarField::fixedRhoFvPatchScalarField
|
||||
(
|
||||
const fixedRhoFvPatchScalarField& tppsf
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(tppsf)
|
||||
{}
|
||||
|
||||
|
||||
fixedRhoFvPatchScalarField::fixedRhoFvPatchScalarField
|
||||
(
|
||||
const fixedRhoFvPatchScalarField& tppsf,
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(tppsf, iF)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void fixedRhoFvPatchScalarField::updateCoeffs()
|
||||
{
|
||||
if (updated())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const fvPatchField<scalar>& psip =
|
||||
patch().lookupPatchField<volScalarField, scalar>("psi");
|
||||
|
||||
const fvPatchField<scalar>& pp =
|
||||
patch().lookupPatchField<volScalarField, scalar>("p");
|
||||
|
||||
operator==(psip*pp);
|
||||
|
||||
fixedValueFvPatchScalarField::updateCoeffs();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
makePatchTypeField(fvPatchScalarField, fixedRhoFvPatchScalarField);
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
@ -0,0 +1,140 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
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 2 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
Foam::fixedRhoFvPatchScalarField
|
||||
|
||||
Description
|
||||
Foam::fixedRhoFvPatchScalarField
|
||||
|
||||
SourceFiles
|
||||
fixedRhoFvPatchScalarField.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef fixedRhoFvPatchScalarField_H
|
||||
#define fixedRhoFvPatchScalarField_H
|
||||
|
||||
#include "fixedValueFvPatchFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class fixedRhoFvPatchScalarField Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class fixedRhoFvPatchScalarField
|
||||
:
|
||||
public fixedValueFvPatchScalarField
|
||||
{
|
||||
|
||||
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();
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
@ -0,0 +1,3 @@
|
||||
rhoCentralFoam.C
|
||||
|
||||
EXE = $(FOAM_APPBIN)/rhoCentralFoam
|
@ -0,0 +1,12 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
|
||||
-IBCs/lnInclude \
|
||||
-I$(LIB_SRC)/sampling/lnInclude
|
||||
EXE_LIBS = \
|
||||
-lfiniteVolume \
|
||||
-lbasicThermophysicalModels \
|
||||
-lspecie \
|
||||
-L$(FOAM_USER_LIBBIN) \
|
||||
-lrhoCentralFoam
|
@ -0,0 +1,51 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
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 2 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Global
|
||||
compressibleCourantNo
|
||||
|
||||
Description
|
||||
Calculates the mean and maximum wave speed based Courant Numbers.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
scalar CoNum = 0.0;
|
||||
scalar meanCoNum = 0.0;
|
||||
|
||||
if (mesh.nInternalFaces())
|
||||
{
|
||||
surfaceScalarField amaxSfbyDelta =
|
||||
mesh.surfaceInterpolation::deltaCoeffs()*amaxSf;
|
||||
|
||||
CoNum = max(amaxSfbyDelta/mesh.magSf())
|
||||
.value()*runTime.deltaT().value();
|
||||
|
||||
meanCoNum = (sum(amaxSfbyDelta)/sum(mesh.magSf()))
|
||||
.value()*runTime.deltaT().value();
|
||||
}
|
||||
|
||||
Info<< "Mean and max Courant Numbers = "
|
||||
<< meanCoNum << " " << CoNum << endl;
|
||||
|
||||
// ************************************************************************* //
|
@ -0,0 +1,97 @@
|
||||
Info<< "Reading thermophysical properties\n" << endl;
|
||||
|
||||
autoPtr<basicThermo> thermo
|
||||
(
|
||||
basicThermo::New(mesh)
|
||||
);
|
||||
|
||||
volScalarField& p = thermo->p();
|
||||
volScalarField& h = thermo->h();
|
||||
const volScalarField& T = thermo->T();
|
||||
const volScalarField& psi = thermo->psi();
|
||||
const volScalarField& mu = thermo->mu();
|
||||
|
||||
bool inviscid(true);
|
||||
if (max(mu.internalField()) > 0.0)
|
||||
{
|
||||
inviscid = false;
|
||||
}
|
||||
|
||||
Info<< "Reading field U\n" << endl;
|
||||
volVectorField U
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"U",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh
|
||||
);
|
||||
|
||||
#include "rhoBoundaryTypes.H"
|
||||
volScalarField rho
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"rho",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
thermo->rho(),
|
||||
rhoBoundaryTypes
|
||||
);
|
||||
|
||||
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*(h + 0.5*magSqr(U)) - p
|
||||
);
|
||||
|
||||
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)
|
||||
);
|
@ -0,0 +1,19 @@
|
||||
word fluxScheme("Kurganov");
|
||||
if (mesh.schemesDict().found("fluxScheme"))
|
||||
{
|
||||
fluxScheme = word(mesh.schemesDict().lookup("fluxScheme"));
|
||||
if ((fluxScheme == "Tadmor") || (fluxScheme == "Kurganov"))
|
||||
{
|
||||
Info<< "fluxScheme: " << fluxScheme << endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"rhoCentralFoam::readFluxScheme"
|
||||
) << "fluxScheme: " << fluxScheme
|
||||
<< " is not a valid choice. "
|
||||
<< "Options are: Tadmor, Kurganov"
|
||||
<< abort(FatalError);
|
||||
}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
Info<< "Reading thermophysicalProperties\n" << endl;
|
||||
|
||||
// Pr defined as a separate constant to enable calculation of k, currently
|
||||
// inaccessible through thermo
|
||||
IOdictionary thermophysicalProperties
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"thermophysicalProperties",
|
||||
runTime.constant(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
);
|
||||
|
||||
dimensionedScalar Pr = dimensionedScalar("Pr", dimless, 1.0);
|
||||
|
||||
if (thermophysicalProperties.found("Pr"))
|
||||
{
|
||||
Pr = thermophysicalProperties.lookup("Pr");
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
const volScalarField::GeometricBoundaryField& pbf = p.boundaryField();
|
||||
wordList rhoBoundaryTypes = pbf.types();
|
||||
|
||||
forAll(rhoBoundaryTypes, patchi)
|
||||
{
|
||||
if
|
||||
(
|
||||
rhoBoundaryTypes[patchi] == "waveTransmissive"
|
||||
)
|
||||
{
|
||||
rhoBoundaryTypes[patchi] = zeroGradientFvPatchScalarField::typeName;
|
||||
}
|
||||
else if (pbf[patchi].fixesValue())
|
||||
{
|
||||
rhoBoundaryTypes[patchi] = fixedRhoFvPatchScalarField::typeName;
|
||||
}
|
||||
}
|
@ -0,0 +1,226 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
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 2 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Application
|
||||
rhoCentralFoam
|
||||
|
||||
Description
|
||||
Density-based compressible flow solver based on central-upwind schemes of
|
||||
Kurganov and Tadmor
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "fvCFD.H"
|
||||
#include "basicThermo.H"
|
||||
#include "zeroGradientFvPatchFields.H"
|
||||
#include "fixedRhoFvPatchScalarField.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
|
||||
# include "setRootCase.H"
|
||||
|
||||
# include "createTime.H"
|
||||
# include "createMesh.H"
|
||||
# include "createFields.H"
|
||||
# include "readThermophysicalProperties.H"
|
||||
# include "readTimeControls.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
# include "readFluxScheme.H"
|
||||
|
||||
dimensionedScalar v_zero("v_zero",dimVolume/dimTime, 0.0);
|
||||
|
||||
Info<< "\nStarting time loop\n" << endl;
|
||||
|
||||
while (runTime.run())
|
||||
{
|
||||
// --- upwind interpolation of primitive fields on faces
|
||||
|
||||
surfaceScalarField rho_pos =
|
||||
fvc::interpolate(rho, pos, "reconstruct(rho)");
|
||||
surfaceScalarField rho_neg =
|
||||
fvc::interpolate(rho, neg, "reconstruct(rho)");
|
||||
|
||||
surfaceVectorField rhoU_pos =
|
||||
fvc::interpolate(rhoU, pos, "reconstruct(U)");
|
||||
surfaceVectorField rhoU_neg =
|
||||
fvc::interpolate(rhoU, neg, "reconstruct(U)");
|
||||
|
||||
volScalarField rPsi = 1.0/psi;
|
||||
surfaceScalarField rPsi_pos =
|
||||
fvc::interpolate(rPsi, pos, "reconstruct(T)");
|
||||
surfaceScalarField rPsi_neg =
|
||||
fvc::interpolate(rPsi, neg, "reconstruct(T)");
|
||||
|
||||
surfaceScalarField h_pos =
|
||||
fvc::interpolate(h, pos, "reconstruct(T)");
|
||||
surfaceScalarField h_neg =
|
||||
fvc::interpolate(h, neg, "reconstruct(T)");
|
||||
|
||||
surfaceVectorField U_pos = rhoU_pos/rho_pos;
|
||||
surfaceVectorField U_neg = rhoU_neg/rho_neg;
|
||||
|
||||
surfaceScalarField p_pos = rho_pos*rPsi_pos;
|
||||
surfaceScalarField p_neg = rho_neg*rPsi_neg;
|
||||
|
||||
surfaceScalarField phiv_pos = U_pos & mesh.Sf();
|
||||
surfaceScalarField phiv_neg = U_neg & mesh.Sf();
|
||||
|
||||
volScalarField c = sqrt(thermo->Cp()/thermo->Cv()*rPsi);
|
||||
surfaceScalarField cSf_pos = fvc::interpolate(c, pos, "reconstruct(T)")*mesh.magSf();
|
||||
surfaceScalarField cSf_neg = fvc::interpolate(c, neg, "reconstruct(T)")*mesh.magSf();
|
||||
|
||||
surfaceScalarField ap = max(max(phiv_pos + cSf_pos, phiv_neg + cSf_neg), v_zero);
|
||||
surfaceScalarField am = min(min(phiv_pos - cSf_pos, phiv_neg - cSf_neg), v_zero);
|
||||
|
||||
surfaceScalarField a_pos = ap/(ap - am);
|
||||
|
||||
surfaceScalarField amaxSf("amaxSf", max(mag(am), mag(ap)));
|
||||
|
||||
# include "compressibleCourantNo.H"
|
||||
# include "readTimeControls.H"
|
||||
# include "setDeltaT.H"
|
||||
|
||||
runTime++;
|
||||
|
||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||
|
||||
surfaceScalarField aSf = am*a_pos;
|
||||
|
||||
if (fluxScheme == "Tadmor")
|
||||
{
|
||||
aSf = -0.5*amaxSf;
|
||||
a_pos = 0.5;
|
||||
}
|
||||
|
||||
surfaceScalarField a_neg = (1.0 - a_pos);
|
||||
|
||||
phiv_pos *= a_pos;
|
||||
phiv_neg *= a_neg;
|
||||
|
||||
surfaceScalarField aphiv_pos = phiv_pos - aSf;
|
||||
surfaceScalarField aphiv_neg = phiv_neg + aSf;
|
||||
|
||||
surfaceScalarField phi("phi", aphiv_pos*rho_pos + aphiv_neg*rho_neg);
|
||||
|
||||
surfaceVectorField phiUp =
|
||||
(aphiv_pos*rhoU_pos + aphiv_neg*rhoU_neg)
|
||||
+ (a_pos*p_pos + a_neg*p_neg)*mesh.Sf();
|
||||
|
||||
surfaceScalarField phiEp =
|
||||
aphiv_pos*rho_pos*(h_pos + 0.5*magSqr(U_pos))
|
||||
+ aphiv_neg*rho_neg*(h_neg + 0.5*magSqr(U_neg))
|
||||
+ aSf*p_pos - aSf*p_neg;
|
||||
|
||||
volTensorField tauMC("tauMC", mu*dev2(fvc::grad(U)().T()));
|
||||
|
||||
// --- Solve density
|
||||
solve(fvm::ddt(rho) + fvc::div(phi));
|
||||
|
||||
// --- Solve momentum
|
||||
solve(fvm::ddt(rhoU) + fvc::div(phiUp));
|
||||
|
||||
U.dimensionedInternalField() =
|
||||
rhoU.dimensionedInternalField()
|
||||
/rho.dimensionedInternalField();
|
||||
U.correctBoundaryConditions();
|
||||
rhoU.boundaryField() = rho.boundaryField()*U.boundaryField();
|
||||
|
||||
volScalarField rhoBydt(rho/runTime.deltaT());
|
||||
|
||||
if (!inviscid)
|
||||
{
|
||||
solve
|
||||
(
|
||||
fvm::ddt(rho, U) - fvc::ddt(rho,U)
|
||||
- fvm::laplacian(mu, U)
|
||||
- fvc::div(tauMC)
|
||||
);
|
||||
rhoU = rho*U;
|
||||
}
|
||||
|
||||
// --- Solve energy
|
||||
surfaceScalarField sigmaDotU =
|
||||
(
|
||||
(
|
||||
fvc::interpolate(mu)*mesh.magSf()*fvc::snGrad(U)
|
||||
+ (mesh.Sf() & fvc::interpolate(tauMC))
|
||||
)
|
||||
& (a_pos*U_pos + a_neg*U_neg)
|
||||
);
|
||||
|
||||
solve
|
||||
(
|
||||
fvm::ddt(rhoE)
|
||||
+ fvc::div(phiEp)
|
||||
- fvc::div(sigmaDotU)
|
||||
);
|
||||
|
||||
h = (rhoE + p)/rho - 0.5*magSqr(U);
|
||||
h.correctBoundaryConditions();
|
||||
thermo->correct();
|
||||
rhoE.boundaryField() =
|
||||
rho.boundaryField()*
|
||||
(
|
||||
h.boundaryField() + 0.5*magSqr(U.boundaryField())
|
||||
)
|
||||
- p.boundaryField();
|
||||
|
||||
if (!inviscid)
|
||||
{
|
||||
volScalarField k("k", thermo->Cp()*mu/Pr);
|
||||
solve
|
||||
(
|
||||
fvm::ddt(rho, h) - fvc::ddt(rho, h)
|
||||
- fvm::laplacian(thermo->alpha(), h)
|
||||
+ fvc::laplacian(thermo->alpha(), h)
|
||||
- fvc::laplacian(k, T)
|
||||
);
|
||||
thermo->correct();
|
||||
rhoE = rho*(h + 0.5*magSqr(U)) - p;
|
||||
}
|
||||
|
||||
p.dimensionedInternalField() =
|
||||
rho.dimensionedInternalField()
|
||||
/psi.dimensionedInternalField();
|
||||
p.correctBoundaryConditions();
|
||||
rho.boundaryField() = psi.boundaryField()*p.boundaryField();
|
||||
|
||||
runTime.write();
|
||||
|
||||
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
|
||||
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
|
||||
<< nl << endl;
|
||||
}
|
||||
|
||||
Info<< "End\n" << endl;
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
Loading…
Reference in New Issue
Block a user