Commit 606516d8 authored by mattijs's avatar mattijs
Browse files

Merge branch 'master' of /home/hunt2/OpenFOAM/OpenFOAM-dev

parents 619f7838 a7090d8f
......@@ -2,14 +2,21 @@ basicMixture = mixtures/basicMixture
basicThermo = basicThermo
$(basicMixture)/basicMixture.C
$(basicMixture)/basicMixtures.C
$(basicThermo)/basicThermo.C
$(basicThermo)/newBasicThermo.C
$(basicThermo)/basicThermos.C
hThermo/hThermos.C
eThermo/eThermos.C
derivedFvPatchFields/fixedEnthalpy/fixedEnthalpyFvPatchScalarField.C
derivedFvPatchFields/gradientEnthalpy/gradientEnthalpyFvPatchScalarField.C
derivedFvPatchFields/mixedEnthalpy/mixedEnthalpyFvPatchScalarField.C
derivedFvPatchFields/fixedInternalEnergy/fixedInternalEnergyFvPatchScalarField.C
derivedFvPatchFields/gradientInternalEnergy/gradientInternalEnergyFvPatchScalarField.C
derivedFvPatchFields/mixedInternalEnergy/mixedInternalEnergyFvPatchScalarField.C
derivedFvPatchFields/wallHeatTransfer/wallHeatTransferFvPatchScalarField.C
LIB = $(FOAM_LIBBIN)/libbasicThermophysicalModels
......@@ -31,6 +31,9 @@ License
#include "fixedEnthalpyFvPatchScalarField.H"
#include "gradientEnthalpyFvPatchScalarField.H"
#include "mixedEnthalpyFvPatchScalarField.H"
#include "fixedInternalEnergyFvPatchScalarField.H"
#include "gradientInternalEnergyFvPatchScalarField.H"
#include "mixedInternalEnergyFvPatchScalarField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......@@ -74,9 +77,9 @@ wordList basicThermo::hBoundaryTypes()
return hbt;
}
void basicThermo::hBoundaryCorrection(volScalarField& h_)
void basicThermo::hBoundaryCorrection(volScalarField& h)
{
volScalarField::GeometricBoundaryField& hbf = h_.boundaryField();
volScalarField::GeometricBoundaryField& hbf = h.boundaryField();
forAll(hbf, patchi)
{
......@@ -93,6 +96,53 @@ void basicThermo::hBoundaryCorrection(volScalarField& h_)
}
}
wordList basicThermo::eBoundaryTypes()
{
const volScalarField::GeometricBoundaryField& tbf = T_.boundaryField();
wordList ebt = tbf.types();
forAll(tbf, patchi)
{
if (isA<fixedValueFvPatchScalarField>(tbf[patchi]))
{
ebt[patchi] = fixedInternalEnergyFvPatchScalarField::typeName;
}
else if
(
isA<zeroGradientFvPatchScalarField>(tbf[patchi])
|| isA<fixedGradientFvPatchScalarField>(tbf[patchi])
)
{
ebt[patchi] = gradientInternalEnergyFvPatchScalarField::typeName;
}
else if (isA<mixedFvPatchScalarField>(tbf[patchi]))
{
ebt[patchi] = mixedInternalEnergyFvPatchScalarField::typeName;
}
}
return ebt;
}
void basicThermo::eBoundaryCorrection(volScalarField& e)
{
volScalarField::GeometricBoundaryField& ebf = e.boundaryField();
forAll(ebf, patchi)
{
if (isA<gradientInternalEnergyFvPatchScalarField>(ebf[patchi]))
{
refCast<gradientInternalEnergyFvPatchScalarField>(ebf[patchi])
.gradient() = ebf[patchi].fvPatchField::snGrad();
}
else if (isA<mixedInternalEnergyFvPatchScalarField>(ebf[patchi]))
{
refCast<mixedInternalEnergyFvPatchScalarField>(ebf[patchi])
.refGrad() = ebf[patchi].fvPatchField::snGrad();
}
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
......
......@@ -74,6 +74,9 @@ protected:
wordList hBoundaryTypes();
void hBoundaryCorrection(volScalarField& h);
wordList eBoundaryTypes();
void eBoundaryCorrection(volScalarField& e);
//- Construct as copy (not implemented)
basicThermo(const basicThermo&);
......@@ -107,9 +110,8 @@ public:
static autoPtr<basicThermo> New(const fvMesh&);
// Destructor
virtual ~basicThermo();
//- Destructor
virtual ~basicThermo();
// Member functions
......@@ -122,13 +124,13 @@ public:
//- Pressure [Pa]
// Non-const access allowed for transport equations
volScalarField& p()
virtual volScalarField& p()
{
return p_;
}
//- Pressure [Pa]
const volScalarField& p() const
virtual const volScalarField& p() const
{
return p_;
}
......@@ -193,23 +195,52 @@ public:
return volScalarField::null();
}
//- Internal energy for cell-set [J/kg]
virtual tmp<scalarField> e
(
const scalarField& T,
const labelList& cells
) const
{
notImplemented
(
"basicThermo::e"
"(const scalarField& T, const labelList& cells) const"
);
return tmp<scalarField>(NULL);
}
//-Internal energy for patch [J/kg]
virtual tmp<scalarField> e
(
const scalarField& T,
const label patchi
) const
{
notImplemented
(
"basicThermo::e"
"(const scalarField& T, const label patchi) const"
);
return tmp<scalarField>(NULL);
}
// Fields derived from thermodynamic state variables
//- Temperature [K]
const volScalarField& T() const
virtual const volScalarField& T() const
{
return T_;
}
//- Density [kg/m^3]
tmp<volScalarField> rho() const
virtual tmp<volScalarField> rho() const
{
return p_*psi();
}
//- Compressibility [s^2/m^2]
const volScalarField& psi() const
virtual const volScalarField& psi() const
{
return psi_;
}
......@@ -236,6 +267,21 @@ public:
return volScalarField::null();
}
//- Heat capacity at constant volume for patch [J/kg/K]
virtual tmp<scalarField> Cv
(
const scalarField& T,
const label patchi
) const
{
notImplemented
(
"basicThermo::Cv"
"(const scalarField& T, const label patchi) const"
);
return tmp<scalarField>(NULL);
}
//- Heat capacity at constant volume [J/kg/K]
virtual tmp<volScalarField> Cv() const
{
......@@ -247,13 +293,13 @@ public:
// Access to transport state variables
//- Dynamic viscosity of mixture [kg/ms]
const volScalarField& mu() const
virtual const volScalarField& mu() const
{
return mu_;
}
//- Thermal diffusivity for enthalpy of mixture [kg/ms]
const volScalarField& alpha() const
virtual const volScalarField& alpha() const
{
return alpha_;
}
......
......@@ -38,13 +38,6 @@ Description
#define makeBasicThermo(Cthermo,Mixture,Transport,Thermo,EqnOfState) \
\
typedef Mixture<Transport<specieThermo<Thermo<EqnOfState> > > > \
Mixture##Transport##Thermo##EqnOfState; \
\
defineTemplateTypeNameAndDebugWithName \
(Mixture##Transport##Thermo##EqnOfState, \
#Mixture"<"#Transport"<specieThermo<"#Thermo"<"#EqnOfState">>>>", 0) \
\
typedef Cthermo<Mixture<Transport<specieThermo<Thermo<EqnOfState> > > > > \
Cthermo##Mixture##Transport##Thermo##EqnOfState; \
\
......@@ -60,7 +53,6 @@ addToRunTimeSelectionTable \
fvMesh \
)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
......
/*---------------------------------------------------------------------------*\
========= |
\\ / 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 "fixedInternalEnergyFvPatchScalarField.H"
#include "addToRunTimeSelectionTable.H"
#include "fvPatchFieldMapper.H"
#include "volFields.H"
#include "basicThermo.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
fixedInternalEnergyFvPatchScalarField::fixedInternalEnergyFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF
)
:
fixedValueFvPatchScalarField(p, iF)
{}
fixedInternalEnergyFvPatchScalarField::fixedInternalEnergyFvPatchScalarField
(
const fixedInternalEnergyFvPatchScalarField& ptf,
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
fixedValueFvPatchScalarField(ptf, p, iF, mapper)
{}
fixedInternalEnergyFvPatchScalarField::fixedInternalEnergyFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const dictionary& dict
)
:
fixedValueFvPatchScalarField(p, iF, dict)
{}
fixedInternalEnergyFvPatchScalarField::fixedInternalEnergyFvPatchScalarField
(
const fixedInternalEnergyFvPatchScalarField& tppsf
)
:
fixedValueFvPatchScalarField(tppsf)
{}
fixedInternalEnergyFvPatchScalarField::fixedInternalEnergyFvPatchScalarField
(
const fixedInternalEnergyFvPatchScalarField& tppsf,
const DimensionedField<scalar, volMesh>& iF
)
:
fixedValueFvPatchScalarField(tppsf, iF)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void fixedInternalEnergyFvPatchScalarField::updateCoeffs()
{
if (updated())
{
return;
}
const basicThermo& thermo = db().lookupObject<basicThermo>
(
"thermophysicalProperties"
);
const label patchi = patch().index();
fvPatchScalarField& Tw =
const_cast<fvPatchScalarField&>(thermo.T().boundaryField()[patchi]);
Tw.evaluate();
operator==(thermo.e(Tw, patchi));
fixedValueFvPatchScalarField::updateCoeffs();
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeField(fvPatchScalarField, fixedInternalEnergyFvPatchScalarField);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //
/*---------------------------------------------------------------------------*\
========= |
\\ / 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::fixedInternalEnergyFvPatchScalarField
Description
A fixed boundary condition for internal energy
SourceFiles
fixedInternalEnergyFvPatchScalarField.C
\*---------------------------------------------------------------------------*/
#ifndef fixedInternalEnergyFvPatchScalarField_H
#define fixedInternalEnergyFvPatchScalarField_H
#include "fixedValueFvPatchFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class fixedInternalEnergyFvPatchScalarField Declaration
\*---------------------------------------------------------------------------*/
class fixedInternalEnergyFvPatchScalarField
:
public fixedValueFvPatchScalarField
{
public:
//- Runtime type information
TypeName("fixedInternalEnergy");
// Constructors
//- Construct from patch and internal field
fixedInternalEnergyFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&
);
//- Construct from patch, internal field and dictionary
fixedInternalEnergyFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const dictionary&
);
//- Construct by mapping given fixedInternalEnergyFvPatchScalarField
// onto a new patch
fixedInternalEnergyFvPatchScalarField
(
const fixedInternalEnergyFvPatchScalarField&,
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
fixedInternalEnergyFvPatchScalarField
(
const fixedInternalEnergyFvPatchScalarField&
);
//- Construct and return a clone
virtual tmp<fvPatchScalarField> clone() const
{
return tmp<fvPatchScalarField>
(
new fixedInternalEnergyFvPatchScalarField(*this)
);
}
//- Construct as copy setting internal field reference
fixedInternalEnergyFvPatchScalarField
(
const fixedInternalEnergyFvPatchScalarField&,
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 fixedInternalEnergyFvPatchScalarField(*this, iF)
);
}
// Member functions
// Evaluation functions
//- Update the coefficients associated with the patch field
virtual void updateCoeffs();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //
/*---------------------------------------------------------------------------*\
========= |
\\ / 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 "gradientInternalEnergyFvPatchScalarField.H"
#include "addToRunTimeSelectionTable.H"
#include "fvPatchFieldMapper.H"
#include "volFields.H"
#include "basicThermo.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
gradientInternalEnergyFvPatchScalarField::gradientInternalEnergyFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF
)
:
fixedGradientFvPatchScalarField(p, iF)
{}
gradientInternalEnergyFvPatchScalarField::gradientInternalEnergyFvPatchScalarField
(
const gradientInternalEnergyFvPatchScalarField& ptf,
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
fixedGradientFvPatchScalarField(ptf, p, iF, mapper)
{}
gradientInternalEnergyFvPatchScalarField::gradientInternalEnergyFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const dictionary& dict
)
:
fixedGradientFvPatchScalarField(p, iF, dict)
{}