diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchField.C index 048e19497f..6c1e1d309a 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchField.C @@ -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::fanFvPatchField const DimensionedField& iF ) : - jumpCyclicFvPatchField(p, iF), - f_(0), - jump_(this->size(), 0.0) + fixedJumpFvPatchField(p, iF), + f_(0) {} @@ -50,9 +49,8 @@ Foam::fanFvPatchField::fanFvPatchField const fvPatchFieldMapper& mapper ) : - jumpCyclicFvPatchField(ptf, p, iF, mapper), - f_(ptf.f_), - jump_(ptf.jump_, mapper) + fixedJumpFvPatchField(ptf, p, iF, mapper), + f_(ptf.f_) {} @@ -64,9 +62,8 @@ Foam::fanFvPatchField::fanFvPatchField const dictionary& dict ) : - jumpCyclicFvPatchField(p, iF), - f_(), - jump_(this->size(), 0.0) + fixedJumpFvPatchField(p, iF), + f_() { { Istream& is = dict.lookup("f"); @@ -97,9 +94,8 @@ Foam::fanFvPatchField::fanFvPatchField ) : cyclicLduInterfaceField(), - jumpCyclicFvPatchField(ptf), - f_(ptf.f_), - jump_(ptf.jump_) + fixedJumpFvPatchField(ptf), + f_(ptf.f_) {} @@ -110,45 +106,19 @@ Foam::fanFvPatchField::fanFvPatchField const DimensionedField& iF ) : - jumpCyclicFvPatchField(ptf, iF), - f_(ptf.f_), - jump_(ptf.jump_) + fixedJumpFvPatchField(ptf, iF), + f_(ptf.f_) {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -template -void Foam::fanFvPatchField::autoMap -( - const fvPatchFieldMapper& m -) -{ - jumpCyclicFvPatchField::autoMap(m); - jump_.autoMap(m); -} - - -template -void Foam::fanFvPatchField::rmap -( - const fvPatchField& ptf, - const labelList& addr -) -{ - jumpCyclicFvPatchField::rmap(ptf, addr); - - const fanFvPatchField& tiptf = - refCast >(ptf); - jump_.rmap(tiptf.jump_, addr); -} - template void Foam::fanFvPatchField::write(Ostream& os) const { - fvPatchField::write(os); - os.writeKeyword("patchType") << "cyclic" << token::END_STATEMENT << nl; + + fixedJumpFvPatchField::write(os); IOstream::streamFormat fmt0 = os.format(IOstream::ASCII); os.writeKeyword("f") << f_ << token::END_STATEMENT << nl; diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchField.H index 9be8b5b6d9..aec3f75e55 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchField.H @@ -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 fanFvPatchField : - public jumpCyclicFvPatchField + public fixedJumpFvPatchField { // Private data //- Fan pressure rise polynomial coefficients List f_; - //- "jump" field - Field jump_; - public: @@ -137,37 +134,6 @@ public: return f_; } - //- Return the "jump" across the patch. - virtual tmp > jump() const - { - if (this->cyclicPatch().owner()) - { - return jump_; - } - else - { - return refCast > - ( - 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&, - const labelList& - ); // Evaluation functions diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fixedJump/fixedJumpFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/fixedJump/fixedJumpFvPatchField.C new file mode 100644 index 0000000000..59d8bdfb94 --- /dev/null +++ b/src/finiteVolume/fields/fvPatchFields/derived/fixedJump/fixedJumpFvPatchField.C @@ -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 . + +\*---------------------------------------------------------------------------*/ + +#include "fixedJumpFvPatchField.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +Foam::fixedJumpFvPatchField::fixedJumpFvPatchField +( + const fvPatch& p, + const DimensionedField& iF +) +: + jumpCyclicFvPatchField(p, iF), + jump_(this->size(), pTraits::zero) +{} + + +template +Foam::fixedJumpFvPatchField::fixedJumpFvPatchField +( + const fixedJumpFvPatchField& ptf, + const fvPatch& p, + const DimensionedField& iF, + const fvPatchFieldMapper& mapper +) +: + jumpCyclicFvPatchField(ptf, p, iF, mapper), + jump_(ptf.jump_, mapper) +{} + + +template +Foam::fixedJumpFvPatchField::fixedJumpFvPatchField +( + const fvPatch& p, + const DimensionedField& iF, + const dictionary& dict +) +: + jumpCyclicFvPatchField(p, iF), + jump_("jump", dict, p.size()) +{} + + +template +Foam::fixedJumpFvPatchField::fixedJumpFvPatchField +( + const fixedJumpFvPatchField& ptf +) +: + cyclicLduInterfaceField(), + jumpCyclicFvPatchField(ptf), + jump_(ptf.jump_) +{} + + +template +Foam::fixedJumpFvPatchField::fixedJumpFvPatchField +( + const fixedJumpFvPatchField& ptf, + const DimensionedField& iF +) +: + jumpCyclicFvPatchField(ptf, iF), + jump_(ptf.jump_) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +void Foam::fixedJumpFvPatchField::autoMap +( + const fvPatchFieldMapper& m +) +{ + jumpCyclicFvPatchField::autoMap(m); + jump_.autoMap(m); +} + + +template +void Foam::fixedJumpFvPatchField::rmap +( + const fvPatchField& ptf, + const labelList& addr +) +{ + jumpCyclicFvPatchField::rmap(ptf, addr); + + const fixedJumpFvPatchField& tiptf = + refCast >(ptf); + jump_.rmap(tiptf.jump_, addr); +} + + +template +void Foam::fixedJumpFvPatchField::write(Ostream& os) const +{ + fvPatchField::write(os); + os.writeKeyword("patchType") << "cyclic" << token::END_STATEMENT << nl; + jump_.writeEntry("jump", os); +} + + +// ************************************************************************* // diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fixedJump/fixedJumpFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/derived/fixedJump/fixedJumpFvPatchField.H new file mode 100644 index 0000000000..e192e190b4 --- /dev/null +++ b/src/finiteVolume/fields/fvPatchFields/derived/fixedJump/fixedJumpFvPatchField.H @@ -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 . + +Class + Foam::fixedJumpFvPatchField + +Description + Base class for "jump" of a field + +SourceFiles + fixedJumpFvPatchField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef fixedJumpFvPatchField_H +#define fixedJumpFvPatchField_H + +#include "jumpCyclicFvPatchField.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class fixedJumpFvPatchField Declaration +\*---------------------------------------------------------------------------*/ + +template +class fixedJumpFvPatchField +: + public jumpCyclicFvPatchField +{ + +protected: + + // Protected data + + //- "jump" field + Field jump_; + + +public: + + + // Constructors + + //- Construct from patch and internal field + fixedJumpFvPatchField + ( + const fvPatch&, + const DimensionedField& + ); + + //- Construct from patch, internal field and dictionary + fixedJumpFvPatchField + ( + const fvPatch&, + const DimensionedField&, + const dictionary& + ); + + //- Construct by mapping given fixedJumpFvPatchField onto a + // new patch + fixedJumpFvPatchField + ( + const fixedJumpFvPatchField&, + const fvPatch&, + const DimensionedField&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + fixedJumpFvPatchField + ( + const fixedJumpFvPatchField& + ); + + //- Construct and return a clone + virtual tmp > clone() const + { + return tmp > + ( + new fixedJumpFvPatchField(*this) + ); + } + + //- Construct as copy setting internal field reference + fixedJumpFvPatchField + ( + const fixedJumpFvPatchField&, + const DimensionedField& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp > clone + ( + const DimensionedField& iF + ) const + { + return tmp > + ( + new fixedJumpFvPatchField(*this, iF) + ); + } + + + // Member functions + + // Access + + //- Return the "jump" across the patch. + virtual tmp > jump() const + { + if (this->cyclicPatch().owner()) + { + return jump_; + } + else + { + return refCast > + ( + 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&, + const labelList& + ); + + + //- Write + virtual void write(Ostream&) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "fixedJumpFvPatchField.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/turbulenceModels/Allwmake b/src/turbulenceModels/Allwmake index e78f0c30dd..3cba27ed1c 100755 --- a/src/turbulenceModels/Allwmake +++ b/src/turbulenceModels/Allwmake @@ -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 diff --git a/src/turbulenceModels/derivedFvPatchFields/Make/files b/src/turbulenceModels/derivedFvPatchFields/Make/files new file mode 100644 index 0000000000..360b593edb --- /dev/null +++ b/src/turbulenceModels/derivedFvPatchFields/Make/files @@ -0,0 +1,3 @@ +porousBafflePressure/porousBafflePressureFvPatchFields.C + +LIB = $(FOAM_LIBBIN)/libturbulenceDerivedFvPatchFields diff --git a/src/turbulenceModels/derivedFvPatchFields/Make/options b/src/turbulenceModels/derivedFvPatchFields/Make/options new file mode 100644 index 0000000000..7e9faff242 --- /dev/null +++ b/src/turbulenceModels/derivedFvPatchFields/Make/options @@ -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 diff --git a/src/turbulenceModels/derivedFvPatchFields/porousBafflePressure/porousBafflePressureFvPatchField.C b/src/turbulenceModels/derivedFvPatchFields/porousBafflePressure/porousBafflePressureFvPatchField.C new file mode 100644 index 0000000000..a89154d606 --- /dev/null +++ b/src/turbulenceModels/derivedFvPatchFields/porousBafflePressure/porousBafflePressureFvPatchField.C @@ -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 . + +\*---------------------------------------------------------------------------*/ + +#include "porousBafflePressureFvPatchField.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +Foam::porousBafflePressureFvPatchField::porousBafflePressureFvPatchField +( + const fvPatch& p, + const DimensionedField& iF +) +: + fixedJumpFvPatchField(p, iF), + D_(0), + I_(0), + length_(0) +{} + + +template +Foam::porousBafflePressureFvPatchField::porousBafflePressureFvPatchField +( + const porousBafflePressureFvPatchField& ptf, + const fvPatch& p, + const DimensionedField& iF, + const fvPatchFieldMapper& mapper +) +: + fixedJumpFvPatchField(ptf, p, iF, mapper), + D_(ptf.D_), + I_(ptf.I_), + length_(ptf.length_) +{} + + +template +Foam::porousBafflePressureFvPatchField::porousBafflePressureFvPatchField +( + const fvPatch& p, + const DimensionedField& iF, + const dictionary& dict +) +: + fixedJumpFvPatchField(p, iF), + D_(readScalar(dict.lookup("D"))), + I_(readScalar(dict.lookup("I"))), + length_(readScalar(dict.lookup("length"))) +{ + if (dict.found("value")) + { + fvPatchField::operator= + ( + Field("value", dict, p.size()) + ); + } + else + { + this->evaluate(Pstream::blocking); + } +} + + +template +Foam::porousBafflePressureFvPatchField::porousBafflePressureFvPatchField +( + const porousBafflePressureFvPatchField& ptf +) +: + cyclicLduInterfaceField(), + fixedJumpFvPatchField(ptf), + D_(ptf.D_), + I_(ptf.I_), + length_(ptf.length_) +{} + + +template +Foam::porousBafflePressureFvPatchField::porousBafflePressureFvPatchField +( + const porousBafflePressureFvPatchField& ptf, + const DimensionedField& iF +) +: + fixedJumpFvPatchField(ptf, iF), + D_(ptf.D_), + I_(ptf.I_), + length_(ptf.length_) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + + +template +void Foam::porousBafflePressureFvPatchField::write(Ostream& os) const +{ + + fixedJumpFvPatchField::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); +} + + +// ************************************************************************* // diff --git a/src/turbulenceModels/derivedFvPatchFields/porousBafflePressure/porousBafflePressureFvPatchField.H b/src/turbulenceModels/derivedFvPatchFields/porousBafflePressure/porousBafflePressureFvPatchField.H new file mode 100644 index 0000000000..a44e9c1ae9 --- /dev/null +++ b/src/turbulenceModels/derivedFvPatchFields/porousBafflePressure/porousBafflePressureFvPatchField.H @@ -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 . + +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 porousBafflePressureFvPatchField +: + public fixedJumpFvPatchField +{ + // 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& + ); + + //- Construct from patch, internal field and dictionary + porousBafflePressureFvPatchField + ( + const fvPatch&, + const DimensionedField&, + const dictionary& + ); + + //- Construct by mapping given porousBafflePressureFvPatchField + // onto a new patch + porousBafflePressureFvPatchField + ( + const porousBafflePressureFvPatchField&, + const fvPatch&, + const DimensionedField&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + porousBafflePressureFvPatchField + ( + const porousBafflePressureFvPatchField& + ); + + //- Construct and return a clone + virtual tmp > clone() const + { + return tmp > + ( + new porousBafflePressureFvPatchField(*this) + ); + } + + //- Construct as copy setting internal field reference + porousBafflePressureFvPatchField + ( + const porousBafflePressureFvPatchField&, + const DimensionedField& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp > clone + ( + const DimensionedField& iF + ) const + { + return tmp > + ( + new porousBafflePressureFvPatchField(*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::updateCoeffs(); + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "porousBafflePressureFvPatchField.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/turbulenceModels/derivedFvPatchFields/porousBafflePressure/porousBafflePressureFvPatchFieldFwd.H b/src/turbulenceModels/derivedFvPatchFields/porousBafflePressure/porousBafflePressureFvPatchFieldFwd.H new file mode 100644 index 0000000000..57c8c3f1ab --- /dev/null +++ b/src/turbulenceModels/derivedFvPatchFields/porousBafflePressure/porousBafflePressureFvPatchFieldFwd.H @@ -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 . + +\*---------------------------------------------------------------------------*/ + +#ifndef porousBafflePressureFvPatchFieldsFwd_H +#define porousBafflePressureFvPatchFieldsFwd_H + +#include "fieldTypes.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +template class porousBafflePressureFvPatchField; + +makePatchTypeFieldTypedefs(porousBafflePressure); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/turbulenceModels/derivedFvPatchFields/porousBafflePressure/porousBafflePressureFvPatchFields.C b/src/turbulenceModels/derivedFvPatchFields/porousBafflePressure/porousBafflePressureFvPatchFields.C new file mode 100644 index 0000000000..f82551589d --- /dev/null +++ b/src/turbulenceModels/derivedFvPatchFields/porousBafflePressure/porousBafflePressureFvPatchFields.C @@ -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 . + +\*---------------------------------------------------------------------------*/ + +#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::updateCoeffs() +{ + if (updated()) + { + return; + } + + const label patchI = patch().index(); + + const surfaceScalarField& phi = + db().lookupObject("phi"); + + const fvsPatchField& phip = + patch().patchField(phi); + + scalarField Un(phip/patch().magSf()); + + if (phi.dimensions() == dimensionSet(0, 3, -1, 0, 0)) + { + const incompressible::turbulenceModel& model = + db().lookupObject + ( + "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 + ( + "turbulenceModel" + ); + + const scalarField muEffw = model.muEff()().boundaryField()[patchI]; + + const scalarField rhow = + patch().lookupPatchField("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::updateCoeffs(); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/turbulenceModels/derivedFvPatchFields/porousBafflePressure/porousBafflePressureFvPatchFields.H b/src/turbulenceModels/derivedFvPatchFields/porousBafflePressure/porousBafflePressureFvPatchFields.H new file mode 100644 index 0000000000..b06bf1f6e4 --- /dev/null +++ b/src/turbulenceModels/derivedFvPatchFields/porousBafflePressure/porousBafflePressureFvPatchFields.H @@ -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 . + +\*---------------------------------------------------------------------------*/ + +#ifndef porousBafflePressureFvPatchFields_H +#define porousBafflePressureFvPatchFields_H + +#include "porousBafflePressureFvPatchField.H" +#include "fieldTypes.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + + +makePatchTypeFieldTypedefs(porousBafflePressure); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* //