diff --git a/src/thermophysicalModels/basic/derivedFvPatchFields/fixedInternalEnergy/fixedInternalEnergyFvPatchScalarField.C b/src/thermophysicalModels/basic/derivedFvPatchFields/fixedInternalEnergy/fixedInternalEnergyFvPatchScalarField.C new file mode 100644 index 0000000000..1ad0a1c0d5 --- /dev/null +++ b/src/thermophysicalModels/basic/derivedFvPatchFields/fixedInternalEnergy/fixedInternalEnergyFvPatchScalarField.C @@ -0,0 +1,125 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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& iF +) +: + fixedValueFvPatchScalarField(p, iF) +{} + + +fixedInternalEnergyFvPatchScalarField::fixedInternalEnergyFvPatchScalarField +( + const fixedInternalEnergyFvPatchScalarField& ptf, + const fvPatch& p, + const DimensionedField& iF, + const fvPatchFieldMapper& mapper +) +: + fixedValueFvPatchScalarField(ptf, p, iF, mapper) +{} + + +fixedInternalEnergyFvPatchScalarField::fixedInternalEnergyFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF, + const dictionary& dict +) +: + fixedValueFvPatchScalarField(p, iF, dict) +{} + + +fixedInternalEnergyFvPatchScalarField::fixedInternalEnergyFvPatchScalarField +( + const fixedInternalEnergyFvPatchScalarField& tppsf +) +: + fixedValueFvPatchScalarField(tppsf) +{} + + +fixedInternalEnergyFvPatchScalarField::fixedInternalEnergyFvPatchScalarField +( + const fixedInternalEnergyFvPatchScalarField& tppsf, + const DimensionedField& iF +) +: + fixedValueFvPatchScalarField(tppsf, iF) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void fixedInternalEnergyFvPatchScalarField::updateCoeffs() +{ + if (updated()) + { + return; + } + + const basicThermo& thermo = db().lookupObject + ( + "thermophysicalProperties" + ); + + const label patchi = patch().index(); + + fvPatchScalarField& Tw = + const_cast(thermo.T().boundaryField()[patchi]); + Tw.evaluate(); + operator==(thermo.e(Tw, patchi)); + + fixedValueFvPatchScalarField::updateCoeffs(); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +makePatchTypeField(fvPatchScalarField, fixedInternalEnergyFvPatchScalarField); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/thermophysicalModels/basic/derivedFvPatchFields/fixedInternalEnergy/fixedInternalEnergyFvPatchScalarField.H b/src/thermophysicalModels/basic/derivedFvPatchFields/fixedInternalEnergy/fixedInternalEnergyFvPatchScalarField.H new file mode 100644 index 0000000000..ae335ed2ef --- /dev/null +++ b/src/thermophysicalModels/basic/derivedFvPatchFields/fixedInternalEnergy/fixedInternalEnergyFvPatchScalarField.H @@ -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::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& + ); + + //- Construct from patch, internal field and dictionary + fixedInternalEnergyFvPatchScalarField + ( + const fvPatch&, + const DimensionedField&, + const dictionary& + ); + + //- Construct by mapping given fixedInternalEnergyFvPatchScalarField + // onto a new patch + fixedInternalEnergyFvPatchScalarField + ( + const fixedInternalEnergyFvPatchScalarField&, + const fvPatch&, + const DimensionedField&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + fixedInternalEnergyFvPatchScalarField + ( + const fixedInternalEnergyFvPatchScalarField& + ); + + //- Construct and return a clone + virtual tmp clone() const + { + return tmp + ( + new fixedInternalEnergyFvPatchScalarField(*this) + ); + } + + //- Construct as copy setting internal field reference + fixedInternalEnergyFvPatchScalarField + ( + const fixedInternalEnergyFvPatchScalarField&, + const DimensionedField& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp clone + ( + const DimensionedField& iF + ) const + { + return tmp + ( + new fixedInternalEnergyFvPatchScalarField(*this, iF) + ); + } + + + // Member functions + + // Evaluation functions + + //- Update the coefficients associated with the patch field + virtual void updateCoeffs(); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/thermophysicalModels/basic/derivedFvPatchFields/gradientInternalEnergy/gradientInternalEnergyFvPatchScalarField.C b/src/thermophysicalModels/basic/derivedFvPatchFields/gradientInternalEnergy/gradientInternalEnergyFvPatchScalarField.C new file mode 100644 index 0000000000..0479eed1e8 --- /dev/null +++ b/src/thermophysicalModels/basic/derivedFvPatchFields/gradientInternalEnergy/gradientInternalEnergyFvPatchScalarField.C @@ -0,0 +1,132 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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& iF +) +: + fixedGradientFvPatchScalarField(p, iF) +{} + + +gradientInternalEnergyFvPatchScalarField::gradientInternalEnergyFvPatchScalarField +( + const gradientInternalEnergyFvPatchScalarField& ptf, + const fvPatch& p, + const DimensionedField& iF, + const fvPatchFieldMapper& mapper +) +: + fixedGradientFvPatchScalarField(ptf, p, iF, mapper) +{} + + +gradientInternalEnergyFvPatchScalarField::gradientInternalEnergyFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF, + const dictionary& dict +) +: + fixedGradientFvPatchScalarField(p, iF, dict) +{} + + +gradientInternalEnergyFvPatchScalarField::gradientInternalEnergyFvPatchScalarField +( + const gradientInternalEnergyFvPatchScalarField& tppsf +) +: + fixedGradientFvPatchScalarField(tppsf) +{} + + +gradientInternalEnergyFvPatchScalarField::gradientInternalEnergyFvPatchScalarField +( + const gradientInternalEnergyFvPatchScalarField& tppsf, + const DimensionedField& iF +) +: + fixedGradientFvPatchScalarField(tppsf, iF) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void gradientInternalEnergyFvPatchScalarField::updateCoeffs() +{ + if (updated()) + { + return; + } + + const basicThermo& thermo = db().lookupObject + ( + "thermophysicalProperties" + ); + + const label patchi = patch().index(); + + fvPatchScalarField& Tw = + const_cast(thermo.T().boundaryField()[patchi]); + + Tw.evaluate(); + + gradient() = thermo.Cv(Tw, patchi)*Tw.snGrad() + + patch().deltaCoeffs()* + ( + thermo.e(Tw, patchi) + - thermo.e(Tw, patch().faceCells()) + ); + + fixedGradientFvPatchScalarField::updateCoeffs(); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +makePatchTypeField(fvPatchScalarField, gradientInternalEnergyFvPatchScalarField); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/thermophysicalModels/basic/derivedFvPatchFields/gradientInternalEnergy/gradientInternalEnergyFvPatchScalarField.H b/src/thermophysicalModels/basic/derivedFvPatchFields/gradientInternalEnergy/gradientInternalEnergyFvPatchScalarField.H new file mode 100644 index 0000000000..562a7aa0c3 --- /dev/null +++ b/src/thermophysicalModels/basic/derivedFvPatchFields/gradientInternalEnergy/gradientInternalEnergyFvPatchScalarField.H @@ -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::gradientInternalEnergyFvPatchScalarField + +Description + Gradient boundary condition for internal energy + +SourceFiles + gradientInternalEnergyFvPatchScalarField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef gradientInternalEnergyFvPatchScalarField_H +#define gradientInternalEnergyFvPatchScalarField_H + +#include "fixedGradientFvPatchFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class gradientInternalEnergyFvPatchScalarField Declaration +\*---------------------------------------------------------------------------*/ + +class gradientInternalEnergyFvPatchScalarField +: + public fixedGradientFvPatchScalarField +{ + +public: + + //- Runtime type information + TypeName("gradientInternalEnergy"); + + + // Constructors + + //- Construct from patch and internal field + gradientInternalEnergyFvPatchScalarField + ( + const fvPatch&, + const DimensionedField& + ); + + //- Construct from patch, internal field and dictionary + gradientInternalEnergyFvPatchScalarField + ( + const fvPatch&, + const DimensionedField&, + const dictionary& + ); + + //- Construct by mapping given gradientInternalEnergyFvPatchScalarField + // onto a new patch + gradientInternalEnergyFvPatchScalarField + ( + const gradientInternalEnergyFvPatchScalarField&, + const fvPatch&, + const DimensionedField&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + gradientInternalEnergyFvPatchScalarField + ( + const gradientInternalEnergyFvPatchScalarField& + ); + + //- Construct and return a clone + virtual tmp clone() const + { + return tmp + ( + new gradientInternalEnergyFvPatchScalarField(*this) + ); + } + + //- Construct as copy setting internal field reference + gradientInternalEnergyFvPatchScalarField + ( + const gradientInternalEnergyFvPatchScalarField&, + const DimensionedField& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp clone + ( + const DimensionedField& iF + ) const + { + return tmp + ( + new gradientInternalEnergyFvPatchScalarField(*this, iF) + ); + } + + + // Member functions + + // Evaluation functions + + //- Update the coefficients associated with the patch field + virtual void updateCoeffs(); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/thermophysicalModels/basic/derivedFvPatchFields/mixedInternalEnergy/mixedInternalEnergyFvPatchScalarField.C b/src/thermophysicalModels/basic/derivedFvPatchFields/mixedInternalEnergy/mixedInternalEnergyFvPatchScalarField.C new file mode 100644 index 0000000000..83f80b6890 --- /dev/null +++ b/src/thermophysicalModels/basic/derivedFvPatchFields/mixedInternalEnergy/mixedInternalEnergyFvPatchScalarField.C @@ -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 + +\*---------------------------------------------------------------------------*/ + +#include "mixedInternalEnergyFvPatchScalarField.H" +#include "addToRunTimeSelectionTable.H" +#include "fvPatchFieldMapper.H" +#include "volFields.H" +#include "basicThermo.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +mixedInternalEnergyFvPatchScalarField::mixedInternalEnergyFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF +) +: + mixedFvPatchScalarField(p, iF) +{ + valueFraction() = 0.0; + refValue() = 0.0; + refGrad() = 0.0; +} + + +mixedInternalEnergyFvPatchScalarField::mixedInternalEnergyFvPatchScalarField +( + const mixedInternalEnergyFvPatchScalarField& ptf, + const fvPatch& p, + const DimensionedField& iF, + const fvPatchFieldMapper& mapper +) +: + mixedFvPatchScalarField(ptf, p, iF, mapper) +{} + + +mixedInternalEnergyFvPatchScalarField::mixedInternalEnergyFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF, + const dictionary& dict +) +: + mixedFvPatchScalarField(p, iF, dict) +{} + + +mixedInternalEnergyFvPatchScalarField::mixedInternalEnergyFvPatchScalarField +( + const mixedInternalEnergyFvPatchScalarField& tppsf +) +: + mixedFvPatchScalarField(tppsf) +{} + + +mixedInternalEnergyFvPatchScalarField::mixedInternalEnergyFvPatchScalarField +( + const mixedInternalEnergyFvPatchScalarField& tppsf, + const DimensionedField& iF +) +: + mixedFvPatchScalarField(tppsf, iF) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void mixedInternalEnergyFvPatchScalarField::updateCoeffs() +{ + if (updated()) + { + return; + } + + const basicThermo& thermo = db().lookupObject + ( + "thermophysicalProperties" + ); + + const label patchi = patch().index(); + + mixedFvPatchScalarField& Tw = refCast + ( + const_cast(thermo.T().boundaryField()[patchi]) + ); + + Tw.evaluate(); + + valueFraction() = Tw.valueFraction(); + refValue() = thermo.e(Tw.refValue(), patchi); + refGrad() = thermo.Cv(Tw, patchi)*Tw.refGrad() + + patch().deltaCoeffs()* + ( + thermo.e(Tw, patchi) + - thermo.e(Tw, patch().faceCells()) + ); + + mixedFvPatchScalarField::updateCoeffs(); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +makePatchTypeField(fvPatchScalarField, mixedInternalEnergyFvPatchScalarField); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/thermophysicalModels/basic/derivedFvPatchFields/mixedInternalEnergy/mixedInternalEnergyFvPatchScalarField.H b/src/thermophysicalModels/basic/derivedFvPatchFields/mixedInternalEnergy/mixedInternalEnergyFvPatchScalarField.H new file mode 100644 index 0000000000..ac6661d609 --- /dev/null +++ b/src/thermophysicalModels/basic/derivedFvPatchFields/mixedInternalEnergy/mixedInternalEnergyFvPatchScalarField.H @@ -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::mixedInternalEnergyFvPatchScalarField + +Description + Mixed boundary conditions for internal energy + +SourceFiles + mixedInternalEnergyFvPatchScalarField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef mixedInternalEnergyFvPatchScalarField_H +#define mixedInternalEnergyFvPatchScalarField_H + +#include "mixedFvPatchFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class mixedInternalEnergyFvPatchScalarField Declaration +\*---------------------------------------------------------------------------*/ + +class mixedInternalEnergyFvPatchScalarField +: + public mixedFvPatchScalarField +{ + +public: + + //- Runtime type information + TypeName("mixedInternalEnergy"); + + + // Constructors + + //- Construct from patch and internal field + mixedInternalEnergyFvPatchScalarField + ( + const fvPatch&, + const DimensionedField& + ); + + //- Construct from patch, internal field and dictionary + mixedInternalEnergyFvPatchScalarField + ( + const fvPatch&, + const DimensionedField&, + const dictionary& + ); + + //- Construct by mapping given mixedInternalEnergyFvPatchScalarField + // onto a new patch + mixedInternalEnergyFvPatchScalarField + ( + const mixedInternalEnergyFvPatchScalarField&, + const fvPatch&, + const DimensionedField&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + mixedInternalEnergyFvPatchScalarField + ( + const mixedInternalEnergyFvPatchScalarField& + ); + + //- Construct and return a clone + virtual tmp clone() const + { + return tmp + ( + new mixedInternalEnergyFvPatchScalarField(*this) + ); + } + + //- Construct as copy setting internal field reference + mixedInternalEnergyFvPatchScalarField + ( + const mixedInternalEnergyFvPatchScalarField&, + const DimensionedField& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp clone + ( + const DimensionedField& iF + ) const + { + return tmp + ( + new mixedInternalEnergyFvPatchScalarField(*this, iF) + ); + } + + + // Member functions + + // Evaluation functions + + //- Update the coefficients associated with the patch field + virtual void updateCoeffs(); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/thermophysicalModels/basic/eThermo/eThermo.C b/src/thermophysicalModels/basic/eThermo/eThermo.C new file mode 100644 index 0000000000..b4629a1d15 --- /dev/null +++ b/src/thermophysicalModels/basic/eThermo/eThermo.C @@ -0,0 +1,343 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 "eThermo.H" +#include "fvMesh.H" +#include "fixedValueFvPatchFields.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +Foam::eThermo::eThermo(const fvMesh& mesh) +: + basicThermo(mesh), + MixtureType(*this, mesh), + + e_ + ( + IOobject + ( + "e", + mesh.time().timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh, + dimensionSet(0, 2, -2, 0, 0), + eBoundaryTypes() + ) +{ + scalarField& eCells = e_.internalField(); + const scalarField& TCells = T_.internalField(); + + forAll(eCells, celli) + { + eCells[celli] = this->cellMixture(celli).E(TCells[celli]); + } + + forAll(e_.boundaryField(), patchi) + { + e_.boundaryField()[patchi] == e(T_.boundaryField()[patchi], patchi); + } + + eBoundaryCorrection(e_); + + calculate(); + psi_.oldTime(); // Switch on saving old time +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +template +Foam::eThermo::~eThermo() +{} + + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +template +void Foam::eThermo::calculate() +{ + const scalarField& eCells = e_.internalField(); + const scalarField& pCells = p_.internalField(); + + scalarField& TCells = T_.internalField(); + scalarField& psiCells = psi_.internalField(); + scalarField& muCells = mu_.internalField(); + scalarField& alphaCells = alpha_.internalField(); + + forAll(TCells, celli) + { + const typename MixtureType::thermoType& mixture_ = + this->cellMixture(celli); + + TCells[celli] = mixture_.TE(eCells[celli], TCells[celli]); + psiCells[celli] = mixture_.psi(pCells[celli], TCells[celli]); + + muCells[celli] = mixture_.mu(TCells[celli]); + alphaCells[celli] = mixture_.alpha(TCells[celli]); + } + + forAll(T_.boundaryField(), patchi) + { + fvPatchScalarField& pp = p_.boundaryField()[patchi]; + fvPatchScalarField& pT = T_.boundaryField()[patchi]; + fvPatchScalarField& ppsi = psi_.boundaryField()[patchi]; + + fvPatchScalarField& pe = e_.boundaryField()[patchi]; + + fvPatchScalarField& pmu = mu_.boundaryField()[patchi]; + fvPatchScalarField& palpha = alpha_.boundaryField()[patchi]; + + if (pT.fixesValue()) + { + forAll(pT, facei) + { + const typename MixtureType::thermoType& mixture_ = + this->patchFaceMixture(patchi, facei); + + pe[facei] = mixture_.E(pT[facei]); + + ppsi[facei] = mixture_.psi(pp[facei], pT[facei]); + pmu[facei] = mixture_.mu(pT[facei]); + palpha[facei] = mixture_.alpha(pT[facei]); + } + } + else + { + forAll(pT, facei) + { + const typename MixtureType::thermoType& mixture_ = + this->patchFaceMixture(patchi, facei); + + pT[facei] = mixture_.TE(pe[facei], pT[facei]); + + ppsi[facei] = mixture_.psi(pp[facei], pT[facei]); + pmu[facei] = mixture_.mu(pT[facei]); + palpha[facei] = mixture_.alpha(pT[facei]); + } + } + } +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +void Foam::eThermo::correct() +{ + if (debug) + { + Info<< "entering eThermo::correct()" << endl; + } + + // force the saving of the old-time values + psi_.oldTime(); + + calculate(); + + if (debug) + { + Info<< "exiting eThermo::correct()" << endl; + } +} + + +template +Foam::tmp Foam::eThermo::e +( + const scalarField& T, + const labelList& cells +) const +{ + tmp te(new scalarField(T.size())); + scalarField& h = te(); + + forAll(T, celli) + { + h[celli] = this->cellMixture(cells[celli]).E(T[celli]); + } + + return te; +} + + +template +Foam::tmp Foam::eThermo::e +( + const scalarField& T, + const label patchi +) const +{ + tmp te(new scalarField(T.size())); + scalarField& h = te(); + + forAll(T, facei) + { + h[facei] = this->patchFaceMixture(patchi, facei).E(T[facei]); + } + + return te; +} + +template +Foam::tmp Foam::eThermo::Cp +( + const scalarField& T, + const label patchi +) const +{ + tmp tCp(new scalarField(T.size())); + scalarField& cp = tCp(); + + forAll(T, facei) + { + cp[facei] = this->patchFaceMixture(patchi, facei).Cp(T[facei]); + } + + return tCp; +} + +template +Foam::tmp Foam::eThermo::Cp() const +{ + const fvMesh& mesh = T_.mesh(); + + tmp tCp + ( + new volScalarField + ( + IOobject + ( + "Cp", + mesh.time().timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh, + dimensionSet(0, 2, -2, -1, 0), + T_.boundaryField().types() + ) + ); + + volScalarField& cp = tCp(); + + forAll(T_, celli) + { + cp[celli] = this->cellMixture(celli).Cp(T_[celli]); + } + + forAll(T_.boundaryField(), patchi) + { + const fvPatchScalarField& pT = T_.boundaryField()[patchi]; + fvPatchScalarField& pCp = cp.boundaryField()[patchi]; + + forAll(pT, facei) + { + pCp[facei] = this->patchFaceMixture(patchi, facei).Cp(pT[facei]); + } + } + + return tCp; +} + + +template +Foam::tmp Foam::eThermo::Cv +( + const scalarField& T, + const label patchi +) const +{ + tmp tCv(new scalarField(T.size())); + scalarField& cv = tCv(); + + forAll(T, facei) + { + cv[facei] = this->patchFaceMixture(patchi, facei).Cv(T[facei]); + } + + return tCv; +} + + +template +Foam::tmp Foam::eThermo::Cv() const +{ + const fvMesh& mesh = T_.mesh(); + + tmp tCv + ( + new volScalarField + ( + IOobject + ( + "Cv", + mesh.time().timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh, + dimensionSet(0, 2, -2, -1, 0) + ) + ); + + volScalarField& cv = tCv(); + + forAll(T_, celli) + { + cv[celli] = this->cellMixture(celli).Cv(T_[celli]); + } + + forAll(T_.boundaryField(), patchi) + { + cv.boundaryField()[patchi] = Cv(T_.boundaryField()[patchi], patchi); + } + + return tCv; +} + + +template +bool Foam::eThermo::read() +{ + if (basicThermo::read()) + { + MixtureType::read(*this); + return true; + } + else + { + return false; + } +} + + +// ************************************************************************* // diff --git a/src/thermophysicalModels/basic/eThermo/eThermo.H b/src/thermophysicalModels/basic/eThermo/eThermo.H new file mode 100644 index 0000000000..3071d6150d --- /dev/null +++ b/src/thermophysicalModels/basic/eThermo/eThermo.H @@ -0,0 +1,176 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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::eThermo + +Description + Internal energy for a mixture + +SourceFiles + eThermo.C + +\*---------------------------------------------------------------------------*/ + +#ifndef eThermo_H +#define eThermo_H + +#include "basicThermo.H" +#include "basicMixture.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class eThermo Declaration +\*---------------------------------------------------------------------------*/ + +template +class eThermo +: + public basicThermo, + public MixtureType +{ + // Private data + + volScalarField e_; + + + // Private member functions + + void calculate(); + + //- Construct as copy (not implemented) + eThermo(const eThermo&); + + +public: + + //- Runtime type information + TypeName("eThermo"); + + + // Constructors + + //- Construct from mese + eThermo(const fvMesh&); + + + //- Destructor + virtual ~eThermo(); + + + // Member functions + + //- Return the compostion of the combustion mixture + virtual basicMixture& composition() + { + return *this; + } + + //- Return the compostion of the combustion mixture + virtual const basicMixture& composition() const + { + return *this; + } + + //- Update properties + virtual void correct(); + + + // Access to thermodynamic state variables + + //- Internal energy [J/kg] + // Non-const access allowed for transport equations + virtual volScalarField& e() + { + return e_; + } + + //- Internal energy [J/kg] + virtual const volScalarField& e() const + { + return e_; + } + + + // Fields derived from thermodynamic state variables + + //- Internal energy for cell-set [J/kg] + virtual tmp e + ( + const scalarField& T, + const labelList& cells + ) const; + + //- Internal energy for patch [J/kg] + virtual tmp e + ( + const scalarField& T, + const label patchi + ) const; + + //- Heat capacity at constant pressure for patch [J/kg/K] + virtual tmp Cp + ( + const scalarField& T, + const label patchi + ) const; + + //- Heat capacity at constant pressure [J/kg/K] + virtual tmp Cp() const; + + //- Heat capacity at constant volume for patch [J/kg/K] + virtual tmp Cv + ( + const scalarField& T, + const label patchi + ) const; + + //- Heat capacity at constant volume [J/kg/K] + virtual tmp Cv() const; + + + //- Read thermophysicalProperties dictionary + virtual bool read(); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + +#ifdef NoRepository +# include "eThermo.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/thermophysicalModels/basic/eThermo/eThermos.C b/src/thermophysicalModels/basic/eThermo/eThermos.C new file mode 100644 index 0000000000..fa4f0d220a --- /dev/null +++ b/src/thermophysicalModels/basic/eThermo/eThermos.C @@ -0,0 +1,88 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 + +Description + Selection function for internal energy based thermodynamics package. + +\*---------------------------------------------------------------------------*/ + +#include "error.H" + +#include "basicThermo.H" +#include "makeBasicThermo.H" + +#include "perfectGas.H" + +#include "hConstThermo.H" +#include "janafThermo.H" +#include "specieThermo.H" + +#include "constTransport.H" +#include "sutherlandTransport.H" + +#include "eThermo.H" +#include "pureMixture.H" + +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/* * * * * * * * * * * * * * * private static data * * * * * * * * * * * * * */ + + +makeBasicThermo +( + eThermo, + pureMixture, + constTransport, + hConstThermo, + perfectGas +); + +makeBasicThermo +( + eThermo, + pureMixture, + sutherlandTransport, + hConstThermo, + perfectGas +); + +makeBasicThermo +( + eThermo, + pureMixture, + sutherlandTransport, + janafThermo, + perfectGas +); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/thermophysicalModels/basic/hThermo/hThermos.C b/src/thermophysicalModels/basic/hThermo/hThermos.C new file mode 100644 index 0000000000..6b144725c0 --- /dev/null +++ b/src/thermophysicalModels/basic/hThermo/hThermos.C @@ -0,0 +1,88 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 + +Description + Selection function for internal energy based thermodynamics package. + +\*---------------------------------------------------------------------------*/ + +#include "error.H" + +#include "basicThermo.H" +#include "makeBasicThermo.H" + +#include "perfectGas.H" + +#include "hConstThermo.H" +#include "janafThermo.H" +#include "specieThermo.H" + +#include "constTransport.H" +#include "sutherlandTransport.H" + +#include "hThermo.H" +#include "pureMixture.H" + +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/* * * * * * * * * * * * * * * private static data * * * * * * * * * * * * * */ + + +makeBasicThermo +( + hThermo, + pureMixture, + constTransport, + hConstThermo, + perfectGas +); + +makeBasicThermo +( + hThermo, + pureMixture, + sutherlandTransport, + hConstThermo, + perfectGas +); + +makeBasicThermo +( + hThermo, + pureMixture, + sutherlandTransport, + janafThermo, + perfectGas +); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/thermophysicalModels/basic/mixtures/basicMixture/basicMixtures.C b/src/thermophysicalModels/basic/mixtures/basicMixture/basicMixtures.C new file mode 100644 index 0000000000..8efab94648 --- /dev/null +++ b/src/thermophysicalModels/basic/mixtures/basicMixture/basicMixtures.C @@ -0,0 +1,83 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 + +Description + Selection function for internal energy based thermodynamics package. + +\*---------------------------------------------------------------------------*/ + +#include "error.H" + +#include "basicMixture.H" +#include "makeBasicMixture.H" + +#include "perfectGas.H" + +#include "hConstThermo.H" +#include "janafThermo.H" +#include "specieThermo.H" + +#include "constTransport.H" +#include "sutherlandTransport.H" + +#include "pureMixture.H" + +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/* * * * * * * * * * * * * * * private static data * * * * * * * * * * * * * */ + +makeBasicMixture +( + pureMixture, + constTransport, + hConstThermo, + perfectGas +); + +makeBasicMixture +( + pureMixture, + sutherlandTransport, + hConstThermo, + perfectGas +); + +makeBasicMixture +( + pureMixture, + sutherlandTransport, + janafThermo, + perfectGas +); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/thermophysicalModels/basic/mixtures/basicMixture/makeBasicMixture.H b/src/thermophysicalModels/basic/mixtures/basicMixture/makeBasicMixture.H new file mode 100644 index 0000000000..6214aa0814 --- /dev/null +++ b/src/thermophysicalModels/basic/mixtures/basicMixture/makeBasicMixture.H @@ -0,0 +1,52 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 + +InClass + Foam::basicMixture + +Description + +\*---------------------------------------------------------------------------*/ + +#ifndef makeBasicMixture_H +#define makeBasicMixture_H + +#include "basicMixture.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#define makeBasicMixture(Mixture,Transport,Thermo,EqnOfState) \ + \ +typedef Mixture > > > \ + Mixture##Transport##Thermo##EqnOfState; \ + \ +defineTemplateTypeNameAndDebugWithName \ + (Mixture##Transport##Thermo##EqnOfState, \ + #Mixture"<"#Transport">>>", 0) + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* //