diff --git a/src/fvOptions/Make/files b/src/fvOptions/Make/files index 6c9f87a634..f9f9baa28f 100644 --- a/src/fvOptions/Make/files +++ b/src/fvOptions/Make/files @@ -40,6 +40,8 @@ $(derivedSources)/buoyancyEnergy/buoyancyEnergyIO.C $(derivedSources)/verticalDamping/verticalDamping.C $(derivedSources)/phaseLimitStabilization/phaseLimitStabilization.C $(derivedSources)/accelerationSource/accelerationSource.C +$(derivedSources)/volumeFractionSource/volumeFractionSource.C +$(derivedSources)/solidEqulibriumEnergySource/solidEqulibriumEnergySource.C interRegion = sources/interRegion $(interRegion)/interRegionHeatTransfer/interRegionHeatTransferModel/interRegionHeatTransferModel.C diff --git a/src/fvOptions/sources/derived/solidEqulibriumEnergySource/solidEqulibriumEnergySource.C b/src/fvOptions/sources/derived/solidEqulibriumEnergySource/solidEqulibriumEnergySource.C new file mode 100644 index 0000000000..570e9d92ff --- /dev/null +++ b/src/fvOptions/sources/derived/solidEqulibriumEnergySource/solidEqulibriumEnergySource.C @@ -0,0 +1,184 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2019 OpenFOAM Foundation + \\/ 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 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "solidEqulibriumEnergySource.H" +#include "fvmDdt.H" +#include "fvmLaplacian.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace fv +{ + defineTypeNameAndDebug(solidEqulibriumEnergySource, 0); + addToRunTimeSelectionTable + ( + option, + solidEqulibriumEnergySource, + dictionary + ); +} +} + + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +const Foam::volScalarField& Foam::fv::solidEqulibriumEnergySource::alpha() const +{ + const word alphaName = IOobject::groupName("alpha", phaseName_); + + if (!mesh_.foundObject(alphaName)) + { + volScalarField* alphaPtr = + new volScalarField + ( + IOobject + ( + alphaName, + mesh_.time().constant(), + mesh_, + IOobject::MUST_READ, + IOobject::NO_WRITE + ), + mesh_ + ); + + alphaPtr->store(); + } + + return mesh_.lookupObject(alphaName); +} + + +const Foam::solidThermo& Foam::fv::solidEqulibriumEnergySource::thermo() const +{ + const word thermoName = + IOobject::groupName(basicThermo::dictName, phaseName_); + + if (!mesh_.foundObject(thermoName)) + { + solidThermo* thermoPtr = solidThermo::New(mesh_, phaseName_).ptr(); + + thermoPtr->store(); + } + + return mesh_.lookupObject(thermoName); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::fv::solidEqulibriumEnergySource::solidEqulibriumEnergySource +( + const word& name, + const word& modelType, + const dictionary& dict, + const fvMesh& mesh +) +: + option(name, modelType, dict, mesh), + phaseName_(dict.lookupType("phase")) +{ + read(dict); + alpha(); + thermo(); +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::fv::solidEqulibriumEnergySource::~solidEqulibriumEnergySource() +{} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +void Foam::fv::solidEqulibriumEnergySource::addSup +( + const volScalarField& rho, + fvMatrix& eqn, + const label fieldi +) +{ + const volScalarField alphahe(thermo().alphahe()); + + const volScalarField& A = this->alpha(); + const volScalarField B(1 - A); + + eqn -= + A/B*fvm::ddt(thermo().rho(), eqn.psi()); + - 1/B*fvm::laplacian + ( + A*alphahe, + eqn.psi(), + "laplacian(" + alphahe.name() + "," + eqn.psi().name() + ")" + ); +} + + +void Foam::fv::solidEqulibriumEnergySource::addSup +( + const volScalarField& alpha, + const volScalarField& rho, + fvMatrix& eqn, + const label fieldi +) +{ + const volScalarField alphahe(alpha*thermo().alphahe()); + + const volScalarField& A = this->alpha(); + const volScalarField B(1 - A); + + eqn -= + A/B*fvm::ddt(alpha, thermo().rho(), eqn.psi()); + - 1/B*fvm::laplacian + ( + A*alphahe, + eqn.psi(), + "laplacian(" + alphahe.name() + "," + eqn.psi().name() + ")" + ); +} + + +bool Foam::fv::solidEqulibriumEnergySource::read(const dictionary& dict) +{ + if (option::read(dict)) + { + fieldNames_ = wordList(1, coeffs_.lookupType("field")); + + applied_.setSize(fieldNames_.size(), false); + + return true; + } + else + { + return false; + } +} + + +// ************************************************************************* // diff --git a/src/fvOptions/sources/derived/solidEqulibriumEnergySource/solidEqulibriumEnergySource.H b/src/fvOptions/sources/derived/solidEqulibriumEnergySource/solidEqulibriumEnergySource.H new file mode 100644 index 0000000000..7ec72a6589 --- /dev/null +++ b/src/fvOptions/sources/derived/solidEqulibriumEnergySource/solidEqulibriumEnergySource.H @@ -0,0 +1,161 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2019 OpenFOAM Foundation + \\/ 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 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::fv::solidEqulibriumEnergySource + +Description + This option adds the thermal inertia of a solid phase into the energy + equation. It assumes that the solid is in thermal equilibrium with the + surrounding fluid phase. + + The volume fraction of the solid phase is read from constant/alpha., + and the associated thermophysical properties are specified in + constant/thermophysicalProperties.. + +Usage + \table + Property | Description | Req'd? | Default + phase | Name of the solid phase | yes | + field | Name of the energy field to apply the option to \\ + | yes | + \endtable + + Example specification: + \verbatim + + { + type solidEqulibriumEnergySource; + phase solid; + field e; + } + \endverbatim + +\*---------------------------------------------------------------------------*/ + +#ifndef solidEqulibriumEnergySource_H +#define solidEqulibriumEnergySource_H + +#include "fvOption.H" +#include "volFields.H" +#include "solidThermo.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace fv +{ + +/*---------------------------------------------------------------------------*\ + Class solidEqulibriumEnergySource Declaration +\*---------------------------------------------------------------------------*/ + +class solidEqulibriumEnergySource +: + public option +{ +private: + + // Private Member Data + + //- The name of the phase + const word phaseName_; + + //- Get the volume fraction field + const volScalarField& alpha() const; + + //- Get the thermo + const solidThermo& thermo() const; + + + // Private Member Functions + + //- Disallow default bitwise copy construct + solidEqulibriumEnergySource(const solidEqulibriumEnergySource&); + + //- Disallow default bitwise assignment + void operator=(const solidEqulibriumEnergySource&); + + +public: + + //- Runtime type information + TypeName("solidEqulibriumEnergySource"); + + + // Constructors + + //- Construct from components + solidEqulibriumEnergySource + ( + const word& name, + const word& modelType, + const dictionary& dict, + const fvMesh& mesh + ); + + + //- Destructor + virtual ~solidEqulibriumEnergySource(); + + + // Member Functions + + // Evaluation + + //- Explicit and implicit sources for compressible equations + virtual void addSup + ( + const volScalarField&, + fvMatrix&, + const label + ); + + //- Explicit and implicit sources for phase equations + virtual void addSup + ( + const volScalarField&, + const volScalarField&, + fvMatrix&, + const label + ); + + + // IO + + //- Read dictionary + virtual bool read(const dictionary& dict); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace fv +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/fvOptions/sources/derived/volumeFractionSource/volumeFractionSource.C b/src/fvOptions/sources/derived/volumeFractionSource/volumeFractionSource.C new file mode 100644 index 0000000000..c35c18b0cc --- /dev/null +++ b/src/fvOptions/sources/derived/volumeFractionSource/volumeFractionSource.C @@ -0,0 +1,467 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2019 OpenFOAM Foundation + \\/ 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 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "volumeFractionSource.H" +#include "fvmDdt.H" +#include "fvmDiv.H" +#include "fvmLaplacian.H" +#include "surfaceInterpolate.H" +#include "turbulentFluidThermoModel.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace fv +{ + defineTypeNameAndDebug(volumeFractionSource, 0); + addToRunTimeSelectionTable + ( + option, + volumeFractionSource, + dictionary + ); +} +} + + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +const Foam::volScalarField& Foam::fv::volumeFractionSource::alpha() const +{ + const word alphaName = IOobject::groupName("alpha", phaseName_); + + if (!mesh_.foundObject(alphaName)) + { + volScalarField* alphaPtr = + new volScalarField + ( + IOobject + ( + alphaName, + mesh_.time().constant(), + mesh_, + IOobject::MUST_READ, + IOobject::NO_WRITE + ), + mesh_ + ); + + alphaPtr->store(); + } + + return mesh_.lookupObject(alphaName); +} + + +Foam::tmp Foam::fv::volumeFractionSource::D +( + const label fieldi +) const +{ + const surfaceScalarField& phi = + mesh().lookupObject(phiName_); + + if (phi.dimensions() == dimVolume/dimTime) + { + const turbulenceModel& turbulence = + mesh().lookupObject + ( + turbulenceModel::propertiesName + ); + + return turbulence.nuEff(); + } + else if (phi.dimensions() == dimMass/dimTime) + { + const compressible::turbulenceModel& turbulence = + mesh().lookupObject + ( + turbulenceModel::propertiesName + ); + + return + fieldNames_[fieldi] == turbulence.transport().T().name() + ? turbulence.kappaEff() + : fieldNames_[fieldi] == turbulence.transport().he().name() + ? turbulence.alphaEff() + : turbulence.muEff(); + } + else + { + FatalErrorInFunction + << "Dimensions of " << phi.name() << " not recognised" + << exit(FatalError); + return tmp(nullptr); + } +} + + +template +void Foam::fv::volumeFractionSource::addDivSup +( + fvMatrix& eqn, + const label fieldi +) +{ + const surfaceScalarField& phi = + mesh().lookupObject(phiName_); + + const volScalarField AByB(this->alpha()/(1 - this->alpha())); + + eqn -= AByB*fvm::div(phi, eqn.psi()); +} + + +void Foam::fv::volumeFractionSource::addUDivSup +( + fvMatrix& eqn, + const label fieldi +) +{ + const surfaceScalarField& phi = + mesh().lookupObject(phiName_); + + const volScalarField AByB(this->alpha()/(1 - this->alpha())); + + const word scheme("div(" + phiName_ + "," + eqn.psi().name() + ")"); + + eqn -= fvm::div(fvc::interpolate(AByB)*phi, eqn.psi(), scheme); +} + + +void Foam::fv::volumeFractionSource::addRhoDivSup +( + fvMatrix& eqn, + const label fieldi +) +{ + const surfaceScalarField& phi = + mesh().lookupObject(phiName_); + + const volScalarField AByB(this->alpha()/(1 - this->alpha())); + + eqn -= AByB*fvc::div(phi); +} + + +template +void Foam::fv::volumeFractionSource::addLaplacianSup +( + const AlphaFieldType& alpha, + fvMatrix& eqn, + const label fieldi +) +{ + const volScalarField B(1 - this->alpha()); + + const volScalarField D(this->D(fieldi)); + + const word scheme("laplacian(" + D.name() + "," + eqn.psi().name() + ")"); + + eqn += + fvm::laplacian(D, eqn.psi()) + - 1/B*fvm::laplacian(B*D, eqn.psi(), scheme); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::fv::volumeFractionSource::volumeFractionSource +( + const word& name, + const word& modelType, + const dictionary& dict, + const fvMesh& mesh +) +: + option(name, modelType, dict, mesh), + phaseName_(dict.lookupType("phase")), + phiName_("phi"), + rhoName_("rho"), + UName_("U") +{ + read(dict); + alpha(); +} + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::fv::volumeFractionSource::~volumeFractionSource() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::fv::volumeFractionSource::addSup +( + fvMatrix& eqn, + const label fieldi +) +{ + if (fieldNames_[fieldi] == rhoName_) + { + addRhoDivSup(eqn, fieldi); + } + else + { + addDivSup(eqn, fieldi); + addLaplacianSup(geometricOneField(), eqn, fieldi); + } +} + + +void Foam::fv::volumeFractionSource::addSup +( + fvMatrix& eqn, + const label fieldi +) +{ + if (fieldNames_[fieldi] == UName_) + { + addUDivSup(eqn, fieldi); + } + else + { + addDivSup(eqn, fieldi); + addLaplacianSup(geometricOneField(), eqn, fieldi); + } +} + + +void Foam::fv::volumeFractionSource::addSup +( + fvMatrix& eqn, + const label fieldi +) +{ + addDivSup(eqn, fieldi); + addLaplacianSup(geometricOneField(), eqn, fieldi); +} + + +void Foam::fv::volumeFractionSource::addSup +( + fvMatrix& eqn, + const label fieldi +) +{ + addDivSup(eqn, fieldi); + addLaplacianSup(geometricOneField(), eqn, fieldi); +} + + +void Foam::fv::volumeFractionSource::addSup +( + fvMatrix& eqn, + const label fieldi +) +{ + addDivSup(eqn, fieldi); + addLaplacianSup(geometricOneField(), eqn, fieldi); +} + + +void Foam::fv::volumeFractionSource::addSup +( + const volScalarField& rho, + fvMatrix& eqn, + const label fieldi +) +{ + if (fieldNames_[fieldi] == rhoName_) + { + addRhoDivSup(eqn, fieldi); + } + else + { + addDivSup(eqn, fieldi); + addLaplacianSup(geometricOneField(), eqn, fieldi); + } +} + + +void Foam::fv::volumeFractionSource::addSup +( + const volScalarField& rho, + fvMatrix& eqn, + const label fieldi +) +{ + if (fieldNames_[fieldi] == UName_) + { + addUDivSup(eqn, fieldi); + } + else + { + addDivSup(eqn, fieldi); + addLaplacianSup(geometricOneField(), eqn, fieldi); + } +} + + +void Foam::fv::volumeFractionSource::addSup +( + const volScalarField& rho, + fvMatrix& eqn, + const label fieldi +) +{ + addDivSup(eqn, fieldi); + addLaplacianSup(geometricOneField(), eqn, fieldi); +} + + +void Foam::fv::volumeFractionSource::addSup +( + const volScalarField& rho, + fvMatrix& eqn, + const label fieldi +) +{ + addDivSup(eqn, fieldi); + addLaplacianSup(geometricOneField(), eqn, fieldi); +} + + +void Foam::fv::volumeFractionSource::addSup +( + const volScalarField& rho, + fvMatrix& eqn, + const label fieldi +) +{ + addDivSup(eqn, fieldi); + addLaplacianSup(geometricOneField(), eqn, fieldi); +} + + +void Foam::fv::volumeFractionSource::addSup +( + const volScalarField& alpha, + const volScalarField& rho, + fvMatrix& eqn, + const label fieldi +) +{ + if (fieldNames_[fieldi] == rhoName_) + { + addRhoDivSup(eqn, fieldi); + } + else + { + addDivSup(eqn, fieldi); + addLaplacianSup(alpha, eqn, fieldi); + } +} + + +void Foam::fv::volumeFractionSource::addSup +( + const volScalarField& alpha, + const volScalarField& rho, + fvMatrix& eqn, + const label fieldi +) +{ + if (fieldNames_[fieldi] == UName_) + { + addUDivSup(eqn, fieldi); + } + else + { + addDivSup(eqn, fieldi); + addLaplacianSup(alpha, eqn, fieldi); + } +} + + +void Foam::fv::volumeFractionSource::addSup +( + const volScalarField& alpha, + const volScalarField& rho, + fvMatrix& eqn, + const label fieldi +) +{ + addDivSup(eqn, fieldi); + addLaplacianSup(alpha, eqn, fieldi); +} + + +void Foam::fv::volumeFractionSource::addSup +( + const volScalarField& alpha, + const volScalarField& rho, + fvMatrix& eqn, + const label fieldi +) +{ + addDivSup(eqn, fieldi); + addLaplacianSup(alpha, eqn, fieldi); +} + + +void Foam::fv::volumeFractionSource::addSup +( + const volScalarField& alpha, + const volScalarField& rho, + fvMatrix& eqn, + const label fieldi +) +{ + addDivSup(eqn, fieldi); + addLaplacianSup(alpha, eqn, fieldi); +} + + +bool Foam::fv::volumeFractionSource::read(const dictionary& dict) +{ + if (option::read(dict)) + { + if (coeffs_.found("fields")) + { + coeffs_.lookup("fields") >> fieldNames_; + } + + applied_.setSize(fieldNames_.size(), false); + + dict.readIfPresent("phi", phiName_); + + dict.readIfPresent("rho", rhoName_); + + dict.readIfPresent("U", UName_); + + return true; + } + else + { + return false; + } +} + + +// ************************************************************************* // diff --git a/src/fvOptions/sources/derived/volumeFractionSource/volumeFractionSource.H b/src/fvOptions/sources/derived/volumeFractionSource/volumeFractionSource.H new file mode 100644 index 0000000000..663de8539a --- /dev/null +++ b/src/fvOptions/sources/derived/volumeFractionSource/volumeFractionSource.H @@ -0,0 +1,297 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2019 OpenFOAM Foundation + \\/ 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 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::fv::volumeFractionSource + +Description + This option adds transport terms into the equations to account for the + presence of a constant volume fraction. The volume fraction is read from + constant/alpha., where is given as a parameter to the + option. Both advective and diffusive terms are added, and the resulting + solution is time-accurate. The flux and velocity are treated as + superficial. + + This can be used to represent the effect of porous media that are caused + purely by the reduction in volume of the fluid phase; i.e., additional + blockage, and changes to transport and diffusion rates. It does not + represent losses or transfers with the porous media. That requires separate + sub-modelling. + +Usage + \table + Property | Description | Req'd? | Default + phase | Name of the phase associated with the volume fraction \\ + | yes | + phi | Name of the flux field | no | phi + rho | Name of the density field | no | rho + U | Name of the velocity field | no | U + fields | Names of the fields to apply the option to \\ + | yes | + \endtable + + Example specification: + \verbatim + + { + type volumeFractionSource; + phase solid; + phi phi; + rho rho; + U U; + fields (rho U e); + } + \endverbatim + +SourceFiles + volumeFractionSource.C + +\*---------------------------------------------------------------------------*/ + +#ifndef volumeFractionSource_H +#define volumeFractionSource_H + +#include "fvOption.H" +#include "surfaceFields.H" +#include "volFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace fv +{ + +/*---------------------------------------------------------------------------*\ + Class volumeFractionSource Declaration +\*---------------------------------------------------------------------------*/ + +class volumeFractionSource +: + public option +{ +private: + + // Private Member Data + + //- The name of the phase + const word phaseName_; + + //- The name of the flux field + word phiName_; + + //- The name of the density field + word rhoName_; + + //- The name of the velocity field + word UName_; + + + // Private Member Functions + + //- Get the volume fraction field + const volScalarField& alpha() const; + + //- Get the diffusivity for a given field + tmp D(const label) const; + + //- Add time-derivative terms to an equation + template + void addDdtSup(fvMatrix&, const label); + + //- Add time-derivative terms to a compressible equation + template + void addDdtSup(const volScalarField&, fvMatrix&, const label); + + //- Add time-derivative terms to a phase-compressible equation + template + void addDdtSup + ( + const volScalarField&, + const volScalarField&, + fvMatrix&, + const label + ); + + //- Add divergence terms to an equation + template + void addDivSup(fvMatrix&, const label); + + //- Add divergence terms to the momentum equation + void addUDivSup(fvMatrix&, const label); + + //- Add divergence terms to the continuity equation + void addRhoDivSup(fvMatrix&, const label); + + //- Add Laplacian terms to an equation + template + void addLaplacianSup + ( + const AlphaFieldType& alpha, + fvMatrix& eqn, + const label fieldi + ); + + //- Disallow default bitwise copy construct + volumeFractionSource(const volumeFractionSource&); + + //- Disallow default bitwise assignment + void operator=(const volumeFractionSource&); + +public: + + //- Runtime type information + TypeName("volumeFractionSource"); + + + // Constructors + + //- Construct from components + volumeFractionSource + ( + const word& name, + const word& modelType, + const dictionary& dict, + const fvMesh& mesh + ); + + + //- Destructor + virtual ~volumeFractionSource(); + + + // Member Functions + + // Evaluation + + // Explicit and implicit sources + + virtual void addSup(fvMatrix&, const label); + + virtual void addSup(fvMatrix&, const label); + + virtual void addSup(fvMatrix&, const label); + + virtual void addSup(fvMatrix&, const label); + + virtual void addSup(fvMatrix&, const label); + + + // Explicit and implicit sources for compressible equations + + virtual void addSup + ( + const volScalarField&, + fvMatrix&, + const label + ); + + virtual void addSup + ( + const volScalarField&, + fvMatrix&, + const label + ); + + virtual void addSup + ( + const volScalarField&, + fvMatrix&, + const label + ); + + virtual void addSup + ( + const volScalarField&, + fvMatrix&, + const label + ); + + virtual void addSup + ( + const volScalarField&, + fvMatrix&, + const label + ); + + + // Explicit and implicit sources for phase equations + + virtual void addSup + ( + const volScalarField&, + const volScalarField&, + fvMatrix&, + const label + ); + + virtual void addSup + ( + const volScalarField&, + const volScalarField&, + fvMatrix&, + const label + ); + + virtual void addSup + ( + const volScalarField&, + const volScalarField&, + fvMatrix&, + const label + ); + + virtual void addSup + ( + const volScalarField&, + const volScalarField&, + fvMatrix&, + const label + ); + + virtual void addSup + ( + const volScalarField&, + const volScalarField&, + fvMatrix&, + const label + ); + + + // IO + + //- Read dictionary + virtual bool read(const dictionary& dict); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace fv +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/tutorials/compressible/rhoPimpleFoam/laminar/blockedChannel/0/T b/tutorials/compressible/rhoPimpleFoam/laminar/blockedChannel/0/T new file mode 100644 index 0000000000..2f4ac99d7d --- /dev/null +++ b/tutorials/compressible/rhoPimpleFoam/laminar/blockedChannel/0/T @@ -0,0 +1,44 @@ +/*--------------------------------*- C++ -*----------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Version: dev + \\/ M anipulation | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + location "0"; + object T; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 0 0 1 0 0 0]; + +internalField uniform 300; + +boundaryField +{ + inlet + { + type fixedValue; + value uniform 400; + } + outlet + { + type zeroGradient; + } + walls + { + type zeroGradient; + } + frontAndBack + { + type empty; + } +} + + +// ************************************************************************* // diff --git a/tutorials/compressible/rhoPimpleFoam/laminar/blockedChannel/0/T.solid b/tutorials/compressible/rhoPimpleFoam/laminar/blockedChannel/0/T.solid new file mode 100644 index 0000000000..63427c168f --- /dev/null +++ b/tutorials/compressible/rhoPimpleFoam/laminar/blockedChannel/0/T.solid @@ -0,0 +1,32 @@ +/*--------------------------------*- C++ -*----------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Version: dev + \\/ M anipulation | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + location "0"; + object T.solid; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 0 0 1 0 0 0]; + +internalField uniform 300; + +boundaryField +{ + ".*" + { + type calculated; + value $internalField; + } +} + + +// ************************************************************************* // diff --git a/tutorials/compressible/rhoPimpleFoam/laminar/blockedChannel/0/U b/tutorials/compressible/rhoPimpleFoam/laminar/blockedChannel/0/U new file mode 100644 index 0000000000..cd4edff067 --- /dev/null +++ b/tutorials/compressible/rhoPimpleFoam/laminar/blockedChannel/0/U @@ -0,0 +1,44 @@ +/*--------------------------------*- C++ -*----------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Version: dev + \\/ M anipulation | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volVectorField; + location "0"; + object U; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 1 -1 0 0 0 0]; + +internalField uniform (10 0 0); + +boundaryField +{ + inlet + { + type fixedValue; + value $internalField; + } + outlet + { + type zeroGradient; + } + walls + { + type noSlip; + } + frontAndBack + { + type empty; + } +} + + +// ************************************************************************* // diff --git a/tutorials/compressible/rhoPimpleFoam/laminar/blockedChannel/0/p b/tutorials/compressible/rhoPimpleFoam/laminar/blockedChannel/0/p new file mode 100644 index 0000000000..cb8eb9f79a --- /dev/null +++ b/tutorials/compressible/rhoPimpleFoam/laminar/blockedChannel/0/p @@ -0,0 +1,44 @@ +/*--------------------------------*- C++ -*----------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Version: dev + \\/ M anipulation | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + location "0"; + object p; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [1 -1 -2 0 0 0 0]; + +internalField uniform 1e5; + +boundaryField +{ + inlet + { + type zeroGradient; + } + outlet + { + type fixedValue; + value $internalField; + } + walls + { + type zeroGradient; + } + frontAndBack + { + type empty; + } +} + + +// ************************************************************************* // diff --git a/tutorials/compressible/rhoPimpleFoam/laminar/blockedChannel/0/tracer b/tutorials/compressible/rhoPimpleFoam/laminar/blockedChannel/0/tracer new file mode 100644 index 0000000000..50152ebdf0 --- /dev/null +++ b/tutorials/compressible/rhoPimpleFoam/laminar/blockedChannel/0/tracer @@ -0,0 +1,44 @@ +/*--------------------------------*- C++ -*----------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Version: dev + \\/ M anipulation | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + location "0"; + object tracer; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 0 0 0 0 0 0]; + +internalField uniform 0; + +boundaryField +{ + inlet + { + type fixedValue; + value uniform 1; + } + outlet + { + type zeroGradient; + } + walls + { + type zeroGradient; + } + frontAndBack + { + type empty; + } +} + + +// ************************************************************************* // diff --git a/tutorials/compressible/rhoPimpleFoam/laminar/blockedChannel/Allclean b/tutorials/compressible/rhoPimpleFoam/laminar/blockedChannel/Allclean new file mode 100755 index 0000000000..6b91855100 --- /dev/null +++ b/tutorials/compressible/rhoPimpleFoam/laminar/blockedChannel/Allclean @@ -0,0 +1,7 @@ +#!/bin/sh + +cd ${0%/*} || exit 1 + +. $WM_PROJECT_DIR/bin/tools/CleanFunctions + +cleanCase && rm -f constant/alpha.solid diff --git a/tutorials/compressible/rhoPimpleFoam/laminar/blockedChannel/Allrun b/tutorials/compressible/rhoPimpleFoam/laminar/blockedChannel/Allrun new file mode 100755 index 0000000000..346924a6a4 --- /dev/null +++ b/tutorials/compressible/rhoPimpleFoam/laminar/blockedChannel/Allrun @@ -0,0 +1,9 @@ +#!/bin/sh + +cd ${0%/*} || exit 1 + +. $WM_PROJECT_DIR/bin/tools/RunFunctions + +runApplication blockMesh +runApplication postProcess -func generateAlphaSolid +runApplication $(getApplication) diff --git a/tutorials/compressible/rhoPimpleFoam/laminar/blockedChannel/constant/thermophysicalProperties b/tutorials/compressible/rhoPimpleFoam/laminar/blockedChannel/constant/thermophysicalProperties new file mode 100644 index 0000000000..31a98aad01 --- /dev/null +++ b/tutorials/compressible/rhoPimpleFoam/laminar/blockedChannel/constant/thermophysicalProperties @@ -0,0 +1,49 @@ +/*--------------------------------*- C++ -*----------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Version: dev + \\/ M anipulation | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object thermophysicalProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +thermoType +{ + type hePsiThermo; + mixture pureMixture; + transport const; + thermo eConst; + equationOfState perfectGas; + specie specie; + energy sensibleInternalEnergy; +} + +mixture +{ + specie + { + molWeight 28.9; + } + thermodynamics + { + Cv 712; + Cp 1005; + Hf 0; + } + transport + { + mu 1.8e-05; + Pr 0.7; + } +} + + +// ************************************************************************* // diff --git a/tutorials/compressible/rhoPimpleFoam/laminar/blockedChannel/constant/thermophysicalProperties.solid b/tutorials/compressible/rhoPimpleFoam/laminar/blockedChannel/constant/thermophysicalProperties.solid new file mode 100644 index 0000000000..a306b8b1a6 --- /dev/null +++ b/tutorials/compressible/rhoPimpleFoam/laminar/blockedChannel/constant/thermophysicalProperties.solid @@ -0,0 +1,50 @@ +/*--------------------------------*- C++ -*----------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Version: dev + \\/ M anipulation | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object thermophysicalProperties.solid; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +thermoType +{ + type heSolidThermo; + mixture pureMixture; + transport constIso; + thermo hConst; + equationOfState rhoConst; + specie specie; + energy sensibleEnthalpy; +} + +mixture +{ + specie + { + molWeight 1; + } + equationOfState + { + rho 900; + } + thermodynamics + { + Hf 0; + Cp 1900; + } + transport + { + kappa 0.5; + } +} + +// ************************************************************************* // diff --git a/tutorials/compressible/rhoPimpleFoam/laminar/blockedChannel/constant/transportProperties b/tutorials/compressible/rhoPimpleFoam/laminar/blockedChannel/constant/transportProperties new file mode 100644 index 0000000000..ff270d42ff --- /dev/null +++ b/tutorials/compressible/rhoPimpleFoam/laminar/blockedChannel/constant/transportProperties @@ -0,0 +1,22 @@ +/*--------------------------------*- C++ -*----------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Version: dev + \\/ M anipulation | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object transportProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +transportModel Newtonian; + +nu [0 2 -1 0 0 0 0] 1e-05; + +// ************************************************************************* // diff --git a/tutorials/compressible/rhoPimpleFoam/laminar/blockedChannel/constant/turbulenceProperties b/tutorials/compressible/rhoPimpleFoam/laminar/blockedChannel/constant/turbulenceProperties new file mode 100644 index 0000000000..e61cb31334 --- /dev/null +++ b/tutorials/compressible/rhoPimpleFoam/laminar/blockedChannel/constant/turbulenceProperties @@ -0,0 +1,20 @@ +/*--------------------------------*- C++ -*----------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Version: dev + \\/ M anipulation | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object turbulenceProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +simulationType laminar; + +// ************************************************************************* // diff --git a/tutorials/compressible/rhoPimpleFoam/laminar/blockedChannel/system/blockMeshDict b/tutorials/compressible/rhoPimpleFoam/laminar/blockedChannel/system/blockMeshDict new file mode 100644 index 0000000000..f7ac8d6432 --- /dev/null +++ b/tutorials/compressible/rhoPimpleFoam/laminar/blockedChannel/system/blockMeshDict @@ -0,0 +1,111 @@ +/*--------------------------------*- C++ -*----------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Version: dev + \\/ M anipulation | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object blockMeshDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +convertToMeters 0.001; + +vertices +( + (0 -16 -1) (256 -16 -1) + (0 16 -1) (256 16 -1) + (0 -16 1) (256 -16 1) + (0 16 1) (256 16 1) + + (0 -52 -1) ( 32 -52 -1) (64 -44 -1) (128 -44 -1) (224 -52 -1) (256 -52 -1) + (0 -20 -1) ( 32 -20 -1) (64 -28 -1) (128 -28 -1) (224 -20 -1) (256 -20 -1) + (0 -52 1) ( 32 -52 1) (64 -44 1) (128 -44 1) (224 -52 1) (256 -52 1) + (0 -20 1) ( 32 -20 1) (64 -28 1) (128 -28 1) (224 -20 1) (256 -20 1) + + (0 -88 -1) (256 -88 -1) + (0 -56 -1) (256 -56 -1) + (0 -88 1) (256 -88 1) + (0 -56 1) (256 -56 1) +); + +blocks +( + hex (0 1 3 2 4 5 7 6) (256 32 1) simpleGrading (1 1 1) + + hex (8 9 15 14 20 21 27 26) (32 32 1) simpleGrading (1 1 1) + hex (9 10 16 15 21 22 28 27) (32 32 1) simpleGrading (1 1 1) + hex (10 11 17 16 22 23 29 28) (32 32 1) simpleGrading (1 1 1) + hex (11 12 18 17 23 24 30 29) (96 32 1) simpleGrading (1 1 1) + hex (12 13 19 18 24 25 31 30) (64 32 1) simpleGrading (1 1 1) + + hex (32 33 35 34 36 37 39 38) (256 32 1) simpleGrading (1 1 1) +); + +edges +( +); + +defaultPatch +{ + name frontAndBack; + type empty; +} + +boundary +( + inlet + { + type patch; + faces + ( + (0 2 6 4) + + (8 14 26 20) + + (32 34 38 36) + ); + } + outlet + { + type patch; + faces + ( + (1 3 7 5) + + (13 19 31 25) + + (33 35 39 37) + ); + } + walls + { + type wall; + faces + ( + (0 1 5 4) + (2 3 7 6) + + (8 9 21 20) + (9 10 22 21) + (10 11 23 22) + (11 12 24 23) + (12 13 25 24) + (14 15 27 26) + (15 16 28 27) + (16 17 29 28) + (17 18 30 29) + (18 19 31 30) + + (32 33 37 36) + (34 35 39 38) + ); + } +); + +// ************************************************************************* // diff --git a/tutorials/compressible/rhoPimpleFoam/laminar/blockedChannel/system/controlDict b/tutorials/compressible/rhoPimpleFoam/laminar/blockedChannel/system/controlDict new file mode 100644 index 0000000000..66d309a2bc --- /dev/null +++ b/tutorials/compressible/rhoPimpleFoam/laminar/blockedChannel/system/controlDict @@ -0,0 +1,57 @@ +/*--------------------------------*- C++ -*----------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Version: dev + \\/ M anipulation | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object controlDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +application rhoPimpleFoam; + +startFrom latestTime; + +startTime 0; + +stopAt endTime; + +endTime 0.03; + +deltaT 0.0001; + +writeControl adjustableRunTime; + +writeInterval 0.001; + +purgeWrite 0; + +writeFormat ascii; + +writePrecision 6; + +writeCompression off; + +timeFormat general; + +timePrecision 6; + +runTimeModifiable yes; + +adjustTimeStep yes; + +maxCo 5; + +functions +{ + #includeFunc scalarTransport +} + +// ************************************************************************* // diff --git a/tutorials/compressible/rhoPimpleFoam/laminar/blockedChannel/system/fvOptions b/tutorials/compressible/rhoPimpleFoam/laminar/blockedChannel/system/fvOptions new file mode 100644 index 0000000000..03b9934f3c --- /dev/null +++ b/tutorials/compressible/rhoPimpleFoam/laminar/blockedChannel/system/fvOptions @@ -0,0 +1,35 @@ +/*--------------------------------*- C++ -*----------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Version: dev + \\/ M anipulation | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object fvOptions; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +volumeFraction +{ + type volumeFractionSource; + phase solid; + phi phi; + rho rho; + U U; + fields (rho U e); +} + +solidEqulibriumEnergy +{ + type solidEqulibriumEnergySource; + phase solid; + field e; +} + +// ************************************************************************* // diff --git a/tutorials/compressible/rhoPimpleFoam/laminar/blockedChannel/system/fvSchemes b/tutorials/compressible/rhoPimpleFoam/laminar/blockedChannel/system/fvSchemes new file mode 100644 index 0000000000..9dd5473376 --- /dev/null +++ b/tutorials/compressible/rhoPimpleFoam/laminar/blockedChannel/system/fvSchemes @@ -0,0 +1,56 @@ +/*--------------------------------*- C++ -*----------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Version: dev + \\/ M anipulation | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object fvSchemes; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +ddtSchemes +{ + default Euler; +} + +gradSchemes +{ + default Gauss linear; + limited cellLimited Gauss linear 1; +} + +divSchemes +{ + default none; + div(phi,U) Gauss linearUpwind limited; + div(phi,e) Gauss linearUpwind limited; + div(phi,tracer) Gauss linearUpwind limited; + div(phi,K) Gauss linear; + div(phiv,p) Gauss linear; + div(((rho*nuEff)*dev2(T(grad(U))))) Gauss linear; +} + +laplacianSchemes +{ + default Gauss linear corrected; +} + +interpolationSchemes +{ + default linear; +} + +snGradSchemes +{ + default corrected; +} + + +// ************************************************************************* // diff --git a/tutorials/compressible/rhoPimpleFoam/laminar/blockedChannel/system/fvSolution b/tutorials/compressible/rhoPimpleFoam/laminar/blockedChannel/system/fvSolution new file mode 100644 index 0000000000..090367f00a --- /dev/null +++ b/tutorials/compressible/rhoPimpleFoam/laminar/blockedChannel/system/fvSolution @@ -0,0 +1,61 @@ +/*--------------------------------*- C++ -*----------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Version: dev + \\/ M anipulation | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object fvSolution; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +solvers +{ + "rho.*" + { + solver diagonal; + } + + p + { + solver GAMG; + smoother DICGaussSeidel; + tolerance 1e-7; + relTol 0.01; + } + + pFinal + { + $p; + relTol 0; + } + + "(U|e|tracer)" + { + solver PBiCGStab; + preconditioner DILU; + tolerance 1e-05; + relTol 0.1; + } + + "(U|e|tracer)Final" + { + $U; + relTol 0; + } +} + +PIMPLE +{ + nNonOrthogonalCorrectors 0; + nCorrectors 2; +} + + +// ************************************************************************* // diff --git a/tutorials/compressible/rhoPimpleFoam/laminar/blockedChannel/system/generateAlphaSolid b/tutorials/compressible/rhoPimpleFoam/laminar/blockedChannel/system/generateAlphaSolid new file mode 100644 index 0000000000..7ae0e2dae3 --- /dev/null +++ b/tutorials/compressible/rhoPimpleFoam/laminar/blockedChannel/system/generateAlphaSolid @@ -0,0 +1,49 @@ +/*--------------------------------*- C++ -*----------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Version: dev + \\/ M anipulation | +\*---------------------------------------------------------------------------*/ + +type coded; +libs ("libutilityFunctionObjects.so"); + +name generateAlphaSolid; + +codeWrite +#{ + const dimensionedVector dx(dimless/dimLength, vector(1, 0, 0)); + const dimensionedVector dy(dimless/dimLength, vector(0, 1, 0)); + + const volScalarField x(mesh().C() & dx), y(mesh().C() & dy); + + const scalar x0 = 0.032, x1 = 0.064, x2 = 0.128, x3 = 0.224; + const scalar y0 = -0.088, y1 = -0.056; + + volScalarField alpha + ( + IOobject + ( + IOobject::groupName("alpha", "solid"), + mesh().time().constant(), + mesh() + ), + mesh(), + dimless, + zeroGradientFvPatchScalarField::typeName + ); + + alpha = + 0.5 + *( + pos(x - x0)*pos(x1 - x)*(x - x0)/(x1 - x0) + + pos(x - x1)*pos(x2 - x) + + pos(x - x2)*pos(x3 - x)*(x3 - x)/(x3 - x2) + ) + *pos(y - y0)*pos(y1 - y); + + alpha.write(); +#}; + +// ************************************************************************* // diff --git a/tutorials/compressible/rhoPimpleFoam/laminar/blockedChannel/system/scalarTransport b/tutorials/compressible/rhoPimpleFoam/laminar/blockedChannel/system/scalarTransport new file mode 100644 index 0000000000..896ab3080c --- /dev/null +++ b/tutorials/compressible/rhoPimpleFoam/laminar/blockedChannel/system/scalarTransport @@ -0,0 +1,34 @@ +/*--------------------------------*- C++ -*----------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Version: dev + \\/ M anipulation | +------------------------------------------------------------------------------- +Description + Solves a transport equation for a scalar field. + + The name of the scalar field is specified in this file. A sample scalar + field file, that must be initialised for the case, typically in the 0 + directory, is available in $FOAM_ETC/caseDicts/solvers/scalarTransport. + +\*---------------------------------------------------------------------------*/ + +#includeEtc "caseDicts/postProcessing/solvers/scalarTransport/scalarTransport.cfg" + +field tracer; + +fvOptions +{ + volumeFraction + { + type volumeFractionSource; + phase solid; + phi phi; + rho rho; + U U; + fields (tracer); + } +} + +// ************************************************************************* // diff --git a/tutorials/incompressible/pimpleFoam/laminar/blockedChannel/0/U b/tutorials/incompressible/pimpleFoam/laminar/blockedChannel/0/U new file mode 100644 index 0000000000..cd4edff067 --- /dev/null +++ b/tutorials/incompressible/pimpleFoam/laminar/blockedChannel/0/U @@ -0,0 +1,44 @@ +/*--------------------------------*- C++ -*----------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Version: dev + \\/ M anipulation | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volVectorField; + location "0"; + object U; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 1 -1 0 0 0 0]; + +internalField uniform (10 0 0); + +boundaryField +{ + inlet + { + type fixedValue; + value $internalField; + } + outlet + { + type zeroGradient; + } + walls + { + type noSlip; + } + frontAndBack + { + type empty; + } +} + + +// ************************************************************************* // diff --git a/tutorials/incompressible/pimpleFoam/laminar/blockedChannel/0/p b/tutorials/incompressible/pimpleFoam/laminar/blockedChannel/0/p new file mode 100644 index 0000000000..0821ff258a --- /dev/null +++ b/tutorials/incompressible/pimpleFoam/laminar/blockedChannel/0/p @@ -0,0 +1,44 @@ +/*--------------------------------*- C++ -*----------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Version: dev + \\/ M anipulation | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + location "0"; + object p; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 2 -2 0 0 0 0]; + +internalField uniform 0; + +boundaryField +{ + inlet + { + type zeroGradient; + } + outlet + { + type fixedValue; + value $internalField; + } + walls + { + type zeroGradient; + } + frontAndBack + { + type empty; + } +} + + +// ************************************************************************* // diff --git a/tutorials/incompressible/pimpleFoam/laminar/blockedChannel/0/tracer b/tutorials/incompressible/pimpleFoam/laminar/blockedChannel/0/tracer new file mode 100644 index 0000000000..50152ebdf0 --- /dev/null +++ b/tutorials/incompressible/pimpleFoam/laminar/blockedChannel/0/tracer @@ -0,0 +1,44 @@ +/*--------------------------------*- C++ -*----------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Version: dev + \\/ M anipulation | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + location "0"; + object tracer; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 0 0 0 0 0 0]; + +internalField uniform 0; + +boundaryField +{ + inlet + { + type fixedValue; + value uniform 1; + } + outlet + { + type zeroGradient; + } + walls + { + type zeroGradient; + } + frontAndBack + { + type empty; + } +} + + +// ************************************************************************* // diff --git a/tutorials/incompressible/pimpleFoam/laminar/blockedChannel/Allclean b/tutorials/incompressible/pimpleFoam/laminar/blockedChannel/Allclean new file mode 100755 index 0000000000..6b91855100 --- /dev/null +++ b/tutorials/incompressible/pimpleFoam/laminar/blockedChannel/Allclean @@ -0,0 +1,7 @@ +#!/bin/sh + +cd ${0%/*} || exit 1 + +. $WM_PROJECT_DIR/bin/tools/CleanFunctions + +cleanCase && rm -f constant/alpha.solid diff --git a/tutorials/incompressible/pimpleFoam/laminar/blockedChannel/Allrun b/tutorials/incompressible/pimpleFoam/laminar/blockedChannel/Allrun new file mode 100755 index 0000000000..346924a6a4 --- /dev/null +++ b/tutorials/incompressible/pimpleFoam/laminar/blockedChannel/Allrun @@ -0,0 +1,9 @@ +#!/bin/sh + +cd ${0%/*} || exit 1 + +. $WM_PROJECT_DIR/bin/tools/RunFunctions + +runApplication blockMesh +runApplication postProcess -func generateAlphaSolid +runApplication $(getApplication) diff --git a/tutorials/incompressible/pimpleFoam/laminar/blockedChannel/constant/transportProperties b/tutorials/incompressible/pimpleFoam/laminar/blockedChannel/constant/transportProperties new file mode 100644 index 0000000000..ff270d42ff --- /dev/null +++ b/tutorials/incompressible/pimpleFoam/laminar/blockedChannel/constant/transportProperties @@ -0,0 +1,22 @@ +/*--------------------------------*- C++ -*----------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Version: dev + \\/ M anipulation | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object transportProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +transportModel Newtonian; + +nu [0 2 -1 0 0 0 0] 1e-05; + +// ************************************************************************* // diff --git a/tutorials/incompressible/pimpleFoam/laminar/blockedChannel/constant/turbulenceProperties b/tutorials/incompressible/pimpleFoam/laminar/blockedChannel/constant/turbulenceProperties new file mode 100644 index 0000000000..e61cb31334 --- /dev/null +++ b/tutorials/incompressible/pimpleFoam/laminar/blockedChannel/constant/turbulenceProperties @@ -0,0 +1,20 @@ +/*--------------------------------*- C++ -*----------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Version: dev + \\/ M anipulation | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object turbulenceProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +simulationType laminar; + +// ************************************************************************* // diff --git a/tutorials/incompressible/pimpleFoam/laminar/blockedChannel/system/blockMeshDict b/tutorials/incompressible/pimpleFoam/laminar/blockedChannel/system/blockMeshDict new file mode 100644 index 0000000000..f7ac8d6432 --- /dev/null +++ b/tutorials/incompressible/pimpleFoam/laminar/blockedChannel/system/blockMeshDict @@ -0,0 +1,111 @@ +/*--------------------------------*- C++ -*----------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Version: dev + \\/ M anipulation | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object blockMeshDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +convertToMeters 0.001; + +vertices +( + (0 -16 -1) (256 -16 -1) + (0 16 -1) (256 16 -1) + (0 -16 1) (256 -16 1) + (0 16 1) (256 16 1) + + (0 -52 -1) ( 32 -52 -1) (64 -44 -1) (128 -44 -1) (224 -52 -1) (256 -52 -1) + (0 -20 -1) ( 32 -20 -1) (64 -28 -1) (128 -28 -1) (224 -20 -1) (256 -20 -1) + (0 -52 1) ( 32 -52 1) (64 -44 1) (128 -44 1) (224 -52 1) (256 -52 1) + (0 -20 1) ( 32 -20 1) (64 -28 1) (128 -28 1) (224 -20 1) (256 -20 1) + + (0 -88 -1) (256 -88 -1) + (0 -56 -1) (256 -56 -1) + (0 -88 1) (256 -88 1) + (0 -56 1) (256 -56 1) +); + +blocks +( + hex (0 1 3 2 4 5 7 6) (256 32 1) simpleGrading (1 1 1) + + hex (8 9 15 14 20 21 27 26) (32 32 1) simpleGrading (1 1 1) + hex (9 10 16 15 21 22 28 27) (32 32 1) simpleGrading (1 1 1) + hex (10 11 17 16 22 23 29 28) (32 32 1) simpleGrading (1 1 1) + hex (11 12 18 17 23 24 30 29) (96 32 1) simpleGrading (1 1 1) + hex (12 13 19 18 24 25 31 30) (64 32 1) simpleGrading (1 1 1) + + hex (32 33 35 34 36 37 39 38) (256 32 1) simpleGrading (1 1 1) +); + +edges +( +); + +defaultPatch +{ + name frontAndBack; + type empty; +} + +boundary +( + inlet + { + type patch; + faces + ( + (0 2 6 4) + + (8 14 26 20) + + (32 34 38 36) + ); + } + outlet + { + type patch; + faces + ( + (1 3 7 5) + + (13 19 31 25) + + (33 35 39 37) + ); + } + walls + { + type wall; + faces + ( + (0 1 5 4) + (2 3 7 6) + + (8 9 21 20) + (9 10 22 21) + (10 11 23 22) + (11 12 24 23) + (12 13 25 24) + (14 15 27 26) + (15 16 28 27) + (16 17 29 28) + (17 18 30 29) + (18 19 31 30) + + (32 33 37 36) + (34 35 39 38) + ); + } +); + +// ************************************************************************* // diff --git a/tutorials/incompressible/pimpleFoam/laminar/blockedChannel/system/controlDict b/tutorials/incompressible/pimpleFoam/laminar/blockedChannel/system/controlDict new file mode 100644 index 0000000000..09c5f84038 --- /dev/null +++ b/tutorials/incompressible/pimpleFoam/laminar/blockedChannel/system/controlDict @@ -0,0 +1,57 @@ +/*--------------------------------*- C++ -*----------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Version: dev + \\/ M anipulation | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object controlDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +application pimpleFoam; + +startFrom latestTime; + +startTime 0; + +stopAt endTime; + +endTime 0.03; + +deltaT 0.0001; + +writeControl adjustableRunTime; + +writeInterval 0.001; + +purgeWrite 0; + +writeFormat ascii; + +writePrecision 6; + +writeCompression off; + +timeFormat general; + +timePrecision 6; + +runTimeModifiable yes; + +adjustTimeStep yes; + +maxCo 5; + +functions +{ + #includeFunc scalarTransport +} + +// ************************************************************************* // diff --git a/tutorials/incompressible/pimpleFoam/laminar/blockedChannel/system/fvOptions b/tutorials/incompressible/pimpleFoam/laminar/blockedChannel/system/fvOptions new file mode 100644 index 0000000000..2f21789776 --- /dev/null +++ b/tutorials/incompressible/pimpleFoam/laminar/blockedChannel/system/fvOptions @@ -0,0 +1,27 @@ +/*--------------------------------*- C++ -*----------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Version: dev + \\/ M anipulation | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object fvOptions; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +volumeFraction +{ + type volumeFractionSource; + phase solid; + phi phi; + U U; + fields (U); +} + +// ************************************************************************* // diff --git a/tutorials/incompressible/pimpleFoam/laminar/blockedChannel/system/fvSchemes b/tutorials/incompressible/pimpleFoam/laminar/blockedChannel/system/fvSchemes new file mode 100644 index 0000000000..a0ded8042d --- /dev/null +++ b/tutorials/incompressible/pimpleFoam/laminar/blockedChannel/system/fvSchemes @@ -0,0 +1,54 @@ +/*--------------------------------*- C++ -*----------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Version: dev + \\/ M anipulation | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object fvSchemes; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +ddtSchemes +{ + default Euler; +} + +gradSchemes +{ + default Gauss linear; + limited cellLimited Gauss linear 1; +} + +divSchemes +{ + default none; + + div(phi,U) Gauss linearUpwind limited; + div(phi,tracer) Gauss linearUpwind limited; + div((nuEff*dev2(T(grad(U))))) Gauss linear; +} + +laplacianSchemes +{ + default Gauss linear corrected; +} + +interpolationSchemes +{ + default linear; +} + +snGradSchemes +{ + default corrected; +} + + +// ************************************************************************* // diff --git a/tutorials/incompressible/pimpleFoam/laminar/blockedChannel/system/fvSolution b/tutorials/incompressible/pimpleFoam/laminar/blockedChannel/system/fvSolution new file mode 100644 index 0000000000..3cdb03afd7 --- /dev/null +++ b/tutorials/incompressible/pimpleFoam/laminar/blockedChannel/system/fvSolution @@ -0,0 +1,56 @@ +/*--------------------------------*- C++ -*----------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Version: dev + \\/ M anipulation | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object fvSolution; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +solvers +{ + p + { + solver GAMG; + smoother DICGaussSeidel; + tolerance 1e-7; + relTol 0.01; + } + + pFinal + { + $p; + relTol 0; + } + + "(U|tracer)" + { + solver PBiCGStab; + preconditioner DILU; + tolerance 1e-05; + relTol 0.1; + } + + "(U|tracer)Final" + { + $U; + relTol 0; + } +} + +PIMPLE +{ + nNonOrthogonalCorrectors 0; + nCorrectors 2; +} + + +// ************************************************************************* // diff --git a/tutorials/incompressible/pimpleFoam/laminar/blockedChannel/system/generateAlphaSolid b/tutorials/incompressible/pimpleFoam/laminar/blockedChannel/system/generateAlphaSolid new file mode 100644 index 0000000000..7ae0e2dae3 --- /dev/null +++ b/tutorials/incompressible/pimpleFoam/laminar/blockedChannel/system/generateAlphaSolid @@ -0,0 +1,49 @@ +/*--------------------------------*- C++ -*----------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Version: dev + \\/ M anipulation | +\*---------------------------------------------------------------------------*/ + +type coded; +libs ("libutilityFunctionObjects.so"); + +name generateAlphaSolid; + +codeWrite +#{ + const dimensionedVector dx(dimless/dimLength, vector(1, 0, 0)); + const dimensionedVector dy(dimless/dimLength, vector(0, 1, 0)); + + const volScalarField x(mesh().C() & dx), y(mesh().C() & dy); + + const scalar x0 = 0.032, x1 = 0.064, x2 = 0.128, x3 = 0.224; + const scalar y0 = -0.088, y1 = -0.056; + + volScalarField alpha + ( + IOobject + ( + IOobject::groupName("alpha", "solid"), + mesh().time().constant(), + mesh() + ), + mesh(), + dimless, + zeroGradientFvPatchScalarField::typeName + ); + + alpha = + 0.5 + *( + pos(x - x0)*pos(x1 - x)*(x - x0)/(x1 - x0) + + pos(x - x1)*pos(x2 - x) + + pos(x - x2)*pos(x3 - x)*(x3 - x)/(x3 - x2) + ) + *pos(y - y0)*pos(y1 - y); + + alpha.write(); +#}; + +// ************************************************************************* // diff --git a/tutorials/incompressible/pimpleFoam/laminar/blockedChannel/system/scalarTransport b/tutorials/incompressible/pimpleFoam/laminar/blockedChannel/system/scalarTransport new file mode 100644 index 0000000000..e3756aab92 --- /dev/null +++ b/tutorials/incompressible/pimpleFoam/laminar/blockedChannel/system/scalarTransport @@ -0,0 +1,33 @@ +/*--------------------------------*- C++ -*----------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Version: dev + \\/ M anipulation | +------------------------------------------------------------------------------- +Description + Solves a transport equation for a scalar field. + + The name of the scalar field is specified in this file. A sample scalar + field file, that must be initialised for the case, typically in the 0 + directory, is available in $FOAM_ETC/caseDicts/solvers/scalarTransport. + +\*---------------------------------------------------------------------------*/ + +#includeEtc "caseDicts/postProcessing/solvers/scalarTransport/scalarTransport.cfg" + +field tracer; + +fvOptions +{ + volumeFraction + { + type volumeFractionSource; + phase solid; + phi phi; + U U; + fields (tracer); + } +} + +// ************************************************************************* //