Merge branch 'master' of /home/dm4/OpenFOAM/OpenFOAM-dev

This commit is contained in:
mattijs
2012-10-22 16:38:18 +01:00
168 changed files with 2500 additions and 2785 deletions

View File

@ -1,34 +1,35 @@
basicSource/basicSource/basicSource.C
basicSource/basicSource/basicSourceIO.C
basicSource/basicSource/basicSourceList.C
basicSource/basicSource/IObasicSourceList.C
basicSource/basicSource.C
basicSource/basicSourceIO.C
basicSource/basicSourceList.C
basicSource/IObasicSourceList.C
basicSource/pressureGradientExplicitSource/pressureGradientExplicitSource.C
basicSource/pressureGradientExplicitSource/pressureGradientExplicitSourceIO.C
general/explicitSource/explicitSource.C
general/explicitSetValue/explicitSetValue.C
general/codedSource/codedSource.C
basicSource/explicitSource/explicitSource.C
basicSource/explicitSetValue/explicitSetValue.C
derived/pressureGradientExplicitSource/pressureGradientExplicitSource.C
derived/pressureGradientExplicitSource/pressureGradientExplicitSourceIO.C
basicSource/rotorDiskSource/rotorDiskSource.C
basicSource/rotorDiskSource/bladeModel/bladeModel.C
basicSource/rotorDiskSource/profileModel/profileModel.C
basicSource/rotorDiskSource/profileModel/profileModelList.C
basicSource/rotorDiskSource/profileModel/lookup/lookupProfile.C
basicSource/rotorDiskSource/profileModel/series/seriesProfile.C
basicSource/rotorDiskSource/trimModel/trimModel/trimModel.C
basicSource/rotorDiskSource/trimModel/trimModel/trimModelNew.C
basicSource/rotorDiskSource/trimModel/fixed/fixedTrim.C
basicSource/rotorDiskSource/trimModel/targetCoeff/targetCoeffTrim.C
derived/rotorDiskSource/rotorDiskSource.C
derived/rotorDiskSource/bladeModel/bladeModel.C
derived/rotorDiskSource/profileModel/profileModel.C
derived/rotorDiskSource/profileModel/profileModelList.C
derived/rotorDiskSource/profileModel/lookup/lookupProfile.C
derived/rotorDiskSource/profileModel/series/seriesProfile.C
derived/rotorDiskSource/trimModel/trimModel/trimModel.C
derived/rotorDiskSource/trimModel/trimModel/trimModelNew.C
derived/rotorDiskSource/trimModel/fixed/fixedTrim.C
derived/rotorDiskSource/trimModel/targetCoeff/targetCoeffTrim.C
basicSource/actuationDiskSource/actuationDiskSource.C
basicSource/radialActuationDiskSource/radialActuationDiskSource.C
derived/actuationDiskSource/actuationDiskSource.C
derived/radialActuationDiskSource/radialActuationDiskSource.C
interRegion = basicSource/interRegionHeatTransferModel
interRegion = derived/interRegionHeatTransferModel
$(interRegion)/interRegionHeatTransferModel/interRegionHeatTransferModel.C
$(interRegion)/constantHeatTransfer/constantHeatTransfer.C
$(interRegion)/tabulatedHeatTransfer/tabulatedHeatTransfer.C
$(interRegion)/variableHeatTransfer/variableHeatTransfer.C
basicSource/codedSource/codedSource.C
derived/fixedTemperatureSource/fixedTemperatureSource.C
LIB = $(FOAM_LIBBIN)/libfieldSources

View File

