diff --git a/applications/solvers/combustion/XiFoam/UEqn.H b/applications/solvers/combustion/XiFoam/UEqn.H index f493177d76..59e51b370b 100644 --- a/applications/solvers/combustion/XiFoam/UEqn.H +++ b/applications/solvers/combustion/XiFoam/UEqn.H @@ -6,8 +6,7 @@ + MRF.DDt(rho, U) + turbulence->divDevRhoReff(U) == - rho*g - + fvOptions(rho, U) + fvOptions(rho, U) ); UEqn.relax(); diff --git a/applications/solvers/combustion/XiFoam/XiFoam.C b/applications/solvers/combustion/XiFoam/XiFoam.C index 6090f923ca..c216e76be3 100644 --- a/applications/solvers/combustion/XiFoam/XiFoam.C +++ b/applications/solvers/combustion/XiFoam/XiFoam.C @@ -70,7 +70,6 @@ int main(int argc, char *argv[]) pimpleControl pimple(mesh); #include "readCombustionProperties.H" - #include "readGravitationalAcceleration.H" #include "createFields.H" #include "createMRF.H" #include "createFvOptions.H" diff --git a/applications/solvers/combustion/reactingFoam/EEqn.H b/applications/solvers/combustion/reactingFoam/EEqn.H index bd47416425..9267c9a9be 100644 --- a/applications/solvers/combustion/reactingFoam/EEqn.H +++ b/applications/solvers/combustion/reactingFoam/EEqn.H @@ -17,8 +17,7 @@ ) - fvm::laplacian(turbulence->alphaEff(), he) == - rho*(U&g) - + reaction->Sh() + reaction->Sh() + fvOptions(rho, he) ); diff --git a/applications/solvers/combustion/reactingFoam/UEqn.H b/applications/solvers/combustion/reactingFoam/UEqn.H index 1704ce4ab9..907c9934e2 100644 --- a/applications/solvers/combustion/reactingFoam/UEqn.H +++ b/applications/solvers/combustion/reactingFoam/UEqn.H @@ -8,8 +8,7 @@ tmp UEqn + MRF.DDt(rho, U) + turbulence->divDevRhoReff(U) == - rho*g - + fvOptions(rho, U) + fvOptions(rho, U) ); UEqn().relax(); diff --git a/applications/solvers/combustion/reactingFoam/reactingFoam.C b/applications/solvers/combustion/reactingFoam/reactingFoam.C index 5ad452b52b..8bc61a6f10 100644 --- a/applications/solvers/combustion/reactingFoam/reactingFoam.C +++ b/applications/solvers/combustion/reactingFoam/reactingFoam.C @@ -51,7 +51,6 @@ int main(int argc, char *argv[]) #include "createTimeControls.H" #include "createRDeltaT.H" #include "initContinuityErrs.H" - #include "readGravitationalAcceleration.H" #include "createFields.H" #include "createMRF.H" #include "createFvOptions.H" diff --git a/applications/solvers/combustion/reactingFoam/rhoReactingFoam/rhoReactingFoam.C b/applications/solvers/combustion/reactingFoam/rhoReactingFoam/rhoReactingFoam.C index 6eb245028d..1691c719ac 100644 --- a/applications/solvers/combustion/reactingFoam/rhoReactingFoam/rhoReactingFoam.C +++ b/applications/solvers/combustion/reactingFoam/rhoReactingFoam/rhoReactingFoam.C @@ -52,7 +52,6 @@ int main(int argc, char *argv[]) #include "createTimeControls.H" #include "createRDeltaT.H" #include "initContinuityErrs.H" - #include "readGravitationalAcceleration.H" #include "createFields.H" #include "createMRF.H" #include "createFvOptions.H" diff --git a/src/fvOptions/Make/files b/src/fvOptions/Make/files index ff2f45032b..70347d182a 100644 --- a/src/fvOptions/Make/files +++ b/src/fvOptions/Make/files @@ -38,7 +38,10 @@ $(derivedSources)/solidificationMeltingSource/solidificationMeltingSource.C $(derivedSources)/solidificationMeltingSource/solidificationMeltingSourceIO.C $(derivedSources)/tabulatedAccelerationSource/tabulatedAccelerationSource.C $(derivedSources)/tabulatedAccelerationSource/tabulated6DoFAcceleration/tabulated6DoFAcceleration.C - +$(derivedSources)/buoyancyForce/buoyancyForce.C +$(derivedSources)/buoyancyForce/buoyancyForceIO.C +$(derivedSources)/buoyancyEnergy/buoyancyEnergy.C +$(derivedSources)/buoyancyEnergy/buoyancyEnergyIO.C interRegion = sources/interRegion $(interRegion)/interRegionHeatTransfer/interRegionHeatTransferModel/interRegionHeatTransferModel.C diff --git a/src/fvOptions/sources/derived/buoyancyEnergy/buoyancyEnergy.C b/src/fvOptions/sources/derived/buoyancyEnergy/buoyancyEnergy.C new file mode 100644 index 0000000000..70238da9b7 --- /dev/null +++ b/src/fvOptions/sources/derived/buoyancyEnergy/buoyancyEnergy.C @@ -0,0 +1,91 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2015 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 "buoyancyEnergy.H" +#include "fvMatrices.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * // + +namespace Foam +{ +namespace fv +{ + defineTypeNameAndDebug(buoyancyEnergy, 0); + + addToRunTimeSelectionTable + ( + option, + buoyancyEnergy, + dictionary + ); +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::fv::buoyancyEnergy::buoyancyEnergy +( + const word& sourceName, + const word& modelType, + const dictionary& dict, + const fvMesh& mesh +) +: + option(sourceName, modelType, dict, mesh), + UName_(coeffs_.lookupOrDefault("UName", "U")) +{ + coeffs_.lookup("fieldNames") >> fieldNames_; + + if (fieldNames_.size() != 1) + { + FatalErrorInFunction + << "settings are:" << fieldNames_ << exit(FatalError); + } + + applied_.setSize(fieldNames_.size(), false); +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::fv::buoyancyEnergy::addSup +( + const volScalarField& rho, + fvMatrix& eqn, + const label fieldI +) +{ + const uniformDimensionedVectorField& g = + mesh_.lookupObject("g"); + + const volVectorField& U = mesh_.lookupObject(UName_); + + eqn += rho*(U&g); +} + + +// ************************************************************************* // diff --git a/src/fvOptions/sources/derived/buoyancyEnergy/buoyancyEnergy.H b/src/fvOptions/sources/derived/buoyancyEnergy/buoyancyEnergy.H new file mode 100644 index 0000000000..7c59a950ac --- /dev/null +++ b/src/fvOptions/sources/derived/buoyancyEnergy/buoyancyEnergy.H @@ -0,0 +1,128 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2015 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::buoyancyEnergy + +Description + Calculates and applies the buoyancy energy source rho*(U&g) to the energy + equation. + + \heading Source usage + Example usage: + \verbatim + buoyancyEnergyCoeffs + { + fieldNames (h); // Name of energy field + } + \endverbatim + +SourceFiles + buoyancyEnergy.C + +\*---------------------------------------------------------------------------*/ + +#ifndef buoyancyEnergy_H +#define buoyancyEnergy_H + +#include "fvOption.H" +#include "uniformDimensionedFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace fv +{ + +/*---------------------------------------------------------------------------*\ + Class buoyancyEnergy Declaration +\*---------------------------------------------------------------------------*/ + +class buoyancyEnergy +: + public option +{ + // Private data + + //- Name of velocity field; default = U + word UName_; + + + // Private Member Functions + + //- Disallow default bitwise copy construct + buoyancyEnergy(const buoyancyEnergy&); + + //- Disallow default bitwise assignment + void operator=(const buoyancyEnergy&); + + +public: + + //- Runtime type information + TypeName("buoyancyEnergy"); + + + // Constructors + + //- Construct from explicit source name and mesh + buoyancyEnergy + ( + const word& sourceName, + const word& modelType, + const dictionary& dict, + const fvMesh& mesh + ); + + + // Member Functions + + // Evaluate + + //- Add explicit contribution to compressible momentum equation + virtual void addSup + ( + const volScalarField& rho, + fvMatrix& eqn, + const label fieldI + ); + + + // IO + + //- Read source dictionary + virtual bool read(const dictionary& dict); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace fv +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/fvOptions/sources/derived/buoyancyEnergy/buoyancyEnergyIO.C b/src/fvOptions/sources/derived/buoyancyEnergy/buoyancyEnergyIO.C new file mode 100644 index 0000000000..c5c25d64e2 --- /dev/null +++ b/src/fvOptions/sources/derived/buoyancyEnergy/buoyancyEnergyIO.C @@ -0,0 +1,38 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2015 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 "buoyancyEnergy.H" + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +bool Foam::fv::buoyancyEnergy::read(const dictionary& dict) +{ + NotImplemented; + + return false; +} + + +// ************************************************************************* // diff --git a/src/fvOptions/sources/derived/buoyancyForce/buoyancyForce.C b/src/fvOptions/sources/derived/buoyancyForce/buoyancyForce.C new file mode 100644 index 0000000000..63a0195e40 --- /dev/null +++ b/src/fvOptions/sources/derived/buoyancyForce/buoyancyForce.C @@ -0,0 +1,96 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2015 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 "buoyancyForce.H" +#include "fvMatrices.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * // + +namespace Foam +{ +namespace fv +{ + defineTypeNameAndDebug(buoyancyForce, 0); + + addToRunTimeSelectionTable + ( + option, + buoyancyForce, + dictionary + ); +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::fv::buoyancyForce::buoyancyForce +( + const word& sourceName, + const word& modelType, + const dictionary& dict, + const fvMesh& mesh +) +: + option(sourceName, modelType, dict, mesh), + g_ + ( + IOobject + ( + "g", + mesh.time().constant(), + mesh, + IOobject::MUST_READ, + IOobject::NO_WRITE + ) + ) +{ + coeffs_.lookup("fieldNames") >> fieldNames_; + + if (fieldNames_.size() != 1) + { + FatalErrorInFunction + << "settings are:" << fieldNames_ << exit(FatalError); + } + + applied_.setSize(fieldNames_.size(), false); +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::fv::buoyancyForce::addSup +( + const volScalarField& rho, + fvMatrix& eqn, + const label fieldI +) +{ + eqn += rho*g_; +} + + +// ************************************************************************* // diff --git a/src/fvOptions/sources/derived/buoyancyForce/buoyancyForce.H b/src/fvOptions/sources/derived/buoyancyForce/buoyancyForce.H new file mode 100644 index 0000000000..a1ac3cc2ad --- /dev/null +++ b/src/fvOptions/sources/derived/buoyancyForce/buoyancyForce.H @@ -0,0 +1,127 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2015 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::buoyancyForce + +Description + Calculates and applies the buoyancy force rho*g to the momentum equation + corresponding to the specified velocity field. + + \heading Source usage + Example usage: + \verbatim + buoyancyForceCoeffs + { + fieldNames (U); // Name of velocity field + } + \endverbatim + +SourceFiles + buoyancyForce.C + +\*---------------------------------------------------------------------------*/ + +#ifndef buoyancyForce_H +#define buoyancyForce_H + +#include "fvOption.H" +#include "uniformDimensionedFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace fv +{ + +/*---------------------------------------------------------------------------*\ + Class buoyancyForce Declaration +\*---------------------------------------------------------------------------*/ + +class buoyancyForce +: + public option +{ + // Private data + + uniformDimensionedVectorField g_; + + + // Private Member Functions + + //- Disallow default bitwise copy construct + buoyancyForce(const buoyancyForce&); + + //- Disallow default bitwise assignment + void operator=(const buoyancyForce&); + + +public: + + //- Runtime type information + TypeName("buoyancyForce"); + + + // Constructors + + //- Construct from explicit source name and mesh + buoyancyForce + ( + const word& sourceName, + const word& modelType, + const dictionary& dict, + const fvMesh& mesh + ); + + + // Member Functions + + // Evaluate + + //- Add explicit contribution to compressible momentum equation + virtual void addSup + ( + const volScalarField& rho, + fvMatrix& eqn, + const label fieldI + ); + + + // IO + + //- Read source dictionary + virtual bool read(const dictionary& dict); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace fv +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/fvOptions/sources/derived/buoyancyForce/buoyancyForceIO.C b/src/fvOptions/sources/derived/buoyancyForce/buoyancyForceIO.C new file mode 100644 index 0000000000..223d42cfa1 --- /dev/null +++ b/src/fvOptions/sources/derived/buoyancyForce/buoyancyForceIO.C @@ -0,0 +1,38 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2015 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 "buoyancyForce.H" + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +bool Foam::fv::buoyancyForce::read(const dictionary& dict) +{ + NotImplemented; + + return false; +} + + +// ************************************************************************* // diff --git a/tutorials/combustion/XiFoam/ras/moriyoshiHomogeneous/constant/g b/tutorials/combustion/XiFoam/ras/moriyoshiHomogeneous/constant/g deleted file mode 100644 index 508d658494..0000000000 --- a/tutorials/combustion/XiFoam/ras/moriyoshiHomogeneous/constant/g +++ /dev/null @@ -1,22 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: dev | -| \\ / A nd | Web: www.OpenFOAM.org | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - format ascii; - class uniformDimensionedVectorField; - location "constant"; - object g; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -dimensions [0 1 -2 0 0 0 0]; -value (0 0 0); - - -// ************************************************************************* // diff --git a/tutorials/combustion/engineFoam/kivaTest/constant/g b/tutorials/combustion/engineFoam/kivaTest/constant/g deleted file mode 100644 index 508d658494..0000000000 --- a/tutorials/combustion/engineFoam/kivaTest/constant/g +++ /dev/null @@ -1,22 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: dev | -| \\ / A nd | Web: www.OpenFOAM.org | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - format ascii; - class uniformDimensionedVectorField; - location "constant"; - object g; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -dimensions [0 1 -2 0 0 0 0]; -value (0 0 0); - - -// ************************************************************************* // diff --git a/tutorials/combustion/reactingFoam/ras/counterFlowFlame2D/constant/g b/tutorials/combustion/reactingFoam/ras/counterFlowFlame2D/constant/g deleted file mode 100644 index 508d658494..0000000000 --- a/tutorials/combustion/reactingFoam/ras/counterFlowFlame2D/constant/g +++ /dev/null @@ -1,22 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: dev | -| \\ / A nd | Web: www.OpenFOAM.org | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - format ascii; - class uniformDimensionedVectorField; - location "constant"; - object g; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -dimensions [0 1 -2 0 0 0 0]; -value (0 0 0); - - -// ************************************************************************* // diff --git a/tutorials/combustion/reactingFoam/ras/counterFlowFlame2DLTS/constant/g b/tutorials/combustion/reactingFoam/ras/counterFlowFlame2DLTS/constant/g deleted file mode 100644 index 508d658494..0000000000 --- a/tutorials/combustion/reactingFoam/ras/counterFlowFlame2DLTS/constant/g +++ /dev/null @@ -1,22 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: dev | -| \\ / A nd | Web: www.OpenFOAM.org | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - format ascii; - class uniformDimensionedVectorField; - location "constant"; - object g; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -dimensions [0 1 -2 0 0 0 0]; -value (0 0 0); - - -// ************************************************************************* //