ENH: split of "jump" class and introduction of a porousBaffer BC

This commit is contained in:
sergio
2011-07-21 11:02:41 +01:00
parent 649c3e65ca
commit a6b54b07d8
12 changed files with 879 additions and 80 deletions

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -35,9 +35,8 @@ Foam::fanFvPatchField<Type>::fanFvPatchField
const DimensionedField<Type, volMesh>& iF
)
:
jumpCyclicFvPatchField<Type>(p, iF),
f_(0),
jump_(this->size(), 0.0)
fixedJumpFvPatchField<Type>(p, iF),
f_(0)
{}
@ -50,9 +49,8 @@ Foam::fanFvPatchField<Type>::fanFvPatchField
const fvPatchFieldMapper& mapper
)
:
jumpCyclicFvPatchField<Type>(ptf, p, iF, mapper),
f_(ptf.f_),
jump_(ptf.jump_, mapper)
fixedJumpFvPatchField<Type>(ptf, p, iF, mapper),
f_(ptf.f_)
{}
@ -64,9 +62,8 @@ Foam::fanFvPatchField<Type>::fanFvPatchField
const dictionary& dict
)
:
jumpCyclicFvPatchField<Type>(p, iF),
f_(),
jump_(this->size(), 0.0)
fixedJumpFvPatchField<Type>(p, iF),
f_()
{
{
Istream& is = dict.lookup("f");
@ -97,9 +94,8 @@ Foam::fanFvPatchField<Type>::fanFvPatchField
)
:
cyclicLduInterfaceField(),
jumpCyclicFvPatchField<Type>(ptf),
f_(ptf.f_),
jump_(ptf.jump_)
fixedJumpFvPatchField<Type>(ptf),
f_(ptf.f_)
{}
@ -110,45 +106,19 @@ Foam::fanFvPatchField<Type>::fanFvPatchField
const DimensionedField<Type, volMesh>& iF
)
:
jumpCyclicFvPatchField<Type>(ptf, iF),
f_(ptf.f_),
jump_(ptf.jump_)
fixedJumpFvPatchField<Type>(ptf, iF),
f_(ptf.f_)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
void Foam::fanFvPatchField<Type>::autoMap
(
const fvPatchFieldMapper& m
)
{
jumpCyclicFvPatchField<Type>::autoMap(m);
jump_.autoMap(m);
}
template<class Type>
void Foam::fanFvPatchField<Type>::rmap
(
const fvPatchField<Type>& ptf,
const labelList& addr
)
{
jumpCyclicFvPatchField<Type>::rmap(ptf, addr);
const fanFvPatchField<Type>& tiptf =
refCast<const fanFvPatchField<Type> >(ptf);
jump_.rmap(tiptf.jump_, addr);
}
template<class Type>
void Foam::fanFvPatchField<Type>::write(Ostream& os) const
{
fvPatchField<Type>::write(os);
os.writeKeyword("patchType") << "cyclic" << token::END_STATEMENT << nl;
fixedJumpFvPatchField<Type>::write(os);
IOstream::streamFormat fmt0 = os.format(IOstream::ASCII);
os.writeKeyword("f") << f_ << token::END_STATEMENT << nl;

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -35,7 +35,7 @@ SourceFiles
#ifndef fanFvPatchField_H
#define fanFvPatchField_H
#include "jumpCyclicFvPatchField.H"
#include "fixedJumpFvPatchField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -49,16 +49,13 @@ namespace Foam
template<class Type>
class fanFvPatchField
:
public jumpCyclicFvPatchField<Type>
public fixedJumpFvPatchField<Type>
{
// Private data
//- Fan pressure rise polynomial coefficients
List<scalar> f_;
//- "jump" field
Field<Type> jump_;
public:
@ -137,37 +134,6 @@ public:
return f_;
}
//- Return the "jump" across the patch.
virtual tmp<Field<Type> > jump() const
{
if (this->cyclicPatch().owner())
{
return jump_;
}
else
{
return refCast<const fanFvPatchField<Type> >
(
this->neighbourPatchField()
).jump();
}
}
// Mapping functions
//- Map (and resize as needed) from self given a mapping object
virtual void autoMap
(
const fvPatchFieldMapper&
);
//- Reverse map the given fvPatchField onto this fvPatchField
virtual void rmap
(
const fvPatchField<Type>&,
const labelList&
);
// Evaluation functions

View File

@ -0,0 +1,130 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd.
\\/ 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 "fixedJumpFvPatchField.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
Foam::fixedJumpFvPatchField<Type>::fixedJumpFvPatchField
(
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF
)
:
jumpCyclicFvPatchField<Type>(p, iF),
jump_(this->size(), pTraits<Type>::zero)
{}
template<class Type>
Foam::fixedJumpFvPatchField<Type>::fixedJumpFvPatchField
(
const fixedJumpFvPatchField<Type>& ptf,
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
jumpCyclicFvPatchField<Type>(ptf, p, iF, mapper),
jump_(ptf.jump_, mapper)
{}
template<class Type>
Foam::fixedJumpFvPatchField<Type>::fixedJumpFvPatchField
(
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF,
const dictionary& dict
)
:
jumpCyclicFvPatchField<Type>(p, iF),
jump_("jump", dict, p.size())
{}
template<class Type>
Foam::fixedJumpFvPatchField<Type>::fixedJumpFvPatchField
(
const fixedJumpFvPatchField<Type>& ptf
)
:
cyclicLduInterfaceField(),
jumpCyclicFvPatchField<Type>(ptf),
jump_(ptf.jump_)
{}
template<class Type>
Foam::fixedJumpFvPatchField<Type>::fixedJumpFvPatchField
(
const fixedJumpFvPatchField<Type>& ptf,
const DimensionedField<Type, volMesh>& iF
)
:
jumpCyclicFvPatchField<Type>(ptf, iF),
jump_(ptf.jump_)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
void Foam::fixedJumpFvPatchField<Type>::autoMap
(
const fvPatchFieldMapper& m
)
{
jumpCyclicFvPatchField<Type>::autoMap(m);
jump_.autoMap(m);
}
template<class Type>
void Foam::fixedJumpFvPatchField<Type>::rmap
(
const fvPatchField<Type>& ptf,
const labelList& addr
)
{
jumpCyclicFvPatchField<Type>::rmap(ptf, addr);
const fixedJumpFvPatchField<Type>& tiptf =
refCast<const fixedJumpFvPatchField<Type> >(ptf);
jump_.rmap(tiptf.jump_, addr);
}
template<class Type>
void Foam::fixedJumpFvPatchField<Type>::write(Ostream& os) const
{
fvPatchField<Type>::write(os);
os.writeKeyword("patchType") << "cyclic" << token::END_STATEMENT << nl;
jump_.writeEntry("jump", os);
}
// ************************************************************************* //

View File

@ -0,0 +1,184 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd.
\\/ 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::fixedJumpFvPatchField
Description
Base class for "jump" of a field<type>
SourceFiles
fixedJumpFvPatchField.C
\*---------------------------------------------------------------------------*/
#ifndef fixedJumpFvPatchField_H
#define fixedJumpFvPatchField_H
#include "jumpCyclicFvPatchField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class fixedJumpFvPatchField Declaration
\*---------------------------------------------------------------------------*/
template<class Type>
class fixedJumpFvPatchField
:
public jumpCyclicFvPatchField<Type>
{
protected:
// Protected data
//- "jump" field
Field<Type> jump_;
public:
// Constructors
//- Construct from patch and internal field
fixedJumpFvPatchField
(
const fvPatch&,
const DimensionedField<Type, volMesh>&
);
//- Construct from patch, internal field and dictionary
fixedJumpFvPatchField
(
const fvPatch&,
const DimensionedField<Type, volMesh>&,
const dictionary&
);
//- Construct by mapping given fixedJumpFvPatchField onto a
// new patch
fixedJumpFvPatchField
(
const fixedJumpFvPatchField<Type>&,
const fvPatch&,
const DimensionedField<Type, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
fixedJumpFvPatchField
(
const fixedJumpFvPatchField<Type>&
);
//- Construct and return a clone
virtual tmp<fvPatchField<Type> > clone() const
{
return tmp<fvPatchField<Type> >
(
new fixedJumpFvPatchField<Type>(*this)
);
}
//- Construct as copy setting internal field reference
fixedJumpFvPatchField
(
const fixedJumpFvPatchField<Type>&,
const DimensionedField<Type, volMesh>&
);
//- Construct and return a clone setting internal field reference
virtual tmp<fvPatchField<Type> > clone
(
const DimensionedField<Type, volMesh>& iF
) const
{
return tmp<fvPatchField<Type> >
(
new fixedJumpFvPatchField<Type>(*this, iF)
);
}
// Member functions
// Access
//- Return the "jump" across the patch.
virtual tmp<Field<Type> > jump() const
{
if (this->cyclicPatch().owner())
{
return jump_;
}
else
{
return refCast<const fixedJumpFvPatchField<Type> >
(
this->neighbourPatchField()
).jump();
}
}
// Mapping functions
//- Map (and resize as needed) from self given a mapping object
virtual void autoMap
(
const fvPatchFieldMapper&
);
//- Reverse map the given fvPatchField onto this fvPatchField
virtual void rmap
(
const fvPatchField<Type>&,
const labelList&
);
//- Write
virtual void write(Ostream&) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "fixedJumpFvPatchField.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,9 +1,11 @@
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
makeType=${1:-libso}
set -x
LES/Allwmake $*
incompressible/Allwmake $*
compressible/Allwmake $*
wmake $makeType derivedFvPatchFields
# ----------------------------------------------------------------- end-of-file

View File

@ -0,0 +1,3 @@
porousBafflePressure/porousBafflePressureFvPatchFields.C
LIB = $(FOAM_LIBBIN)/libturbulenceDerivedFvPatchFields

View File

@ -0,0 +1,16 @@
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/turbulenceModels \
-I$(LIB_SRC)/transportModels \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
-I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel
LIB_LIBS = \
-lfiniteVolume \
-lbasicThermophysicalModels \
-lspecie \
-lmeshTools \
-lcompressibleTurbulenceModel \
-lincompressibleTurbulenceModel

View File

@ -0,0 +1,132 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd.
\\/ 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 "porousBafflePressureFvPatchField.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
Foam::porousBafflePressureFvPatchField<Type>::porousBafflePressureFvPatchField
(
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF
)
:
fixedJumpFvPatchField<Type>(p, iF),
D_(0),
I_(0),
length_(0)
{}
template<class Type>
Foam::porousBafflePressureFvPatchField<Type>::porousBafflePressureFvPatchField
(
const porousBafflePressureFvPatchField<Type>& ptf,
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
fixedJumpFvPatchField<Type>(ptf, p, iF, mapper),
D_(ptf.D_),
I_(ptf.I_),
length_(ptf.length_)
{}
template<class Type>
Foam::porousBafflePressureFvPatchField<Type>::porousBafflePressureFvPatchField
(
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF,
const dictionary& dict
)
:
fixedJumpFvPatchField<Type>(p, iF),
D_(readScalar(dict.lookup("D"))),
I_(readScalar(dict.lookup("I"))),
length_(readScalar(dict.lookup("length")))
{
if (dict.found("value"))
{
fvPatchField<Type>::operator=
(
Field<Type>("value", dict, p.size())
);
}
else
{
this->evaluate(Pstream::blocking);
}
}
template<class Type>
Foam::porousBafflePressureFvPatchField<Type>::porousBafflePressureFvPatchField
(
const porousBafflePressureFvPatchField<Type>& ptf
)
:
cyclicLduInterfaceField(),
fixedJumpFvPatchField<Type>(ptf),
D_(ptf.D_),
I_(ptf.I_),
length_(ptf.length_)
{}
template<class Type>
Foam::porousBafflePressureFvPatchField<Type>::porousBafflePressureFvPatchField
(
const porousBafflePressureFvPatchField<Type>& ptf,
const DimensionedField<Type, volMesh>& iF
)
:
fixedJumpFvPatchField<Type>(ptf, iF),
D_(ptf.D_),
I_(ptf.I_),
length_(ptf.length_)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
void Foam::porousBafflePressureFvPatchField<Type>::write(Ostream& os) const
{
fixedJumpFvPatchField<Type>::write(os);
os.writeKeyword("D") << D_ << token::END_STATEMENT << nl;
os.writeKeyword("I") << I_ << token::END_STATEMENT << nl;
os.writeKeyword("length") << length_ << token::END_STATEMENT << nl;
this->writeEntry("value", os);
}
// ************************************************************************* //

View File

@ -0,0 +1,177 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd.
\\/ 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::porousBafflePressureFvPatchField
Description
Foam::porousBafflePressureFvPatchField
the porous baffle operates on a cyclic patch and introduce a jump on the p
field as follow:
deltaP = -(I*mu*U + 0.5*D*rho*magSqr(U)*L)
where:
I is the inertial coefficient
D is the darcy coeafficient
L is the porous media lenght in the flow direction
SourceFiles
porousBafflePressureFvPatchField.C
\*---------------------------------------------------------------------------*/
#ifndef porousBafflePressureFvPatchField_H
#define porousBafflePressureFvPatchField_H
#include "fixedJumpFvPatchField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class porousBafflePressureFvPatchField Declaration
\*---------------------------------------------------------------------------*/
template<class Type>
class porousBafflePressureFvPatchField
:
public fixedJumpFvPatchField<Type>
{
// Private data
//- Darcy pressure lost coefficient
scalar D_;
//- Inertia pressure lost coefficient
scalar I_;
//- Porous media length
scalar length_;
public:
//- Runtime type information
TypeName("porousBafflePressure");
// Constructors
//- Construct from patch and internal field
porousBafflePressureFvPatchField
(
const fvPatch&,
const DimensionedField<Type, volMesh>&
);
//- Construct from patch, internal field and dictionary
porousBafflePressureFvPatchField
(
const fvPatch&,
const DimensionedField<Type, volMesh>&,
const dictionary&
);
//- Construct by mapping given porousBafflePressureFvPatchField
// onto a new patch
porousBafflePressureFvPatchField
(
const porousBafflePressureFvPatchField<Type>&,
const fvPatch&,
const DimensionedField<Type, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
porousBafflePressureFvPatchField
(
const porousBafflePressureFvPatchField<Type>&
);
//- Construct and return a clone
virtual tmp<fvPatchField<Type> > clone() const
{
return tmp<fvPatchField<Type> >
(
new porousBafflePressureFvPatchField<Type>(*this)
);
}
//- Construct as copy setting internal field reference
porousBafflePressureFvPatchField
(
const porousBafflePressureFvPatchField<Type>&,
const DimensionedField<Type, volMesh>&
);
//- Construct and return a clone setting internal field reference
virtual tmp<fvPatchField<Type> > clone
(
const DimensionedField<Type, volMesh>& iF
) const
{
return tmp<fvPatchField<Type> >
(
new porousBafflePressureFvPatchField<Type>(*this, iF)
);
}
// Member functions
// Evaluation functions
//- Update the coefficients associated with the patch field
virtual void updateCoeffs();
//- Write
virtual void write(Ostream&) const;
};
//- Specialisation of the jump-condition for the pressure
template<>
void porousBafflePressureFvPatchField<scalar>::updateCoeffs();
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "porousBafflePressureFvPatchField.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,50 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd.
\\/ 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/>.
\*---------------------------------------------------------------------------*/
#ifndef porousBafflePressureFvPatchFieldsFwd_H
#define porousBafflePressureFvPatchFieldsFwd_H
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Type> class porousBafflePressureFvPatchField;
makePatchTypeFieldTypedefs(porousBafflePressure);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,119 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd.
\\/ 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 "porousBafflePressureFvPatchFields.H"
#include "addToRunTimeSelectionTable.H"
#include "volFields.H"
#include "surfaceFields.H"
#include "compressible/turbulenceModel/turbulenceModel.H"
#include "incompressible/turbulenceModel/turbulenceModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
makeTemplatePatchTypeField
(
fvPatchScalarField,
porousBafflePressureFvPatchScalarField
);
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
//- Specialisation of the jump-condition for the pressure
template<>
void Foam::porousBafflePressureFvPatchField<Foam::scalar>::updateCoeffs()
{
if (updated())
{
return;
}
const label patchI = patch().index();
const surfaceScalarField& phi =
db().lookupObject<surfaceScalarField>("phi");
const fvsPatchField<scalar>& phip =
patch().patchField<surfaceScalarField, scalar>(phi);
scalarField Un(phip/patch().magSf());
if (phi.dimensions() == dimensionSet(0, 3, -1, 0, 0))
{
const incompressible::turbulenceModel& model =
db().lookupObject<incompressible::turbulenceModel>
(
"turbulenceModel"
);
const scalarField nuEffw = model.nuEff()().boundaryField()[patchI];
jump_ = -(I_*nuEffw*mag(Un) + D_*0.5*magSqr(Un)*length_);
}
else
{
const compressible::turbulenceModel& model =
db().lookupObject<compressible::turbulenceModel>
(
"turbulenceModel"
);
const scalarField muEffw = model.muEff()().boundaryField()[patchI];
const scalarField rhow =
patch().lookupPatchField<volScalarField, scalar>("rho");
Un /= rhow;
jump_ = -(I_*muEffw*mag(Un) + D_*0.5*rhow*magSqr(Un)*length_);
}
if (debug)
{
scalar avePressureJump = gAverage(jump_);
scalar aveVelocity = gAverage(mag(Un));
Info<< patch().boundaryMesh().mesh().name() << ':'
<< patch().name() << ':'
<< " Average pressure drop :" << avePressureJump
<< " Average velocity :" << aveVelocity
<< endl;
}
jumpCyclicFvPatchField<scalar>::updateCoeffs();
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,50 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd.
\\/ 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/>.
\*---------------------------------------------------------------------------*/
#ifndef porousBafflePressureFvPatchFields_H
#define porousBafflePressureFvPatchFields_H
#include "porousBafflePressureFvPatchField.H"
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeFieldTypedefs(porousBafflePressure);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //