Skip to content
Permalink
Browse files

fvOptions: New buoyancyForce and buoyancyEnergy

Provides run-time selection of buoyancy sources for compressible solvers

Replaces the built-in buoyancy sources in XiFoam, reactingFoam and
rhoReactingFoam.

e.g. in constant/fvOptions specify

momentumSource
{
    type            buoyancyForce;

    buoyancyForceCoeffs
    {
        fieldNames      (U);
    }
}

and optionally specify the buoyancy energy source in the enthalpy
equation:

energySource
{
    type            buoyancyEnergy;

    buoyancyEnergyCoeffs
    {
        fieldNames      (h);
    }
}

or internal energy equation

energySource
{
    type            buoyancyEnergy;

    buoyancyEnergyCoeffs
    {
        fieldNames      (e);
    }
}
  • Loading branch information...
Henry Weller
Henry Weller committed Nov 23, 2015
1 parent 151e1fa commit 56913f6307cbb9cdbfe8eb0145813fada74e2194
@@ -6,8 +6,7 @@
+ MRF.DDt(rho, U)
+ turbulence->divDevRhoReff(U)
==
rho*g
+ fvOptions(rho, U)
fvOptions(rho, U)
);

UEqn.relax();
@@ -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"
@@ -17,8 +17,7 @@
)
- fvm::laplacian(turbulence->alphaEff(), he)
==
rho*(U&g)
+ reaction->Sh()
reaction->Sh()
+ fvOptions(rho, he)
);

@@ -8,8 +8,7 @@ tmp<fvVectorMatrix> UEqn
+ MRF.DDt(rho, U)
+ turbulence->divDevRhoReff(U)
==
rho*g
+ fvOptions(rho, U)
fvOptions(rho, U)
);

UEqn().relax();
@@ -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"
@@ -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"
@@ -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
@@ -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 <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/

#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<word>("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<scalar>& eqn,
const label fieldI
)
{
const uniformDimensionedVectorField& g =
mesh_.lookupObject<uniformDimensionedVectorField>("g");

const volVectorField& U = mesh_.lookupObject<volVectorField>(UName_);

eqn += rho*(U&g);
}


// ************************************************************************* //
@@ -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 <http://www.gnu.org/licenses/>.
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<scalar>& eqn,
const label fieldI
);


// IO

//- Read source dictionary
virtual bool read(const dictionary& dict);
};


// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

} // End namespace fv
} // End namespace Foam

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

#endif

// ************************************************************************* //
@@ -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 <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/

#include "buoyancyEnergy.H"

// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //

bool Foam::fv::buoyancyEnergy::read(const dictionary& dict)
{
NotImplemented;

return false;
}


// ************************************************************************* //

0 comments on commit 56913f6

Please sign in to comment.
You can’t perform that action at this time.