@ -56,6 +56,12 @@ namespace Foam
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
bool Foam::basicSource::alwaysApply() const
{
return false;
}
void Foam::basicSource::setSelection(const dictionary& dict)
{
switch (selectionMode_)
@ -314,6 +320,7 @@ Foam::basicSource::~basicSource()
}
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::basicSource::isActive()
@ -341,6 +348,11 @@ bool Foam::basicSource::isActive()
Foam::label Foam::basicSource::applyToField(const word& fieldName) const
{
if (alwaysApply())
{
return 0;
}
forAll(fieldNames_, i)
{
if (fieldNames_[i] == fieldName)

View File

@ -150,6 +150,9 @@ protected:
// Protected functions
//- Flag to bypass the apply flag list checking
virtual bool alwaysApply() const;
//- Set the cellSet or points selection
void setSelection(const dictionary& dict);

View File

@ -157,7 +157,7 @@ public:
//- Read dictionary
virtual bool read(const dictionary& dict);
//- Write data to Istream
//- Write data to Ostream
virtual bool writeData(Ostream& os) const;
//- Ostream operator

View File

@ -0,0 +1,112 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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 "fixedTemperatureSource.H"
#include "fvMesh.H"
#include "fvMatrices.H"
#include "basicThermo.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(fixedTemperatureSource, 0);
addToRunTimeSelectionTable
(
basicSource,
fixedTemperatureSource,
dictionary
);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::fixedTemperatureSource::fixedTemperatureSource
(
const word& name,
const word& modelType,
const dictionary& dict,
const fvMesh& mesh
)
:
basicSource(name, modelType, dict, mesh),
T_(readScalar(coeffs_.lookup("temperature")))
{
fieldNames_.setSize(1, "energy");
applied_.setSize(1, false);
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::fixedTemperatureSource::alwaysApply() const
{
return true;
}
void Foam::fixedTemperatureSource::setValue
(
fvMatrix<scalar>& eqn,
const label
)
{
const basicThermo& thermo =
mesh_.lookupObject<basicThermo>("thermophysicalProperties");
if (eqn.psi().name() == thermo.he().name())
{
const scalarField Tfield(cells_.size(), T_);
eqn.setValues(cells_, thermo.he(thermo.p(), Tfield, cells_));
}
}
void Foam::fixedTemperatureSource::writeData(Ostream& os) const
{
os << indent << name_ << endl;
dict_.write(os);
}
bool Foam::fixedTemperatureSource::read(const dictionary& dict)
{
if (basicSource::read(dict))
{
coeffs_.readIfPresent("T", T_);
return true;
}
else
{
return false;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,135 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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::fixedTemperatureSource
Description
Fixed temperature equation constraint
Sources described by:
fixedTemperatureSourceCoeffs
{
fieldNames (h e hs); // names of fields to apply source
temperature 500; // fixed temperature [K]
}
SourceFiles
basicSource.C
\*---------------------------------------------------------------------------*/
#ifndef fixedTemperatureSource_H
#define fixedTemperatureSource_H
#include "basicSource.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class fixedTemperatureSource Declaration
\*---------------------------------------------------------------------------*/
class fixedTemperatureSource
:
public basicSource
{
protected:
// Protected data
//- Fixed temperature [K]
scalar T_;
private:
// Private Member Functions
//- Disallow default bitwise copy construct
fixedTemperatureSource(const fixedTemperatureSource&);
//- Disallow default bitwise assignment
void operator=(const fixedTemperatureSource&);
public:
//- Runtime type information
TypeName("fixedTemperatureSource");
// Constructors
//- Construct from components
fixedTemperatureSource
(
const word& name,
const word& modelType,
const dictionary& dict,
const fvMesh& mesh
);
//- Destructor
virtual ~fixedTemperatureSource()
{}
// Member Functions
virtual bool alwaysApply() const;
// Set values directly
//- Scalar
virtual void setValue(fvMatrix<scalar>& 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
// ************************************************************************* //

View File

@ -105,7 +105,7 @@ public:
// Evaluation
//- Set value on vector field
//- Set value on field
virtual void setValue(fvMatrix<Type>& eqn, const label fieldI);

View File

@ -364,9 +364,13 @@ $(solutionControl)/solutionControl/solutionControl.C
$(solutionControl)/simpleControl/simpleControl.C
$(solutionControl)/pimpleControl/pimpleControl.C
porousMedia = $(general)/porousMedia
$(porousMedia)/porousZone.C
$(porousMedia)/porousZones.C
porosity = $(general)/porosityModel
$(porosity)/porosityModel/porosityModel.C
$(porosity)/porosityModel/porosityModelNew.C
$(porosity)/porosityModel/porosityModelList.C
$(porosity)/porosityModel/IOporosityModelList.C
$(porosity)/DarcyForchheimer/DarcyForchheimer.C
$(porosity)/powerLaw/powerLaw.C
MRF = $(general)/MRF
$(MRF)/MRFZone.C

View File

@ -0,0 +1,202 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "addToRunTimeSelectionTable.H"
#include "DarcyForchheimer.H"
#include "geometricOneField.H"
#include "fvMatrices.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace porosityModels
{
defineTypeNameAndDebug(DarcyForchheimer, 0);
addToRunTimeSelectionTable(porosityModel, DarcyForchheimer, mesh);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::porosityModels::DarcyForchheimer::DarcyForchheimer
(
const word& name,
const word& modelType,
const fvMesh& mesh,
const dictionary& dict
)
:
porosityModel(name, modelType, mesh, dict),
coordSys_(coeffs_, mesh),
D_("D", dimless/sqr(dimLength), tensor::zero),
F_("F", dimless/dimLength, tensor::zero),
rhoName_(coeffs_.lookupOrDefault<word>("rho", "rho")),
muName_(coeffs_.lookupOrDefault<word>("mu", "mu")),
nuName_(coeffs_.lookupOrDefault<word>("nu", "nu"))
{
// local-to-global transformation tensor
const tensor& E = coordSys_.R();
dimensionedVector d(coeffs_.lookup("d"));
if (D_.dimensions() != d.dimensions())
{
FatalIOErrorIn
(
"Foam::porosityModels::DarcyForchheimer::DarcyForchheimer"
"("
"const dictionary&, "
"const coordinateSystem&, "
"const keyType&"
")",
coeffs_
) << "incorrect dimensions for d: " << d.dimensions()
<< " should be " << D_.dimensions()
<< exit(FatalIOError);
}
adjustNegativeResistance(d);
D_.value().xx() = d.value().x();
D_.value().yy() = d.value().y();
D_.value().zz() = d.value().z();
D_.value() = (E & D_ & E.T()).value();
dimensionedVector f(coeffs_.lookup("f"));
if (F_.dimensions() != f.dimensions())
{
FatalIOErrorIn
(
"Foam::porosityModels::DarcyForchheimer::DarcyForchheimer"
"("
"const dictionary&, "
"const coordinateSystem&, "
"const keyType&"
")",
coeffs_
) << "incorrect dimensions for f: " << f.dimensions()
<< " should be " << F_.dimensions()
<< exit(FatalIOError);
}
adjustNegativeResistance(f);
// leading 0.5 is from 1/2*rho
F_.value().xx() = 0.5*f.value().x();
F_.value().yy() = 0.5*f.value().y();
F_.value().zz() = 0.5*f.value().z();
F_.value() = (E & F_ & E.T()).value();
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::porosityModels::DarcyForchheimer::~DarcyForchheimer()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::porosityModels::DarcyForchheimer::correct
(
fvVectorMatrix& UEqn
) const
{
const vectorField& U = UEqn.psi();
const scalarField& V = mesh_.V();
scalarField& Udiag = UEqn.diag();
vectorField& Usource = UEqn.source();
if (UEqn.dimensions() == dimForce)
{
const volScalarField& rho =
mesh_.lookupObject<volScalarField>(rhoName_);
const volScalarField& mu =
mesh_.lookupObject<volScalarField>(muName_);
apply(Udiag, Usource, V, rho, mu, U);
}
else
{
const volScalarField& nu =
mesh_.lookupObject<volScalarField>(nuName_);
apply(Udiag, Usource, V, geometricOneField(), nu, U);
}
}
void Foam::porosityModels::DarcyForchheimer::correct
(
fvVectorMatrix& UEqn,
const volScalarField& rho,
const volScalarField& mu
) const
{
const vectorField& U = UEqn.psi();
const scalarField& V = mesh_.V();
scalarField& Udiag = UEqn.diag();
vectorField& Usource = UEqn.source();
apply(Udiag, Usource, V, rho, mu, U);
}
void Foam::porosityModels::DarcyForchheimer::correct
(
const fvVectorMatrix& UEqn,
volTensorField& AU
) const
{
const vectorField& U = UEqn.psi();
if (UEqn.dimensions() == dimForce)
{
const volScalarField& rho =
mesh_.lookupObject<volScalarField>(rhoName_);
const volScalarField& mu =
mesh_.lookupObject<volScalarField>(muName_);
apply(AU, rho, mu, U);
}
else
{
const volScalarField& nu =
mesh_.lookupObject<volScalarField>(nuName_);
apply(AU, geometricOneField(), nu, U);
}
}
void Foam::porosityModels::DarcyForchheimer::writeData(Ostream& os) const
{
os << indent << name_ << endl;
dict_.write(os);
}
// ************************************************************************* //

View File

@ -0,0 +1,187 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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, see <http://www.gnu.org/licenses/>.
Class
Foam::DarcyForchheimer
Description
Darcy-Forchheimer law porosity model, given by:
\f[
S = - (\mu d + \frac{\rho |U|}{2} f) U
\f]
where
\vartable
d | Darcy coefficient [1/m2]
f | Forchheimer coefficient [1/m]
\endvartable
Since negative Darcy/Forchheimer parameters are invalid, they can be used
to specify a multiplier (of the max component).
The orientation of the porous region is defined with the same notation as
a co-ordinate system, but only a Cartesian co-ordinate system is valid.
SourceFiles
DarcyForchheimer.C
\*---------------------------------------------------------------------------*/
#ifndef DarcyForchheimer_H
#define DarcyForchheimer_H
#include "porosityModel.H"
#include "coordinateSystem.H"
#include "dimensionedTensor.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace porosityModels
{
/*---------------------------------------------------------------------------*\
Class DarcyForchheimer Declaration
\*---------------------------------------------------------------------------*/
class DarcyForchheimer
:
public porosityModel
{
private:
// Private data
//- Local co-ordinate system
coordinateSystem coordSys_;
//- Darcy coefficient [1/m2]
dimensionedTensor D_;
//- Forchheimer coefficient [1/m]
dimensionedTensor F_;
//- Name of density field
word rhoName_;
//- Name of dynamic viscosity field
word muName_;
//- Name of kinematic viscosity field
word nuName_;
// Private Member Functions
//- Apply
template<class RhoFieldType>
void apply
(
scalarField& Udiag,
vectorField& Usource,
const scalarField& V,
const RhoFieldType& rho,
const scalarField& mu,
const vectorField& U
) const;
//- Apply
template<class RhoFieldType>
void apply
(
tensorField& AU,
const RhoFieldType& rho,
const scalarField& mu,
const vectorField& U
) const;
//- Disallow default bitwise copy construct
DarcyForchheimer(const DarcyForchheimer&);
//- Disallow default bitwise assignment
void operator=(const DarcyForchheimer&);
public:
//- Runtime type information
TypeName("DarcyForchheimer");
//- Constructor
DarcyForchheimer
(
const word& name,
const word& modelType,
const fvMesh& mesh,
const dictionary& dict
);
//- Destructor
virtual ~DarcyForchheimer();
// Member Functions
//- Add resistance
virtual void correct(fvVectorMatrix& UEqn) const;
//- Add resistance
virtual void correct
(
fvVectorMatrix& UEqn,
const volScalarField& rho,
const volScalarField& mu
) const;
//- Add resistance
virtual void correct
(
const fvVectorMatrix& UEqn,
volTensorField& AU
) const;
// I-O
//- Write
void writeData(Ostream& os) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace porosityModels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
#include "DarcyForchheimerTemplates.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,86 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class RhoFieldType>
void Foam::porosityModels::DarcyForchheimer::apply
(
scalarField& Udiag,
vectorField& Usource,
const scalarField& V,
const RhoFieldType& rho,
const scalarField& mu,
const vectorField& U
) const
{
const tensor& D = D_.value();
const tensor& F = F_.value();
forAll(cellZoneIds_, zoneI)
{
const labelList& cells = mesh_.cellZones()[cellZoneIds_[zoneI]];
forAll(cells, i)
{
const label cellI = cells[i];
const tensor Cd = mu[cellI]*D + (rho[cellI]*mag(U[cellI]))*F;
const scalar isoCd = tr(Cd);
Udiag[cellI] += V[cellI]*isoCd;
Usource[cellI] -= V[cellI]*((Cd - I*isoCd) & U[cellI]);
}
}
}
template<class RhoFieldType>
void Foam::porosityModels::DarcyForchheimer::apply
(
tensorField& AU,
const RhoFieldType& rho,
const scalarField& mu,
const vectorField& U
) const
{
const tensor& D = D_.value();
const tensor& F = F_.value();
forAll(cellZoneIds_, zoneI)
{
const labelList& cells = mesh_.cellZones()[cellZoneIds_[zoneI]];
forAll(cells, i)
{
const label cellI = cells[i];
AU[cellI] += mu[cellI]*D + (rho[cellI]*mag(U[cellI]))*F;
}
}
}
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -23,41 +23,68 @@ License
\*---------------------------------------------------------------------------*/
#include "thermalPorousZones.H"
#include "volFields.H"
#include "IOporosityModelList.H"
#include "fvMesh.H"
#include "Time.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
namespace Foam
Foam::IOobject Foam::IOporosityModelList::createIOobject
(
const fvMesh& mesh
) const
{
defineTemplateTypeNameAndDebug(IOPtrList<thermalPorousZone>, 0);
IOobject io
(
"porosityProperties",
mesh.time().constant(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
);
if (io.headerOk())
{
Info<< "Creating porosity model list from " << io.name() << nl << endl;
io.readOpt() = IOobject::MUST_READ_IF_MODIFIED;
return io;
}
else
{
Info<< "No porosity models present" << nl << endl;
io.readOpt() = IOobject::NO_READ;
return io;
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::thermalPorousZones::thermalPorousZones
Foam::IOporosityModelList::IOporosityModelList
(
const fvMesh& mesh
)
:
PorousZones<thermalPorousZone>(mesh)
IOdictionary(createIOobject(mesh)),
porosityModelList(mesh, *this)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::thermalPorousZones::addEnergySource
(
const fluidThermo& thermo,
const volScalarField& rho,
fvScalarMatrix& hEqn
) const
bool Foam::IOporosityModelList::read()
{
forAll(*this, i)
if (regIOobject::read())
{
operator[](i).addEnergySource(thermo, rho, hEqn);
porosityModelList::read(*this);
return true;
}
else
{
return false;
}
}
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -22,67 +22,69 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::porousMedia::noThermalModel
Foam::IOporosityModelList
Description
A dummy thermal model porous media, corresponding to the 'none' option
List of porosity models with IO functionality
SourceFiles
IOporosityModelList.C
\*---------------------------------------------------------------------------*/
#ifndef noThermalModel_H
#define noThermalModel_H
#ifndef IOporosityModelList_H
#define IOporosityModelList_H
#include "thermalModel.H"
#include "runTimeSelectionTables.H"
#include "IOdictionary.H"
#include "porosityModelList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace porousMedia
{
/*---------------------------------------------------------------------------*\
Class noThermalModel Declaration
Class IOporosityModelList Declaration
\*---------------------------------------------------------------------------*/
class noThermalModel
class IOporosityModelList
:
public thermalModel
public IOdictionary,
public porosityModelList
{
private:
// Private Member Functions
//- Create IO object if dictionary is present
IOobject createIOobject(const fvMesh& mesh) const;
//- Disallow default bitwise copy construct
IOporosityModelList(const IOporosityModelList&);
//- Disallow default bitwise assignment
void operator=(const IOporosityModelList&);
public:
//- Runtime type information
TypeName("none");
// Constructors
//- Construct from porous zone
noThermalModel(const porousZone&);
//- Construct from mesh
IOporosityModelList(const fvMesh& mesh);
//- Destructor
virtual ~noThermalModel();
//- Destructor
virtual ~IOporosityModelList()
{}
// Member Functions
//- Add the thermal source to the enthalpy equation
virtual void addEnergySource
(
const fluidThermo&,
const volScalarField& rho,
fvScalarMatrix& hEqn
) const;
//- Read dictionary
virtual bool read();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace porousMedia
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam

View File

@ -0,0 +1,182 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "porosityModel.H"
#include "volFields.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(porosityModel, 0);
defineRunTimeSelectionTable(porosityModel, mesh);
}
// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
void Foam::porosityModel::adjustNegativeResistance(dimensionedVector& resist)
{
scalar maxCmpt = max(0, cmptMax(resist.value()));
if (maxCmpt < 0)
{
FatalErrorIn
(
"void Foam::porosityModel::adjustNegativeResistance"
"("
"dimensionedVector&"
")"
) << "Negative resistances are invalid, resistance = " << resist
<< exit(FatalError);
}
else
{
vector& val = resist.value();
for (label cmpt = 0; cmpt < vector::nComponents; cmpt++)
{
if (val[cmpt] < 0)
{
val[cmpt] *= -maxCmpt;
}
}
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::porosityModel::porosityModel
(
const word& name,
const word& modelType,
const fvMesh& mesh,
const dictionary& dict
)
:
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_))
{
Info<< " creating porous zone: " << zoneName_ << endl;
bool foundZone = !cellZoneIds_.empty();
reduce(foundZone, orOp<bool>());
if (!foundZone && Pstream::master())
{
FatalErrorIn
(
"Foam::porosityModel::porosityModel"
"("
"const word&, "
"const word&, "
"const fvMesh&, "
"const dictionary&"
")"
) << "cannot find porous cellZone " << zoneName_
<< exit(FatalError);
}
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::porosityModel::~porosityModel()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::porosityModel::porosityModel::addResistance
(
fvVectorMatrix& UEqn
) const
{
if (cellZoneIds_.empty())
{
return;
}
this->correct(UEqn);
}
void Foam::porosityModel::porosityModel::addResistance
(
fvVectorMatrix& UEqn,
const volScalarField& rho,
const volScalarField& mu
) const
{
if (cellZoneIds_.empty())
{
return;
}
this->correct(UEqn, rho, mu);
}
void Foam::porosityModel::porosityModel::addResistance
(
const fvVectorMatrix& UEqn,
volTensorField& AU,
bool correctAUprocBC
) const
{
if (cellZoneIds_.empty())
{
return;
}
this->correct(UEqn, AU);
if (correctAUprocBC)
{
// Correct the boundary conditions of the tensorial diagonal to ensure
// processor boundaries are correctly handled when AU^-1 is interpolated
// for the pressure equation.
AU.correctBoundaryConditions();
}
}
bool Foam::porosityModel::read(const dictionary& dict)
{
active_ = readBool(dict.lookup("active"));
coeffs_ = dict.subDict(type() + "Coeffs");
dict.lookup("cellZone") >> zoneName_;
cellZoneIds_ = mesh_.cellZones().findIndices(zoneName_);
return true;
}
// ************************************************************************* //

View File

@ -0,0 +1,241 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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, see <http://www.gnu.org/licenses/>.
Class
Foam::porosityModel
Description
Top level model for porosity models
SourceFiles
porosityModel.C
porosityModelNew.C
\*---------------------------------------------------------------------------*/
#ifndef porosityModel_H
#define porosityModel_H
#include "fvMesh.H"
#include "dictionary.H"
#include "fvMatricesFwd.H"
#include "runTimeSelectionTables.H"
#include "dimensionedVector.H"
#include "keyType.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class porosityModel Declaration
\*---------------------------------------------------------------------------*/
class porosityModel
{
private:
// Private Member Functions
//- Disallow default bitwise copy construct
porosityModel(const porosityModel&);
//- Disallow default bitwise assignment
void operator=(const porosityModel&);
protected:
// Protected data
//- Porosity name
word name_;
//- Reference to the mesh database
const fvMesh& mesh_;
//- Dictionary used for model construction
const dictionary dict_;
//- Model coefficients dictionary
dictionary coeffs_;
//- Porosity active flag
bool active_;
//- Name(s) of cell-zone
keyType zoneName_;
//- Cell zone Ids
labelList cellZoneIds_;
// Protected Member Functions
//- Adjust negative resistance values to be multiplier of max value
void adjustNegativeResistance(dimensionedVector& resist);
virtual void correct(fvVectorMatrix& UEqn) const = 0;
virtual void correct
(
fvVectorMatrix& UEqn,
const volScalarField& rho,
const volScalarField& mu
) const = 0;
virtual void correct
(
const fvVectorMatrix& UEqn,
volTensorField& AU
) const = 0;
public:
//- Runtime type information
TypeName("porosityModel");
//- Selection table
declareRunTimeSelectionTable
(
autoPtr,
porosityModel,
mesh,
(
const word& modelName,
const word& name,
const fvMesh& mesh,
const dictionary& dict
),
(modelName, name, mesh, dict)
);
//- Constructor
porosityModel
(
const word& name,
const word& modelType,
const fvMesh& mesh,
const dictionary& dict
);
//- Return pointer to new porosityModel object created on the freestore
// from an Istream
class iNew
{
//- Reference to the mesh database
const fvMesh& mesh_;
const word& name_;
public:
iNew
(
const fvMesh& mesh,
const word& name
)
:
mesh_(mesh),
name_(name)
{}
autoPtr<porosityModel> operator()(Istream& is) const
{
const dictionary dict(is);
return autoPtr<porosityModel>
(
porosityModel::New
(
name_,
mesh_,
dict
)
);
}
};
//- Selector
static autoPtr<porosityModel> New
(
const word& name,
const fvMesh& mesh,
const dictionary& dict
);
//- Destructor
virtual ~porosityModel();
// Member Functions
//- Return const access to the porosity model name
inline const word& name() const;
//- Return const access to the porosity active flag
inline bool active() const;
//- Add resistance
virtual void addResistance(fvVectorMatrix& UEqn) const;
//- Add resistance
virtual void addResistance
(
fvVectorMatrix& UEqn,
const volScalarField& rho,
const volScalarField& mu
) const;
//- Add resistance
virtual void addResistance
(
const fvVectorMatrix& UEqn,
volTensorField& AU,
bool correctAUprocBC
) const;
// I-O
//- Write
virtual void writeData(Ostream& os) const = 0;
//- Read porosity dictionary
virtual bool read(const dictionary& dict);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "porosityModelI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -23,13 +23,16 @@ License
\*---------------------------------------------------------------------------*/
#include "porousZones.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
inline const Foam::word& Foam::porosityModel::name() const
{
defineTemplateTypeNameAndDebug(IOPtrList<porousZone>, 0);
return name_;
}
inline bool Foam::porosityModel::active() const
{
return active_;
}
// ************************************************************************* //

View File

@ -0,0 +1,183 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "porosityModelList.H"
#include "volFields.H"
// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
/*
void Foam::porosityModelList::XXX()
{}
*/
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::porosityModelList::porosityModelList
(
const fvMesh& mesh,
const dictionary& dict
)
:
PtrList<porosityModel>(),
mesh_(mesh)
{
reset(dict);
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::porosityModelList::~porosityModelList()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::porosityModelList::active() const
{
bool a = false;
forAll(*this, i)
{
a = a || this->operator[](i).active();
}
if (!a)
{
Info<< "No porosity models active" << endl;
}
return a;
}
void Foam::porosityModelList::reset(const dictionary& dict)
{
label count = 0;
forAllConstIter(dictionary, dict, iter)
{
if (iter().isDict())
{
count++;
}
}
this->setSize(count);
label i = 0;
forAllConstIter(dictionary, dict, iter)
{
if (iter().isDict())
{
const word& name = iter().keyword();
const dictionary& modelDict = iter().dict();
this->set
(
i++,
porosityModel::New(name, mesh_, modelDict)
);
}
}
}
bool Foam::porosityModelList::read(const dictionary& dict)
{
bool allOk = true;
forAll(*this, i)
{
porosityModel& pm = this->operator[](i);
bool ok = pm.read(dict.subDict(pm.name()));
allOk = (allOk && ok);
}
return allOk;
}
bool Foam::porosityModelList::writeData(Ostream& os) const
{
forAll(*this, i)
{
os << nl;
this->operator[](i).writeData(os);
}
return os.good();
}
void Foam::porosityModelList::addResistance
(
fvVectorMatrix& UEqn
) const
{
forAll(*this, i)
{
this->operator[](i).addResistance(UEqn);
}
}
void Foam::porosityModelList::addResistance
(
fvVectorMatrix& UEqn,
const volScalarField& rho,
const volScalarField& mu
) const
{
forAll(*this, i)
{
this->operator[](i).addResistance(UEqn, rho, mu);
}
}
void Foam::porosityModelList::addResistance
(
const fvVectorMatrix& UEqn,
volTensorField& AU,
bool correctAUprocBC
) const
{
forAll(*this, i)
{
this->operator[](i).addResistance(UEqn, AU, correctAUprocBC);
}
}
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
Foam::Ostream& Foam::operator<<
(
Ostream& os,
const porosityModelList& models
)
{
models.writeData(os);
return os;
}
// ************************************************************************* //

View File

@ -0,0 +1,140 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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, see <http://www.gnu.org/licenses/>.
Class
Foam::porosityModelList
Description
List container for porosity models
SourceFiles
porosityModelList.C
\*---------------------------------------------------------------------------*/
#ifndef porosityModelList_H
#define porosityModelList_H
#include "fvMesh.H"
#include "dictionary.H"
#include "fvMatricesFwd.H"
#include "porosityModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of friend functions and operators
class porosityModelList;
Ostream& operator<<(Ostream& os, const porosityModelList& models);
/*---------------------------------------------------------------------------*\
Class porosityModelList Declaration
\*---------------------------------------------------------------------------*/
class porosityModelList
:
PtrList<porosityModel>
{
private:
// Private Member Functions
//- Disallow default bitwise copy construct
porosityModelList(const porosityModelList&);
//- Disallow default bitwise assignment
void operator=(const porosityModelList&);
protected:
// Protected data
//- Reference to the mesh database
const fvMesh& mesh_;
public:
//- Constructor
porosityModelList(const fvMesh& mesh, const dictionary& dict);
//- Destructor
~porosityModelList();
// Member Functions
//- Return active status
bool active() const;
//- Reset the source list
void reset(const dictionary& dict);
//- Add resistance
void addResistance(fvVectorMatrix& UEqn) const;
//- Add resistance
void addResistance
(
fvVectorMatrix& UEqn,
const volScalarField& rho,
const volScalarField& mu
) const;
//- Add resistance
void addResistance
(
const fvVectorMatrix& UEqn,
volTensorField& AU,
bool correctAUprocBC = true
) const;
// I-O
//- Read dictionary
bool read(const dictionary& dict);
//- Write data to Ostream
bool writeData(Ostream& os) const;
//- Ostream operator
friend Ostream& operator<<
(
Ostream& os,
const porosityModelList& models
);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -23,42 +23,43 @@ License
\*---------------------------------------------------------------------------*/
#include "thermalModel.H"
#include "porosityModel.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::autoPtr<Foam::porousMedia::thermalModel>
Foam::porousMedia::thermalModel::New
Foam::autoPtr<Foam::porosityModel> Foam::porosityModel::New
(
const porousZone& pZone
const word& name,
const fvMesh& mesh,
const dictionary& dict
)
{
// a missing thermalModel is the same as type "none"
word modelType("none");
const word modelType(dict.lookup("type"));
if (const dictionary* dictPtr = pZone.dict().subDictPtr("thermalModel"))
{
dictPtr->lookup("type") >> modelType;
}
Info<< "Porosity region " << name << ":" << nl
<< " selecting model: " << modelType << endl;
Info<< "Selecting thermalModel " << modelType << endl;
meshConstructorTable::iterator cstrIter =
meshConstructorTablePtr_->find(modelType);
pZoneConstructorTable::iterator cstrIter =
pZoneConstructorTablePtr_->find(modelType);
if (cstrIter == pZoneConstructorTablePtr_->end())
if (cstrIter == meshConstructorTablePtr_->end())
{
FatalErrorIn
(
"porousMedia::thermalModel::New(const porousZone&)"
) << "Unknown thermalModel type "
<< modelType << nl << nl
<< "Valid thermalModel types are :" << endl
<< pZoneConstructorTablePtr_->sortedToc()
<< abort(FatalError);
"porosityModel::New"
"("
"const word& name,"
"const fvMesh&, "
"const dictionary&"
")"
)
<< "Unknown " << typeName << " type " << modelType << nl << nl
<< "Valid " << typeName << " types are:" << nl
<< meshConstructorTablePtr_->sortedToc()
<< exit(FatalError);
}
return autoPtr<porousMedia::thermalModel>(cstrIter()(pZone));
return autoPtr<porosityModel>(cstrIter()(name, modelType, mesh, dict));
}

View File

@ -0,0 +1,135 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "addToRunTimeSelectionTable.H"
#include "powerLaw.H"
#include "geometricOneField.H"
#include "fvMatrices.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace porosityModels
{
defineTypeNameAndDebug(powerLaw, 0);
addToRunTimeSelectionTable(porosityModel, powerLaw, mesh);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::porosityModels::powerLaw::powerLaw
(
const word& name,
const word& modelType,
const fvMesh& mesh,
const dictionary& dict
)
:
porosityModel(name, modelType, mesh, dict),
C0_(readScalar(coeffs_.lookup("C0"))),
C1_(readScalar(coeffs_.lookup("C1"))),
rhoName_(coeffs_.lookupOrDefault<word>("rho", "rho"))
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::porosityModels::powerLaw::~powerLaw()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::porosityModels::powerLaw::correct
(
fvVectorMatrix& UEqn
) const
{
const vectorField& U = UEqn.psi();
const scalarField& V = mesh_.V();
scalarField& Udiag = UEqn.diag();
if (UEqn.dimensions() == dimForce)
{
const volScalarField& rho =
mesh_.lookupObject<volScalarField>(rhoName_);
apply(Udiag, V, rho, U);
}
else
{
apply(Udiag, V, geometricOneField(), U);
}
}
void Foam::porosityModels::powerLaw::correct
(
fvVectorMatrix& UEqn,
const volScalarField& rho,
const volScalarField& mu
) const
{
const vectorField& U = UEqn.psi();
const scalarField& V = mesh_.V();
scalarField& Udiag = UEqn.diag();
apply(Udiag, V, rho, U);
}
void Foam::porosityModels::powerLaw::correct
(
const fvVectorMatrix& UEqn,
volTensorField& AU
) const
{
const vectorField& U = UEqn.psi();
if (UEqn.dimensions() == dimForce)
{
const volScalarField& rho =
mesh_.lookupObject<volScalarField>(rhoName_);
apply(AU, rho, U);
}
else
{
apply(AU, geometricOneField(), U);
}
}
void Foam::porosityModels::powerLaw::writeData(Ostream& os) const
{
os << indent << name_ << endl;
dict_.write(os);
}
// ************************************************************************* //

View File

@ -0,0 +1,168 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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, see <http://www.gnu.org/licenses/>.
Class
Foam::powerLaw
Description
Power law porosity model, given by:
\f[
S = - \rho C_0 |U|^{(C_1 - 1)} U
\f]
where
\vartable
C_0 | model coefficient
C_1 | model coefficient
\endvartable
SourceFiles
powerLaw.C
\*---------------------------------------------------------------------------*/
#ifndef powerLaw_H
#define powerLaw_H
#include "porosityModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace porosityModels
{
/*---------------------------------------------------------------------------*\
Class powerLaw Declaration
\*---------------------------------------------------------------------------*/
class powerLaw
:
public porosityModel
{
private:
// Private data
//- C0 coefficient
scalar C0_;
//- C1 coefficient
scalar C1_;
//- Name of density field
word rhoName_;
// Private Member Functions
//- Apply resistance
template<class RhoFieldType>
void apply
(
scalarField& Udiag,
const scalarField& V,
const RhoFieldType& rho,
const vectorField& U
) const;
//- Apply resistance
template<class RhoFieldType>
void apply
(
tensorField& AU,
const RhoFieldType& rho,
const vectorField& U
) const;
//- Disallow default bitwise copy construct
powerLaw(const powerLaw&);
//- Disallow default bitwise assignment
void operator=(const powerLaw&);
public:
//- Runtime type information
TypeName("powerLaw");
//- Constructor
powerLaw
(
const word& name,
const word& modelType,
const fvMesh& mesh,
const dictionary& dict
);
//- Destructor
virtual ~powerLaw();
// Member Functions
//- Add resistance
virtual void correct(fvVectorMatrix& UEqn) const;
//- Add resistance
virtual void correct
(
fvVectorMatrix& UEqn,
const volScalarField& rho,
const volScalarField& mu
) const;
//- Add resistance
virtual void correct
(
const fvVectorMatrix& UEqn,
volTensorField& AU
) const;
// I-O
//- Write
void writeData(Ostream& os) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace porosityModels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
#include "powerLawTemplates.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,81 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class RhoFieldType>
void Foam::porosityModels::powerLaw::apply
(
scalarField& Udiag,
const scalarField& V,
const RhoFieldType& rho,
const vectorField& U
) const
{
const scalar C0 = C0_;
const scalar C1m1b2 = (C1_ - 1.0)/2.0;
forAll(cellZoneIds_, zoneI)
{
const labelList& cells = mesh_.cellZones()[cellZoneIds_[zoneI]];
forAll(cells, i)
{
const label cellI = cells[i];
Udiag[cellI] +=
V[cellI]*rho[cellI]*C0*pow(magSqr(U[cellI]), C1m1b2);
}
}
}
template<class RhoFieldType>
void Foam::porosityModels::powerLaw::apply
(
tensorField& AU,
const RhoFieldType& rho,
const vectorField& U
) const
{
const scalar C0 = C0_;
const scalar C1m1b2 = (C1_ - 1.0)/2.0;
forAll(cellZoneIds_, zoneI)
{
const labelList& cells = mesh_.cellZones()[cellZoneIds_[zoneI]];
forAll(cells, i)
{
const label cellI = cells[i];
AU[cellI] =
AU[cellI] + I*(rho[cellI]*C0*pow(magSqr(U[cellI]), C1m1b2));
}
}
}
// ************************************************************************* //

View File

@ -1,223 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 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 "PorousZones.H"
#include "Time.H"
#include "volFields.H"
#include "fvm.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class ZoneType>
template<class Type>
void Foam::PorousZones<ZoneType>::modifyDdt(fvMatrix<Type>& m) const
{
forAll(*this, i)
{
this->operator[](i).modifyDdt(m);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class ZoneType>
Foam::PorousZones<ZoneType>::PorousZones
(
const fvMesh& mesh
)
:
IOPtrList<ZoneType>
(
IOobject
(
"porousZones",
mesh.time().constant(),
mesh,
IOobject::READ_IF_PRESENT,
IOobject::NO_WRITE
),
typename ZoneType::iNew(mesh)
),
mesh_(mesh)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class ZoneType>
template<class Type>
Foam::tmp<Foam::fvMatrix<Type> >
Foam::PorousZones<ZoneType>::ddt
(
GeometricField<Type, fvPatchField, volMesh>& vf
)
{
tmp<fvMatrix<Type> > tres = fvm::ddt(vf);
modifyDdt(tres());
return tres;
}
template<class ZoneType>
template<class Type>
Foam::tmp<Foam::fvMatrix<Type> >
Foam::PorousZones<ZoneType>::ddt
(
const geometricOneField&,
GeometricField<Type, fvPatchField, volMesh>& vf
)
{
tmp<fvMatrix<Type> > tres = fvm::ddt(vf);
modifyDdt(tres());
return tres;
}
template<class ZoneType>
template<class Type>
Foam::tmp<Foam::fvMatrix<Type> >
Foam::PorousZones<ZoneType>::ddt
(
const dimensionedScalar& rho,
GeometricField<Type, fvPatchField, volMesh>& vf
)
{
tmp<fvMatrix<Type> > tres = fvm::ddt(rho,vf);
modifyDdt(tres());
return tres;
}
template<class ZoneType>
template<class Type>
Foam::tmp<Foam::fvMatrix<Type> >
Foam::PorousZones<ZoneType>::ddt
(
const volScalarField& rho,
GeometricField<Type, fvPatchField, volMesh>& vf
)
{
tmp<fvMatrix<Type> > tres = fvm::ddt(rho,vf);
modifyDdt(tres());
return tres;
}
template<class ZoneType>
void Foam::PorousZones<ZoneType>::addResistance(fvVectorMatrix& UEqn) const
{
forAll(*this, i)
{
this->operator[](i).addResistance(UEqn);
}
}
template<class ZoneType>
void Foam::PorousZones<ZoneType>::addResistance
(
fvVectorMatrix& UEqn,
const volScalarField& rho,
const volScalarField& mu
) const
{
forAll(*this, i)
{
this->operator[](i).addResistance(UEqn, rho, mu);
}
}
template<class ZoneType>
void Foam::PorousZones<ZoneType>::addResistance
(
const fvVectorMatrix& UEqn,
volTensorField& AU
) const
{
// addResistance for each zone, delaying the correction of the
// processor BCs of AU
forAll(*this, i)
{
this->operator[](i).addResistance(UEqn, AU, false);
}
// Correct the boundary conditions of the tensorial diagonal to ensure
// processor bounaries are correctly handled when AU^-1 is interpolated
// for the pressure equation.
AU.correctBoundaryConditions();
}
template<class ZoneType>
bool Foam::PorousZones<ZoneType>::readData(Istream& is)
{
this->clear();
IOPtrList<ZoneType> newLst
(
IOobject
(
"porousZones",
mesh_.time().constant(),
mesh_,
IOobject::MUST_READ,
IOobject::NO_WRITE,
false // Don't re-register new zones with objectRegistry
),
typename ZoneType::iNew(mesh_)
);
this->transfer(newLst);
return is.good();
}
template<class ZoneType>
bool Foam::PorousZones<ZoneType>::writeData(Ostream& os, bool subDict) const
{
// Write size of list
os << nl << this->size();
// Write beginning of contents
os << nl << token::BEGIN_LIST;
// Write list contents
forAll(*this, i)
{
os << nl;
this->operator[](i).writeDict(os, subDict);
}
// Write end of contents
os << token::END_LIST << nl;
// Check state of IOstream
return os.good();
}
// ************************************************************************* //

View File

@ -1,170 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 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::PorousZones
Description
A centralized ZoneType collection.
Container class for a set of ZoneType with the ZoneType member
functions implemented to loop over the functions for each ZoneType.
SourceFiles
PorousZones.C
\*---------------------------------------------------------------------------*/
#ifndef PorousZones_H
#define PorousZones_H
#include "IOPtrList.H"
#include "volFieldsFwd.H"
#include "fvMatricesFwd.H"
#include "dimensionedScalarFwd.H"
#include "geometricOneField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of friend functions and operators
class fvMesh;
/*---------------------------------------------------------------------------*\
Class PorousZones Declaration
\*---------------------------------------------------------------------------*/
template<class ZoneType>
class PorousZones
:
public IOPtrList<ZoneType>
{
// Private data
//- Reference to the finite volume mesh this zone is part of
const fvMesh& mesh_;
// Private Member Functions
//- Disallow default bitwise copy construct
PorousZones(const PorousZones<ZoneType>&);
//- Disallow default bitwise assignment
void operator=(const PorousZones<ZoneType>&);
//- modify time derivative elements
template<class Type>
void modifyDdt(fvMatrix<Type>&) const;
public:
// Constructors
//- Construct from fvMesh
// with automatically constructed coordinate systems list
PorousZones(const fvMesh&);
// Member Functions
//- mirror fvm::ddt with porosity
template<class Type>
tmp<fvMatrix<Type> > ddt
(
GeometricField<Type, fvPatchField, volMesh>&
);
//- mirror fvm::ddt with porosity
template<class Type>
tmp<fvMatrix<Type> > ddt
(
const geometricOneField&,
GeometricField<Type, fvPatchField, volMesh>&
);
//- mirror fvm::ddt with porosity
template<class Type>
tmp<fvMatrix<Type> > ddt
(
const dimensionedScalar&,
GeometricField<Type, fvPatchField, volMesh>&
);
//- mirror fvm::ddt with porosity
template<class Type>
tmp<fvMatrix<Type> > ddt
(
const volScalarField&,
GeometricField<Type, fvPatchField, volMesh>&
);
//- Add the viscous and inertial resistance force contribution
// to the momentum equation
void addResistance(fvVectorMatrix& UEqn) const;
//- Add the viscous and inertial resistance force contribution
// to the momentum equation using rho and mu provided
void addResistance
(
fvVectorMatrix& UEqn,
const volScalarField& rho,
const volScalarField& mu
) const;
//- Add the viscous and inertial resistance force contribution
// to the tensorial diagonal
void addResistance
(
const fvVectorMatrix& UEqn,
volTensorField& AU
) const;
//- read modified data
virtual bool readData(Istream&);
//- write data
bool writeData(Ostream&, bool subDict = true) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "PorousZones.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,512 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 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 "porousZone.H"
#include "fvMesh.H"
#include "fvMatrices.H"
#include "geometricOneField.H"
// * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * * //
// adjust negative resistance values to be multiplier of max value
void Foam::porousZone::adjustNegativeResistance(dimensionedVector& resist)
{
scalar maxCmpt = max(0, cmptMax(resist.value()));
if (maxCmpt < 0)
{
FatalErrorIn
(
"Foam::porousZone::porousZone::adjustNegativeResistance"
"(dimensionedVector&)"
) << "negative resistances! " << resist
<< exit(FatalError);
}
else
{
vector& val = resist.value();
for (label cmpt=0; cmpt < vector::nComponents; ++cmpt)
{
if (val[cmpt] < 0)
{
val[cmpt] *= -maxCmpt;
}
}
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::porousZone::porousZone
(
const keyType& key,
const fvMesh& mesh,
const dictionary& dict
)
:
key_(key),
mesh_(mesh),
dict_(dict),
cellZoneIds_(mesh_.cellZones().findIndices(key_)),
coordSys_(dict, mesh),
porosity_(1),
intensity_(0),
mixingLength_(0),
C0_(0),
C1_(0),
D_("D", dimensionSet(0, -2, 0, 0, 0), tensor::zero),
F_("F", dimensionSet(0, -1, 0, 0, 0), tensor::zero)
{
Info<< "Creating porous zone: " << key_ << endl;
bool foundZone = !cellZoneIds_.empty();
reduce(foundZone, orOp<bool>());
if (!foundZone && Pstream::master())
{
FatalErrorIn
(
"Foam::porousZone::porousZone"
"(const keyType&, const fvMesh&, const dictionary&)"
) << "cannot find porous cellZone " << key_
<< exit(FatalError);
}
// porosity
if
(
dict_.readIfPresent("porosity", porosity_)
&& (porosity_ <= 0.0 || porosity_ > 1.0)
)
{
FatalIOErrorIn
(
"Foam::porousZone::porousZone"
"(const keyType&, const fvMesh&, const dictionary&)",
dict_
)
<< "out-of-range porosity value " << porosity_
<< exit(FatalIOError);
}
// turbulent intensity
if
(
dict_.readIfPresent("intensity", intensity_)
&& (intensity_ <= 0.0 || intensity_ > 1.0)
)
{
FatalIOErrorIn
(
"Foam::porousZone::porousZone"
"(const keyType&, const fvMesh&, const dictionary&)",
dict_
)
<< "out-of-range turbulent intensity value " << intensity_
<< exit(FatalIOError);
}
// turbulent length scale
if
(
dict_.readIfPresent("mixingLength", mixingLength_)
&& (mixingLength_ <= 0.0)
)
{
FatalIOErrorIn
(
"Foam::porousZone::porousZone"
"(const keyType&, const fvMesh&, const dictionary&)",
dict_
)
<< "out-of-range turbulent length scale " << mixingLength_
<< exit(FatalIOError);
}
// powerLaw coefficients
if (const dictionary* dictPtr = dict_.subDictPtr("powerLaw"))
{
dictPtr->readIfPresent("C0", C0_);
dictPtr->readIfPresent("C1", C1_);
}
// Darcy-Forchheimer coefficients
if (const dictionary* dictPtr = dict_.subDictPtr("Darcy"))
{
// local-to-global transformation tensor
const tensor& E = coordSys_.R();
dimensionedVector d(vector::zero);
if (dictPtr->readIfPresent("d", d))
{
if (D_.dimensions() != d.dimensions())
{
FatalIOErrorIn
(
"Foam::porousZone::porousZone"
"(const keyType&, const fvMesh&, const dictionary&)",
dict_
) << "incorrect dimensions for d: " << d.dimensions()
<< " should be " << D_.dimensions()
<< exit(FatalIOError);
}
adjustNegativeResistance(d);
D_.value().xx() = d.value().x();
D_.value().yy() = d.value().y();
D_.value().zz() = d.value().z();
D_.value() = (E & D_ & E.T()).value();
}
dimensionedVector f(vector::zero);
if (dictPtr->readIfPresent("f", f))
{
if (F_.dimensions() != f.dimensions())
{
FatalIOErrorIn
(
"Foam::porousZone::porousZone"
"(const keyType&, const fvMesh&, const dictionary&)",
dict_
) << "incorrect dimensions for f: " << f.dimensions()
<< " should be " << F_.dimensions()
<< exit(FatalIOError);
}
adjustNegativeResistance(f);
// leading 0.5 is from 1/2 * rho
F_.value().xx() = 0.5*f.value().x();
F_.value().yy() = 0.5*f.value().y();
F_.value().zz() = 0.5*f.value().z();
F_.value() = (E & F_ & E.T()).value();
}
}
// it is an error not to define anything
if
(
C0_ <= VSMALL
&& magSqr(D_.value()) <= VSMALL
&& magSqr(F_.value()) <= VSMALL
)
{
FatalIOErrorIn
(
"Foam::porousZone::porousZone"
"(const keyType&, const fvMesh&, const dictionary&)",
dict_
) << "neither powerLaw (C0/C1) "
"nor Darcy-Forchheimer law (d/f) specified"
<< exit(FatalIOError);
}
// feedback for the user
if (dict.lookupOrDefault("printCoeffs", false))
{
writeDict(Info, false);
}
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::porousZone::addResistance(fvVectorMatrix& UEqn) const
{
if (cellZoneIds_.empty())
{
return;
}
bool compressible = false;
if (UEqn.dimensions() == dimensionSet(1, 1, -2, 0, 0))
{
compressible = true;
}
const scalarField& V = mesh_.V();
scalarField& Udiag = UEqn.diag();
vectorField& Usource = UEqn.source();
const vectorField& U = UEqn.psi();
if (C0_ > VSMALL)
{
if (compressible)
{
addPowerLawResistance
(
Udiag,
V,
mesh_.lookupObject<volScalarField>("rho"),
U
);
}
else
{
addPowerLawResistance
(
Udiag,
V,
geometricOneField(),
U
);
}
}
const tensor& D = D_.value();
const tensor& F = F_.value();
if (magSqr(D) > VSMALL || magSqr(F) > VSMALL)
{
if (compressible)
{
addViscousInertialResistance
(
Udiag,
Usource,
V,
mesh_.lookupObject<volScalarField>("rho"),
mesh_.lookupObject<volScalarField>("mu"),
U
);
}
else
{
addViscousInertialResistance
(
Udiag,
Usource,
V,
geometricOneField(),
mesh_.lookupObject<volScalarField>("nu"),
U
);
}
}
}
void Foam::porousZone::addResistance
(
fvVectorMatrix& UEqn,
const volScalarField& rho,
const volScalarField& mu
) const
{
if (cellZoneIds_.empty())
{
return;
}
const scalarField& V = mesh_.V();
scalarField& Udiag = UEqn.diag();
vectorField& Usource = UEqn.source();
const vectorField& U = UEqn.psi();
if (C0_ > VSMALL)
{
addPowerLawResistance
(
Udiag,
V,
rho,
U
);
}
const tensor& D = D_.value();
const tensor& F = F_.value();
if (magSqr(D) > VSMALL || magSqr(F) > VSMALL)
{
addViscousInertialResistance
(
Udiag,
Usource,
V,
rho,
mu,
U
);
}
}
void Foam::porousZone::addResistance
(
const fvVectorMatrix& UEqn,
volTensorField& AU,
bool correctAUprocBC
) const
{
if (cellZoneIds_.empty())
{
return;
}
bool compressible = false;
if (UEqn.dimensions() == dimensionSet(1, 1, -2, 0, 0))
{
compressible = true;
}
const vectorField& U = UEqn.psi();
if (C0_ > VSMALL)
{
if (compressible)
{
addPowerLawResistance
(
AU,
mesh_.lookupObject<volScalarField>("rho"),
U
);
}
else
{
addPowerLawResistance
(
AU,
geometricOneField(),
U
);
}
}
const tensor& D = D_.value();
const tensor& F = F_.value();
if (magSqr(D) > VSMALL || magSqr(F) > VSMALL)
{
if (compressible)
{
addViscousInertialResistance
(
AU,
mesh_.lookupObject<volScalarField>("rho"),
mesh_.lookupObject<volScalarField>("mu"),
U
);
}
else
{
addViscousInertialResistance
(
AU,
geometricOneField(),
mesh_.lookupObject<volScalarField>("nu"),
U
);
}
}
if (correctAUprocBC)
{
// Correct the boundary conditions of the tensorial diagonal to ensure
// processor boundaries are correctly handled when AU^-1 is interpolated
// for the pressure equation.
AU.correctBoundaryConditions();
}
}
void Foam::porousZone::writeDict(Ostream& os, bool subDict) const
{
if (subDict)
{
os << indent << token::BEGIN_BLOCK << incrIndent << nl;
os.writeKeyword("name")
<< zoneName() << token::END_STATEMENT << nl;
}
else
{
os << indent << zoneName() << nl
<< indent << token::BEGIN_BLOCK << incrIndent << nl;
}
if (dict_.found("note"))
{
os.writeKeyword("note")
<< string(dict_.lookup("note")) << token::END_STATEMENT << nl;
}
coordSys_.writeDict(os, true);
if (dict_.found("porosity"))
{
os.writeKeyword("porosity")
<< porosity() << token::END_STATEMENT << nl;
}
if (dict_.found("intensity"))
{
os.writeKeyword("intensity")
<< intensity() << token::END_STATEMENT << nl;
}
if (dict_.found("mixingLength"))
{
os.writeKeyword("mixingLength")
<< mixingLength() << token::END_STATEMENT << nl;
}
// powerLaw coefficients
if (const dictionary* dictPtr = dict_.subDictPtr("powerLaw"))
{
os << indent << "powerLaw";
dictPtr->write(os);
}
// Darcy-Forchheimer coefficients
if (const dictionary* dictPtr = dict_.subDictPtr("Darcy"))
{
os << indent << "Darcy";
dictPtr->write(os);
}
// thermalModel
if (const dictionary* dictPtr = dict_.subDictPtr("thermalModel"))
{
os << indent << "thermalModel";
dictPtr->write(os);
}
os << decrIndent << indent << token::END_BLOCK << endl;
}
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
Foam::Ostream& Foam::operator<<(Ostream& os, const porousZone& pz)
{
pz.writeDict(os);
return os;
}
// ************************************************************************* //

View File

@ -1,389 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-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, see <http://www.gnu.org/licenses/>.
Namespace
Foam::porousMedia
Description
Namespace for models related to porous media
Class
Foam::porousZone
Description
Porous zone definition based on cell zones.
Porous zone definition based on cell zones and parameters obtained from a
control dictionary constructed from the given stream. The orientation of
the porous region is defined with the same notation as a coordinateSystem,
but only a Cartesian coordinate system is valid.
Implemented porosity models:
powerLaw (\e C0 and \e C1 parameters)
\f[
S = - \rho C_0 |U|^{(C_1 - 1)} U
\f]
Darcy-Forchheimer (@e d and \e f parameters)
\f[
S = - (\mu \, d + \frac{\rho |U|}{2} \, f) U
\f]
Since negative Darcy/Forchheimer parameters are invalid, they can be used
to specify a multiplier (of the max component).
The porousZones method porousZones::ddt() mirrors the normal fvm::ddt()
method, but accounts for the effective volume of the cells.
An example dictionary entry:
\verbatim
cat1
{
note "some catalyst";
coordinateSystem system_10;
porosity 0.809;
intensity 0.001; // optional
mixingLength 0.0001; // optional
printCoeffs yes; // optional: feedback for the user
Darcy
{
d d [0 -2 0 0 0] (-1000 -1000 5.3756e+07);
f f [0 -1 0 0 0] (-1000 -1000 15.83);
}
}
\endverbatim
See Also
porousZones and coordinateSystems
SourceFiles
porousZone.C
porousZoneTemplates.C
\*---------------------------------------------------------------------------*/
#ifndef porousZone_H
#define porousZone_H
#include "dictionary.H"
#include "coordinateSystem.H"
#include "coordinateSystems.H"
#include "wordList.H"
#include "labelList.H"
#include "dimensionedScalar.H"
#include "dimensionedTensor.H"
#include "primitiveFieldsFwd.H"
#include "volFieldsFwd.H"
#include "fvMatricesFwd.H"
#include "fvMesh.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
class fvMesh;
/*---------------------------------------------------------------------------*\
Class porousZone Declaration
\*---------------------------------------------------------------------------*/
class porousZone
{
// Private data
//- Name of this zone, or a regular expression
keyType key_;
//- Reference to the finite volume mesh this zone is part of
const fvMesh& mesh_;
//- Dictionary containing the parameters
dictionary dict_;
//- Cell zone Ids
labelList cellZoneIds_;
//- Coordinate system used for the zone (Cartesian)
coordinateSystem coordSys_;
//- porosity of the zone (0 < porosity <= 1)
// Placeholder for treatment of temporal terms.
// Currently unused.
scalar porosity_;
//- Turbulent intensity as fraction of the velocity
scalar intensity_;
//- Turbulent length scale
scalar mixingLength_;
//- powerLaw coefficient C0
scalar C0_;
//- powerLaw coefficient C1
scalar C1_;
//- Darcy coefficient
dimensionedTensor D_;
//- Forchheimer coefficient
dimensionedTensor F_;
// Private Member Functions
//- adjust negative resistance values to be multiplier of max value
static void adjustNegativeResistance(dimensionedVector& resist);
//- Power-law resistance
template<class RhoFieldType>
void addPowerLawResistance
(
scalarField& Udiag,
const scalarField& V,
const RhoFieldType& rho,
const vectorField& U
) const;
//- Viscous and inertial resistance
template<class RhoFieldType>
void addViscousInertialResistance
(
scalarField& Udiag,
vectorField& Usource,
const scalarField& V,
const RhoFieldType& rho,
const scalarField& mu,
const vectorField& U
) const;
//- Power-law resistance
template<class RhoFieldType>
void addPowerLawResistance
(
tensorField& AU,
const RhoFieldType& rho,
const vectorField& U
) const;
//- Viscous and inertial resistance
template<class RhoFieldType>
void addViscousInertialResistance
(
tensorField& AU,
const RhoFieldType& rho,
const scalarField& mu,
const vectorField& U
) const;
//- Disallow default bitwise copy construct
porousZone(const porousZone&);
//- Disallow default bitwise assignment
void operator=(const porousZone&);
public:
// Constructors
//- Construct from components
porousZone(const keyType& key, const fvMesh&, const dictionary&);
//- Return clone
autoPtr<porousZone> clone() const
{
notImplemented("autoPtr<porousZone> clone() const");
return autoPtr<porousZone>(NULL);
}
//- Return pointer to new porousZone created on freestore from Istream
class iNew
{
//- Reference to the finite volume mesh this zone is part of
const fvMesh& mesh_;
public:
iNew(const fvMesh& mesh)
:
mesh_(mesh)
{}
autoPtr<porousZone> operator()(Istream& is) const
{
keyType key(is);
dictionary dict(is);
return autoPtr<porousZone>(new porousZone(key, mesh_, dict));
}
};
//- Destructor
virtual ~porousZone()
{}
// Member Functions
// Access
//- cellZone name
const keyType& zoneName() const
{
return key_;
}
//- Return mesh
const fvMesh& mesh() const
{
return mesh_;
}
//- cellZone numbers
const labelList& zoneIds() const
{
return cellZoneIds_;
}
//- dictionary values used for the porousZone
const dictionary& dict() const
{
return dict_;
}
//- Return coordinate system
const coordinateSystem& coordSys() const
{
return coordSys_;
}
//- Return origin
const point& origin() const
{
return coordSys_.origin();
}
//- Return axis
vector axis() const
{
return coordSys_.axis();
}
//- Return porosity
scalar porosity() const
{
return porosity_;
}
//- Edit access to porosity
scalar& porosity()
{
return porosity_;
}
//- Return turbulent intensity
scalar intensity() const
{
return intensity_;
}
//- Edit access to turbulent intensity
scalar& intensity()
{
return intensity_;
}
//- Return turbulent length scale
scalar mixingLength() const
{
return mixingLength_;
}
//- Edit access to turbulent length scale
scalar& mixingLength()
{
return mixingLength_;
}
//- Modify time derivative elements according to porosity
template<class Type>
void modifyDdt(fvMatrix<Type>&) const;
//- Add the viscous and inertial resistance force contribution
// to the momentum equation
void addResistance(fvVectorMatrix& UEqn) const;
//- Add the viscous and inertial resistance force contribution
// to the momentum equation giving rho and mu.
void addResistance
(
fvVectorMatrix& UEqn,
const volScalarField& rho,
const volScalarField& mu
) const;
//- Add the viscous and inertial resistance force contribution
// to the tensorial diagonal.
// Optionally correct the processor BCs of AU.
void addResistance
(
const fvVectorMatrix& UEqn,
volTensorField& AU,
bool correctAUprocBC = true
) const;
//- Write the porousZone dictionary
virtual void writeDict(Ostream&, bool subDict = true) const;
// Ostream Operator
friend Ostream& operator<<(Ostream&, const porousZone&);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "porousZoneTemplates.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,156 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 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 "porousZone.H"
#include "fvMesh.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class Type>
void Foam::porousZone::modifyDdt(fvMatrix<Type>& m) const
{
if (porosity_ < 1)
{
forAll(cellZoneIds_, zoneI)
{
const labelList& cells = mesh_.cellZones()[cellZoneIds_[zoneI]];
forAll(cells, i)
{
m.diag()[cells[i]] *= porosity_;
m.source()[cells[i]] *= porosity_;
}
}
}
}
template<class RhoFieldType>
void Foam::porousZone::addPowerLawResistance
(
scalarField& Udiag,
const scalarField& V,
const RhoFieldType& rho,
const vectorField& U
) const
{
const scalar C0 = C0_;
const scalar C1m1b2 = (C1_ - 1.0)/2.0;
forAll(cellZoneIds_, zoneI)
{
const labelList& cells = mesh_.cellZones()[cellZoneIds_[zoneI]];
forAll(cells, i)
{
Udiag[cells[i]] +=
V[cells[i]]*rho[cells[i]]*C0*pow(magSqr(U[cells[i]]), C1m1b2);
}
}
}
template<class RhoFieldType>
void Foam::porousZone::addViscousInertialResistance
(
scalarField& Udiag,
vectorField& Usource,
const scalarField& V,
const RhoFieldType& rho,
const scalarField& mu,
const vectorField& U
) const
{
const tensor& D = D_.value();
const tensor& F = F_.value();
forAll(cellZoneIds_, zoneI)
{
const labelList& cells = mesh_.cellZones()[cellZoneIds_[zoneI]];
forAll(cells, i)
{
const tensor dragCoeff = mu[cells[i]]*D
+ (rho[cells[i]]*mag(U[cells[i]]))*F;
const scalar isoDragCoeff = tr(dragCoeff);
Udiag[cells[i]] += V[cells[i]]*isoDragCoeff;
Usource[cells[i]] -=
V[cells[i]]*((dragCoeff - I*isoDragCoeff) & U[cells[i]]);
}
}
}
template<class RhoFieldType>
void Foam::porousZone::addPowerLawResistance
(
tensorField& AU,
const RhoFieldType& rho,
const vectorField& U
) const
{
const scalar C0 = C0_;
const scalar C1m1b2 = (C1_ - 1.0)/2.0;
forAll(cellZoneIds_, zoneI)
{
const labelList& cells = mesh_.cellZones()[cellZoneIds_[zoneI]];
forAll(cells, i)
{
AU[cells[i]] = AU[cells[i]]
+ I*(rho[cells[i]]*C0*pow(magSqr(U[cells[i]]), C1m1b2));
}
}
}
template<class RhoFieldType>
void Foam::porousZone::addViscousInertialResistance
(
tensorField& AU,
const RhoFieldType& rho,
const scalarField& mu,
const vectorField& U
) const
{
const tensor& D = D_.value();
const tensor& F = F_.value();
forAll(cellZoneIds_, zoneI)
{
const labelList& cells = mesh_.cellZones()[cellZoneIds_[zoneI]];
forAll(cells, i)
{
AU[cells[i]] += mu[cells[i]]*D + (rho[cells[i]]*mag(U[cells[i]]))*F;
}
}
}
// ************************************************************************* //

View File

@ -1,46 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 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/>.
Typedef
Foam::porousZones
\*---------------------------------------------------------------------------*/
#ifndef porousZones_H
#define porousZones_H
#include "PorousZones.H"
#include "porousZone.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef PorousZones<porousZone> porousZones;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -61,7 +61,7 @@ protected:
CloudType& owner_;
//- Reference to the cloud dictionary
const dictionary& dict_;
const dictionary dict_;
//- Name of the sub-model base class
const word baseName_;
@ -73,7 +73,7 @@ protected:
const word modelName_;
//- Coefficients dictionary
const dictionary& coeffDict_;
const dictionary coeffDict_;
// Protected Member Functions

View File

@ -266,7 +266,6 @@ Foam::label Foam::AMIInterpolation<SourcePatch, TargetPatch>::findTargetFace
const point srcPt = srcFace.centre(srcPts);
const scalar srcFaceArea = srcMagSf_[srcFaceI];
// pointIndexHit sample = treePtr_->findNearest(srcPt, sqr(0.1*bb.mag()));
pointIndexHit sample = treePtr_->findNearest(srcPt, 10.0*srcFaceArea);
@ -295,7 +294,6 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::appendNbrFaces
DynamicList<label>& faceIDs
) const
{
// const labelList& nbrFaces = patch.pointFaces()[faceI];
const labelList& nbrFaces = patch.faceFaces()[faceI];
// filter out faces already visited from src face neighbours
@ -401,7 +399,6 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::setNextFaces
const DynamicList<label>& visitedFaces
) const
{
// const labelList& srcNbrFaces = srcPatch0.pointFaces()[srcFaceI];
const labelList& srcNbrFaces = srcPatch0.faceFaces()[srcFaceI];
// set possible seeds for later use
@ -610,9 +607,12 @@ restartUncoveredSourceFace
}
}
Info<< "AMIInterpolation : restarting search on "
<< returnReduce(lowWeightFaces.size(), sumOp<label>())
<< " faces since sum of weights < 0.5" << endl;
if (debug)
{
Pout<< "AMIInterpolation: restarting search on "
<< lowWeightFaces.size() << " faces since sum of weights < 0.5"
<< endl;
}
if (lowWeightFaces.size() > 0)
{

View File

@ -211,6 +211,7 @@ void sixDoFRigidBodyDisplacementPointPatchVectorField::updateCoeffs()
dictionary forcesDict;
forcesDict.add("type", forces::typeName);
forcesDict.add("patches", wordList(1, ptPatch.name()));
forcesDict.add("rhoInf", rhoInf_);
forcesDict.add("rhoName", rhoName_);

View File

@ -28,78 +28,91 @@ Group
grpThermoBoundaryConditions
Description
This boundary condition provides a coupled condition between the primary
baffle mesh regions.
This boundary condition provides a coupled temperature condition between
multiple mesh regions. The regions are generally referred to as the:
- primary region, and
- baffle region
The primary region creates it and evolves the thermal baffle heat transfer
equation.
The primary region creates the baffle region and evolves its energy
equation either:
- 1-D, normal to each patch face
- 2-D, normal and tangential components
The solid thermo and baffle dictionaries are located on the
primary region.
The thermodynamic properties of the baffle material are specified via
dictionary entries.
type compressible::temperatureThermoBaffle;
\heading Patch usage
// Coupled BC.
neighbourFieldName T;
kappa fluidThermo;
KName none;
// Thermo baffle model
thermoBaffleModel thermoBaffle2D;
regionName baffleRegion;
infoOutput yes;
active yes;
thermoBaffle2DCoeffs
Example of the boundary condition specification:
\verbatim
myPatch
{
}
type compressible::temperatureThermoBaffle;
// Coupled boundary condition
neighbourFieldName T;
kappa fluidThermo;
KName none;
// Solid thermo
thermoType
heSolidThermo
<pureSolidMixture
<constIsoSolidTransport
<constSolidRad
<thermo
<hConstThermo<incompressible>,sensibleEnthalpy>
>
>
>
>;
mixture
{
specie
// Thermo baffle model
thermoBaffleModel thermoBaffle2D;
regionName baffleRegion;
infoOutput yes;
active yes;
thermoBaffle2DCoeffs
{
nMoles 1;
molWeight 20;
}
transport
// Solid thermo
thermoType
{
kappa 0.01;
type heSolidThermo;
mixture pureSolidMixture;
transport constIso;
thermo hConst;
equationOfState rhoConst;
specie specie;
energy sensibleEnthalpy;
}
mixture
{
specie
{
nMoles 1;
molWeight 20;
}
transport
{
kappa 0.01;
}
thermodynamics
{
Hf 0;
Cp 15;
}
density
{
rho 80;
}
}
radiation
{
sigmaS 0;
kappaRad 0;
emissivity 1;
radiationModel opaqueSolid;
absorptionEmissionModel none;
scatterModel none;
}
thermodynamics
{
Hf 0;
Cp 15;
}
density
{
rho 80;
}
}
value uniform 300;
value uniform 300;
}
\endverbatim
SeeAlso
Foam::turbulentTemperatureCoupledBaffleMixedFvPatchScalarField
Foam::regionModels::thermoBaffleModels::thermoBaffleModel
SourceFiles
temperatureThermoBaffleFvPatchScalarField.C

View File

@ -87,14 +87,13 @@ void Foam::nastranSurfaceWriter::formatOS(OFstream& os) const
void Foam::nastranSurfaceWriter::writeCoord
(
const point& p,
label& nPoint,
label& continuation,
Ostream& os
const label pointI,
OFstream& os
) const
{
// Fixed short/long formats:
// 1 GRID
// 2 ID : point ID
// 2 ID : point ID - requires starting index of 1
// 3 CP : co-ordinate system ID (blank)
// 4 X1 : point x cp-ordinate
// 5 X2 : point x cp-ordinate
@ -107,35 +106,46 @@ void Foam::nastranSurfaceWriter::writeCoord
{
case wfShort:
{
os << setw(8) << "GRID"
<< setw(8) << ++nPoint
os.setf(ios_base::left);
os << setw(8) << "GRID";
os.unsetf(ios_base::left);
os.setf(ios_base::right);
os << setw(8) << pointI + 1
<< " "
<< setw(8) << p.x()
<< setw(8) << p.y()
<< setw(8) << p.z()
<< nl;
os.unsetf(ios_base::right);
break;
}
case wfLong:
{
os << setw(8) << "GRID*"
<< setw(16) << ++nPoint
os.setf(ios_base::left);
os << setw(8) << "GRID*";
os.unsetf(ios_base::left);
os.setf(ios_base::right);
os << setw(16) << pointI + 1
<< " "
<< setw(16) << p.x()
<< setw(16) << p.y()
<< setw(8) << ++continuation
<< nl
<< setw(8) << continuation
<< setw(16) << p.z()
<< nl;
os.unsetf(ios_base::right);
os.setf(ios_base::left);
os << setw(8) << "*";
os.unsetf(ios_base::left);
os.setf(ios_base::right);
os << setw(16) << p.z()
<< nl;
os.unsetf(ios_base::right);
break;
}
case wfFree:
{
os << "GRID"
<< ',' << ++nPoint
<< ',' << pointI + 1
<< ','
<< ',' << p.x()
<< ',' << p.y()
@ -163,7 +173,7 @@ void Foam::nastranSurfaceWriter::writeFace
const word& faceType,
const labelList& facePts,
label& nFace,
Ostream& os
OFstream& os
) const
{
// Only valid surface elements are CTRIA3 and CQUAD4
@ -172,7 +182,7 @@ void Foam::nastranSurfaceWriter::writeFace
// 1 CQUAD4
// 2 EID : element ID
// 3 PID : property element ID; default = EID (blank)
// 4 G1 : grid point index
// 4 G1 : grid point index - requires starting index of 1
// 5 G2 : grid point index
// 6 G3 : grid point index
// 7 G4 : grid point index
@ -183,18 +193,49 @@ void Foam::nastranSurfaceWriter::writeFace
switch (writeFormat_)
{
case wfShort:
case wfLong:
{
os << setw(8) << faceType
<< setw(8) << ++nFace
os.setf(ios_base::left);
os << setw(8) << faceType;
os.unsetf(ios_base::left);
os.setf(ios_base::right);
os << setw(8) << nFace++
<< " ";
forAll(facePts, i)
{
os << setw(8) << facePts[i];
os << setw(8) << facePts[i] + 1;
}
os << nl;
os.unsetf(ios_base::right);
break;
}
case wfLong:
{
os.setf(ios_base::left);
os << setw(8) << word(faceType + "*");
os.unsetf(ios_base::left);
os.setf(ios_base::right);
os << setw(16) << nFace++
<< " ";
forAll(facePts, i)
{
os << setw(16) << facePts[i] + 1;
if (i == 1)
{
os << nl;
os.unsetf(ios_base::right);
os.setf(ios_base::left);
os << setw(8) << "*";
os.unsetf(ios_base::left);
os.setf(ios_base::right);
}
}
os << nl;
os.unsetf(ios_base::right);
break;
}
@ -205,7 +246,7 @@ void Foam::nastranSurfaceWriter::writeFace
forAll(facePts, i)
{
os << ',' << facePts[i];
os << ',' << facePts[i] + 1;
}
os << nl;
@ -235,7 +276,7 @@ void Foam::nastranSurfaceWriter::writeGeometry
const pointField& points,
const faceList& faces,
List<DynamicList<face> >& decomposedFaces,
Ostream& os
OFstream& os
) const
{
// write points
@ -244,12 +285,9 @@ void Foam::nastranSurfaceWriter::writeGeometry
<< "$ Points" << nl
<< "$" << nl;
label nPoint = 0;
label continuation = 0;
forAll(points, pointI)
{
writeCoord(points[pointI], nPoint, continuation, os);
writeCoord(points[pointI], pointI, os);
}
@ -259,7 +297,7 @@ void Foam::nastranSurfaceWriter::writeGeometry
<< "$ Faces" << nl
<< "$" << nl;
label nFace = 0;
label nFace = 1;
forAll(faces, faceI)
{
@ -352,7 +390,7 @@ void Foam::nastranSurfaceWriter::write
Info<< "Writing nastran file to " << os.name() << endl;
}
os << "TITLE=OpeNFOAM " << surfaceName.c_str() << " mesh" << nl
os << "TITLE=OpenFOAM " << surfaceName.c_str() << " mesh" << nl
<< "$" << nl
<< "BEGIN BULK" << nl;

View File

@ -85,9 +85,8 @@ private:
void writeCoord
(
const point& p,
label& nPoint,
label& continuation,
Ostream& os
const label pointI,
OFstream& os
) const;
//- Write a face element (CTRIA3 or CQUAD4)
@ -96,7 +95,7 @@ private:
const word& faceType,
const labelList& facePts,
label& nFace,
Ostream& os
OFstream& os
) const;
//- Main driver to write the surface mesh geometry
@ -105,7 +104,7 @@ private:
const pointField& points,
const faceList& faces,
List<DynamicList<face> >& decomposedFaces,
Ostream& os
OFstream& os
) const;
//- Write a face-based value
@ -115,7 +114,7 @@ private:
const word& nasFieldName,
const Type& value,
const label EID,
Ostream& os
OFstream& os
) const;
//- Templated write operation

View File

@ -34,7 +34,7 @@ void Foam::nastranSurfaceWriter::writeFaceValue
const word& nasFieldName,
const Type& value,
const label EID,
Ostream& os
OFstream& os
) const
{
// Fixed short/long formats:
@ -43,26 +43,50 @@ void Foam::nastranSurfaceWriter::writeFaceValue
// 3 EID : element ID
// 4 onwards: load values
label SID = 0;
label SID = 1;
label w = 16;
switch (writeFormat_)
{
case wfShort:
{
w = 8;
}
case wfLong:
{
os << setw(8) << nasFieldName
<< setw(8) << SID
os.setf(ios_base::left);
os << setw(8) << nasFieldName;
os.unsetf(ios_base::left);
os.setf(ios_base::right);
os << setw(8) << SID
<< setw(8) << EID;
for (direction dirI = 0; dirI < pTraits<Type>::nComponents; dirI++)
{
os << setw(w) << component(value, dirI);
os << setw(8) << component(value, dirI);
}
os.unsetf(ios_base::right);
break;
}
case wfLong:
{
os.setf(ios_base::left);
os << setw(8) << word(nasFieldName + "*");
os.unsetf(ios_base::left);
os.setf(ios_base::right);
os << setw(16) << SID
<< setw(16) << EID;
for (direction dirI = 0; dirI < pTraits<Type>::nComponents; dirI++)
{
os << setw(16) << component(value, dirI);
}
os.unsetf(ios_base::right);
os << nl;
os.setf(ios_base::left);
os << '*';
os.unsetf(ios_base::left);
break;
}
case wfFree:

View File

@ -12,7 +12,6 @@ wmake $makeType reactionThermo
wmake $makeType laminarFlameSpeed
wmake $makeType chemistryModel
wmake $makeType barotropicCompressibilityModel
wmake $makeType thermalPorousZone
wmake $makeType SLGThermo
wmake $makeType solidSpecie

View File

@ -1,9 +0,0 @@
thermalPorousZone/thermalPorousZone.C
thermalPorousZone/thermalPorousZones.C
thermalModel/thermalModel/thermalModel.C
thermalModel/thermalModel/thermalModelNew.C
thermalModel/fixedTemperature/fixedTemperature.C
thermalModel/noThermalModel/noThermalModel.C
LIB = $(FOAM_LIBBIN)/libthermalPorousZone

View File

@ -1,9 +0,0 @@
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude
LIB_LIBS = \
-lfluidThermophysicalModels \
-lmeshTools \
-lfiniteVolume

View File

@ -1,91 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-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, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "fixedTemperature.H"
#include "addToRunTimeSelectionTable.H"
#include "fluidThermo.H"
#include "volFields.H"
#include "fvMatrices.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace porousMedia
{
defineTypeNameAndDebug(fixedTemperature, 0);
addToRunTimeSelectionTable
(
thermalModel,
fixedTemperature,
pZone
);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::porousMedia::fixedTemperature::fixedTemperature(const porousZone& pZone)
:
thermalModel(pZone),
T_(readScalar(thermalCoeffs_.lookup("T")))
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * //
Foam::porousMedia::fixedTemperature::~fixedTemperature()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::porousMedia::fixedTemperature::addEnergySource
(
const fluidThermo& thermo,
const volScalarField& rho,
fvScalarMatrix& hEqn
) const
{
const labelList& zones = pZone_.zoneIds();
if (zones.empty() || T_ < 0.0)
{
return;
}
const fvMesh& mesh = pZone_.mesh();
const scalarField T(hEqn.diag().size(), T_);
forAll(zones, zoneI)
{
const labelList& cells = mesh.cellZones()[zones[zoneI]];
hEqn.setValues(cells, thermo.he(thermo.p(), T, cells));
}
}
// ************************************************************************* //

View File

@ -1,102 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-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, see <http://www.gnu.org/licenses/>.
Class
Foam::porousMedia::fixedTemperature
Description
Fixed temperature model for porous media
\*---------------------------------------------------------------------------*/
#ifndef fixedTemperature_H
#define fixedTemperature_H
#include "thermalModel.H"
#include "runTimeSelectionTables.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace porousMedia
{
/*---------------------------------------------------------------------------*\
Class fixedTemperature Declaration
\*---------------------------------------------------------------------------*/
class fixedTemperature
:
public thermalModel
{
protected:
// Protected data
//- Fixed temperature
const scalar T_;
public:
//- Runtime type information
TypeName("fixedTemperature");
// Constructors
//- Construct from porous zone
fixedTemperature(const porousZone& pZone);
//- Destructor
virtual ~fixedTemperature();
// Member Functions
//- Add the thermal source to the enthalpy equation
virtual void addEnergySource
(
const fluidThermo&,
const volScalarField& rho,
fvScalarMatrix& hEqn
) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace porousMedia
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,77 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-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, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "noThermalModel.H"
#include "addToRunTimeSelectionTable.H"
#include "fluidThermo.H"
#include "volFields.H"
#include "fvMatrices.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace porousMedia
{
defineTypeNameAndDebug(noThermalModel, 0);
addToRunTimeSelectionTable
(
thermalModel,
noThermalModel,
pZone
);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::porousMedia::noThermalModel::noThermalModel(const porousZone& pZone)
:
thermalModel(pZone)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * //
Foam::porousMedia::noThermalModel::~noThermalModel()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::porousMedia::noThermalModel::addEnergySource
(
const fluidThermo&,
const volScalarField&,
fvScalarMatrix&
) const
{
// do nothing
}
// ************************************************************************* //

View File

@ -1,66 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 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 "thermalModel.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace porousMedia
{
defineTypeNameAndDebug(thermalModel, 0);
defineRunTimeSelectionTable(thermalModel, pZone);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::porousMedia::thermalModel::thermalModel(const porousZone& pZone)
:
pZone_(pZone),
thermalCoeffs_(pZone.dict().subDictPtr("thermalModel"))
{}
Foam::porousMedia::thermalModel::thermalModel
(
const porousZone& pZone,
const dictionary& thermalCoeffs
)
:
pZone_(pZone),
thermalCoeffs_(thermalCoeffs)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * //
Foam::porousMedia::thermalModel::~thermalModel()
{}
// ************************************************************************* //

View File

@ -1,129 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-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, see <http://www.gnu.org/licenses/>.
Class
Foam::porousMedia::thermalModel
Description
Base class to select the temperature specification models for porousMedia
\*---------------------------------------------------------------------------*/
#ifndef thermalModel_H
#define thermalModel_H
#include "porousZone.H"
#include "autoPtr.H"
#include "runTimeSelectionTables.H"
#include "volFieldsFwd.H"
#include "fvMatricesFwd.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of classes
class fluidThermo;
namespace porousMedia
{
/*---------------------------------------------------------------------------*\
Class thermalModel Declaration
\*---------------------------------------------------------------------------*/
class thermalModel
{
protected:
// Protected data
//- Reference to the porous zone
const porousZone& pZone_;
//- Thermal model coefficients dictionary
const dictionary thermalCoeffs_;
public:
//- Runtime type information
TypeName("thermalModel");
//- Declare runtime constructor selection table
declareRunTimeSelectionTable
(
autoPtr,
thermalModel,
pZone,
(
const porousZone& pZone
),
(pZone)
);
// Constructors
//- Construct from porous zone, coefficients from "thermalModel" entry
thermalModel(const porousZone&);
//- Construct from porous zone and thermal model coefficients
thermalModel(const porousZone&, const dictionary& thermalCoeffs);
//- Destructor
virtual ~thermalModel();
//- Selector
static autoPtr<thermalModel> New(const porousZone&);
// Member Functions
//- Add the thermal source to the enthalpy equation
virtual void addEnergySource
(
const fluidThermo&,
const volScalarField& rho,
fvScalarMatrix& hEqn
) const = 0;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace porousMedia
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

Some files were not shown because too many files have changed in this diff Show More