mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'master' of /home/dm4/OpenFOAM/OpenFOAM-dev
This commit is contained in:
@ -3,13 +3,17 @@ basicSource/basicSourceIO.C
|
||||
basicSource/basicSourceList.C
|
||||
basicSource/IObasicSourceList.C
|
||||
|
||||
general/semiImplicitSource/semiImplicitSource.C
|
||||
general/explicitSetValue/explicitSetValue.C
|
||||
general/codedSource/codedSource.C
|
||||
general/explicitSetValue/explicitSetValue.C
|
||||
general/semiImplicitSource/semiImplicitSource.C
|
||||
|
||||
derived/actuationDiskSource/actuationDiskSource.C
|
||||
derived/explicitPorositySource/explicitPorositySource.C
|
||||
derived/fixedTemperatureSource/fixedTemperatureSource.C
|
||||
derived/MRFSource/MRFSource.C
|
||||
derived/pressureGradientExplicitSource/pressureGradientExplicitSource.C
|
||||
derived/pressureGradientExplicitSource/pressureGradientExplicitSourceIO.C
|
||||
|
||||
derived/radialActuationDiskSource/radialActuationDiskSource.C
|
||||
derived/rotorDiskSource/rotorDiskSource.C
|
||||
derived/rotorDiskSource/bladeModel/bladeModel.C
|
||||
derived/rotorDiskSource/profileModel/profileModel.C
|
||||
@ -21,15 +25,11 @@ derived/rotorDiskSource/trimModel/trimModel/trimModelNew.C
|
||||
derived/rotorDiskSource/trimModel/fixed/fixedTrim.C
|
||||
derived/rotorDiskSource/trimModel/targetCoeff/targetCoeffTrim.C
|
||||
|
||||
derived/actuationDiskSource/actuationDiskSource.C
|
||||
derived/radialActuationDiskSource/radialActuationDiskSource.C
|
||||
|
||||
interRegion = derived/interRegionHeatTransferModel
|
||||
$(interRegion)/interRegionHeatTransferModel/interRegionHeatTransferModel.C
|
||||
$(interRegion)/constantHeatTransfer/constantHeatTransfer.C
|
||||
$(interRegion)/interRegionHeatTransferModel/interRegionHeatTransferModel.C
|
||||
$(interRegion)/tabulatedHeatTransfer/tabulatedHeatTransfer.C
|
||||
$(interRegion)/variableHeatTransfer/variableHeatTransfer.C
|
||||
|
||||
derived/fixedTemperatureSource/fixedTemperatureSource.C
|
||||
|
||||
LIB = $(FOAM_LIBBIN)/libfieldSources
|
||||
|
||||
@ -481,4 +481,36 @@ void Foam::basicSource::setValue(fvMatrix<tensor>& eqn, const label fieldI)
|
||||
}
|
||||
|
||||
|
||||
void Foam::basicSource::relativeFlux(surfaceScalarField& phi) const
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
|
||||
|
||||
void Foam::basicSource::relativeFlux
|
||||
(
|
||||
const surfaceScalarField& rho,
|
||||
surfaceScalarField& phi
|
||||
) const
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
|
||||
|
||||
void Foam::basicSource::absoluteFlux(surfaceScalarField& phi) const
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
|
||||
|
||||
void Foam::basicSource::absoluteFlux
|
||||
(
|
||||
const surfaceScalarField& rho,
|
||||
surfaceScalarField& phi
|
||||
) const
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -427,6 +427,29 @@ public:
|
||||
);
|
||||
|
||||
|
||||
// Flux manipulations
|
||||
|
||||
//- Make the given absolute flux relative
|
||||
virtual void relativeFlux(surfaceScalarField& phi) const;
|
||||
|
||||
//- Make the given absolute mass-flux relative
|
||||
virtual void relativeFlux
|
||||
(
|
||||
const surfaceScalarField& rho,
|
||||
surfaceScalarField& phi
|
||||
) const;
|
||||
|
||||
//- Make the given relative flux absolute
|
||||
virtual void absoluteFlux(surfaceScalarField& phi) const;
|
||||
|
||||
//- Make the given relative mass-flux absolute
|
||||
virtual void absoluteFlux
|
||||
(
|
||||
const surfaceScalarField& rho,
|
||||
surfaceScalarField& phi
|
||||
) const;
|
||||
|
||||
|
||||
// I-O
|
||||
|
||||
//- Write the source header information
|
||||
|
||||
@ -108,6 +108,50 @@ void Foam::basicSourceList::reset(const dictionary& dict)
|
||||
}
|
||||
|
||||
|
||||
void Foam::basicSourceList::relativeFlux(surfaceScalarField& phi) const
|
||||
{
|
||||
forAll(*this, i)
|
||||
{
|
||||
this->operator[](i).relativeFlux(phi);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::basicSourceList::relativeFlux
|
||||
(
|
||||
const surfaceScalarField& rho,
|
||||
surfaceScalarField& phi
|
||||
) const
|
||||
{
|
||||
forAll(*this, i)
|
||||
{
|
||||
this->operator[](i).relativeFlux(rho, phi);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::basicSourceList::absoluteFlux(surfaceScalarField& phi) const
|
||||
{
|
||||
forAll(*this, i)
|
||||
{
|
||||
this->operator[](i).absoluteFlux(phi);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::basicSourceList::absoluteFlux
|
||||
(
|
||||
const surfaceScalarField& rho,
|
||||
surfaceScalarField& phi
|
||||
) const
|
||||
{
|
||||
forAll(*this, i)
|
||||
{
|
||||
this->operator[](i).absoluteFlux(rho, phi);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool Foam::basicSourceList::read(const dictionary& dict)
|
||||
{
|
||||
checkTimeIndex_ = mesh_.time().timeIndex() + 2;
|
||||
|
||||
@ -152,6 +152,29 @@ public:
|
||||
void constrain(fvMatrix<Type>& eqn, const word& fieldName);
|
||||
|
||||
|
||||
// Flux manipulations
|
||||
|
||||
//- Make the given absolute flux relative
|
||||
void relativeFlux(surfaceScalarField& phi) const;
|
||||
|
||||
//- Make the given absolute mass-flux relative
|
||||
void relativeFlux
|
||||
(
|
||||
const surfaceScalarField& rho,
|
||||
surfaceScalarField& phi
|
||||
) const;
|
||||
|
||||
//- Make the given relative flux absolute
|
||||
void absoluteFlux(surfaceScalarField& phi) const;
|
||||
|
||||
//- Make the given relative mass-flux absolute
|
||||
void absoluteFlux
|
||||
(
|
||||
const surfaceScalarField& rho,
|
||||
surfaceScalarField& phi
|
||||
) const;
|
||||
|
||||
|
||||
// I-O
|
||||
|
||||
//- Read dictionary
|
||||
|
||||
176
src/fieldSources/derived/MRFSource/MRFSource.C
Normal file
176
src/fieldSources/derived/MRFSource/MRFSource.C
Normal file
@ -0,0 +1,176 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*----------------------------------------------------------------------------*/
|
||||
|
||||
#include "MRFSource.H"
|
||||
#include "fvMesh.H"
|
||||
#include "fvMatrices.H"
|
||||
#include "MRFZone.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(MRFSource, 0);
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
basicSource,
|
||||
MRFSource,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
|
||||
|
||||
void Foam::MRFSource::initialise()
|
||||
{
|
||||
if (selectionMode_ != smCellZone)
|
||||
{
|
||||
FatalErrorIn("void Foam::MRFSource::initialise()")
|
||||
<< "The porosity region must be specified as a cellZone. Current "
|
||||
<< "selection mode is " << selectionModeTypeNames_[selectionMode_]
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
mrfPtr_.reset
|
||||
(
|
||||
new MRFZone
|
||||
(
|
||||
name_,
|
||||
mesh_,
|
||||
coeffs_,
|
||||
cellSetName_
|
||||
)
|
||||
);
|
||||
|
||||
const volVectorField& U = mesh_.lookupObject<volVectorField>(UName_);
|
||||
|
||||
mrfPtr_->correctBoundaryVelocity(const_cast<volVectorField&>(U));
|
||||
|
||||
fieldNames_.setSize(1, UName_);
|
||||
applied_.setSize(1, false);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::MRFSource::MRFSource
|
||||
(
|
||||
const word& name,
|
||||
const word& modelType,
|
||||
const dictionary& dict,
|
||||
const fvMesh& mesh
|
||||
)
|
||||
:
|
||||
basicSource(name, modelType, dict, mesh),
|
||||
mrfPtr_(NULL),
|
||||
UName_(coeffs_.lookupOrDefault<word>("UName", "U")),
|
||||
rhoName_(coeffs_.lookupOrDefault<word>("rhoName", "rho"))
|
||||
{
|
||||
initialise();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::MRFSource::addSup
|
||||
(
|
||||
fvMatrix<vector>& eqn,
|
||||
const label fieldI
|
||||
)
|
||||
{
|
||||
if (eqn.dimensions() == dimForce)
|
||||
{
|
||||
const volScalarField& rho =
|
||||
mesh_.lookupObject<volScalarField>(rhoName_);
|
||||
|
||||
// use 'true' flag to add to rhs of equation
|
||||
mrfPtr_->addCoriolis(rho, eqn, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
// use 'true' flag to add to rhs of equation
|
||||
mrfPtr_->addCoriolis(eqn, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::MRFSource::relativeFlux(surfaceScalarField& phi) const
|
||||
{
|
||||
mrfPtr_->relativeFlux(phi);
|
||||
}
|
||||
|
||||
|
||||
void Foam::MRFSource::relativeFlux
|
||||
(
|
||||
const surfaceScalarField& rho,
|
||||
surfaceScalarField& phi
|
||||
) const
|
||||
{
|
||||
mrfPtr_->relativeFlux(rho, phi);
|
||||
}
|
||||
|
||||
|
||||
void Foam::MRFSource::absoluteFlux(surfaceScalarField& phi) const
|
||||
{
|
||||
mrfPtr_->absoluteFlux(phi);
|
||||
}
|
||||
|
||||
|
||||
void Foam::MRFSource::absoluteFlux
|
||||
(
|
||||
const surfaceScalarField& rho,
|
||||
surfaceScalarField& phi
|
||||
) const
|
||||
{
|
||||
mrfPtr_->absoluteFlux(rho, phi);
|
||||
}
|
||||
|
||||
|
||||
void Foam::MRFSource::writeData(Ostream& os) const
|
||||
{
|
||||
os << indent << name_ << endl;
|
||||
dict_.write(os);
|
||||
}
|
||||
|
||||
|
||||
bool Foam::MRFSource::read(const dictionary& dict)
|
||||
{
|
||||
if (basicSource::read(dict))
|
||||
{
|
||||
coeffs_.readIfPresent("UName", UName_);
|
||||
coeffs_.readIfPresent("rhoName", rhoName_);
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
173
src/fieldSources/derived/MRFSource/MRFSource.H
Normal file
173
src/fieldSources/derived/MRFSource/MRFSource.H
Normal file
@ -0,0 +1,173 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
Foam::MRFSource
|
||||
|
||||
Description
|
||||
Multiple Reference Frame (MRF) source
|
||||
|
||||
Example usage:
|
||||
|
||||
MRFSourceCoeffs
|
||||
{
|
||||
origin (0 0 0);
|
||||
axis (0 0 1);
|
||||
omega 104.72;
|
||||
}
|
||||
|
||||
SourceFiles
|
||||
MRFSource.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef MRFSource_H
|
||||
#define MRFSource_H
|
||||
|
||||
#include "basicSource.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
class MRFZone;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class MRFSource Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class MRFSource
|
||||
:
|
||||
public basicSource
|
||||
{
|
||||
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
//- Run-time selectable porosity model
|
||||
autoPtr<MRFZone> mrfPtr_;
|
||||
|
||||
//- Velocity field name, default = U
|
||||
word UName_;
|
||||
|
||||
//- Density field name, default = rho
|
||||
word rhoName_;
|
||||
|
||||
|
||||
// Protected Member Functions
|
||||
|
||||
//- Initialise
|
||||
void initialise();
|
||||
|
||||
|
||||
private:
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
MRFSource(const MRFSource&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const MRFSource&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("MRFSource");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
MRFSource
|
||||
(
|
||||
const word& name,
|
||||
const word& modelType,
|
||||
const dictionary& dict,
|
||||
const fvMesh& mesh
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~MRFSource()
|
||||
{}
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Add explicit and implicit contributions
|
||||
|
||||
//- Vector
|
||||
virtual void addSup
|
||||
(
|
||||
fvMatrix<vector>& eqn,
|
||||
const label fieldI
|
||||
);
|
||||
|
||||
|
||||
// Flux manipulations
|
||||
|
||||
//- Make the given absolute flux relative
|
||||
virtual void relativeFlux(surfaceScalarField& phi) const;
|
||||
|
||||
//- Make the given absolute mass-flux relative
|
||||
virtual void relativeFlux
|
||||
(
|
||||
const surfaceScalarField& rho,
|
||||
surfaceScalarField& phi
|
||||
) const;
|
||||
|
||||
//- Make the given relative flux absolute
|
||||
virtual void absoluteFlux(surfaceScalarField& phi) const;
|
||||
|
||||
//- Make the given relative mass-flux absolute
|
||||
virtual void absoluteFlux
|
||||
(
|
||||
const surfaceScalarField& rho,
|
||||
surfaceScalarField& phi
|
||||
) const;
|
||||
|
||||
|
||||
// I-O
|
||||
|
||||
//- Write data
|
||||
virtual void writeData(Ostream&) const;
|
||||
|
||||
//- Read dictionary
|
||||
virtual bool read(const dictionary& dict);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,145 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*----------------------------------------------------------------------------*/
|
||||
|
||||
#include "explicitPorositySource.H"
|
||||
#include "fvMesh.H"
|
||||
#include "fvMatrices.H"
|
||||
#include "porosityModel.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(explicitPorositySource, 0);
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
basicSource,
|
||||
explicitPorositySource,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
|
||||
|
||||
void Foam::explicitPorositySource::initialise()
|
||||
{
|
||||
if (selectionMode_ != smCellZone)
|
||||
{
|
||||
FatalErrorIn("void Foam::explicitPorositySource::initialise()")
|
||||
<< "The porosity region must be specified as a cellZone. Current "
|
||||
<< "selection mode is " << selectionModeTypeNames_[selectionMode_]
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
porosityPtr_.reset
|
||||
(
|
||||
porosityModel::New
|
||||
(
|
||||
name_,
|
||||
mesh_,
|
||||
coeffs_,
|
||||
cellSetName_
|
||||
).ptr()
|
||||
),
|
||||
|
||||
fieldNames_.setSize(1, UName_);
|
||||
applied_.setSize(1, false);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::explicitPorositySource::explicitPorositySource
|
||||
(
|
||||
const word& name,
|
||||
const word& modelType,
|
||||
const dictionary& dict,
|
||||
const fvMesh& mesh
|
||||
)
|
||||
:
|
||||
basicSource(name, modelType, dict, mesh),
|
||||
porosityPtr_(NULL),
|
||||
UName_(coeffs_.lookupOrDefault<word>("UName", "U")),
|
||||
rhoName_(coeffs_.lookupOrDefault<word>("rhoName", "rho")),
|
||||
muName_(coeffs_.lookupOrDefault<word>("muName", "thermo:mu"))
|
||||
{
|
||||
initialise();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::explicitPorositySource::addSup
|
||||
(
|
||||
fvMatrix<vector>& eqn,
|
||||
const label fieldI
|
||||
)
|
||||
{
|
||||
fvMatrix<vector> porosityEqn(eqn.psi(), eqn.dimensions());
|
||||
|
||||
if (eqn.dimensions() == dimForce)
|
||||
{
|
||||
const volScalarField& rho =
|
||||
mesh_.lookupObject<volScalarField>(rhoName_);
|
||||
const volScalarField& mu = mesh_.lookupObject<volScalarField>(muName_);
|
||||
|
||||
porosityPtr_->addResistance(porosityEqn, rho, mu);
|
||||
}
|
||||
else
|
||||
{
|
||||
porosityPtr_->addResistance(porosityEqn);
|
||||
}
|
||||
|
||||
eqn -= porosityEqn;
|
||||
}
|
||||
|
||||
|
||||
void Foam::explicitPorositySource::writeData(Ostream& os) const
|
||||
{
|
||||
os << indent << name_ << endl;
|
||||
dict_.write(os);
|
||||
}
|
||||
|
||||
|
||||
bool Foam::explicitPorositySource::read(const dictionary& dict)
|
||||
{
|
||||
if (basicSource::read(dict))
|
||||
{
|
||||
coeffs_.readIfPresent("UName", UName_);
|
||||
coeffs_.readIfPresent("rhoName", rhoName_);
|
||||
coeffs_.readIfPresent("muName", muName_);
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,166 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
Foam::explicitPorositySource
|
||||
|
||||
Description
|
||||
Explicit porosity source
|
||||
|
||||
Sources described by, for example using the DarcyForchheimer model:
|
||||
|
||||
explicitPorositySourceCoeffs
|
||||
{
|
||||
type DarcyForchheimer;
|
||||
DarcyForchheimerCoeffs
|
||||
{
|
||||
d d [0 -2 0 0 0 0 0] (5e7 -1000 -1000);
|
||||
f f [0 -1 0 0 0 0 0] (0 0 0);
|
||||
|
||||
coordinateSystem
|
||||
{
|
||||
e1 (0.70710678 0.70710678 0);
|
||||
e2 (0 0 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Note:
|
||||
The porous region must be selected as a cellZone.
|
||||
|
||||
SourceFiles
|
||||
explicitPorositySource.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef explicitPorositySource_H
|
||||
#define explicitPorositySource_H
|
||||
|
||||
#include "basicSource.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
class porosityModel;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class explicitPorositySource Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class explicitPorositySource
|
||||
:
|
||||
public basicSource
|
||||
{
|
||||
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
//- Run-time selectable porosity model
|
||||
autoPtr<porosityModel> porosityPtr_;
|
||||
|
||||
//- Velocity field name, default = U
|
||||
word UName_;
|
||||
|
||||
//- Density field name (compressible case only), default = rho
|
||||
word rhoName_;
|
||||
|
||||
//- Dynamic viscosity field name (compressible case only)
|
||||
// default = thermo:mu
|
||||
word muName_;
|
||||
|
||||
|
||||
// Protected Member Functions
|
||||
|
||||
//- Initialise
|
||||
void initialise();
|
||||
|
||||
|
||||
private:
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
explicitPorositySource(const explicitPorositySource&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const explicitPorositySource&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("explicitPorositySource");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
explicitPorositySource
|
||||
(
|
||||
const word& name,
|
||||
const word& modelType,
|
||||
const dictionary& dict,
|
||||
const fvMesh& mesh
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~explicitPorositySource()
|
||||
{}
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Add explicit and implicit contributions
|
||||
|
||||
//- Vector
|
||||
virtual void addSup
|
||||
(
|
||||
fvMatrix<vector>& eqn,
|
||||
const label fieldI
|
||||
);
|
||||
|
||||
|
||||
// I-O
|
||||
|
||||
//- Write data
|
||||
virtual void writeData(Ostream&) const;
|
||||
|
||||
//- Read dictionary
|
||||
virtual bool read(const dictionary& dict);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -32,13 +32,12 @@ Description
|
||||
|
||||
fixedTemperatureSourceCoeffs
|
||||
{
|
||||
fieldNames (h e hs); // names of fields to apply source
|
||||
mode uniform; // constant or lookup
|
||||
mode uniform; // uniform or lookup
|
||||
|
||||
// uniform option
|
||||
temperature constant 500; // fixed temperature [K]
|
||||
temperature constant 500; // fixed temperature with time [K]
|
||||
|
||||
// loolup option
|
||||
// lookup option
|
||||
// TName T; // optional temperature field name
|
||||
}
|
||||
|
||||
|
||||
@ -230,15 +230,16 @@ Foam::MRFZone::MRFZone
|
||||
(
|
||||
const word& name,
|
||||
const fvMesh& mesh,
|
||||
const dictionary& dict
|
||||
const dictionary& dict,
|
||||
const word& cellZoneName
|
||||
)
|
||||
:
|
||||
mesh_(mesh),
|
||||
name_(name),
|
||||
coeffs_(dict),
|
||||
active_(readBool(coeffs_.lookup("active"))),
|
||||
cellZoneName_(coeffs_.lookup("cellZone")),
|
||||
cellZoneID_(mesh_.cellZones().findZoneID(cellZoneName_)),
|
||||
active_(true),
|
||||
cellZoneName_(cellZoneName),
|
||||
cellZoneID_(),
|
||||
excludedPatchNames_
|
||||
(
|
||||
coeffs_.lookupOrDefault("nonRotatingPatches", wordList(0))
|
||||
@ -247,12 +248,20 @@ Foam::MRFZone::MRFZone
|
||||
axis_(coeffs_.lookup("axis")),
|
||||
omega_(DataEntry<scalar>::New("omega", coeffs_))
|
||||
{
|
||||
if (cellZoneName_ == word::null)
|
||||
{
|
||||
coeffs_.lookup("active") >> active_;
|
||||
coeffs_.lookup("cellZone") >> cellZoneName_;
|
||||
}
|
||||
|
||||
if (!active_)
|
||||
{
|
||||
cellZoneID_ = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
cellZoneID_ = mesh_.cellZones().findZoneID(cellZoneName_);
|
||||
|
||||
const polyBoundaryMesh& patches = mesh_.boundaryMesh();
|
||||
|
||||
axis_ = axis_/mag(axis_);
|
||||
@ -268,7 +277,13 @@ Foam::MRFZone::MRFZone
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"MRFZone(const word&, const fvMesh&, const dictionary&)"
|
||||
"MRFZone"
|
||||
"("
|
||||
"const word&, "
|
||||
"const fvMesh&, "
|
||||
"const dictionary&, "
|
||||
"const word&"
|
||||
")"
|
||||
)
|
||||
<< "cannot find MRF patch " << excludedPatchNames_[i]
|
||||
<< exit(FatalError);
|
||||
@ -283,7 +298,13 @@ Foam::MRFZone::MRFZone
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"MRFZone(const word&, const fvMesh&, const dictionary&)"
|
||||
"MRFZone"
|
||||
"("
|
||||
"const word&, "
|
||||
"const fvMesh&, "
|
||||
"const dictionary&, "
|
||||
"const word&"
|
||||
")"
|
||||
)
|
||||
<< "cannot find MRF cellZone " << cellZoneName_
|
||||
<< exit(FatalError);
|
||||
@ -328,7 +349,7 @@ void Foam::MRFZone::addCoriolis
|
||||
}
|
||||
|
||||
|
||||
void Foam::MRFZone::addCoriolis(fvVectorMatrix& UEqn) const
|
||||
void Foam::MRFZone::addCoriolis(fvVectorMatrix& UEqn, const bool rhs) const
|
||||
{
|
||||
if (cellZoneID_ == -1)
|
||||
{
|
||||
@ -342,10 +363,21 @@ void Foam::MRFZone::addCoriolis(fvVectorMatrix& UEqn) const
|
||||
|
||||
const vector Omega = this->Omega();
|
||||
|
||||
forAll(cells, i)
|
||||
if (rhs)
|
||||
{
|
||||
label celli = cells[i];
|
||||
Usource[celli] -= V[celli]*(Omega ^ U[celli]);
|
||||
forAll(cells, i)
|
||||
{
|
||||
label celli = cells[i];
|
||||
Usource[celli] += V[celli]*(Omega ^ U[celli]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
forAll(cells, i)
|
||||
{
|
||||
label celli = cells[i];
|
||||
Usource[celli] -= V[celli]*(Omega ^ U[celli]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -353,7 +385,8 @@ void Foam::MRFZone::addCoriolis(fvVectorMatrix& UEqn) const
|
||||
void Foam::MRFZone::addCoriolis
|
||||
(
|
||||
const volScalarField& rho,
|
||||
fvVectorMatrix& UEqn
|
||||
fvVectorMatrix& UEqn,
|
||||
const bool rhs
|
||||
) const
|
||||
{
|
||||
if (cellZoneID_ == -1)
|
||||
@ -368,10 +401,21 @@ void Foam::MRFZone::addCoriolis
|
||||
|
||||
const vector Omega = this->Omega();
|
||||
|
||||
forAll(cells, i)
|
||||
if (rhs)
|
||||
{
|
||||
label celli = cells[i];
|
||||
Usource[celli] -= V[celli]*rho[celli]*(Omega ^ U[celli]);
|
||||
forAll(cells, i)
|
||||
{
|
||||
label celli = cells[i];
|
||||
Usource[celli] += V[celli]*rho[celli]*(Omega ^ U[celli]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
forAll(cells, i)
|
||||
{
|
||||
label celli = cells[i];
|
||||
Usource[celli] -= V[celli]*rho[celli]*(Omega ^ U[celli]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -144,7 +144,13 @@ public:
|
||||
// Constructors
|
||||
|
||||
//- Construct from fvMesh
|
||||
MRFZone(const word& name, const fvMesh& mesh, const dictionary& dict);
|
||||
MRFZone
|
||||
(
|
||||
const word& name,
|
||||
const fvMesh& mesh,
|
||||
const dictionary& dict,
|
||||
const word& cellZoneName = word::null
|
||||
);
|
||||
|
||||
//- Return clone
|
||||
autoPtr<MRFZone> clone() const
|
||||
@ -185,13 +191,20 @@ public:
|
||||
) const;
|
||||
|
||||
//- Add the Coriolis force contribution to the momentum equation
|
||||
void addCoriolis(fvVectorMatrix& UEqn) const;
|
||||
// Adds to the lhs of the equation; optionally add to rhs
|
||||
void addCoriolis
|
||||
(
|
||||
fvVectorMatrix& UEqn,
|
||||
const bool rhs = false
|
||||
) const;
|
||||
|
||||
//- Add the Coriolis force contribution to the momentum equation
|
||||
// Adds to the lhs of the equation; optionally add to rhs
|
||||
void addCoriolis
|
||||
(
|
||||
const volScalarField& rho,
|
||||
fvVectorMatrix& UEqn
|
||||
fvVectorMatrix& UEqn,
|
||||
const bool rhs = false
|
||||
) const;
|
||||
|
||||
//- Make the given absolute velocity relative within the MRF region
|
||||
|
||||
@ -47,10 +47,11 @@ Foam::porosityModels::DarcyForchheimer::DarcyForchheimer
|
||||
const word& name,
|
||||
const word& modelType,
|
||||
const fvMesh& mesh,
|
||||
const dictionary& dict
|
||||
const dictionary& dict,
|
||||
const word& cellZoneName
|
||||
)
|
||||
:
|
||||
porosityModel(name, modelType, mesh, dict),
|
||||
porosityModel(name, modelType, mesh, dict, cellZoneName),
|
||||
coordSys_(coeffs_, mesh),
|
||||
D_("D", dimless/sqr(dimLength), tensor::zero),
|
||||
F_("F", dimless/dimLength, tensor::zero),
|
||||
|
||||
@ -136,7 +136,8 @@ public:
|
||||
const word& name,
|
||||
const word& modelType,
|
||||
const fvMesh& mesh,
|
||||
const dictionary& dict
|
||||
const dictionary& dict,
|
||||
const word& cellZoneName
|
||||
);
|
||||
|
||||
//- Destructor
|
||||
|
||||
@ -102,10 +102,11 @@ Foam::porosityModels::fixedCoeff::fixedCoeff
|
||||
const word& name,
|
||||
const word& modelType,
|
||||
const fvMesh& mesh,
|
||||
const dictionary& dict
|
||||
const dictionary& dict,
|
||||
const word& cellZoneName
|
||||
)
|
||||
:
|
||||
porosityModel(name, modelType, mesh, dict),
|
||||
porosityModel(name, modelType, mesh, dict, cellZoneName),
|
||||
coordSys_(coeffs_, mesh),
|
||||
alpha_("alpha", dimless/dimTime, tensor::zero),
|
||||
beta_("beta", dimless/dimLength, tensor::zero)
|
||||
|
||||
@ -113,7 +113,8 @@ public:
|
||||
const word& name,
|
||||
const word& modelType,
|
||||
const fvMesh& mesh,
|
||||
const dictionary& dict
|
||||
const dictionary& dict,
|
||||
const word& cellZoneName
|
||||
);
|
||||
|
||||
//- Destructor
|
||||
|
||||
@ -73,17 +73,26 @@ Foam::porosityModel::porosityModel
|
||||
const word& name,
|
||||
const word& modelType,
|
||||
const fvMesh& mesh,
|
||||
const dictionary& dict
|
||||
const dictionary& dict,
|
||||
const word& cellZoneName
|
||||
)
|
||||
:
|
||||
name_(name),
|
||||
mesh_(mesh),
|
||||
dict_(dict),
|
||||
coeffs_(dict.subDict(modelType + "Coeffs")),
|
||||
active_(readBool(dict_.lookup("active"))),
|
||||
zoneName_(dict_.lookup("cellZone")),
|
||||
cellZoneIds_(mesh_.cellZones().findIndices(zoneName_))
|
||||
active_(true),
|
||||
zoneName_(cellZoneName),
|
||||
cellZoneIds_()
|
||||
{
|
||||
if (zoneName_ == word::null)
|
||||
{
|
||||
dict.lookup("actuve") >> active_;
|
||||
dict_.lookup("cellZone") >> zoneName_;
|
||||
}
|
||||
|
||||
cellZoneIds_ = mesh_.cellZones().findIndices(zoneName_);
|
||||
|
||||
Info<< " creating porous zone: " << zoneName_ << endl;
|
||||
|
||||
bool foundZone = !cellZoneIds_.empty();
|
||||
@ -99,6 +108,7 @@ Foam::porosityModel::porosityModel
|
||||
"const word&, "
|
||||
"const fvMesh&, "
|
||||
"const dictionary&"
|
||||
"const word&, "
|
||||
")"
|
||||
) << "cannot find porous cellZone " << zoneName_
|
||||
<< exit(FatalError);
|
||||
|
||||
@ -127,9 +127,10 @@ public:
|
||||
const word& modelName,
|
||||
const word& name,
|
||||
const fvMesh& mesh,
|
||||
const dictionary& dict
|
||||
const dictionary& dict,
|
||||
const word& cellZoneName
|
||||
),
|
||||
(modelName, name, mesh, dict)
|
||||
(modelName, name, mesh, dict, cellZoneName)
|
||||
);
|
||||
|
||||
//- Constructor
|
||||
@ -138,7 +139,8 @@ public:
|
||||
const word& name,
|
||||
const word& modelType,
|
||||
const fvMesh& mesh,
|
||||
const dictionary& dict
|
||||
const dictionary& dict,
|
||||
const word& cellZoneName = word::null
|
||||
);
|
||||
|
||||
//- Return pointer to new porosityModel object created on the freestore
|
||||
@ -182,7 +184,8 @@ public:
|
||||
(
|
||||
const word& name,
|
||||
const fvMesh& mesh,
|
||||
const dictionary& dict
|
||||
const dictionary& dict,
|
||||
const word& cellZoneName = word::null
|
||||
);
|
||||
|
||||
//- Destructor
|
||||
|
||||
@ -31,7 +31,8 @@ Foam::autoPtr<Foam::porosityModel> Foam::porosityModel::New
|
||||
(
|
||||
const word& name,
|
||||
const fvMesh& mesh,
|
||||
const dictionary& dict
|
||||
const dictionary& dict,
|
||||
const word& cellZoneName
|
||||
)
|
||||
{
|
||||
const word modelType(dict.lookup("type"));
|
||||
@ -48,9 +49,10 @@ Foam::autoPtr<Foam::porosityModel> Foam::porosityModel::New
|
||||
(
|
||||
"porosityModel::New"
|
||||
"("
|
||||
"const word& name,"
|
||||
"const word&, "
|
||||
"const fvMesh&, "
|
||||
"const dictionary&"
|
||||
"const dictionary&, "
|
||||
"const word&"
|
||||
")"
|
||||
)
|
||||
<< "Unknown " << typeName << " type " << modelType << nl << nl
|
||||
@ -59,7 +61,17 @@ Foam::autoPtr<Foam::porosityModel> Foam::porosityModel::New
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
return autoPtr<porosityModel>(cstrIter()(name, modelType, mesh, dict));
|
||||
return autoPtr<porosityModel>
|
||||
(
|
||||
cstrIter()
|
||||
(
|
||||
name,
|
||||
modelType,
|
||||
mesh,
|
||||
dict,
|
||||
cellZoneName
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -47,10 +47,11 @@ Foam::porosityModels::powerLaw::powerLaw
|
||||
const word& name,
|
||||
const word& modelType,
|
||||
const fvMesh& mesh,
|
||||
const dictionary& dict
|
||||
const dictionary& dict,
|
||||
const word& cellZoneName
|
||||
)
|
||||
:
|
||||
porosityModel(name, modelType, mesh, dict),
|
||||
porosityModel(name, modelType, mesh, dict, cellZoneName),
|
||||
C0_(readScalar(coeffs_.lookup("C0"))),
|
||||
C1_(readScalar(coeffs_.lookup("C1"))),
|
||||
rhoName_(coeffs_.lookupOrDefault<word>("rho", "rho"))
|
||||
|
||||
@ -117,7 +117,8 @@ public:
|
||||
const word& name,
|
||||
const word& modelType,
|
||||
const fvMesh& mesh,
|
||||
const dictionary& dict
|
||||
const dictionary& dict,
|
||||
const word& cellZoneName
|
||||
);
|
||||
|
||||
//- Destructor
|
||||
|
||||
Reference in New Issue
Block a user