ENH: Updated and restructured film models

- separated out the geometry handling into the 'regionModels' library
- regionModels currently includes single layer and 1-D regions
- surface film modelling over-hauled
This commit is contained in:
andy
2011-01-26 12:21:09 +00:00
parent d404293a6f
commit 101285018b
95 changed files with 13964 additions and 1 deletions

View File

@ -58,7 +58,7 @@ wmake libso randomProcesses
thermophysicalModels/Allwmake
transportModels/Allwmake
turbulenceModels/Allwmake
wmake libso surfaceFilmModels
regionModels/Allwmake
lagrangian/Allwmake
postProcessing/Allwmake
mesh/Allwmake

11
src/regionModels/Allwmake Executable file
View File

@ -0,0 +1,11 @@
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
set -x
wmake libso regionModel
#wmake libso pyrolysisModels
wmake libso surfaceFilmModels
#wmake libso regionCoupling
# ----------------------------------------------------------------- end-of-file

View File

@ -0,0 +1,14 @@
/* Region models */
regionModel/regionModel.C
singleLayerRegion/singleLayerRegion.C
regionModel1D/regionModel1D.C
/* Boundary conditions */
derivedFvPatchFields/directMappedField/directMappedFieldFvPatchFields.C
derivedFvPatchFields/directMappedFixedInternalValue/directMappedFixedInternalValueFvPatchFields.C
derivedFvPatchFields/directMappedFixedPushedInternalValue/directMappedFixedPushedInternalValueFvPatchFields.C
derivedFvPatchFields/directMappedNamedFixedValue/directMappedNamedFixedValueFvPatchFields.C
LIB = $(FOAM_LIBBIN)/libregionModels

View File

@ -0,0 +1,7 @@
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude
EXE_LIBS = \
-lfiniteVolume \
-lmeshTools

View File

@ -0,0 +1,313 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 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 "directMappedFieldFvPatchField.H"
#include "volFields.H"
#include "interpolationCell.H"
#include "mapDistribute.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
directMappedFieldFvPatchField<Type>::directMappedFieldFvPatchField
(
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF
)
:
directMappedPatchBase(p.patch()),
fixedValueFvPatchField<Type>(p, iF),
fieldName_(iF.name()),
setAverage_(false),
average_(pTraits<Type>::zero)
{}
template<class Type>
directMappedFieldFvPatchField<Type>::directMappedFieldFvPatchField
(
const directMappedFieldFvPatchField<Type>& ptf,
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
directMappedPatchBase(p.patch(), ptf),
fixedValueFvPatchField<Type>(ptf, p, iF, mapper),
fieldName_(ptf.fieldName_),
setAverage_(ptf.setAverage_),
average_(ptf.average_)
{}
template<class Type>
directMappedFieldFvPatchField<Type>::directMappedFieldFvPatchField
(
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF,
const dictionary& dict
)
:
directMappedPatchBase(p.patch(), dict),
fixedValueFvPatchField<Type>(p, iF, dict),
fieldName_(dict.template lookupOrDefault<word>("fieldName", iF.name())),
setAverage_(readBool(dict.lookup("setAverage"))),
average_(pTraits<Type>(dict.lookup("average")))
{}
template<class Type>
directMappedFieldFvPatchField<Type>::directMappedFieldFvPatchField
(
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF,
// directMappedPatchBase
const word& sampleRegion,
const sampleMode sampleMode,
const word& samplePatch,
const scalar distance,
// My settings
const word& fieldName,
const bool setAverage,
const Type average
)
:
directMappedPatchBase
(
p.patch(),
sampleRegion,
sampleMode,
samplePatch,
distance
),
fixedValueFvPatchField<Type>(p, iF),
fieldName_(fieldName),
setAverage_(setAverage),
average_(average)
{}
template<class Type>
directMappedFieldFvPatchField<Type>::directMappedFieldFvPatchField
(
const directMappedFieldFvPatchField<Type>& ptf
)
:
directMappedPatchBase(ptf.patch().patch(), ptf),
fixedValueFvPatchField<Type>(ptf),
fieldName_(ptf.fieldName_),
setAverage_(ptf.setAverage_),
average_(ptf.average_)
{}
template<class Type>
directMappedFieldFvPatchField<Type>::directMappedFieldFvPatchField
(
const directMappedFieldFvPatchField<Type>& ptf,
const DimensionedField<Type, volMesh>& iF
)
:
directMappedPatchBase(ptf.patch().patch(), ptf),
fixedValueFvPatchField<Type>(ptf, iF),
fieldName_(ptf.fieldName_),
setAverage_(ptf.setAverage_),
average_(ptf.average_)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
const GeometricField<Type, fvPatchField, volMesh>&
directMappedFieldFvPatchField<Type>::sampleField() const
{
typedef GeometricField<Type, fvPatchField, volMesh> fieldType;
const fvMesh& nbrMesh = refCast<const fvMesh>(sampleMesh());
if (sameRegion())
{
if (fieldName_ == this->dimensionedInternalField().name())
{
// Optimisation: bypass field lookup
return
dynamic_cast<const fieldType&>
(
this->dimensionedInternalField()
);
}
else
{
const fvMesh& thisMesh = this->patch().boundaryMesh().mesh();
return thisMesh.template lookupObject<fieldType>(fieldName_);
}
}
else
{
return nbrMesh.template lookupObject<fieldType>(fieldName_);
}
}
template<class Type>
void directMappedFieldFvPatchField<Type>::updateCoeffs()
{
if (this->updated())
{
return;
}
typedef GeometricField<Type, fvPatchField, volMesh> fieldType;
const fvMesh& nbrMesh = refCast<const fvMesh>(sampleMesh());
const mapDistribute& distMap = directMappedPatchBase::map();
// Result of obtaining remote values
Field<Type> newValues;
switch (mode())
{
case NEARESTCELL:
{
newValues = sampleField();
distMap.distribute(newValues);
break;
}
case NEARESTPATCHFACE:
{
const label nbrPatchID = nbrMesh.boundaryMesh().findPatchID
(
samplePatch()
);
if (nbrPatchID < 0)
{
FatalErrorIn
(
"void directMappedFieldFvPatchField<Type>::updateCoeffs()"
)<< "Unable to find sample patch " << samplePatch()
<< " in region " << sampleRegion()
<< " for patch " << this->patch().name() << nl
<< abort(FatalError);
}
const fieldType& nbrField = sampleField();
newValues = nbrField.boundaryField()[nbrPatchID];
distMap.distribute(newValues);
break;
}
case NEARESTFACE:
{
Field<Type> allValues(nbrMesh.nFaces(), pTraits<Type>::zero);
const fieldType& nbrField = sampleField();
forAll(nbrField.boundaryField(), patchI)
{
const fvPatchField<Type>& pf =
nbrField.boundaryField()[patchI];
label faceStart = pf.patch().patch().start();
forAll(pf, faceI)
{
allValues[faceStart++] = pf[faceI];
}
}
distMap.distribute(allValues);
newValues.transfer(allValues);
break;
}
default:
{
FatalErrorIn("directMappedFieldFvPatchField<Type>::updateCoeffs()")
<< "Unknown sampling mode: " << mode()
<< nl << abort(FatalError);
}
}
if (setAverage_)
{
Type averagePsi =
gSum(this->patch().magSf()*newValues)
/gSum(this->patch().magSf());
if (mag(averagePsi)/mag(average_) > 0.5)
{
newValues *= mag(average_)/mag(averagePsi);
}
else
{
newValues += (average_ - averagePsi);
}
}
this->operator==(newValues);
if (debug)
{
Info<< "operating on field:" << this->dimensionedInternalField().name()
<< " patch:" << this->patch().name()
<< " avg:" << gAverage(*this)
<< " min:" << gMin(*this)
<< " max:" << gMax(*this)
<< endl;
}
fixedValueFvPatchField<Type>::updateCoeffs();
}
template<class Type>
void directMappedFieldFvPatchField<Type>::write(Ostream& os) const
{
fvPatchField<Type>::write(os);
directMappedPatchBase::write(os);
os.writeKeyword("fieldName") << fieldName_ << token::END_STATEMENT << nl;
os.writeKeyword("setAverage") << setAverage_ << token::END_STATEMENT << nl;
os.writeKeyword("average") << average_ << token::END_STATEMENT << nl;
this->writeEntry("value", os);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,201 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 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::directMappedFieldFvPatchField
Description
Self-contained version of directMapped. Does not use information on
patch, instead holds it locally (and possibly duplicate) so use
normal directMapped in preference and only use this if you cannot
change the underlying patch type to directMapped.
SourceFiles
directMappedFieldFvPatchField.C
\*---------------------------------------------------------------------------*/
#ifndef directMappedFieldFvPatchField_H
#define directMappedFieldFvPatchField_H
#include "directMappedPatchBase.H"
#include "fixedValueFvPatchFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class directMappedFieldFvPatchField Declaration
\*---------------------------------------------------------------------------*/
template<class Type>
class directMappedFieldFvPatchField
:
public directMappedPatchBase,
public fixedValueFvPatchField<Type>
{
// Private data
//- Name of field to sample - defaults to field associated with this
// patchField if not specified
word fieldName_;
//- If true adjust the mapped field to maintain average value average_
const bool setAverage_;
//- Average value the mapped field is adjusted to maintain if
// setAverage_ is set true
const Type average_;
// Private Member Functions
//- Field to sample. Either on my or nbr mesh
const GeometricField<Type, fvPatchField, volMesh>& sampleField() const;
public:
//- Runtime type information
TypeName("directMappedField");
// Constructors
//- Construct from patch and internal field
directMappedFieldFvPatchField
(
const fvPatch&,
const DimensionedField<Type, volMesh>&
);
//- Construct from patch, internal field and dictionary
directMappedFieldFvPatchField
(
const fvPatch&,
const DimensionedField<Type, volMesh>&,
const dictionary&
);
//- Construct from patch, internal field and distance for normal type
// sampling
directMappedFieldFvPatchField
(
const fvPatch&,
const DimensionedField<Type, volMesh>&,
// directMappedPatchBase
const word& sampleRegion,
const sampleMode sampleMode,
const word& samplePatch,
const scalar distance,
// My settings
const word& fieldName,
const bool setAverage,
const Type average
);
//- Construct by mapping given
// directMappedFieldFvPatchField
// onto a new patch
directMappedFieldFvPatchField
(
const directMappedFieldFvPatchField<Type>&,
const fvPatch&,
const DimensionedField<Type, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
directMappedFieldFvPatchField
(
const directMappedFieldFvPatchField<Type>&
);
//- Construct and return a clone
virtual tmp<fvPatchField<Type> > clone() const
{
return tmp<fvPatchField<Type> >
(
new directMappedFieldFvPatchField<Type>
(
*this
)
);
}
//- Construct as copy setting internal field reference
directMappedFieldFvPatchField
(
const directMappedFieldFvPatchField<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 directMappedFieldFvPatchField<Type>
(
*this,
iF
)
);
}
// Member functions
// Evaluation functions
//- Update the coefficients associated with the patch field
virtual void updateCoeffs();
//- Write
virtual void write(Ostream&) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "directMappedFieldFvPatchField.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,43 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 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 "directMappedFieldFvPatchFields.H"
#include "volMesh.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
makePatchFields(directMappedField);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,49 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 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 directMappedFieldFvPatchFields_H
#define directMappedFieldFvPatchFields_H
#include "directMappedFieldFvPatchField.H"
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeFieldTypedefs(directMappedField)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

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

View File

@ -0,0 +1,157 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-2010 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 2 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 "directMappedFixedInternalValueFvPatchField.H"
#include "UIndirectList.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
Foam::directMappedFixedInternalValueFvPatchField<Type>::
directMappedFixedInternalValueFvPatchField
(
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF
)
:
directMappedFixedValueFvPatchField<Type>(p, iF)
{}
template<class Type>
Foam::directMappedFixedInternalValueFvPatchField<Type>::
directMappedFixedInternalValueFvPatchField
(
const directMappedFixedInternalValueFvPatchField<Type>& ptf,
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
directMappedFixedValueFvPatchField<Type>(ptf, p, iF, mapper)
{}
template<class Type>
Foam::directMappedFixedInternalValueFvPatchField<Type>::
directMappedFixedInternalValueFvPatchField
(
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF,
const dictionary& dict
)
:
directMappedFixedValueFvPatchField<Type>(p, iF, dict)
{}
template<class Type>
Foam::directMappedFixedInternalValueFvPatchField<Type>::
directMappedFixedInternalValueFvPatchField
(
const directMappedFixedInternalValueFvPatchField<Type>& ptf
)
:
directMappedFixedValueFvPatchField<Type>(ptf)
{}
template<class Type>
Foam::directMappedFixedInternalValueFvPatchField<Type>::
directMappedFixedInternalValueFvPatchField
(
const directMappedFixedInternalValueFvPatchField<Type>& ptf,
const DimensionedField<Type, volMesh>& iF
)
:
directMappedFixedValueFvPatchField<Type>(ptf, iF)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
void Foam::directMappedFixedInternalValueFvPatchField<Type>::updateCoeffs()
{
typedef GeometricField<Type, fvPatchField, volMesh> FieldType;
if (this->updated())
{
return;
}
// Retrieve the neighbour values and assign to this patch boundary field
directMappedFixedValueFvPatchField<Type>::updateCoeffs();
// Get the coupling information from the directMappedPatchBase
const directMappedPatchBase& mpp =
refCast<const directMappedPatchBase>(this->patch().patch());
const polyMesh& nbrMesh = mpp.sampleMesh();
const fvPatch& nbrPatch =
refCast<const fvMesh>
(
nbrMesh
).boundary()[mpp.samplePolyPatch().index()];
// Force recalculation of mapping and schedule
const mapDistribute& distMap = mpp.map();
// Retrieve the neighbour field
const fvPatchField<Type>& nbrField =
nbrPatch.template lookupPatchField<FieldType, Type>
(
this->dimensionedInternalField().name()
);
// Retrieve the neighbour patch internal field
Field<Type> nbrIntFld = nbrField.patchInternalField();
mapDistribute::distribute
(
Pstream::defaultCommsType,
distMap.schedule(),
distMap.constructSize(),
distMap.subMap(), // what to send
distMap.constructMap(), // what to receive
nbrIntFld
);
// Assign (this) patch internal field to its neighbour values
Field<Type>& intFld = const_cast<Field<Type>&>(this->internalField());
UIndirectList<Type>(intFld, this->patch().faceCells()) = nbrIntFld;
}
template<class Type>
void Foam::directMappedFixedInternalValueFvPatchField<Type>::write
(
Ostream& os
) const
{
directMappedFixedValueFvPatchField<Type>::write(os);
}
// ************************************************************************* //

View File

@ -0,0 +1,151 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-2010 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 2 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::directMappedFixedInternalValueFvPatchField
Description
Recycles the boundary and internal values of a neighbour patch field to
the boundary and internal values of *this.
SourceFiles
directMappedFixedInternalValueFvPatchField.C
\*---------------------------------------------------------------------------*/
#ifndef directMappedFixedInternalValueFvPatchField_H
#define directMappedFixedInternalValueFvPatchField_H
#include "directMappedFixedValueFvPatchField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class directMappedFixedInternalValueFvPatchField Declaration
\*---------------------------------------------------------------------------*/
template<class Type>
class directMappedFixedInternalValueFvPatchField
:
public directMappedFixedValueFvPatchField<Type>
{
public:
//- Runtime type information
TypeName("directMappedFixedInternalValue");
// Constructors
//- Construct from patch and internal field
directMappedFixedInternalValueFvPatchField
(
const fvPatch&,
const DimensionedField<Type, volMesh>&
);
//- Construct from patch, internal field and dictionary
directMappedFixedInternalValueFvPatchField
(
const fvPatch&,
const DimensionedField<Type, volMesh>&,
const dictionary&
);
//- Construct by mapping given
// directMappedFixedInternalValueFvPatchField onto a new patch
directMappedFixedInternalValueFvPatchField
(
const directMappedFixedInternalValueFvPatchField<Type>&,
const fvPatch&,
const DimensionedField<Type, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
directMappedFixedInternalValueFvPatchField
(
const directMappedFixedInternalValueFvPatchField<Type>&
);
//- Construct and return a clone
virtual tmp<fvPatchField<Type> > clone() const
{
return tmp<fvPatchField<Type> >
(
new directMappedFixedInternalValueFvPatchField<Type>(*this)
);
}
//- Construct as copy setting internal field reference
directMappedFixedInternalValueFvPatchField
(
const directMappedFixedInternalValueFvPatchField<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 directMappedFixedInternalValueFvPatchField<Type>(*this, iF)
);
}
// Member functions
// Evaluation functions
//- Update the coefficients associated with the patch field
virtual void updateCoeffs();
//- Write
virtual void write(Ostream&) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "directMappedFixedInternalValueFvPatchField.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,44 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-2010 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 2 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 "directMappedFixedInternalValueFvPatchFields.H"
#include "volMesh.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
makePatchFields(directMappedFixedInternalValue);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,50 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-2010 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 2 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
\*---------------------------------------------------------------------------*/
#ifndef directMappedFixedInternalValueFvPatchFields_H
#define directMappedFixedInternalValueFvPatchFields_H
#include "directMappedFixedInternalValueFvPatchField.H"
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeFieldTypedefs(directMappedFixedInternalValue)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,51 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-2010 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 2 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
\*---------------------------------------------------------------------------*/
#ifndef directMappedFixedInternalValueFvPatchFieldsFwd_H
#define directMappedFixedInternalValueFvPatchFieldsFwd_H
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Type> class directMappedFixedInternalValueFvPatchField;
makePatchTypeFieldTypedefs(directMappedFixedInternalValue)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,126 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-2010 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 2 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 "directMappedFixedPushedInternalValueFvPatchField.H"
#include "UIndirectList.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
Foam::directMappedFixedPushedInternalValueFvPatchField<Type>::
directMappedFixedPushedInternalValueFvPatchField
(
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF
)
:
directMappedFixedValueFvPatchField<Type>(p, iF)
{}
template<class Type>
Foam::directMappedFixedPushedInternalValueFvPatchField<Type>::
directMappedFixedPushedInternalValueFvPatchField
(
const directMappedFixedPushedInternalValueFvPatchField<Type>& ptf,
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
directMappedFixedValueFvPatchField<Type>(ptf, p, iF, mapper)
{}
template<class Type>
Foam::directMappedFixedPushedInternalValueFvPatchField<Type>::
directMappedFixedPushedInternalValueFvPatchField
(
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF,
const dictionary& dict
)
:
directMappedFixedValueFvPatchField<Type>(p, iF, dict)
{}
template<class Type>
Foam::directMappedFixedPushedInternalValueFvPatchField<Type>::
directMappedFixedPushedInternalValueFvPatchField
(
const directMappedFixedPushedInternalValueFvPatchField<Type>& ptf
)
:
directMappedFixedValueFvPatchField<Type>(ptf)
{}
template<class Type>
Foam::directMappedFixedPushedInternalValueFvPatchField<Type>::
directMappedFixedPushedInternalValueFvPatchField
(
const directMappedFixedPushedInternalValueFvPatchField<Type>& ptf,
const DimensionedField<Type, volMesh>& iF
)
:
directMappedFixedValueFvPatchField<Type>(ptf, iF)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
void
Foam::directMappedFixedPushedInternalValueFvPatchField<Type>::updateCoeffs()
{
typedef GeometricField<Type, fvPatchField, volMesh> FieldType;
if (this->updated())
{
return;
}
// Retrieve the neighbour values and assign to this patch boundary field
directMappedFixedValueFvPatchField<Type>::updateCoeffs();
// Assign the patch internal field to its boundary value
Field<Type>& intFld = const_cast<Field<Type>&>(this->internalField());
UIndirectList<Type>(intFld, this->patch().faceCells()) = *this;
}
template<class Type>
void Foam::directMappedFixedPushedInternalValueFvPatchField<Type>::write
(
Ostream& os
) const
{
directMappedFixedValueFvPatchField<Type>::write(os);
}
// ************************************************************************* //

View File

@ -0,0 +1,158 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-2010 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 2 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::directMappedFixedPushedInternalValueFvPatchField
Description
Recycles the boundary values of a neighbour patch field to the boundary
and internal values of *this.
SourceFiles
directMappedFixedPushedInternalValueFvPatchField.C
\*---------------------------------------------------------------------------*/
#ifndef directMappedFixedPushedInternalValueFvPatchField_H
#define directMappedFixedPushedInternalValueFvPatchField_H
#include "directMappedFixedValueFvPatchField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class directMappedFixedPushedInternalValueFvPatchField Declaration
\*---------------------------------------------------------------------------*/
template<class Type>
class directMappedFixedPushedInternalValueFvPatchField
:
public directMappedFixedValueFvPatchField<Type>
{
public:
//- Runtime type information
TypeName("directMappedFixedPushedInternalValue");
// Constructors
//- Construct from patch and internal field
directMappedFixedPushedInternalValueFvPatchField
(
const fvPatch&,
const DimensionedField<Type, volMesh>&
);
//- Construct from patch, internal field and dictionary
directMappedFixedPushedInternalValueFvPatchField
(
const fvPatch&,
const DimensionedField<Type, volMesh>&,
const dictionary&
);
//- Construct by mapping given a
// directMappedFixedPushedInternalValueFvPatchField onto a new patch
directMappedFixedPushedInternalValueFvPatchField
(
const directMappedFixedPushedInternalValueFvPatchField<Type>&,
const fvPatch&,
const DimensionedField<Type, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
directMappedFixedPushedInternalValueFvPatchField
(
const directMappedFixedPushedInternalValueFvPatchField<Type>&
);
//- Construct and return a clone
virtual tmp<fvPatchField<Type> > clone() const
{
return tmp<fvPatchField<Type> >
(
new directMappedFixedPushedInternalValueFvPatchField<Type>
(
*this
)
);
}
//- Construct as copy setting internal field reference
directMappedFixedPushedInternalValueFvPatchField
(
const directMappedFixedPushedInternalValueFvPatchField<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 directMappedFixedPushedInternalValueFvPatchField<Type>
(
*this,
iF
)
);
}
// Member functions
// Evaluation functions
//- Update the coefficients associated with the patch field
virtual void updateCoeffs();
//- Write
virtual void write(Ostream&) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "directMappedFixedPushedInternalValueFvPatchField.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,44 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-2010 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 2 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 "directMappedFixedPushedInternalValueFvPatchFields.H"
#include "volMesh.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
makePatchFields(directMappedFixedPushedInternalValue);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,50 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-2010 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 2 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
\*---------------------------------------------------------------------------*/
#ifndef directMappedFixedPushedInternalValueFvPatchFields_H
#define directMappedFixedPushedInternalValueFvPatchFields_H
#include "directMappedFixedPushedInternalValueFvPatchField.H"
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeFieldTypedefs(directMappedFixedPushedInternalValue)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,51 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-2010 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 2 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
\*---------------------------------------------------------------------------*/
#ifndef directMappedFixedPushedInternalValueFvPatchFieldsFwd_H
#define directMappedFixedPushedInternalValueFvPatchFieldsFwd_H
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Type> class directMappedFixedPushedInternalValueFvPatchField;
makePatchTypeFieldTypedefs(directMappedFixedInternalValue)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,336 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 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 2 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 "directMappedNamedFixedValueFvPatchField.H"
#include "directMappedPatchBase.H"
#include "mapDistribute.H"
#include "volFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
directMappedNamedFixedValueFvPatchField<Type>::
directMappedNamedFixedValueFvPatchField
(
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF
)
:
fixedValueFvPatchField<Type>(p, iF),
fieldName_(iF.name()),
setAverage_(false),
average_(pTraits<Type>::zero)
{}
template<class Type>
directMappedNamedFixedValueFvPatchField<Type>::
directMappedNamedFixedValueFvPatchField
(
const directMappedNamedFixedValueFvPatchField<Type>& ptf,
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
fixedValueFvPatchField<Type>(ptf, p, iF, mapper),
fieldName_(ptf.fieldName_),
setAverage_(ptf.setAverage_),
average_(ptf.average_)
{
if (!isA<directMappedPatchBase>(this->patch().patch()))
{
FatalErrorIn
(
"directMappedNamedFixedValueFvPatchField<Type>::"
"directMappedNamedFixedValueFvPatchField\n"
"(\n"
" const directMappedNamedFixedValueFvPatchField<Type>&,\n"
" const fvPatch&,\n"
" const Field<Type>&,\n"
" const fvPatchFieldMapper&\n"
")\n"
) << "\n patch type '" << p.type()
<< "' not type '" << directMappedPatchBase::typeName << "'"
<< "\n for patch " << p.name()
<< " of field " << this->dimensionedInternalField().name()
<< " in file " << this->dimensionedInternalField().objectPath()
<< exit(FatalError);
}
}
template<class Type>
directMappedNamedFixedValueFvPatchField<Type>::
directMappedNamedFixedValueFvPatchField
(
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF,
const dictionary& dict
)
:
fixedValueFvPatchField<Type>(p, iF, dict),
fieldName_(dict.lookupOrDefault<word>("fieldName", iF.name())),
setAverage_(readBool(dict.lookup("setAverage"))),
average_(pTraits<Type>(dict.lookup("average")))
{
if (!isA<directMappedPatchBase>(this->patch().patch()))
{
FatalErrorIn
(
"directMappedNamedFixedValueFvPatchField<Type>::"
"directMappedNamedFixedValueFvPatchField"
"("
" const fvPatch&, "
" const DimensionedField<Type, volMesh>& iF, "
" const dictionary&"
")"
) << "\n patch type '" << p.type()
<< "' not type '" << directMappedPatchBase::typeName << "'"
<< "\n for patch " << p.name()
<< " of field " << fieldName_
<< " in file " << this->dimensionedInternalField().objectPath()
<< exit(FatalError);
}
//// Force calculation of schedule (uses parallel comms)
//const directMappedPatchBase& mpp = refCast<const directMappedPatchBase>
//(
// this->patch().patch()
//);
//(void)mpp.map().schedule();
}
template<class Type>
directMappedNamedFixedValueFvPatchField<Type>::
directMappedNamedFixedValueFvPatchField
(
const directMappedNamedFixedValueFvPatchField<Type>& ptf
)
:
fixedValueFvPatchField<Type>(ptf),
fieldName_(ptf.fieldName_),
setAverage_(ptf.setAverage_),
average_(ptf.average_)
{}
template<class Type>
directMappedNamedFixedValueFvPatchField<Type>::
directMappedNamedFixedValueFvPatchField
(
const directMappedNamedFixedValueFvPatchField<Type>& ptf,
const DimensionedField<Type, volMesh>& iF
)
:
fixedValueFvPatchField<Type>(ptf, iF),
fieldName_(ptf.fieldName_),
setAverage_(ptf.setAverage_),
average_(ptf.average_)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
void directMappedNamedFixedValueFvPatchField<Type>::updateCoeffs()
{
if (this->updated())
{
return;
}
typedef GeometricField<Type, fvPatchField, volMesh> fieldType;
// Get the scheduling information from the directMappedPatchBase
const directMappedPatchBase& mpp = refCast<const directMappedPatchBase>
(
directMappedNamedFixedValueFvPatchField<Type>::patch().patch()
);
const mapDistribute& distMap = mpp.map();
// Force recalculation of schedule
(void)distMap.schedule();
const fvMesh& nbrMesh = refCast<const fvMesh>(mpp.sampleMesh());
// Result of obtaining remote values
Field<Type> newValues;
switch (mpp.mode())
{
case directMappedPatchBase::NEARESTCELL:
{
if (mpp.sameRegion())
{
newValues = this->internalField();
}
else
{
newValues = nbrMesh.lookupObject<fieldType>
(
fieldName_
).internalField();
}
mapDistribute::distribute
(
Pstream::defaultCommsType,
distMap.schedule(),
distMap.constructSize(),
distMap.subMap(),
distMap.constructMap(),
newValues
);
break;
}
case directMappedPatchBase::NEARESTPATCHFACE:
{
const label nbrPatchID =
nbrMesh.boundaryMesh().findPatchID(mpp.samplePatch());
if (nbrPatchID < 0)
{
FatalErrorIn
(
"void directMappedNamedFixedValueFvPatchField<Type>::"
"updateCoeffs()"
)<< "Unable to find sample patch " << mpp.samplePatch()
<< " in region " << mpp.sampleRegion()
<< " for patch " << this->patch().name() << nl
<< abort(FatalError);
}
const fieldType& nbrField =
nbrMesh.lookupObject<fieldType>(fieldName_);
newValues = nbrField.boundaryField()[nbrPatchID];
mapDistribute::distribute
(
Pstream::defaultCommsType,
distMap.schedule(),
distMap.constructSize(),
distMap.subMap(),
distMap.constructMap(),
newValues
);
break;
}
case directMappedPatchBase::NEARESTFACE:
{
Field<Type> allValues(nbrMesh.nFaces(), pTraits<Type>::zero);
const fieldType& nbrField =
nbrMesh.lookupObject<fieldType>(fieldName_);
forAll(nbrField.boundaryField(), patchI)
{
const fvPatchField<Type>& pf =
nbrField.boundaryField()[patchI];
label faceStart = pf.patch().patch().start();
forAll(pf, faceI)
{
allValues[faceStart++] = pf[faceI];
}
}
mapDistribute::distribute
(
Pstream::defaultCommsType,
distMap.schedule(),
distMap.constructSize(),
distMap.subMap(),
distMap.constructMap(),
allValues
);
newValues = this->patch().patchSlice(allValues);
break;
}
default:
{
FatalErrorIn
(
"directMappedNamedFixedValueFvPatchField<Type>::updateCoeffs()"
)<< "Unknown sampling mode: " << mpp.mode()
<< nl << abort(FatalError);
}
}
if (setAverage_)
{
Type averagePsi =
gSum(this->patch().magSf()*newValues)
/gSum(this->patch().magSf());
if (mag(averagePsi)/mag(average_) > 0.5)
{
newValues *= mag(average_)/mag(averagePsi);
}
else
{
newValues += (average_ - averagePsi);
}
}
this->operator==(newValues);
if (debug)
{
Info<< "directMapped on field:" << fieldName_
<< " patch:" << this->patch().name()
<< " avg:" << gAverage(*this)
<< " min:" << gMin(*this)
<< " max:" << gMax(*this)
<< endl;
}
fixedValueFvPatchField<Type>::updateCoeffs();
}
template<class Type>
void directMappedNamedFixedValueFvPatchField<Type>::write(Ostream& os) const
{
fvPatchField<Type>::write(os);
os.writeKeyword("fieldName") << fieldName_ << token::END_STATEMENT << nl;
os.writeKeyword("setAverage") << setAverage_ << token::END_STATEMENT << nl;
os.writeKeyword("average") << average_ << token::END_STATEMENT << nl;
this->writeEntry("value", os);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,165 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 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 2 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::directMappedNamedFixedValueFvPatchField
Description
Variant of directMappedFixedValueFvPatch where the name of the field to
map is input.
SourceFiles
directMappedNamedFixedValueFvPatchField.C
\*---------------------------------------------------------------------------*/
#ifndef directMappedNamedFixedValueFvPatchField_H
#define directMappedNamedFixedValueFvPatchField_H
#include "fixedValueFvPatchField.H"
#include "directMappedFvPatch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class directMappedNamesFixedValueFvPatchField Declaration
\*---------------------------------------------------------------------------*/
template<class Type>
class directMappedNamedFixedValueFvPatchField
:
public fixedValueFvPatchField<Type>
{
// Private data
//- Name of field to sample - defaults to field associated with this
// patch if not specified
word fieldName_;
//- If true adjust the mapped field to maintain average value average_
bool setAverage_;
//- Average value the mapped field is adjusted to maintain if
// setAverage_ is set true
Type average_;
public:
//- Runtime type information
TypeName("directMappedNamedFixedValue");
// Constructors
//- Construct from patch and internal field
directMappedNamedFixedValueFvPatchField
(
const fvPatch&,
const DimensionedField<Type, volMesh>&
);
//- Construct from patch, internal field and dictionary
directMappedNamedFixedValueFvPatchField
(
const fvPatch&,
const DimensionedField<Type, volMesh>&,
const dictionary&
);
//- Construct by mapping given directMappedNamedFixedValueFvPatchField
// onto a new patch
directMappedNamedFixedValueFvPatchField
(
const directMappedNamedFixedValueFvPatchField<Type>&,
const fvPatch&,
const DimensionedField<Type, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
directMappedNamedFixedValueFvPatchField
(
const directMappedNamedFixedValueFvPatchField<Type>&
);
//- Construct and return a clone
virtual tmp<fvPatchField<Type> > clone() const
{
return tmp<fvPatchField<Type> >
(
new directMappedNamedFixedValueFvPatchField<Type>(*this)
);
}
//- Construct as copy setting internal field reference
directMappedNamedFixedValueFvPatchField
(
const directMappedNamedFixedValueFvPatchField<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 directMappedNamedFixedValueFvPatchField<Type>(*this, iF)
);
}
// Member functions
// Evaluation functions
//- Update the coefficients associated with the patch field
virtual void updateCoeffs();
//- Write
virtual void write(Ostream&) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "directMappedNamedFixedValueFvPatchField.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,44 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 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 2 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 "directMappedNamedFixedValueFvPatchFields.H"
#include "volMesh.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
makePatchFields(directMappedNamedFixedValue);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

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

View File

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

View File

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

View File

@ -0,0 +1,170 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-2010 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 2 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 "regionMappedFixedInternalValueFvPatchField.H"
#include "UIndirectList.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
Foam::regionMappedFixedInternalValueFvPatchField<Type>::
regionMappedFixedInternalValueFvPatchField
(
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF
)
:
fixedValueFvPatchField<Type>(p, iF)
{}
template<class Type>
Foam::regionMappedFixedInternalValueFvPatchField<Type>::
regionMappedFixedInternalValueFvPatchField
(
const regionMappedFixedInternalValueFvPatchField<Type>& ptf,
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
fixedValueFvPatchField<Type>(ptf, p, iF, mapper)
{}
template<class Type>
Foam::regionMappedFixedInternalValueFvPatchField<Type>::
regionMappedFixedInternalValueFvPatchField
(
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF,
const dictionary& dict
)
:
fixedValueFvPatchField<Type>(p, iF, dict)
{}
template<class Type>
Foam::regionMappedFixedInternalValueFvPatchField<Type>::
regionMappedFixedInternalValueFvPatchField
(
const regionMappedFixedInternalValueFvPatchField<Type>& ptf
)
:
fixedValueFvPatchField<Type>(ptf)
{}
template<class Type>
Foam::regionMappedFixedInternalValueFvPatchField<Type>::
regionMappedFixedInternalValueFvPatchField
(
const regionMappedFixedInternalValueFvPatchField<Type>& ptf,
const DimensionedField<Type, volMesh>& iF
)
:
fixedValueFvPatchField<Type>(ptf, iF)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
void Foam::regionMappedFixedInternalValueFvPatchField<Type>::updateCoeffs()
{
typedef GeometricField<Type, fvPatchField, volMesh> FieldType;
if (this->updated())
{
return;
}
const regionModels::regionModel& region =
this->db.lookupObject<regionModels::regionModel>
(
"surfaceFilmProperties"
);
const label regionPatchI = region.regionPatchID(this->patch().index())
const directMappedPatchBase& mpp = region.mappedPatches()[patchI];
// Force recalculation of mapping and schedule
const mapDistribute& distMap = mpp.map();
const polyMesh& nbrMesh = mpp.sampleMesh();
const label samplePatchI = mpp.samplePolyPatch().index();
const fvPatch& nbrPatch =
refCast<const fvMesh>(nbrMesh).boundary()[samplePatchI];
// Retrieve the neighbour field
Field<Type> nbrField =
nbrPatch.lookupPatchField<FieldType, Type>(fieldName_);
mapDistribute::distribute
(
Pstream::defaultCommsType,
distMap.schedule(),
distMap.constructSize(),
distMap.subMap(), // what to send
distMap.constructMap(), // what to receive
nbrField
);
this->operator==(nbrField);
// Retrieve the neighbour patch internal field
Field<Type> nbrIntField = nbrField.patchInternalField();
mapDistribute::distribute
(
Pstream::defaultCommsType,
distMap.schedule(),
distMap.constructSize(),
distMap.subMap(), // what to send
distMap.constructMap(), // what to receive
nbrIntField
);
// Assign (this) patch internal field to its neighbour values
Field<Type>& intField = const_cast<Field<Type>&>(this->internalField());
UIndirectList<Type>(intFld, this->patch().faceCells()) = nbrIntField;
fixedValueFvPatchField<Type>::updateCoeffs();
}
template<class Type>
void Foam::regionMappedFixedInternalValueFvPatchField<Type>::write
(
Ostream& os
) const
{
fixedValueFvPatchField<Type>::write(os);
}
// ************************************************************************* //

View File

@ -0,0 +1,162 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-2010 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 2 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::regionMappedFixedInternalValueFvPatchField
Description
Recycles the boundary and internal values of a neighbour patch field to
the boundary and internal values of *this.
SourceFiles
regionMappedFixedInternalValueFvPatchField.C
\*---------------------------------------------------------------------------*/
#ifndef regionMappedFixedInternalValueFvPatchField_H
#define regionMappedFixedInternalValueFvPatchField_H
#include "fixedValueFvPatchFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class regionMappedFixedInternalValueFvPatchField Declaration
\*---------------------------------------------------------------------------*/
template<class Type>
class regionMappedFixedInternalValueFvPatchField
:
public fixedValueFvPatchField<Type>
{
protected:
// Protected Data
//- Name of communicating region
word regionName_;
//- Name of communicating field
word fieldName_;
public:
//- Runtime type information
TypeName("directMappedFixedInternalValue");
// Constructors
//- Construct from patch and internal field
regionMappedFixedInternalValueFvPatchField
(
const fvPatch&,
const DimensionedField<Type, volMesh>&
);
//- Construct from patch, internal field and dictionary
regionMappedFixedInternalValueFvPatchField
(
const fvPatch&,
const DimensionedField<Type, volMesh>&,
const dictionary&
);
//- Construct by mapping given
// regionMappedFixedInternalValueFvPatchField onto a new patch
regionMappedFixedInternalValueFvPatchField
(
const regionMappedFixedInternalValueFvPatchField<Type>&,
const fvPatch&,
const DimensionedField<Type, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
regionMappedFixedInternalValueFvPatchField
(
const regionMappedFixedInternalValueFvPatchField<Type>&
);
//- Construct and return a clone
virtual tmp<fvPatchField<Type> > clone() const
{
return tmp<fvPatchField<Type> >
(
new regionMappedFixedInternalValueFvPatchField<Type>(*this)
);
}
//- Construct as copy setting internal field reference
regionMappedFixedInternalValueFvPatchField
(
const regionMappedFixedInternalValueFvPatchField<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 regionMappedFixedInternalValueFvPatchField<Type>(*this, iF)
);
}
// Member functions
// Evaluation functions
//- Update the coefficients associated with the patch field
virtual void updateCoeffs();
//- Write
virtual void write(Ostream&) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "regionMappedFixedInternalValueFvPatchField.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,44 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-2010 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 2 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 "regionMappedFixedInternalValueFvPatchFields.H"
#include "volMesh.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
makePatchFields(directMappedFixedInternalValue);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,50 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-2010 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 2 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
\*---------------------------------------------------------------------------*/
#ifndef regionMappedFixedInternalValueFvPatchFields_H
#define regionMappedFixedInternalValueFvPatchFields_H
#include "regionMappedFixedInternalValueFvPatchField.H"
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeFieldTypedefs(directMappedFixedInternalValue)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,51 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-2010 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 2 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
\*---------------------------------------------------------------------------*/
#ifndef regionMappedFixedInternalValueFvPatchFieldsFwd_H
#define regionMappedFixedInternalValueFvPatchFieldsFwd_H
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Type> class regionMappedFixedInternalValueFvPatchField;
makePatchTypeFieldTypedefs(directMappedFixedInternalValue)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,283 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 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 2 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 "regionModel.H"
#include "fvMesh.H"
#include "Time.H"
#include "directMappedWallPolyPatch.H"
#include "zeroGradientFvPatchFields.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace regionModels
{
defineTypeNameAndDebug(regionModel, 0);
}
}
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
void Foam::regionModels::regionModel::constructMeshObjects()
{
// construct region mesh
regionMeshPtr_.reset
(
new fvMesh
(
IOobject
(
lookup("regionName"),
time_.timeName(),
time_,
IOobject::MUST_READ
)
)
);
}
void Foam::regionModels::regionModel::initialise()
{
if (debug)
{
Pout<< "regionModel::initialise()" << endl;
}
label nBoundaryFaces = 0;
DynamicList<label> primaryPatchIDs;
DynamicList<label> intCoupledPatchIDs;
const polyBoundaryMesh& rbm = regionMesh().boundaryMesh();
const polyBoundaryMesh& pbm = primaryMesh().boundaryMesh();
mappedPatches_.setSize(rbm.size());
forAll(rbm, patchI)
{
const polyPatch& regionPatch = rbm[patchI];
if (isA<directMappedWallPolyPatch>(regionPatch))
{
if (debug)
{
Pout<< "found " << directMappedWallPolyPatch::typeName
<< " " << regionPatch.name() << endl;
}
intCoupledPatchIDs.append(patchI);
nBoundaryFaces += regionPatch.faceCells().size();
const directMappedWallPolyPatch& dmp =
refCast<const directMappedWallPolyPatch>(regionPatch);
const label primaryPatchI = dmp.samplePolyPatch().index();
primaryPatchIDs.append(primaryPatchI);
mappedPatches_.set
(
patchI,
new directMappedPatchBase
(
pbm[primaryPatchI],
regionMesh().name(),
directMappedPatchBase::NEARESTPATCHFACE,
regionPatch.name(),
vector::zero
)
);
}
}
primaryPatchIDs_.transfer(primaryPatchIDs);
intCoupledPatchIDs_.transfer(intCoupledPatchIDs);
// mappedPatches_.resize(nCoupledPatches);
if (nBoundaryFaces == 0)
{
WarningIn("regionModel::initialise()")
<< "Region model being applied without direct mapped boundary "
<< "conditions" << endl;
}
}
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
bool Foam::regionModels::regionModel::read()
{
if (regIOobject::read())
{
if (active_)
{
if (const dictionary* dictPtr = subDictPtr(modelName_ + "Coeffs"))
{
coeffs_ <<= *dictPtr;
}
infoOutput_.readIfPresent("infoOutput", *this);
}
return true;
}
else
{
return false;
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::regionModels::regionModel::regionModel(const fvMesh& mesh)
:
IOdictionary
(
IOobject
(
"regionModelProperties",
mesh.time().constant(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
)
),
primaryMesh_(mesh),
time_(mesh.time()),
active_(false),
infoOutput_(false),
modelName_("none"),
regionMeshPtr_(NULL),
coeffs_(dictionary::null),
primaryPatchIDs_(),
intCoupledPatchIDs_(),
mappedPatches_()
{}
Foam::regionModels::regionModel::regionModel
(
const fvMesh& mesh,
const word& regionType,
const word& modelName,
bool readFields
)
:
IOdictionary
(
IOobject
(
regionType + "Properties",
mesh.time().constant(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
)
),
primaryMesh_(mesh),
time_(mesh.time()),
active_(lookup("active")),
infoOutput_(true),
modelName_(modelName),
regionMeshPtr_(NULL),
coeffs_(subOrEmptyDict(modelName + "Coeffs")),
primaryPatchIDs_(),
intCoupledPatchIDs_(),
mappedPatches_()
{
if (active_)
{
constructMeshObjects();
initialise();
if (readFields)
{
read();
}
}
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::regionModels::regionModel::~regionModel()
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
void Foam::regionModels::regionModel::preEvolveRegion()
{
// do nothing
}
void Foam::regionModels::regionModel::evolveRegion()
{
// do nothing
}
void Foam::regionModels::regionModel::evolve()
{
if (active_)
{
if (primaryMesh_.changing())
{
FatalErrorIn("regionModel::evolve()")
<< "Currently not possible to apply " << modelName_
<< " model to moving mesh cases" << nl << abort(FatalError);
}
Info<< "\nEvolving " << modelName_ << " for region "
<< regionMesh().name() << endl;
// Update any input information
read();
// Pre-evolve
preEvolveRegion();
// Increment the region equations up to the new time level
evolveRegion();
// Provide some feedback
if (infoOutput_)
{
Info<< incrIndent;
info();
Info<< endl << decrIndent;
}
}
}
void Foam::regionModels::regionModel::info() const
{
// do nothing
}
// ************************************************************************* //

View File

@ -0,0 +1,236 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 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 2 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::regionModel
Description
Base class for region models
SourceFiles
regionModelI.H
regionModel.C
\*---------------------------------------------------------------------------*/
#ifndef regionModel_H
#define regionModel_H
#include "IOdictionary.H"
#include "Switch.H"
#include "labelList.H"
#include "volFields.H"
#include "directMappedPatchBase.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of classes
//class fvMesh;
//class Time;
namespace regionModels
{
/*---------------------------------------------------------------------------*\
Class regionModel Declaration
\*---------------------------------------------------------------------------*/
class regionModel
:
public IOdictionary
{
private:
// Private Member Functions
//- Disallow default bitwise copy construct
regionModel(const regionModel&);
//- Disallow default bitwise assignment
void operator=(const regionModel&);
//- Construct region mesh and fields
void constructMeshObjects();
//- Initialise the region
void initialise();
protected:
// Protected data
//- Reference to the primary mesh database
const fvMesh& primaryMesh_;
//- Reference to the time database
const Time& time_;
//- Active flag
Switch active_;
//- Active information output
Switch infoOutput_;
//- Model name
const word modelName_;
//- Pointer to the region mesh database
autoPtr<fvMesh> regionMeshPtr_;
//- Model coefficients dictionary
dictionary coeffs_;
// Addressing
//- List of patch IDs on the primary region coupled to this region
labelList primaryPatchIDs_;
//- List of patch IDs internally coupled with the primary region
labelList intCoupledPatchIDs_;
//- List of patch map info
PtrList<directMappedPatchBase> mappedPatches_;
// Protected member functions
//- Read control parameters from dictionary
virtual bool read();
public:
//- Runtime type information
TypeName("regionModel");
// Constructors
//- Construct null
regionModel(const fvMesh& mesh);
//- Construct from mesh, region type and name
regionModel
(
const fvMesh& mesh,
const word& regionType,
const word& modelName,
bool readFields = true
);
//- Destructor
virtual ~regionModel();
// Member Functions
// Access
//- Return the reference to the primary mesh database
inline const fvMesh& primaryMesh() const;
//- Return the reference to the time database
inline const Time& time() const;
//- Return the active flag
inline const Switch& active() const;
//- Return the model name
inline const word& modelName() const;
//- Return the region mesh database
inline const fvMesh& regionMesh() const;
//- Return the region mesh database for manipulation
inline fvMesh& regionMesh();
//- Return the model coefficients dictionary
inline const dictionary& coeffs() const;
//- Return the solution dictionary
inline const dictionary& solution() const;
// Addressing
//- Return true if patchI on the primary region is a coupled
// patch to the local region
inline bool isRegionPatch(const label patchI) const;
//- Return the list of patch IDs on the primary region coupled
// to this region
inline const labelList& primaryPatchIDs() const;
//- Return the list of patch IDs internally coupled with the
// primary region
inline const labelList& intCoupledPatchIDs() const;
//- Return the list of patch map info
inline const PtrList<directMappedPatchBase>&
mappedPatches() const;
//- Return region ID corresponding to primaryPatchID
inline label regionPatchID(const label primaryPatchID) const;
// Evolution
//- Pre-evolve region
virtual void preEvolveRegion();
//- Evolve the region
virtual void evolveRegion();
//- Evolve the film
virtual void evolve();
// I-O
//- Provide some feedback
virtual void info() const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace regionModels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "regionModelI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,154 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 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 2 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 "regionModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
inline const Foam::fvMesh&
Foam::regionModels::regionModel::primaryMesh() const
{
return primaryMesh_;
}
inline const Foam::Time& Foam::regionModels::regionModel::time() const
{
return time_;
}
inline const Foam::Switch& Foam::regionModels::regionModel::active() const
{
return active_;
}
inline const Foam::word& Foam::regionModels::regionModel::modelName() const
{
return modelName_;
}
inline const Foam::fvMesh& Foam::regionModels::regionModel::regionMesh() const
{
if (!regionMeshPtr_.valid())
{
FatalErrorIn
(
"inline const Foam::fvMesh&"
"Foam::regionModels::regionModel::regionMesh() const"
)<< "Region mesh not available" << abort(FatalError);
}
return regionMeshPtr_();
}
inline Foam::fvMesh& Foam::regionModels::regionModel::regionMesh()
{
if (!regionMeshPtr_.valid())
{
FatalErrorIn
(
"inline Foam::fvMesh&"
"Foam::regionModels::regionModel::regionMesh()"
)<< "Region mesh not available" << abort(FatalError);
}
return regionMeshPtr_();
}
inline const Foam::dictionary& Foam::regionModels::regionModel::coeffs() const
{
return coeffs_;
}
inline const Foam::dictionary&
Foam::regionModels::regionModel::solution() const
{
return regionMesh().solutionDict();
}
inline bool Foam::regionModels::regionModel::isRegionPatch
(
const label patchI
) const
{
forAll(primaryPatchIDs_, i)
{
if (primaryPatchIDs_[i] == patchI)
{
return true;
}
}
return false;
}
inline const Foam::labelList&
Foam::regionModels::regionModel::primaryPatchIDs() const
{
return primaryPatchIDs_;
}
inline const Foam::labelList&
Foam::regionModels::regionModel::intCoupledPatchIDs() const
{
return intCoupledPatchIDs_;
}
inline const Foam::PtrList<Foam::directMappedPatchBase>&
Foam::regionModels::regionModel::mappedPatches() const
{
return mappedPatches_;
}
inline Foam::label Foam::regionModels::regionModel::regionPatchID
(
const label primaryPatchID
) const
{
forAll(primaryPatchIDs_, i)
{
if (primaryPatchIDs_[i] == primaryPatchID)
{
return intCoupledPatchIDs_[i];
}
}
return -1;
}
// ************************************************************************* //

View File

@ -0,0 +1,308 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 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 2 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 "regionModel1D.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace regionModels
{
defineTypeNameAndDebug(regionModel1D, 0);
}
}
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
void Foam::regionModels::regionModel1D::constructMeshObjects()
{
const fvMesh& regionMesh = regionMeshPtr_();
nMagSfPtr_.reset
(
new surfaceScalarField
(
IOobject
(
"nMagSf",
time().timeName(),
regionMesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
regionMesh,
dimensionedScalar("zero", dimArea, 0.0)
)
);
}
void Foam::regionModels::regionModel1D::initialise()
{
if (debug)
{
Pout<< "regionModel1D::initialise()" << endl;
}
// Calculate boundaryFaceFaces and boundaryFaceCells
DynamicList<label> faceIDs;
DynamicList<label> cellIDs;
label localPyrolysisFaceI = 0;
const polyBoundaryMesh& rbm = regionMesh().boundaryMesh();
forAll(intCoupledPatchIDs_, i)
{
const label patchI = intCoupledPatchIDs_[i];
const polyPatch& ppCoupled = rbm[patchI];
forAll(ppCoupled, localFaceI)
{
label faceI = ppCoupled.start() + localFaceI;
label cellI = -1;
label nFaces = 0;
label nCells = 0;
do
{
label ownCellI = regionMesh().faceOwner()[faceI];
if (ownCellI != cellI)
{
cellI = ownCellI;
}
else
{
cellI = regionMesh().faceNeighbour()[faceI];
}
nCells++;
cellIDs.append(cellI);
const cell& cFaces = regionMesh().cells()[cellI];
faceI = cFaces.opposingFaceLabel(faceI, regionMesh().faces());
faceIDs.append(faceI);
nFaces++;
} while (regionMesh().isInternalFace(faceI));
boundaryFaceOppositeFace_[localPyrolysisFaceI] = faceI;
faceIDs.remove(); //remove boundary face.
nFaces--;
boundaryFaceFaces_[localPyrolysisFaceI].transfer(faceIDs);
boundaryFaceCells_[localPyrolysisFaceI].transfer(cellIDs);
localPyrolysisFaceI++;
}
}
boundaryFaceOppositeFace_.setSize(localPyrolysisFaceI);
surfaceScalarField& nMagSf = nMagSfPtr_();
forAll(intCoupledPatchIDs_, i)
{
const label patchI = intCoupledPatchIDs_[i];
const polyPatch& ppCoupled = rbm[patchI];
const vectorField& pNormals = ppCoupled.faceNormals();
nMagSf.boundaryField()[patchI] =
regionMesh().Sf().boundaryField()[patchI] & pNormals;
forAll(pNormals, localFaceI)
{
const vector& n = pNormals[localFaceI];
const labelList& faces = boundaryFaceFaces_[localFaceI];
forAll (faces, faceI)
{
const label faceID = faces[faceI];
nMagSf[faceID] = regionMesh().Sf()[faceID] & n;
}
}
}
}
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
bool Foam::regionModels::regionModel1D::read()
{
if (regionModel::read())
{
moveMesh_.readIfPresent("moveMesh", coeffs_);
return true;
}
else
{
return false;
}
}
Foam::tmp<Foam::labelField> Foam::regionModels::regionModel1D::moveMesh
(
const scalarList& deltaV,
const scalar minDelta
)
{
tmp<labelField> tcellMoveMap(new labelField(regionMesh().nCells(), 0));
labelField& cellMoveMap = tcellMoveMap();
if (!moveMesh_)
{
return cellMoveMap;
}
pointField oldPoints = regionMesh().points();
pointField newPoints = oldPoints;
const polyBoundaryMesh& bm = regionMesh().boundaryMesh();
forAll(intCoupledPatchIDs_, localPatchI)
{
label patchI = intCoupledPatchIDs_[localPatchI];
const polyPatch pp = bm[patchI];
const vectorField& cf = regionMesh().Cf().boundaryField()[patchI];
forAll(pp, patchFaceI)
{
const labelList& faces = boundaryFaceFaces_[patchFaceI];
const labelList& cells = boundaryFaceCells_[patchFaceI];
const vector n = pp.faceNormals()[patchFaceI];
const vector sf = pp.faceAreas()[patchFaceI];
List<point> oldCf(faces.size() + 1);
oldCf[0] = cf[patchFaceI];
forAll(faces, i)
{
oldCf[i + 1] = regionMesh().faceCentres()[faces[i]];
}
vector newDelta = vector::zero;
point nbrCf = oldCf[0];
forAll(faces, i)
{
const label faceI = faces[i];
const label cellI = cells[i];
const face f = regionMesh().faces()[faceI];
newDelta += (deltaV[cellI]/mag(sf))*n;
vector localDelta = vector::zero;
forAll(f, pti)
{
const label pointI = f[pti];
if
(
((nbrCf - (oldPoints[pointI] + newDelta)) & n)
> minDelta
)
{
newPoints[pointI] = oldPoints[pointI] + newDelta;
localDelta = newDelta;
cellMoveMap[cellI] = 1;
}
}
nbrCf = oldCf[i + 1] + localDelta;
}
// Modify boundary
const label bFaceI = boundaryFaceOppositeFace_[patchFaceI];
const face f = regionMesh().faces()[bFaceI];
const label cellI = cells[cells.size() - 1];
newDelta += (deltaV[cellI]/mag(sf))*n;
forAll(f, pti)
{
const label pointI = f[pti];
if
(
((nbrCf - (oldPoints[pointI] + newDelta)) & n)
> minDelta
)
{
newPoints[pointI] = oldPoints[pointI] + newDelta;
cellMoveMap[cellI] = 1;
}
}
}
}
// Move points
regionMesh().movePoints(newPoints);
return tcellMoveMap;
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::regionModels::regionModel1D::regionModel1D(const fvMesh& mesh)
:
regionModel(mesh),
boundaryFaceFaces_(),
boundaryFaceCells_(),
boundaryFaceOppositeFace_(),
nMagSfPtr_(NULL),
moveMesh_(false)
{}
Foam::regionModels::regionModel1D::regionModel1D
(
const fvMesh& mesh,
const word& regionType,
const word& modelName,
bool readFields
)
:
regionModel(mesh, regionType, modelName, false),
boundaryFaceFaces_(regionMesh().nCells()),
boundaryFaceCells_(regionMesh().nCells()),
boundaryFaceOppositeFace_(regionMesh().nCells()),
nMagSfPtr_(NULL),
moveMesh_(true)
{
if (active_)
{
constructMeshObjects();
initialise();
if (readFields)
{
read();
}
}
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::regionModels::regionModel1D::~regionModel1D()
{}
// ************************************************************************* //

View File

@ -0,0 +1,176 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 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 2 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::regionModel1D
Description
Base class for 1-D region models
SourceFiles
regionModel1D.C
\*---------------------------------------------------------------------------*/
#ifndef regionModel1D_H
#define regionModel1D_H
#include "regionModel.H"
#include "surfaceFields.H"
#include "labelList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace regionModels
{
/*---------------------------------------------------------------------------*\
Class regionModel1D Declaration
\*---------------------------------------------------------------------------*/
class regionModel1D
:
public regionModel
{
private:
// Private Member Functions
//- Disallow default bitwise copy construct
regionModel1D(const regionModel1D&);
//- Disallow default bitwise assignment
void operator=(const regionModel1D&);
//- Construct region mesh and fields
void constructMeshObjects();
//- Initialise the region
void initialise();
protected:
// Protected data
// Region addressing - per internally coupled patch face walking out
//- Global face IDs
labelListList boundaryFaceFaces_;
//- Global cell IDs
labelListList boundaryFaceCells_;
//- Global boundary face IDs oppossite coupled patch
labelList boundaryFaceOppositeFace_;
// Geometry
//- Face area magnitude normal to patch
autoPtr<surfaceScalarField> nMagSfPtr_;
//- Flag to allow mesh movement
Switch moveMesh_;
// Protected member functions
//- Read control parameters from dictionary
virtual bool read();
//- Move mesh points according to change in cell volumes
// Returns map ordered by cell where 1 = cell moved, 0 = cell unchanged
tmp<labelField> moveMesh
(
const scalarList& deltaV,
const scalar minDelta = 0.0
);
public:
//- Runtime type information
TypeName("regionModel");
// Constructors
//- Construct null
regionModel1D(const fvMesh& mesh);
//- Construct from mesh, region type and name
regionModel1D
(
const fvMesh& mesh,
const word& regionType,
const word& modelName,
bool readFields = true
);
//- Destructor
virtual ~regionModel1D();
// Member Functions
// Access
// Addressing
//- Return the global face IDs
inline const labelListList& boundaryFaceFaces() const;
//- Return the global cell IDs
inline const labelListList& boundaryFaceCells() const;
//- Return the global boundary face IDs oppossite coupled patch
inline const labelList& boundaryFaceOppositeFace() const;
// Geometry
//- Return the face area magnitudes / [m2]
inline const surfaceScalarField& nMagSf() const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace regionModels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "regionModel1DI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,68 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 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 2 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 "regionModel1D.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
inline const Foam::labelListList&
Foam::regionModels::regionModel1D::boundaryFaceFaces() const
{
return boundaryFaceFaces_;
}
inline const Foam::labelListList&
Foam::regionModels::regionModel1D::boundaryFaceCells() const
{
return boundaryFaceCells_;
}
inline const Foam::labelList&
Foam::regionModels::regionModel1D::boundaryFaceOppositeFace() const
{
return boundaryFaceOppositeFace_;
}
inline const Foam::surfaceScalarField&
Foam::regionModels::regionModel1D::nMagSf() const
{
if (!nMagSfPtr_.valid())
{
FatalErrorIn
(
"inline const Foam::surfaceScalarField&"
"Foam::regionModel1Ds::regionModel1D::nMagSf() const"
)<< "Face normal areas not available" << abort(FatalError);
}
return nMagSfPtr_();
}
// ************************************************************************* //

View File

@ -0,0 +1,238 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 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 2 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 "singleLayerRegion.H"
#include "fvMesh.H"
#include "Time.H"
#include "directMappedWallPolyPatch.H"
#include "zeroGradientFvPatchFields.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace regionModels
{
defineTypeNameAndDebug(singleLayerRegion, 0);
}
}
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
void Foam::regionModels::singleLayerRegion::constructMeshObjects()
{
// construct patch normal vectors
nHatPtr_.reset
(
new volVectorField
(
IOobject
(
"nHat",
time_.timeName(),
regionMesh(),
IOobject::READ_IF_PRESENT,
NO_WRITE
),
regionMesh(),
dimensionedVector("zero", dimless, vector::zero),
zeroGradientFvPatchField<vector>::typeName
)
);
// construct patch areas
magSfPtr_.reset
(
new volScalarField
(
IOobject
(
"magSf",
time_.timeName(),
regionMesh(),
IOobject::READ_IF_PRESENT,
NO_WRITE
),
regionMesh(),
dimensionedScalar("zero", dimArea, 0.0),
zeroGradientFvPatchField<scalar>::typeName
)
);
}
void Foam::regionModels::singleLayerRegion::initialise()
{
if (debug)
{
Pout<< "singleLayerRegion::initialise()" << endl;
}
label nBoundaryFaces = 0;
const polyBoundaryMesh& rbm = regionMesh().boundaryMesh();
volVectorField& nHat = nHatPtr_();
volScalarField& magSf = magSfPtr_();
forAll(intCoupledPatchIDs_, i)
{
const label patchI = intCoupledPatchIDs_[i];
const polyPatch& pp = rbm[patchI];
const labelList& fCells = pp.faceCells();
nBoundaryFaces += fCells.size();
UIndirectList<vector>(nHat, fCells) = pp.faceNormals();
UIndirectList<scalar>(magSf, fCells) = mag(pp.faceAreas());
}
nHat.correctBoundaryConditions();
magSf.correctBoundaryConditions();
if (nBoundaryFaces != regionMesh().nCells())
{
FatalErrorIn("singleLayerRegion::initialise()")
<< "Number of primary region coupled boundary faces not equal to "
<< "the number of cells in the local region" << nl << nl
<< "Number of cells = " << regionMesh().nCells() << nl
<< "Boundary faces = " << nBoundaryFaces << nl
<< abort(FatalError);
}
scalarField passiveMagSf(magSf.size(), 0.0);
passivePatchIDs_.setSize(intCoupledPatchIDs_.size(), -1);
forAll(intCoupledPatchIDs_, i)
{
const label patchI = intCoupledPatchIDs_[i];
const polyPatch& ppIntCoupled = rbm[patchI];
if (ppIntCoupled.size() > 0)
{
label cellId = rbm[patchI].faceCells()[0];
const cell& cFaces = regionMesh().cells()[cellId];
label faceI = ppIntCoupled.start();
label faceO = cFaces.opposingFaceLabel(faceI, regionMesh().faces());
label passivePatchI = rbm.whichPatch(faceO);
passivePatchIDs_[i] = passivePatchI;
const polyPatch& ppPassive = rbm[passivePatchI];
UIndirectList<scalar>(passiveMagSf, ppPassive.faceCells()) =
mag(ppPassive.faceAreas());
}
}
Pstream::listCombineGather(passivePatchIDs_, maxEqOp<label>());
Pstream::listCombineScatter(passivePatchIDs_);
magSf.field() = 0.5*(magSf + passiveMagSf);
magSf.correctBoundaryConditions();
}
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
bool Foam::regionModels::singleLayerRegion::read()
{
return regionModel::read();
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::regionModels::singleLayerRegion::singleLayerRegion(const fvMesh& mesh)
:
regionModel(mesh),
nHatPtr_(NULL),
magSfPtr_(NULL),
passivePatchIDs_()
{}
Foam::regionModels::singleLayerRegion::singleLayerRegion
(
const fvMesh& mesh,
const word& regionType,
const word& modelName,
bool readFields
)
:
regionModel(mesh, regionType, modelName, false),
nHatPtr_(NULL),
magSfPtr_(NULL),
passivePatchIDs_()
{
if (active_)
{
constructMeshObjects();
initialise();
if (readFields)
{
read();
}
}
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::regionModels::singleLayerRegion::~singleLayerRegion()
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
const Foam::volVectorField& Foam::regionModels::singleLayerRegion::nHat() const
{
if (!nHatPtr_.valid())
{
FatalErrorIn("const fvMesh& singleLayerRegion::nHat() const")
<< "Region patch normal vectors not available"
<< abort(FatalError);
}
return nHatPtr_();
}
const Foam::volScalarField& Foam::regionModels::singleLayerRegion::magSf() const
{
if (!magSfPtr_.valid())
{
FatalErrorIn("const fvMesh& singleLayerRegion::magSf() const")
<< "Region patch areas not available"
<< abort(FatalError);
}
return magSfPtr_();
}
const Foam::labelList&
Foam::regionModels::singleLayerRegion::passivePatchIDs() const
{
return passivePatchIDs_;
}
// ************************************************************************* //

View File

@ -0,0 +1,174 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 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 2 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::singleLayerRegion
Description
Base class for single layer region models
SourceFiles
singleLayerRegion.C
\*---------------------------------------------------------------------------*/
#ifndef singleLayerRegion_H
#define singleLayerRegion_H
#include "regionModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace regionModels
{
/*---------------------------------------------------------------------------*\
Class singleLayerRegion Declaration
\*---------------------------------------------------------------------------*/
class singleLayerRegion
:
public regionModel
{
private:
// Private Member Functions
//- Disallow default bitwise copy construct
singleLayerRegion(const singleLayerRegion&);
//- Disallow default bitwise assignment
void operator=(const singleLayerRegion&);
//- Construct region mesh and fields
void constructMeshObjects();
//- Initialise the region
void initialise();
protected:
// Protected data
// Region addressing
//- Patch normal vectors
autoPtr<volVectorField> nHatPtr_;
//- Face area magnitudes / [m2]
autoPtr<volScalarField> magSfPtr_;
// Addressing
//- List of patch IDs opposite to internally coupled patches
labelList passivePatchIDs_;
// Protected member functions
//- Read control parameters from dictionary
virtual bool read();
public:
//- Runtime type information
TypeName("regionModel");
// Constructors
//- Construct null
singleLayerRegion(const fvMesh& mesh);
//- Construct from mesh, region type and name
singleLayerRegion
(
const fvMesh& mesh,
const word& regionType,
const word& modelName,
bool readFields = true
);
//- Destructor
virtual ~singleLayerRegion();
// Member Functions
// Access
// Region geometry
//- Return the patch normal vectors
virtual const volVectorField& nHat() const;
//- Return the face area magnitudes / [m2]
virtual const volScalarField& magSf() const;
// Addressing
//- Return the list of patch IDs opposite to internally
// coupled patches
virtual const labelList& passivePatchIDs() const;
// Patch type information
//- Return boundary types for mapped field patches
// Also maps internal field value
// Mapping region prescribed by underlying mapped poly patch
template<class Type>
wordList mappedFieldAndInternalPatchTypes() const;
//- Return boundary types for pushed mapped field patches
// Mapping region prescribed by underlying mapped poly patch
template<class Type>
wordList mappedPushedFieldPatchTypes() const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace regionModels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
#include "singleLayerRegionTemplates.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,72 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 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 2 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 "singleLayerRegion.H"
#include "zeroGradientFvPatchFields.H"
#include "directMappedFixedInternalValueFvPatchFields.H"
#include "directMappedFixedPushedInternalValueFvPatchFields.H"
// * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * * //
template<class Type>
Foam::wordList
Foam::regionModels::singleLayerRegion::mappedFieldAndInternalPatchTypes() const
{
wordList bTypes(regionMesh().boundaryMesh().size());
bTypes = zeroGradientFvPatchField<Type>::typeName;
forAll(intCoupledPatchIDs_, i)
{
const label patchI = intCoupledPatchIDs_[i];
bTypes[patchI] =
directMappedFixedInternalValueFvPatchField<Type>::typeName;
}
return bTypes;
}
template<class Type>
Foam::wordList
Foam::regionModels::singleLayerRegion::mappedPushedFieldPatchTypes() const
{
wordList bTypes(regionMesh().boundaryMesh().size());
bTypes = zeroGradientFvPatchField<Type>::typeName;
forAll(intCoupledPatchIDs_, i)
{
const label patchI = intCoupledPatchIDs_[i];
bTypes[patchI] =
directMappedFixedPushedInternalValueFvPatchField<Type>::typeName;
}
return bTypes;
}
// ************************************************************************* //

View File

@ -0,0 +1,45 @@
/* Surface film models */
surfaceFilmModel/surfaceFilmModel.C
surfaceFilmModel/surfaceFilmModelNew.C
noFilm/noFilm.C
kinematicSingleLayer/kinematicSingleLayer.C
thermoSingleLayer/thermoSingleLayer.C
/* Sub-models */
submodels/subModelBase.C
KINEMATICMODELS=submodels/kinematic
$(KINEMATICMODELS)/injectionModel/injectionModel/injectionModel.C
$(KINEMATICMODELS)/injectionModel/injectionModel/injectionModelNew.C
$(KINEMATICMODELS)/injectionModel/noInjection/noInjection.C
$(KINEMATICMODELS)/injectionModel/cloudInjection/cloudInjection.C
$(KINEMATICMODELS)/injectionModel/removeInjection/removeInjection.C
THERMOMODELS=submodels/thermo
$(THERMOMODELS)/phaseChangeModel/phaseChangeModel/phaseChangeModel.C
$(THERMOMODELS)/phaseChangeModel/phaseChangeModel/phaseChangeModelNew.C
$(THERMOMODELS)/phaseChangeModel/noPhaseChange/noPhaseChange.C
$(THERMOMODELS)/phaseChangeModel/standardPhaseChange/standardPhaseChange.C
$(THERMOMODELS)/heatTransferModel/heatTransferModel/heatTransferModel.C
$(THERMOMODELS)/heatTransferModel/heatTransferModel/heatTransferModelNew.C
$(THERMOMODELS)/heatTransferModel/constantHeatTransfer/constantHeatTransfer.C
$(THERMOMODELS)/heatTransferModel/mappedConvectiveHeatTransfer/mappedConvectiveHeatTransfer.C
$(THERMOMODELS)/filmRadiationModel/filmRadiationModel/filmRadiationModel.C
$(THERMOMODELS)/filmRadiationModel/filmRadiationModel/filmRadiationModelNew.C
$(THERMOMODELS)/filmRadiationModel/noRadiation/noRadiation.C
$(THERMOMODELS)/filmRadiationModel/standardRadiation/standardRadiation.C
/* Boundary conditions */
derivedFvPatchFields/filmHeightInletVelocity/filmHeightInletVelocityFvPatchVectorField.C
derivedFvPatchFields/htcConv/htcConvFvPatchScalarField.C
/* Wall functions for primary region */
derivedFvPatchFields/wallFunctions/alphatFilmWallFunction/alphatFilmWallFunctionFvPatchScalarField.C
derivedFvPatchFields/wallFunctions/mutkFilmWallFunction/mutkFilmWallFunctionFvPatchScalarField.C
LIB = $(FOAM_LIBBIN)/libsurfaceFilmModels

View File

@ -0,0 +1,25 @@
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/liquids/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/liquidMixture/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/pointSolids/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/pointSolidMixture/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/pdfs/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/SLGThermo/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
-I$(LIB_SRC)/turbulenceModels \
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \
-I$(LIB_SRC)/turbulenceModels/compressible/RAS/lnInclude \
-I$(LIB_SRC)/regionModels/regionModel/lnInclude
EXE_LIBS = \
-lregionModels \
-lSLGThermoNew \
-lfiniteVolume \
-lmeshTools \
-lpdf \
-lcompressibleRASModels \
-lcompressibleLESModels

View File

@ -0,0 +1,168 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 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 2 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 "filmHeightInletVelocityFvPatchVectorField.H"
#include "addToRunTimeSelectionTable.H"
#include "volFields.H"
#include "surfaceFields.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::filmHeightInletVelocityFvPatchVectorField::
filmHeightInletVelocityFvPatchVectorField
(
const fvPatch& p,
const DimensionedField<vector, volMesh>& iF
)
:
fixedValueFvPatchVectorField(p, iF),
phiName_("phi"),
rhoName_("rho"),
deltafName_("deltaf")
{}
Foam::filmHeightInletVelocityFvPatchVectorField::
filmHeightInletVelocityFvPatchVectorField
(
const filmHeightInletVelocityFvPatchVectorField& ptf,
const fvPatch& p,
const DimensionedField<vector, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
fixedValueFvPatchVectorField(ptf, p, iF, mapper),
phiName_(ptf.phiName_),
rhoName_(ptf.rhoName_),
deltafName_(ptf.deltafName_)
{}
Foam::filmHeightInletVelocityFvPatchVectorField::
filmHeightInletVelocityFvPatchVectorField
(
const fvPatch& p,
const DimensionedField<vector, volMesh>& iF,
const dictionary& dict
)
:
fixedValueFvPatchVectorField(p, iF),
phiName_(dict.lookupOrDefault<word>("phi", "phi")),
rhoName_(dict.lookupOrDefault<word>("rho", "rho")),
deltafName_(dict.lookupOrDefault<word>("deltaf", "deltaf"))
{
fvPatchVectorField::operator=(vectorField("value", dict, p.size()));
}
Foam::filmHeightInletVelocityFvPatchVectorField::
filmHeightInletVelocityFvPatchVectorField
(
const filmHeightInletVelocityFvPatchVectorField& fhivpvf
)
:
fixedValueFvPatchVectorField(fhivpvf),
phiName_(fhivpvf.phiName_),
rhoName_(fhivpvf.rhoName_),
deltafName_(fhivpvf.deltafName_)
{}
Foam::filmHeightInletVelocityFvPatchVectorField::
filmHeightInletVelocityFvPatchVectorField
(
const filmHeightInletVelocityFvPatchVectorField& fhivpvf,
const DimensionedField<vector, volMesh>& iF
)
:
fixedValueFvPatchVectorField(fhivpvf, iF),
phiName_(fhivpvf.phiName_),
rhoName_(fhivpvf.rhoName_),
deltafName_(fhivpvf.deltafName_)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::filmHeightInletVelocityFvPatchVectorField::updateCoeffs()
{
if (updated())
{
return;
}
const fvsPatchField<scalar>& phip =
patch().lookupPatchField<surfaceScalarField, scalar>(phiName_);
const fvPatchField<scalar>& rhop =
patch().lookupPatchField<volScalarField, scalar>(rhoName_);
const fvPatchField<scalar>& deltafp =
patch().lookupPatchField<volScalarField, scalar>(deltafName_);
vectorField n = patch().nf();
const scalarField& magSf = patch().magSf();
operator==(deltafp*n*phip/(rhop*magSf*sqr(deltafp) + ROOTVSMALL));
fixedValueFvPatchVectorField::updateCoeffs();
}
void Foam::filmHeightInletVelocityFvPatchVectorField::write(Ostream& os) const
{
fvPatchVectorField::write(os);
writeEntryIfDifferent<word>(os, "phi", "phi", phiName_);
writeEntryIfDifferent<word>(os, "rho", "rho", rhoName_);
writeEntryIfDifferent<word>(os, "deltaf", "deltaf", deltafName_);
writeEntry("value", os);
}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
void Foam::filmHeightInletVelocityFvPatchVectorField::operator=
(
const fvPatchField<vector>& pvf
)
{
fvPatchField<vector>::operator=(patch().nf()*(patch().nf() & pvf));
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
makePatchTypeField
(
fvPatchVectorField,
filmHeightInletVelocityFvPatchVectorField
);
}
// ************************************************************************* //

View File

@ -0,0 +1,199 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 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 2 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::filmHeightInletVelocityFvPatchVectorField
Description
Velocity inlet boundary condition for patches where the film height is
specified. The inflow velocity is obtained from the flux with a direction
normal to the patch faces.
SourceFiles
filmHeightInletVelocityFvPatchVectorField.C
\*---------------------------------------------------------------------------*/
#ifndef filmHeightInletVelocityFvPatchVectorField_H
#define filmHeightInletVelocityFvPatchVectorField_H
#include "fvPatchFields.H"
#include "fixedValueFvPatchFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class filmHeightInletVelocityFvPatchVectorField Declaration
\*---------------------------------------------------------------------------*/
class filmHeightInletVelocityFvPatchVectorField
:
public fixedValueFvPatchVectorField
{
// Private data
//- Name of flux field
word phiName_;
//- Name of density field
word rhoName_;
//- Name of film height field
word deltafName_;
public:
//- Runtime type information
TypeName("filmHeightInletVelocity");
// Constructors
//- Construct from patch and internal field
filmHeightInletVelocityFvPatchVectorField
(
const fvPatch&,
const DimensionedField<vector, volMesh>&
);
//- Construct from patch, internal field and dictionary
filmHeightInletVelocityFvPatchVectorField
(
const fvPatch&,
const DimensionedField<vector, volMesh>&,
const dictionary&
);
//- Construct by mapping given filmHeightInletVelocityFvPatchVectorField
// onto a new patch
filmHeightInletVelocityFvPatchVectorField
(
const filmHeightInletVelocityFvPatchVectorField&,
const fvPatch&,
const DimensionedField<vector, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
filmHeightInletVelocityFvPatchVectorField
(
const filmHeightInletVelocityFvPatchVectorField&
);
//- Construct and return a clone
virtual tmp<fvPatchVectorField> clone() const
{
return tmp<fvPatchVectorField>
(
new filmHeightInletVelocityFvPatchVectorField(*this)
);
}
//- Construct as copy setting internal field reference
filmHeightInletVelocityFvPatchVectorField
(
const filmHeightInletVelocityFvPatchVectorField&,
const DimensionedField<vector, volMesh>&
);
//- Construct and return a clone setting internal field reference
virtual tmp<fvPatchVectorField> clone
(
const DimensionedField<vector, volMesh>& iF
) const
{
return tmp<fvPatchVectorField>
(
new filmHeightInletVelocityFvPatchVectorField(*this, iF)
);
}
// Member functions
// Access
//- Return the name of phi
const word& phiName() const
{
return phiName_;
}
//- Return reference to the name of phi to allow adjustment
word& phiName()
{
return phiName_;
}
//- Return the name of rho
const word& rhoName() const
{
return rhoName_;
}
//- Return reference to the name of rho to allow adjustment
word& rhoName()
{
return rhoName_;
}
//- Return the name of deltaf
const word& deltafName() const
{
return deltafName_;
}
//- Return reference to the name of df to allow adjustment
word& deltafName()
{
return deltafName_;
}
//- Update the coefficients associated with the patch field
virtual void updateCoeffs();
//- Write
virtual void write(Ostream&) const;
// Member operators
virtual void operator=(const fvPatchField<vector>& pvf);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,166 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 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 2 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 "htcConvFvPatchScalarField.H"
#include "RASModel.H"
#include "fvPatchFieldMapper.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace compressible
{
namespace RASModels
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
htcConvFvPatchScalarField::htcConvFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF
)
:
fixedValueFvPatchScalarField(p, iF),
L_(1.0)
{}
htcConvFvPatchScalarField::htcConvFvPatchScalarField
(
const htcConvFvPatchScalarField& ptf,
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
fixedValueFvPatchScalarField(ptf, p, iF, mapper),
L_(ptf.L_)
{}
htcConvFvPatchScalarField::htcConvFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const dictionary& dict
)
:
fixedValueFvPatchScalarField(p, iF, dict),
L_(readScalar(dict.lookup("L")))
{}
htcConvFvPatchScalarField::htcConvFvPatchScalarField
(
const htcConvFvPatchScalarField& htcpsf
)
:
fixedValueFvPatchScalarField(htcpsf),
L_(htcpsf.L_)
{}
htcConvFvPatchScalarField::htcConvFvPatchScalarField
(
const htcConvFvPatchScalarField& htcpsf,
const DimensionedField<scalar, volMesh>& iF
)
:
fixedValueFvPatchScalarField(htcpsf, iF),
L_(htcpsf.L_)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void htcConvFvPatchScalarField::updateCoeffs()
{
if (updated())
{
return;
}
const label patchI = patch().index();
const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties");
const scalarField alphaEffw = rasModel.alphaEff()().boundaryField()[patchI];
const scalarField& muw = rasModel.mu().boundaryField()[patchI];
const scalarField& rhow = rasModel.rho().boundaryField()[patchI];
const vectorField& Uc = rasModel.U();
const vectorField& Uw = rasModel.U().boundaryField()[patchI];
const scalarField& Tw = rasModel.thermo().T().boundaryField()[patchI];
const scalarField Cpw = rasModel.thermo().Cp(Tw, patchI);
const scalarField kappaw = Cpw*alphaEffw;
const scalarField Pr = muw*Cpw/kappaw;
scalarField& htc = *this;
forAll(htc, faceI)
{
label faceCellI = patch().faceCells()[faceI];
scalar Re = rhow[faceI]*mag(Uc[faceCellI] - Uw[faceI])*L_/muw[faceI];
if (Re < 5.0E+05)
{
htc[faceI] = 0.664*sqrt(Re)*cbrt(Pr[faceI])*kappaw[faceI]/L_;
}
else
{
htc[faceI] = 0.037*pow(Re, 0.8)*cbrt(Pr[faceI])*kappaw[faceI]/L_;
}
}
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void htcConvFvPatchScalarField::write(Ostream& os) const
{
fvPatchField<scalar>::write(os);
os.writeKeyword("L") << L_ << token::END_STATEMENT << nl;
writeEntry("value", os);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeField
(
fvPatchScalarField,
htcConvFvPatchScalarField
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace RASModels
} // End namespace compressible
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,160 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 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 2 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::compressible::RASModels::htcConvFvPatchScalarField
Description
Convective heat transfer boundary condition
SourceFiles
htcConvFvPatchScalarField.C
\*---------------------------------------------------------------------------*/
#ifndef compressibleMutRoughWallFunctionFvPatchScalarField_H
#define compressibleMutRoughWallFunctionFvPatchScalarField_H
#include "fixedValueFvPatchFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace compressible
{
namespace RASModels
{
/*---------------------------------------------------------------------------*\
Class htcConvFvPatchScalarField Declaration
\*---------------------------------------------------------------------------*/
class htcConvFvPatchScalarField
:
public fixedValueFvPatchScalarField
{
protected:
// Protected data
//- L Length scale [m]
const scalar L_;
public:
//- Runtime type information
TypeName("htcConvection");
// Constructors
//- Construct from patch and internal field
htcConvFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&
);
//- Construct from patch, internal field and dictionary
htcConvFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const dictionary&
);
//- Construct by mapping given
// htcConvFvPatchScalarField
// onto a new patch
htcConvFvPatchScalarField
(
const htcConvFvPatchScalarField&,
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
htcConvFvPatchScalarField
(
const htcConvFvPatchScalarField&
);
//- Construct and return a clone
virtual tmp<fvPatchScalarField> clone() const
{
return tmp<fvPatchScalarField>
(
new htcConvFvPatchScalarField(*this)
);
}
//- Construct as copy setting internal field reference
htcConvFvPatchScalarField
(
const htcConvFvPatchScalarField&,
const DimensionedField<scalar, volMesh>&
);
//- Construct and return a clone setting internal field reference
virtual tmp<fvPatchScalarField> clone
(
const DimensionedField<scalar, volMesh>& iF
) const
{
return tmp<fvPatchScalarField>
(
new htcConvFvPatchScalarField(*this, iF)
);
}
// Member functions
// Evaluation functions
//- Update the coefficients associated with the patch field
virtual void updateCoeffs();
// I-O
//- Write
virtual void write(Ostream&) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace RASModels
} // End namespace compressible
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,240 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 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 2 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 "alphatFilmWallFunctionFvPatchScalarField.H"
#include "RASModel.H"
#include "surfaceFilmModel.H"
#include "fvPatchFieldMapper.H"
#include "volFields.H"
#include "addToRunTimeSelectionTable.H"
#include "directMappedWallPolyPatch.H"
#include "mapDistribute.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace compressible
{
namespace RASModels
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
alphatFilmWallFunctionFvPatchScalarField::
alphatFilmWallFunctionFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF
)
:
fixedValueFvPatchScalarField(p, iF),
B_(5.5),
yPlusCrit_(11.05),
Cmu_(0.09),
kappa_(0.41),
Prt_(0.85)
{}
alphatFilmWallFunctionFvPatchScalarField::
alphatFilmWallFunctionFvPatchScalarField
(
const alphatFilmWallFunctionFvPatchScalarField& ptf,
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
fixedValueFvPatchScalarField(ptf, p, iF, mapper),
B_(ptf.B_),
yPlusCrit_(ptf.yPlusCrit_),
Cmu_(ptf.Cmu_),
kappa_(ptf.kappa_),
Prt_(ptf.Prt_)
{}
alphatFilmWallFunctionFvPatchScalarField::
alphatFilmWallFunctionFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const dictionary& dict
)
:
fixedValueFvPatchScalarField(p, iF, dict),
B_(dict.lookupOrDefault("B", 5.5)),
yPlusCrit_(dict.lookupOrDefault("yPlusCrit", 11.05)),
Cmu_(dict.lookupOrDefault("Cmu", 0.09)),
kappa_(dict.lookupOrDefault("kappa", 0.41)),
Prt_(dict.lookupOrDefault("Prt", 0.85))
{}
alphatFilmWallFunctionFvPatchScalarField::
alphatFilmWallFunctionFvPatchScalarField
(
const alphatFilmWallFunctionFvPatchScalarField& fwfpsf
)
:
fixedValueFvPatchScalarField(fwfpsf),
B_(fwfpsf.B_),
yPlusCrit_(fwfpsf.yPlusCrit_),
Cmu_(fwfpsf.Cmu_),
kappa_(fwfpsf.kappa_),
Prt_(fwfpsf.Prt_)
{}
alphatFilmWallFunctionFvPatchScalarField::
alphatFilmWallFunctionFvPatchScalarField
(
const alphatFilmWallFunctionFvPatchScalarField& fwfpsf,
const DimensionedField<scalar, volMesh>& iF
)
:
fixedValueFvPatchScalarField(fwfpsf, iF),
B_(fwfpsf.B_),
yPlusCrit_(fwfpsf.yPlusCrit_),
Cmu_(fwfpsf.Cmu_),
kappa_(fwfpsf.kappa_),
Prt_(fwfpsf.Prt_)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void alphatFilmWallFunctionFvPatchScalarField::updateCoeffs()
{
if (updated())
{
return;
}
typedef regionModels::surfaceFilmModels::surfaceFilmModel modelType;
bool ok =
db().objectRegistry::foundObject<modelType>("surfaceFilmProperties");
if (!ok)
{
// do nothing on construction - film model doesn't exist yet
return;
}
const label patchI = patch().index();
// Retrieve phase change mass from surface film model
const modelType& filmModel =
db().objectRegistry::lookupObject<modelType>("surfaceFilmProperties");
const label filmPatchI = filmModel.regionPatchID(patchI);
const mapDistribute& distMap = filmModel.mappedPatches()[filmPatchI].map();
scalarField mDotFilm =
filmModel.massPhaseChangeForPrimary().boundaryField()[filmPatchI];
distMap.distribute(mDotFilm);
// Retrieve RAS turbulence model
const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties");
const scalarField& y = rasModel.y()[patchI];
const scalarField& rhow = rasModel.rho().boundaryField()[patchI];
const tmp<volScalarField> tk = rasModel.k();
const volScalarField& k = tk();
const scalarField& muw = rasModel.mu().boundaryField()[patchI];
const scalarField& alphaw = rasModel.alpha().boundaryField()[patchI];
const scalar Cmu25 = pow(Cmu_, 0.25);
// Populate alphat field values
scalarField& alphat = *this;
forAll(alphat, faceI)
{
label faceCellI = patch().faceCells()[faceI];
scalar uTau = Cmu25*sqrt(k[faceCellI]);
scalar yPlus = y[faceI]*uTau/(muw[faceI]/rhow[faceI]);
scalar Pr = muw[faceI]/alphaw[faceI];
scalar factor = 0.0;
scalar mStar = mDotFilm[faceI]/(y[faceI]*uTau);
if (yPlus > yPlusCrit_)
{
scalar expTerm = exp(min(50.0, yPlusCrit_*mStar*Pr));
scalar yPlusRatio = yPlus/yPlusCrit_;
scalar powTerm = mStar*Prt_/kappa_;
factor =
mStar/(expTerm*(pow(yPlusRatio, powTerm)) - 1.0 + ROOTVSMALL);
}
else
{
scalar expTerm = exp(min(50.0, yPlus*mStar*Pr));
factor = mStar/(expTerm - 1.0 + ROOTVSMALL);
}
scalar dx = patch().deltaCoeffs()[faceI];
scalar alphaEff = dx*rhow[faceI]*uTau*factor;
alphat[faceI] = max(alphaEff - alphaw[faceI], 0.0);
}
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void alphatFilmWallFunctionFvPatchScalarField::write(Ostream& os) const
{
fvPatchField<scalar>::write(os);
os.writeKeyword("B") << B_ << token::END_STATEMENT << nl;
os.writeKeyword("yPlusCrit") << yPlusCrit_ << token::END_STATEMENT << nl;
os.writeKeyword("Cmu") << Cmu_ << token::END_STATEMENT << nl;
os.writeKeyword("kappa") << kappa_ << token::END_STATEMENT << nl;
os.writeKeyword("Prt") << Prt_ << token::END_STATEMENT << nl;
writeEntry("value", os);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeField
(
fvPatchScalarField,
alphatFilmWallFunctionFvPatchScalarField
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace RASModels
} // End namespace compressible
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,173 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 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 2 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::compressible::RASModels::alphatFilmWallFunctionFvPatchScalarField
Description
Turbulent thermal diffusivity boundary conditions for use with surface
film models.
SourceFiles
alphatFilmWallFunctionFvPatchScalarField.C
\*---------------------------------------------------------------------------*/
#ifndef compressibleMutRoughWallFunctionFvPatchScalarField_H
#define compressibleMutRoughWallFunctionFvPatchScalarField_H
#include "fixedValueFvPatchFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace compressible
{
namespace RASModels
{
/*---------------------------------------------------------------------------*\
Class alphatFilmWallFunctionFvPatchScalarField Declaration
\*---------------------------------------------------------------------------*/
class alphatFilmWallFunctionFvPatchScalarField
:
public fixedValueFvPatchScalarField
{
protected:
// Protected data
//- B Coefficient (default = 5.5)
scalar B_;
//- y+ value for laminar -> turbulent transition (default = 11.05)
scalar yPlusCrit_;
//- Turbulent Cmu coefficient (default = 0.09)
scalar Cmu_;
//- Von-Karman constant (default = 0.41)
scalar kappa_;
//- Turbulent Prandtl number (default = 0.85)
scalar Prt_;
public:
//- Runtime type information
TypeName("alphatFilmWallFunction");
// Constructors
//- Construct from patch and internal field
alphatFilmWallFunctionFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&
);
//- Construct from patch, internal field and dictionary
alphatFilmWallFunctionFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const dictionary&
);
//- Construct by mapping given
// alphatFilmWallFunctionFvPatchScalarField
// onto a new patch
alphatFilmWallFunctionFvPatchScalarField
(
const alphatFilmWallFunctionFvPatchScalarField&,
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
alphatFilmWallFunctionFvPatchScalarField
(
const alphatFilmWallFunctionFvPatchScalarField&
);
//- Construct and return a clone
virtual tmp<fvPatchScalarField> clone() const
{
return tmp<fvPatchScalarField>
(
new alphatFilmWallFunctionFvPatchScalarField(*this)
);
}
//- Construct as copy setting internal field reference
alphatFilmWallFunctionFvPatchScalarField
(
const alphatFilmWallFunctionFvPatchScalarField&,
const DimensionedField<scalar, volMesh>&
);
//- Construct and return a clone setting internal field reference
virtual tmp<fvPatchScalarField> clone
(
const DimensionedField<scalar, volMesh>& iF
) const
{
return tmp<fvPatchScalarField>
(
new alphatFilmWallFunctionFvPatchScalarField(*this, iF)
);
}
// Member functions
// Evaluation functions
//- Update the coefficients associated with the patch field
virtual void updateCoeffs();
// I-O
//- Write
virtual void write(Ostream&) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace RASModels
} // End namespace compressible
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,238 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 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 "mutkFilmWallFunctionFvPatchScalarField.H"
#include "fvPatchFieldMapper.H"
#include "volFields.H"
#include "RASModel.H"
#include "addToRunTimeSelectionTable.H"
#include "surfaceFilmModel.H"
#include "directMappedWallPolyPatch.H"
#include "mapDistribute.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace compressible
{
namespace RASModels
{
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
tmp<scalarField> mutkFilmWallFunctionFvPatchScalarField::calcUTau
(
const scalarField& magGradU
) const
{
tmp<scalarField> tuTau(new scalarField(patch().size(), 0.0));
scalarField& uTau = tuTau();
typedef regionModels::surfaceFilmModels::surfaceFilmModel modelType;
bool ok =
db().objectRegistry::foundObject<modelType>("surfaceFilmProperties");
if (!ok)
{
// do nothing on construction - film model doesn't exist yet
return tuTau;
}
const label patchI = patch().index();
// Retrieve phase change mass from surface film model
const modelType& filmModel =
db().objectRegistry::lookupObject<modelType>("surfaceFilmProperties");
const label filmPatchI = filmModel.regionPatchID(patchI);
const mapDistribute& distMap = filmModel.mappedPatches()[filmPatchI].map();
scalarField mDotFilm =
filmModel.massPhaseChangeForPrimary().boundaryField()[filmPatchI];
distMap.distribute(mDotFilm);
// Retrieve RAS turbulence model
const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties");
const scalarField& y = rasModel.y()[patchI];
const fvPatchScalarField& rhow = rasModel.rho().boundaryField()[patchI];
const fvPatchScalarField& muw = rasModel.mu().boundaryField()[patchI];
const tmp<volScalarField> tk = rasModel.k();
const volScalarField& k = tk();
const scalar Cmu25 = pow(Cmu_, 0.25);
forAll(uTau, faceI)
{
label faceCellI = patch().faceCells()[faceI];
scalar ut = Cmu25*sqrt(k[faceCellI]);
scalar yPlus = y[faceI]*ut/(muw[faceI]/rhow[faceI]);
scalar mStar = mDotFilm[faceI]/(y[faceI]*ut);
scalar factor = 0.0;
if (yPlus > yPlusCrit_)
{
scalar expTerm = exp(min(50.0, B_*mStar));
scalar powTerm = pow(yPlus, mStar/kappa_);
factor = mStar/(expTerm*powTerm - 1.0 + ROOTVSMALL);
}
else
{
scalar expTerm = exp(min(50.0, mStar));
factor = mStar/(expTerm*yPlus - 1.0 + ROOTVSMALL);
}
uTau[faceI] = sqrt(max(0, magGradU[faceI]*ut*factor));
}
return tuTau;
}
tmp<scalarField> mutkFilmWallFunctionFvPatchScalarField::calcMut() const
{
const label patchI = patch().index();
const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties");
const fvPatchVectorField& Uw = rasModel.U().boundaryField()[patchI];
const scalarField magGradU = mag(Uw.snGrad());
const scalarField& rhow = rasModel.rho().boundaryField()[patchI];
const scalarField& muw = rasModel.mu().boundaryField()[patchI];
return max
(
scalar(0),
rhow*sqr(calcUTau(magGradU))/(magGradU + ROOTVSMALL) - muw
);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
mutkFilmWallFunctionFvPatchScalarField::mutkFilmWallFunctionFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF
)
:
mutkWallFunctionFvPatchScalarField(p, iF),
B_(5.5),
yPlusCrit_(11.05)
{}
mutkFilmWallFunctionFvPatchScalarField::mutkFilmWallFunctionFvPatchScalarField
(
const mutkFilmWallFunctionFvPatchScalarField& ptf,
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
mutkWallFunctionFvPatchScalarField(ptf, p, iF, mapper),
B_(5.5),
yPlusCrit_(11.05)
{}
mutkFilmWallFunctionFvPatchScalarField::mutkFilmWallFunctionFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const dictionary& dict
)
:
mutkWallFunctionFvPatchScalarField(p, iF, dict),
B_(dict.lookupOrDefault("B", 5.5)),
yPlusCrit_(dict.lookupOrDefault("yPlusCrit", 11.05))
{}
mutkFilmWallFunctionFvPatchScalarField::mutkFilmWallFunctionFvPatchScalarField
(
const mutkFilmWallFunctionFvPatchScalarField& wfpsf
)
:
mutkWallFunctionFvPatchScalarField(wfpsf),
B_(wfpsf.B_),
yPlusCrit_(wfpsf.yPlusCrit_)
{}
mutkFilmWallFunctionFvPatchScalarField::mutkFilmWallFunctionFvPatchScalarField
(
const mutkFilmWallFunctionFvPatchScalarField& wfpsf,
const DimensionedField<scalar, volMesh>& iF
)
:
mutkWallFunctionFvPatchScalarField(wfpsf, iF),
B_(wfpsf.B_),
yPlusCrit_(wfpsf.yPlusCrit_)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
tmp<scalarField> mutkFilmWallFunctionFvPatchScalarField::yPlus() const
{
const label patchI = patch().index();
const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties");
const scalarField& y = rasModel.y()[patchI];
const fvPatchVectorField& Uw = rasModel.U().boundaryField()[patchI];
const scalarField& rhow = rasModel.rho().boundaryField()[patchI];
const scalarField& muw = rasModel.mu().boundaryField()[patchI];
return y*calcUTau(mag(Uw.snGrad()))/(muw/rhow);
}
void mutkFilmWallFunctionFvPatchScalarField::write(Ostream& os) const
{
fvPatchField<scalar>::write(os);
writeLocalEntries(os);
os.writeKeyword("B") << B_ << token::END_STATEMENT << nl;
os.writeKeyword("yPlusCrit") << yPlusCrit_ << token::END_STATEMENT << nl;
writeEntry("value", os);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeField(fvPatchScalarField, mutkFilmWallFunctionFvPatchScalarField);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace RASModels
} // End namespace compressible
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,172 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 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::compressible::RASModels::
mutkFilmWallFunctionFvPatchScalarField
Description
Wall function boundary condition for use with surface film models.
SourceFiles
mutkFilmWallFunctionFvPatchScalarField.C
\*---------------------------------------------------------------------------*/
#ifndef compressibleMutSpalartAllmarasWallFunctionFvPatchScalarField_H
#define compressibleMutSpalartAllmarasWallFunctionFvPatchScalarField_H
#include "mutkWallFunctionFvPatchScalarField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace compressible
{
namespace RASModels
{
/*---------------------------------------------------------------------------*\
Class mutkFilmWallFunctionFvPatchScalarField Declaration
\*---------------------------------------------------------------------------*/
class mutkFilmWallFunctionFvPatchScalarField
:
public mutkWallFunctionFvPatchScalarField
{
protected:
// Protected data
//- B Coefficient (default = 5.5)
scalar B_;
//- y+ value for laminar -> turbulent transition (default = 11.05)
scalar yPlusCrit_;
// Protected member functions
//- Calculate the turbulence viscosity
virtual tmp<scalarField> calcMut() const;
//- Calculate the friction velocity
virtual tmp<scalarField> calcUTau(const scalarField& magGradU) const;
public:
//- Runtime type information
TypeName("mutkFilmWallFunction");
// Constructors
//- Construct from patch and internal field
mutkFilmWallFunctionFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&
);
//- Construct from patch, internal field and dictionary
mutkFilmWallFunctionFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const dictionary&
);
//- Construct by mapping given
// mutkFilmWallFunctionFvPatchScalarField
// onto a new patch
mutkFilmWallFunctionFvPatchScalarField
(
const mutkFilmWallFunctionFvPatchScalarField&,
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
mutkFilmWallFunctionFvPatchScalarField
(
const mutkFilmWallFunctionFvPatchScalarField&
);
//- Construct and return a clone
virtual tmp<fvPatchScalarField> clone() const
{
return tmp<fvPatchScalarField>
(
new mutkFilmWallFunctionFvPatchScalarField(*this)
);
}
//- Construct as copy setting internal field reference
mutkFilmWallFunctionFvPatchScalarField
(
const mutkFilmWallFunctionFvPatchScalarField&,
const DimensionedField<scalar, volMesh>&
);
//- Construct and return a clone setting internal field reference
virtual tmp<fvPatchScalarField> clone
(
const DimensionedField<scalar, volMesh>& iF
) const
{
return tmp<fvPatchScalarField>
(
new mutkFilmWallFunctionFvPatchScalarField(*this, iF)
);
}
// Member functions
// Evaluation functions
//- Calculate and return the yPlus at the boundary
virtual tmp<scalarField> yPlus() const;
// I-O
//- Write
virtual void write(Ostream& os) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace RASModels
} // End namespace compressible
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,524 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-2010 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 2 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::kinematicSingleLayer
Description
Kinematic form of single-cell layer surface film model
SourceFiles
kinematicSingleLayer.C
\*---------------------------------------------------------------------------*/
#ifndef kinematicSingleLayer_H
#define kinematicSingleLayer_H
#include "surfaceFilmModel.H"
#include "fvMesh.H"
#include "volFields.H"
#include "surfaceFields.H"
#include "fvMatrices.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace regionModels
{
namespace surfaceFilmModels
{
// Forward declaration of classes
class injectionModel;
/*---------------------------------------------------------------------------*\
Class kinematicSingleLayer Declaration
\*---------------------------------------------------------------------------*/
class kinematicSingleLayer
:
public surfaceFilmModel
{
private:
// Private member functions
//- Disallow default bitwise copy construct
kinematicSingleLayer(const kinematicSingleLayer&);
//- Disallow default bitwise assignment
void operator=(const kinematicSingleLayer&);
protected:
// Protected data
// Solution parameters
//- Momentum predictor
Switch momentumPredictor_;
//- Number of outer correctors
label nOuterCorr_;
//- Number of PISO-like correctors
label nCorr_;
//- Number of non-orthogonal correctors
label nNonOrthCorr_;
//- Cumulative continuity error
scalar cumulativeContErr_;
// Model parameters
//- Skin frition coefficient for film/primary region interface
scalar Cf_;
//- Stable film thickness - film cannot detach until this is reached
dimensionedScalar deltaStable_;
// Thermo properties
// Fields
//- Density / [kg/m3]
volScalarField rho_;
//- Dynamic viscosity / [Pa.s]
volScalarField mu_;
//- Surface tension / [m/s2]
volScalarField sigma_;
// Fields
//- Film thickness / [m]
volScalarField delta_;
//- Velocity - mean / [m/s]
volVectorField U_;
//- Velocity - surface / [m/s]
volVectorField Us_;
//- Velocity - wall / [m/s]
volVectorField Uw_;
//- Film thickness*density (helper field) / [kg/m2]
volScalarField deltaRho_;
//- Mass flux (includes film thickness) / [kg.m/s]
surfaceScalarField phi_;
// Transfer fields - to the primary region
//- Film mass available for transfer
volScalarField massForPrimary_;
//- Parcel diameters originating from film
volScalarField diametersForPrimary_;
//- Film mass evolved via phase change
volScalarField massPhaseChangeForPrimary_;
// Source term fields
// Film region - registered to the film region mesh
// Note: need boundary value mapped from primary region, and then
// pushed into the patch internal field
//- Momementum / [kg/m/s2]
volVectorField USp_;
//- Pressure / [Pa]
volScalarField pSp_;
//- Mass / [kg/m2/s]
volScalarField rhoSp_;
// Primary region - registered to the primary region mesh
// Internal use only - not read-in
//- Momementum / [kg/m/s2]
volVectorField USpPrimary_;
//- Pressure / [Pa]
volScalarField pSpPrimary_;
//- Mass / [kg/m2/s]
volScalarField rhoSpPrimary_;
// Fields mapped from primary region - registered to the film region
// Note: need both boundary AND patch internal fields to be mapped
//- Velocity / [m/s]
volVectorField UPrimary_;
//- Pressure / [Pa]
volScalarField pPrimary_;
//- Density / [kg/m3]
volScalarField rhoPrimary_;
//- Viscosity / [Pa.s]
volScalarField muPrimary_;
// Sub-models
//- Injection
autoPtr<injectionModel> injection_;
// Checks
//- Cumulative mass added via sources [kg]
scalar addedMassTotal_;
// Detached surface properties
//- Cumulative mass detached [kg]
scalar injectedMassTotal_;
// Protected member functions
//- Read control parameters from dictionary
virtual bool read();
//- Correct the thermo fields
virtual void correctThermoFields();
//- Reset source term fields
virtual void resetPrimaryRegionSourceTerms();
//- Transfer thermo fields from the primary region to the film region
virtual void transferPrimaryRegionThermoFields();
//- Transfer source fields from the primary region to the film region
virtual void transferPrimaryRegionSourceFields();
//- Correct the source terms for film that detaches from film region
virtual void correctDetachedFilm();
// Explicit pressure source contribution
virtual tmp<volScalarField> pu();
// Implicit pressure source coefficient
virtual tmp<volScalarField> pp();
//- Update the film sub-models
virtual void updateSubmodels();
//- Continuity check
virtual void continuityCheck();
//- Update film surface velocities
virtual void updateSurfaceVelocities();
//- Return the stress term for the momentum equation
virtual tmp<fvVectorMatrix> tau(volVectorField& dU) const;
//- Constrain a film region master/slave boundaries of a field to a
// given value
template<class Type>
void constrainFilmField
(
Type& field,
const typename Type::cmptType& value
);
// Equations
//- Solve continuity equation
virtual void solveContinuity();
//- Solve for film velocity
virtual tmp<fvVectorMatrix> solveMomentum
(
const volScalarField& pu,
const volScalarField& pp
);
//- Solve coupled velocity-thickness equations
virtual void solveThickness
(
const volScalarField& pu,
const volScalarField& pp,
const fvVectorMatrix& UEqn
);
public:
//- Runtime type information
TypeName("kinematicSingleLayer");
// Constructors
//- Construct from components
kinematicSingleLayer
(
const word& modelType,
const fvMesh& mesh,
const dimensionedVector& g,
const bool readFields = true
);
//- Destructor
virtual ~kinematicSingleLayer();
// Member Functions
// Solution parameters
//- Courant number evaluation
virtual scalar CourantNumber() const;
//- Return the momentum predictor
inline const Switch& momentumPredictor() const;
//- Return the number of outer correctors
inline label nOuterCorr() const;
//- Return the number of PISO correctors
inline label nCorr() const;
//- Return the number of non-orthogonal correctors
inline label nNonOrthCorr() const;
// Model parameters
//- Return the skin friction coefficient
inline scalar Cf() const;
// Thermo properties
//- Return const access to the dynamic viscosity / [Pa.s]
inline const volScalarField& mu() const;
//- Return const access to the surface tension / [m/s2]
inline const volScalarField& sigma() const;
// Fields
//- Return const access to the film thickness / [m]
inline const volScalarField& delta() const;
//- Return the film velocity [m/s]
virtual const volVectorField& U() const;
//- Return the film surface velocity [m/s]
virtual const volVectorField& Us() const;
//- Return the film wall velocity [m/s]
virtual const volVectorField& Uw() const;
//- Return the film density [kg/m3]
virtual const volScalarField& rho() const;
//- Return the film mean temperature [K]
virtual const volScalarField& T() const;
//- Return the film surface temperature [K]
virtual const volScalarField& Ts() const;
//- Return the film wall temperature [K]
virtual const volScalarField& Tw() const;
//- Return the film specific heat capacity [J/kg/K]
virtual const volScalarField& Cp() const;
//- Return the film thermal conductivity [W/m/K]
virtual const volScalarField& kappa() const;
// Transfer fields - to the primary region
//- Return the film mass available for transfer
virtual const volScalarField& massForPrimary() const;
//- Return the parcel diameters originating from film
virtual const volScalarField& diametersForPrimary() const;
//- Return the film mass evolved via phase change
virtual const volScalarField& massPhaseChangeForPrimary() const;
// External helper functions
//- External hook to add sources to the film
virtual void addSources
(
const label patchI, // patchI on primary region
const label faceI, // faceI of patchI
const scalar massSource, // [kg]
const vector& momentumSource, // [kg.m/s] (tangential momentum)
const scalar pressureSource, // [kg.m/s] (normal momentum)
const scalar energySource = 0 // [J]
);
// Source fields (read/write access)
// Primary region
//- Momementum / [kg/m/s2]
inline volVectorField& USpPrimary();
//- Pressure / [Pa]
inline volScalarField& pSpPrimary();
//- Mass / [kg/m2/s]
inline volScalarField& rhoSpPrimary();
// Film region
//- Momentum / [kg/m/s2]
inline volVectorField& USp();
//- Pressure / [Pa]
inline volScalarField& pSp();
//- Mass / [kg/m2/s]
inline volScalarField& rhoSp();
//- Momentum / [kg/m/s2]
inline const volVectorField& USp() const;
//- Pressure / [Pa]
inline const volScalarField& pSp() const;
//- Mass / [kg/m2/s]
inline const volScalarField& rhoSp() const;
// Fields mapped from primary region
//- Velocity / [m/s]
inline const volVectorField& UPrimary() const;
//- Pressure / [Pa]
inline const volScalarField& pPrimary() const;
//- Density / [kg/m3]
inline const volScalarField& rhoPrimary() const;
//- Viscosity / [Pa.s]
inline const volScalarField& muPrimary() const;
// Sub-models
//- Injection
inline injectionModel& injection();
// Helper functions
//- Return the gravity tangential component contributions
inline tmp<volVectorField> gTan() const;
//- Return the gravity normal-to-patch component contribution
inline tmp<volScalarField> gNorm() const;
//- Return the gravity normal-to-patch component contribution
// Clipped so that only non-zero if g & nHat_ < 0
inline tmp<volScalarField> gNormClipped() const;
// Evolution
//- Pre-evolve film hook
virtual void preEvolveRegion();
//- Evolve the film equations
virtual void evolveRegion();
// Source fields
// Mapped into primary region
//- Return total mass source - Eulerian phase only
virtual tmp<DimensionedField<scalar, volMesh> > Srho() const;
//- Return mass source for specie i - Eulerian phase only
virtual tmp<DimensionedField<scalar, volMesh> > Srho
(
const label i
) const;
//- Return enthalpy source - Eulerian phase only
virtual tmp<DimensionedField<scalar, volMesh> > Sh() const;
// I-O
//- Provide some feedback
virtual void info() const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace surfaceFilmModels
} // End namespace regionModels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "kinematicSingleLayerTemplates.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "kinematicSingleLayerI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,250 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-2010 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 2 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 "kinematicSingleLayer.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace regionModels
{
namespace surfaceFilmModels
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
inline const Switch& kinematicSingleLayer::momentumPredictor() const
{
return momentumPredictor_;
}
inline label kinematicSingleLayer::nOuterCorr() const
{
return nOuterCorr_;
}
inline label kinematicSingleLayer::nCorr() const
{
return nCorr_;
}
inline label kinematicSingleLayer::nNonOrthCorr() const
{
return nNonOrthCorr_;
}
inline scalar kinematicSingleLayer::Cf() const
{
return Cf_;
}
inline const volScalarField& kinematicSingleLayer::mu() const
{
return mu_;
}
inline const volScalarField& kinematicSingleLayer::sigma() const
{
return sigma_;
}
inline const volScalarField& kinematicSingleLayer::delta() const
{
return delta_;
}
inline volVectorField& kinematicSingleLayer::USpPrimary()
{
return USpPrimary_;
}
inline volScalarField& kinematicSingleLayer::pSpPrimary()
{
return pSpPrimary_;
}
inline volScalarField& kinematicSingleLayer::rhoSpPrimary()
{
return rhoSpPrimary_;
}
inline volVectorField& kinematicSingleLayer::USp()
{
return USp_;
}
inline volScalarField& kinematicSingleLayer::pSp()
{
return pSp_;
}
inline volScalarField& kinematicSingleLayer::rhoSp()
{
return rhoSp_;
}
inline const volVectorField& kinematicSingleLayer::USp() const
{
return USp_;
}
inline const volScalarField& kinematicSingleLayer::pSp() const
{
return pSp_;
}
inline const volScalarField& kinematicSingleLayer::rhoSp() const
{
return rhoSp_;
}
inline const volVectorField& kinematicSingleLayer::UPrimary() const
{
return UPrimary_;
}
inline const volScalarField& kinematicSingleLayer::pPrimary() const
{
return pPrimary_;
}
inline const volScalarField& kinematicSingleLayer::rhoPrimary() const
{
return rhoPrimary_;
}
inline const volScalarField& kinematicSingleLayer::muPrimary() const
{
return muPrimary_;
}
inline injectionModel& kinematicSingleLayer::injection()
{
return injection_();
}
inline tmp<volScalarField> kinematicSingleLayer::gNorm() const
{
tmp<volScalarField> tgNorm
(
new volScalarField
(
IOobject
(
"gNorm",
time().timeName(),
regionMesh(),
IOobject::NO_READ,
IOobject::NO_WRITE
),
g_ & nHat(),
zeroGradientFvPatchScalarField::typeName
)
);
return tgNorm;
}
inline tmp<volScalarField> kinematicSingleLayer::gNormClipped() const
{
tmp<volScalarField> tgNormClipped
(
new volScalarField
(
IOobject
(
"gNormClipped",
time().timeName(),
regionMesh(),
IOobject::NO_READ,
IOobject::NO_WRITE
),
g_ & nHat(),
zeroGradientFvPatchScalarField::typeName
)
);
volScalarField& gNormClipped = tgNormClipped();
gNormClipped.min(0.0);
return tgNormClipped;
}
inline tmp<volVectorField> kinematicSingleLayer::gTan() const
{
tmp<volVectorField> tgTan
(
new volVectorField
(
IOobject
(
"gTan",
time().timeName(),
regionMesh(),
IOobject::NO_READ,
IOobject::NO_WRITE
),
g_ - nHat()*gNorm(),
zeroGradientFvPatchVectorField::typeName
)
);
return tgTan;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace surfaceFilmModels
} // End namespace regionModels
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,78 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 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 2 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 "kinematicSingleLayer.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace regionModels
{
namespace surfaceFilmModels
{
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
template<class Type>
void kinematicSingleLayer::constrainFilmField
(
Type& field,
const typename Type::cmptType& value
)
{
forAll(intCoupledPatchIDs_, i)
{
label patchI = intCoupledPatchIDs_[i];
field.boundaryField()[patchI] = value;
if (debug)
{
Info<< "Constraining " << field.name()
<< " boundary " << field.boundaryField()[patchI].patch().name()
<< " to " << value << endl;
}
}
forAll(passivePatchIDs_, i)
{
label patchI = passivePatchIDs_[i];
field.boundaryField()[patchI] = value;
if (debug)
{
Info<< "Constraining " << field.name()
<< " boundary " << field.boundaryField()[patchI].patch().name()
<< " to " << value << endl;
}
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // end namespace Foam
} // end namespace regionModels
} // end namespace surfaceFilmModels
// ************************************************************************* //

View File

@ -0,0 +1,291 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-2010 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 2 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 "noFilm.H"
#include "addToRunTimeSelectionTable.H"
#include "volFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace regionModels
{
namespace surfaceFilmModels
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(noFilm, 0);
addToRunTimeSelectionTable(surfaceFilmModel, noFilm, mesh);
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
bool noFilm::read()
{
if (surfaceFilmModel::read())
{
// no additional info to read
return true;
}
else
{
return false;
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
noFilm::noFilm
(
const word&,
const fvMesh& mesh,
const dimensionedVector&
)
:
surfaceFilmModel(mesh)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
noFilm::~noFilm()
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
void noFilm::addSources
(
const label,
const label,
const scalar,
const vector&,
const scalar,
const scalar
)
{
// do nothing
}
const volScalarField& noFilm::delta() const
{
FatalErrorIn("const volScalarField& noFilm::delta() const")
<< "delta field not available for " << type() << abort(FatalError);
return volScalarField::null();
}
const volVectorField& noFilm::U() const
{
FatalErrorIn("const volVectorField& noFilm::U() const")
<< "U field not available for " << type() << abort(FatalError);
return volVectorField::null();
}
const volVectorField& noFilm::Us() const
{
FatalErrorIn("const volVectorField& noFilm::Us() const")
<< "Us field not available for " << type() << abort(FatalError);
return volVectorField::null();
}
const volVectorField& noFilm::Uw() const
{
FatalErrorIn("const volVectorField& noFilm::Uw() const")
<< "Uw field not available for " << type() << abort(FatalError);
return volVectorField::null();
}
const volScalarField& noFilm::rho() const
{
FatalErrorIn("const volScalarField& noFilm::rho() const")
<< "rho field not available for " << type() << abort(FatalError);
return volScalarField::null();
}
const volScalarField& noFilm::T() const
{
FatalErrorIn("const volScalarField& noFilm::T() const")
<< "T field not available for " << type() << abort(FatalError);
return volScalarField::null();
}
const volScalarField& noFilm::Ts() const
{
FatalErrorIn("const volScalarField& noFilm::Ts() const")
<< "Ts field not available for " << type() << abort(FatalError);
return volScalarField::null();
}
const volScalarField& noFilm::Tw() const
{
FatalErrorIn("const volScalarField& noFilm::Tw() const")
<< "Tw field not available for " << type() << abort(FatalError);
return volScalarField::null();
}
const volScalarField& noFilm::Cp() const
{
FatalErrorIn("const volScalarField& noFilm::Cp() const")
<< "Cp field not available for " << type() << abort(FatalError);
return volScalarField::null();
}
const volScalarField& noFilm::kappa() const
{
FatalErrorIn("const volScalarField& noFilm::kappa() const")
<< "kappa field not available for " << type() << abort(FatalError);
return volScalarField::null();
}
const volScalarField& noFilm::massForPrimary() const
{
FatalErrorIn("const volScalarField& noFilm::massForPrimary() const")
<< "massForPrimary field not available for " << type()
<< abort(FatalError);
return volScalarField::null();
}
const volScalarField& noFilm::diametersForPrimary() const
{
FatalErrorIn("const volScalarField& noFilm::diametersForPrimary() const")
<< "diametersForPrimary field not available for " << type()
<< abort(FatalError);
return volScalarField::null();
}
const volScalarField& noFilm::massPhaseChangeForPrimary() const
{
FatalErrorIn
(
"const volScalarField& noFilm::massPhaseChangeForPrimary() const"
) << "massPhaseChange field not available for " << type()
<< abort(FatalError);
return volScalarField::null();
}
tmp<DimensionedField<scalar, volMesh> > noFilm::Srho() const
{
return tmp<DimensionedField<scalar, volMesh> >
(
new DimensionedField<scalar, volMesh>
(
IOobject
(
"noFilm::Srho",
time().timeName(),
primaryMesh(),
IOobject::NO_READ,
IOobject::NO_WRITE,
false
),
primaryMesh(),
dimensionedScalar("zero", dimMass/dimVolume/dimTime, 0.0)
)
);
}
tmp<DimensionedField<scalar, volMesh> > noFilm::Srho(const label) const
{
return tmp<DimensionedField<scalar, volMesh> >
(
new DimensionedField<scalar, volMesh>
(
IOobject
(
"noFilm::Srho(i)",
time().timeName(),
primaryMesh(),
IOobject::NO_READ,
IOobject::NO_WRITE,
false
),
primaryMesh(),
dimensionedScalar("zero", dimMass/dimVolume/dimTime, 0.0)
)
);
}
tmp<DimensionedField<scalar, volMesh> > noFilm::Sh() const
{
return tmp<DimensionedField<scalar, volMesh> >
(
new DimensionedField<scalar, volMesh>
(
IOobject
(
"noFilm::Sh",
time().timeName(),
primaryMesh(),
IOobject::NO_READ,
IOobject::NO_WRITE,
false
),
primaryMesh(),
dimensionedScalar("zero", dimEnergy/dimVolume/dimTime, 0.0)
)
);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace surfaceFilmModels
} // End namespace regionModels
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,187 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-2010 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 2 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::noFilm
Description
Dummy surface film model for 'none'
SourceFiles
noFilm.C
\*---------------------------------------------------------------------------*/
#ifndef noFilm_H
#define noFilm_H
#include "surfaceFilmModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace regionModels
{
namespace surfaceFilmModels
{
/*---------------------------------------------------------------------------*\
Class noFilm Declaration
\*---------------------------------------------------------------------------*/
class noFilm
:
public surfaceFilmModel
{
private:
// Private member functions
//- Disallow default bitwise copy construct
noFilm(const noFilm&);
//- Disallow default bitwise assignment
void operator=(const noFilm&);
protected:
// Protected member functions
//- Read control parameters from dictionary
virtual bool read();
public:
//- Runtime type information
TypeName("none");
// Constructors
//- Construct from components
noFilm
(
const word& modelType,
const fvMesh& mesh,
const dimensionedVector& g
);
//- Destructor
virtual ~noFilm();
// Member Functions
// Access
//- External hook to add sources to the film
virtual void addSources
(
const label patchI,
const label faceI,
const scalar massSource,
const vector& momentumSource,
const scalar pressureSource,
const scalar energySource
);
// Fields
//- Return the film thickness [m]
virtual const volScalarField& delta() const;
//- Return the film velocity [m/s]
virtual const volVectorField& U() const;
//- Return the film density [kg/m3]
virtual const volScalarField& rho() const;
//- Return the film surface velocity [m/s]
virtual const volVectorField& Us() const;
//- Return the film wall velocity [m/s]
virtual const volVectorField& Uw() const;
//- Return the film mean temperature [K]
virtual const volScalarField& T() const;
//- Return the film surface temperature [K]
virtual const volScalarField& Ts() const;
//- Return the film wall temperature [K]
virtual const volScalarField& Tw() const;
//- Return the film specific heat capacity [J/kg/K]
virtual const volScalarField& Cp() const;
//- Return the film thermal conductivity [W/m/K]
virtual const volScalarField& kappa() const;
// Transfer fields - to the primary region
//- Return the film mass available for transfer
virtual const volScalarField& massForPrimary() const;
//- Return the parcel diameters originating from film
virtual const volScalarField& diametersForPrimary() const;
//- Return the film mass evolved via phase change
virtual const volScalarField& massPhaseChangeForPrimary() const;
// Source fields
// Mapped into primary region
//- Return total mass source - Eulerian phase only
virtual tmp<DimensionedField<scalar, volMesh> > Srho() const;
//- Return mass source for specie i - Eulerian phase only
virtual tmp<DimensionedField<scalar, volMesh> > Srho
(
const label i
) const;
//- Return enthalpy source - Eulerian phase only
virtual tmp<DimensionedField<scalar, volMesh> > Sh() const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace surfaceFilmModels
} // regionModels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,118 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-2010 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 2 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 "cloudInjection.H"
#include "addToRunTimeSelectionTable.H"
#include "fvMesh.H"
#include "Time.H"
#include "mathematicalConstants.H"
#include "Random.H"
#include "volFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace regionModels
{
namespace surfaceFilmModels
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(cloudInjection, 0);
addToRunTimeSelectionTable(injectionModel, cloudInjection, dictionary);
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
cloudInjection::cloudInjection
(
const surfaceFilmModel& owner,
const dictionary& dict
)
:
injectionModel(type(), owner, dict),
particlesPerParcel_(readScalar(coeffs_.lookup("particlesPerParcel"))),
rndGen_(label(0), -1),
parcelPDF_(pdfs::pdf::New(coeffs_.subDict("parcelPDF"), rndGen_)),
diameter_(owner.regionMesh().nCells(), 0.0)
{
forAll(diameter_, faceI)
{
diameter_[faceI] = parcelPDF_->sample();
}
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
cloudInjection::~cloudInjection()
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
void cloudInjection::correct
(
scalarField& massToInject,
scalarField& diameterToInject
)
{
const scalar pi = constant::mathematical::pi;
const scalarField& rhoFilm = owner().rho();
// Collect the data to be transferred
forAll(massToInject, cellI)
{
scalar rho = rhoFilm[cellI];
scalar diam = diameter_[cellI];
scalar minMass = particlesPerParcel_*rho*pi/6*pow3(diam);
if (massToInject[cellI] > minMass)
{
// All mass can be injected - set particle diameter
diameterToInject[cellI] = diameter_[cellI];
// Retrieve new particle diameter sample
diameter_[cellI] = parcelPDF_->sample();
}
else
{
// Mass below minimum threshold - cannot be injected
massToInject[cellI] = 0.0;
diameterToInject[cellI] = -1.0;
}
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace surfaceFilmModels
} // End namespace regionModels
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,126 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-2010 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 2 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::cloudInjection
Description
Cloud injection model
SourceFiles
cloudInjection.C
\*---------------------------------------------------------------------------*/
#ifndef cloudInjection_H
#define cloudInjection_H
#include "injectionModel.H"
#include "pdf.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace regionModels
{
namespace surfaceFilmModels
{
/*---------------------------------------------------------------------------*\
Class cloudInjection Declaration
\*---------------------------------------------------------------------------*/
class cloudInjection
:
public injectionModel
{
private:
// Private member functions
//- Disallow default bitwise copy construct
cloudInjection(const cloudInjection&);
//- Disallow default bitwise assignment
void operator=(const cloudInjection&);
protected:
// Protected data
//- Number of particles per parcel
scalar particlesPerParcel_;
//- Random number generator
cachedRandom rndGen_;
//- Parcel size PDF model
const autoPtr<pdfs::pdf> parcelPDF_;
//- Diameters of particles to inject into the cloud
scalarList diameter_;
public:
//- Runtime type information
TypeName("cloudInjection");
// Constructors
//- Construct from surface film model
cloudInjection(const surfaceFilmModel& owner, const dictionary& dict);
//- Destructor
virtual ~cloudInjection();
// Member Functions
// Evolution
//- Correct
virtual void correct
(
scalarField& massToInject,
scalarField& diameterToInject
);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace surfaceFilmModels
} // End namespace regionModels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,74 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-2010 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 2 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 "injectionModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace regionModels
{
namespace surfaceFilmModels
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(injectionModel, 0);
defineRunTimeSelectionTable(injectionModel, dictionary);
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
injectionModel::injectionModel(const surfaceFilmModel& owner)
:
subModelBase(owner)
{}
injectionModel::injectionModel
(
const word& type,
const surfaceFilmModel& owner,
const dictionary& dict
)
:
subModelBase(type, owner, dict)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
injectionModel::~injectionModel()
{}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace surfaceFilmModels
} // End namespace regionModels
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,143 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-2010 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 2 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::injectionModel
Description
Base class for film injection models
SourceFiles
injectionModel.C
injectionModelNew.C
\*---------------------------------------------------------------------------*/
#ifndef injectionModel_H
#define injectionModel_H
#include "subModelBase.H"
#include "runTimeSelectionTables.H"
#include "scalarField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace regionModels
{
namespace surfaceFilmModels
{
/*---------------------------------------------------------------------------*\
Class injectionModel Declaration
\*---------------------------------------------------------------------------*/
class injectionModel
:
public subModelBase
{
private:
// Private Member Functions
//- Disallow default bitwise copy construct
injectionModel(const injectionModel&);
//- Disallow default bitwise assignment
void operator=(const injectionModel&);
public:
//- Runtime type information
TypeName("injectionModel");
// Declare runtime constructor selection table
declareRunTimeSelectionTable
(
autoPtr,
injectionModel,
dictionary,
(
const surfaceFilmModel& owner,
const dictionary& dict
),
(owner, dict)
);
// Constructors
//- Construct null
injectionModel(const surfaceFilmModel& owner);
//- Construct from type name, dictionary and surface film model
injectionModel
(
const word& type,
const surfaceFilmModel& owner,
const dictionary& dict
);
// Selectors
//- Return a reference to the selected injection model
static autoPtr<injectionModel> New
(
const surfaceFilmModel& owner,
const dictionary& dict
);
//- Destructor
virtual ~injectionModel();
// Member Functions
// Evolution
//- Correct
virtual void correct
(
scalarField& massToInject,
scalarField& diameterToInject
) = 0;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace surfaceFilmModels
} // End namespace regionModels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,74 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-2010 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 2 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 "injectionModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace regionModels
{
namespace surfaceFilmModels
{
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
autoPtr<injectionModel> injectionModel::New
(
const surfaceFilmModel& model,
const dictionary& dict
)
{
word modelType(dict.lookup("injectionModel"));
Info<< " Selecting injectionModel " << modelType << endl;
dictionaryConstructorTable::iterator cstrIter =
dictionaryConstructorTablePtr_->find(modelType);
if (cstrIter == dictionaryConstructorTablePtr_->end())
{
FatalErrorIn
(
"injectionModel::New(const surfaceFilmModel&, const dictionary&)"
) << "Unknown injectionModel type " << modelType
<< nl << nl << "Valid injectionModel types are:" << nl
<< dictionaryConstructorTablePtr_->toc()
<< exit(FatalError);
}
return autoPtr<injectionModel>(cstrIter()(model, dict));
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace surfaceFilmModels
} // End namespace regionModels
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,81 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-2010 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 2 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 "noInjection.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace regionModels
{
namespace surfaceFilmModels
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(noInjection, 0);
addToRunTimeSelectionTable(injectionModel, noInjection, dictionary);
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
noInjection::noInjection
(
const surfaceFilmModel& owner,
const dictionary&
)
:
injectionModel(owner)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
noInjection::~noInjection()
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
void noInjection::correct
(
scalarField& massToInject,
scalarField& diameterToInject
)
{
// no mass injected
massToInject = 0.0;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace surfaceFilmModels
} // End namespace regionModels
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,108 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-2010 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 2 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::noInjection
Description
Dummy injection model for 'none'
SourceFiles
noInjection.C
\*---------------------------------------------------------------------------*/
#ifndef noInjection_H
#define noInjection_H
#include "injectionModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace regionModels
{
namespace surfaceFilmModels
{
/*---------------------------------------------------------------------------*\
Class noInjection Declaration
\*---------------------------------------------------------------------------*/
class noInjection
:
public injectionModel
{
private:
// Private member functions
//- Disallow default bitwise copy construct
noInjection(const noInjection&);
//- Disallow default bitwise assignment
void operator=(const noInjection&);
public:
//- Runtime type information
TypeName("none");
// Constructors
//- Construct from surface film model
noInjection(const surfaceFilmModel& owner, const dictionary& dict);
//- Destructor
virtual ~noInjection();
// Member Functions
// Evolution
//- Correct
virtual void correct
(
scalarField& massToInject,
scalarField& diameterToInject
);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace surfaceFilmModels
} // End namespace regionModels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,80 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 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 2 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 "removeInjection.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace regionModels
{
namespace surfaceFilmModels
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(removeInjection, 0);
addToRunTimeSelectionTable(injectionModel, removeInjection, dictionary);
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
removeInjection::removeInjection
(
const surfaceFilmModel& owner,
const dictionary&
)
:
injectionModel(owner)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
removeInjection::~removeInjection()
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
void removeInjection::correct
(
scalarField&,
scalarField&
)
{
// do nothing - all mass available to be removed
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace surfaceFilmModels
} // End namespace regionModels
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,108 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-2010 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 2 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::removeInjection
Description
All mass available to be removed from the system is removed.
SourceFiles
removeInjection.C
\*---------------------------------------------------------------------------*/
#ifndef removeInjection_H
#define removeInjection_H
#include "injectionModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace regionModels
{
namespace surfaceFilmModels
{
/*---------------------------------------------------------------------------*\
Class removeInjection Declaration
\*---------------------------------------------------------------------------*/
class removeInjection
:
public injectionModel
{
private:
// Private member functions
//- Disallow default bitwise copy construct
removeInjection(const removeInjection&);
//- Disallow default bitwise assignment
void operator=(const removeInjection&);
public:
//- Runtime type information
TypeName("removeInjection");
// Constructors
//- Construct from surface film model
removeInjection(const surfaceFilmModel& owner, const dictionary& dict);
//- Destructor
virtual ~removeInjection();
// Member Functions
// Evolution
//- Correct
virtual void correct
(
scalarField& massToInject,
scalarField& diameterToInject
);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace surfaceFilmModels
} // End namespace regionModels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,71 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 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 2 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 "subModelBase.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace regionModels
{
namespace surfaceFilmModels
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
subModelBase::subModelBase(const surfaceFilmModel& owner)
:
owner_(owner),
coeffs_(dictionary::null)
{}
subModelBase::subModelBase
(
const word& type,
const surfaceFilmModel& owner,
const dictionary& dict
)
:
owner_(owner),
coeffs_(dict.subDict(type + "Coeffs"))
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
subModelBase::~subModelBase()
{}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace surfaceFilmModels
} // End namespace regionModels
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,125 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 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 2 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::subModelBase
Description
Base class for surface film sub-models
SourceFiles
subModelBaseI.H
subModelBase.C
\*---------------------------------------------------------------------------*/
#ifndef subModelBase_H
#define subModelBase_H
#include "surfaceFilmModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace regionModels
{
namespace surfaceFilmModels
{
/*---------------------------------------------------------------------------*\
Class subModelBase Declaration
\*---------------------------------------------------------------------------*/
class subModelBase
{
private:
// Private Member Functions
//- Disallow default bitwise copy construct
subModelBase(const subModelBase&);
//- Disallow default bitwise assignment
void operator=(const subModelBase&);
protected:
// Protected data
//- Reference to the owner surface film model
const surfaceFilmModel& owner_;
//- Model coefficients dictionary
dictionary coeffs_;
public:
// Constructors
//- Construct null
subModelBase(const surfaceFilmModel& owner);
//- Construct from type name, dictionary and surface film model
subModelBase
(
const word& type,
const surfaceFilmModel& owner,
const dictionary& dict
);
//- Destructor
virtual ~subModelBase();
// Member Functions
// Access
//- Return the reference to the owner surface film model
inline const surfaceFilmModel& owner() const;
//- Return the model coefficients dictionary
inline const dictionary& coeffs() const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace surfaceFilmModels
} // End namespace regionModels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "subModelBaseI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,58 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 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 2 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 "subModelBase.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace regionModels
{
namespace surfaceFilmModels
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
inline const surfaceFilmModel& subModelBase::owner() const
{
return owner_;
}
inline const dictionary& subModelBase::coeffs() const
{
return coeffs_;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace surfaceFilmModels
} // End namespace regionModels
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,77 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 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 2 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 "filmRadiationModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace regionModels
{
namespace surfaceFilmModels
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(filmRadiationModel, 0);
defineRunTimeSelectionTable(filmRadiationModel, dictionary);
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
filmRadiationModel::filmRadiationModel
(
const surfaceFilmModel& owner
)
:
subModelBase(owner)
{}
filmRadiationModel::filmRadiationModel
(
const word& type,
const surfaceFilmModel& owner,
const dictionary& dict
)
:
subModelBase(type, owner, dict)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
filmRadiationModel::~filmRadiationModel()
{}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace surfaceFilmModels
} // End namespace regionModels
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,141 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 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 2 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::filmRadiationModel
Description
Base class for film radiation models
SourceFiles
filmRadiationModel.C
filmRadiationModelNew.C
\*---------------------------------------------------------------------------*/
#ifndef filmRadiationModel_H
#define filmRadiationModel_H
#include "subModelBase.H"
#include "runTimeSelectionTables.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace regionModels
{
namespace surfaceFilmModels
{
/*---------------------------------------------------------------------------*\
Class filmRadiationModel Declaration
\*---------------------------------------------------------------------------*/
class filmRadiationModel
:
public subModelBase
{
private:
// Private Member Functions
//- Disallow default bitwise copy construct
filmRadiationModel(const filmRadiationModel&);
//- Disallow default bitwise assignment
void operator=(const filmRadiationModel&);
public:
//- Runtime type information
TypeName("radiationModel");
// Declare runtime constructor selection table
declareRunTimeSelectionTable
(
autoPtr,
filmRadiationModel,
dictionary,
(
const surfaceFilmModel& owner,
const dictionary& dict
),
(owner, dict)
);
// Constructors
//- Construct null
filmRadiationModel(const surfaceFilmModel& owner);
//- Construct from type name, dictionary and surface film model
filmRadiationModel
(
const word& type,
const surfaceFilmModel& owner,
const dictionary& dict
);
// Selectors
//- Return a reference to the selected phase change model
static autoPtr<filmRadiationModel> New
(
const surfaceFilmModel& owner,
const dictionary& dict
);
//- Destructor
virtual ~filmRadiationModel();
// Member Functions
// Evolution
//- Correct
virtual void correct() = 0;
//- Return the radiation sensible enthalpy source
virtual tmp<volScalarField> Shs() = 0;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace surfaceFilmModels
} // End namespace regionModels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,78 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 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 2 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 "filmRadiationModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace regionModels
{
namespace surfaceFilmModels
{
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
autoPtr<filmRadiationModel> filmRadiationModel::New
(
const surfaceFilmModel& model,
const dictionary& dict
)
{
word modelType(dict.lookup("radiationModel"));
Info<< " Selecting radiationModel " << modelType << endl;
dictionaryConstructorTable::iterator cstrIter =
dictionaryConstructorTablePtr_->find(modelType);
if (cstrIter == dictionaryConstructorTablePtr_->end())
{
FatalErrorIn
(
"filmRadiationModel::New"
"("
"const surfaceFilmModel&, "
"const dictionary&"
")"
) << "Unknown radiationModel type " << modelType << nl << nl
<< "Valid filmRadiationModel types are:" << nl
<< dictionaryConstructorTablePtr_->toc()
<< exit(FatalError);
}
return autoPtr<filmRadiationModel>(cstrIter()(model, dict));
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace surfaceFilmModels
} // End namespace regionModels
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,106 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 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 2 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 "noRadiation.H"
#include "volFields.H"
#include "addToRunTimeSelectionTable.H"
#include "zeroGradientFvPatchFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace regionModels
{
namespace surfaceFilmModels
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(noRadiation, 0);
addToRunTimeSelectionTable
(
filmRadiationModel,
noRadiation,
dictionary
);
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
noRadiation::noRadiation
(
const surfaceFilmModel& owner,
const dictionary& dict
)
:
filmRadiationModel(owner)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
noRadiation::~noRadiation()
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
void noRadiation::correct()
{
// do nothing
}
tmp<volScalarField> noRadiation::Shs()
{
return tmp<volScalarField>
(
new volScalarField
(
IOobject
(
typeName + "::Shs",
owner().time().timeName(),
owner().regionMesh(),
IOobject::NO_READ,
IOobject::NO_WRITE
),
owner().regionMesh(),
dimensionedScalar("zero", dimMass/pow3(dimTime), 0.0),
zeroGradientFvPatchScalarField::typeName
)
);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace surfaceFilmModels
} // End namespace regionModels
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,112 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 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 2 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::noRadiation
Description
Dummy radiation model for 'none' option
SourceFiles
noRadiation.C
\*---------------------------------------------------------------------------*/
#ifndef noRadiation_H
#define noRadiation_H
#include "filmRadiationModel.H"
#include "volFieldsFwd.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace regionModels
{
namespace surfaceFilmModels
{
/*---------------------------------------------------------------------------*\
Class noRadiation Declaration
\*---------------------------------------------------------------------------*/
class noRadiation
:
public filmRadiationModel
{
private:
// Private member functions
//- Disallow default bitwise copy construct
noRadiation(const noRadiation&);
//- Disallow default bitwise assignment
void operator=(const noRadiation&);
public:
//- Runtime type information
TypeName("none");
// Constructors
//- Construct from surface film model and dictionary
noRadiation
(
const surfaceFilmModel& owner,
const dictionary& dict
);
//- Destructor
virtual ~noRadiation();
// Member Functions
// Evolution
//- Correct
virtual void correct();
//- Return the radiation sensible enthalpy source
virtual tmp<volScalarField> Shs();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace surfaceFilmModels
} // End namespace regionModels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,151 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 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 2 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 "standardRadiation.H"
#include "volFields.H"
#include "addToRunTimeSelectionTable.H"
#include "zeroGradientFvPatchFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace regionModels
{
namespace surfaceFilmModels
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(standardRadiation, 0);
addToRunTimeSelectionTable
(
filmRadiationModel,
standardRadiation,
dictionary
);
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
standardRadiation::standardRadiation
(
const surfaceFilmModel& owner,
const dictionary& dict
)
:
filmRadiationModel(typeName, owner, dict),
QrPrimary_
(
IOobject
(
"Qr", // same name as Qr on primary region to enable mapping
owner.time().timeName(),
owner.regionMesh(),
IOobject::NO_READ,
IOobject::NO_WRITE
),
owner.regionMesh(),
dimensionedScalar("zero", dimMass/pow3(dimTime), 0.0),
owner.mappedPushedFieldPatchTypes<scalar>()
),
QrNet_
(
IOobject
(
"QrNet",
owner.time().timeName(),
owner.regionMesh(),
IOobject::NO_READ,
IOobject::NO_WRITE
),
owner.regionMesh(),
dimensionedScalar("zero", dimMass/pow3(dimTime), 0.0),
zeroGradientFvPatchScalarField::typeName
),
delta_(owner.delta()),
deltaMin_(readScalar(coeffs_.lookup("deltaMin"))),
beta_(readScalar(coeffs_.lookup("beta"))),
kappaBar_(readScalar(coeffs_.lookup("kappaBar")))
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
standardRadiation::~standardRadiation()
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
void standardRadiation::correct()
{
// Transfer Qr from primary region
QrPrimary_.correctBoundaryConditions();
}
tmp<volScalarField> standardRadiation::Shs()
{
tmp<volScalarField> tShs
(
new volScalarField
(
IOobject
(
typeName + "::Shs",
owner().time().timeName(),
owner().regionMesh(),
IOobject::NO_READ,
IOobject::NO_WRITE
),
owner().regionMesh(),
dimensionedScalar("zero", dimMass/pow3(dimTime), 0.0),
zeroGradientFvPatchScalarField::typeName
)
);
scalarField& Shs = tShs();
const scalarField& QrP = QrPrimary_.internalField();
const scalarField& delta = delta_.internalField();
Shs = beta_*(QrP*pos(delta - deltaMin_))*(1.0 - exp(-kappaBar_*delta));
// Update net Qr on local region
QrNet_.internalField() = QrP - Shs;
QrNet_.correctBoundaryConditions();
return tShs;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace surfaceFilmModels
} // End namespace regionModels
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,137 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 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 2 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::standardRadiation
Description
Standard radiation model
SourceFiles
standardRadiation.C
\*---------------------------------------------------------------------------*/
#ifndef standardRadiation_H
#define standardRadiation_H
#include "filmRadiationModel.H"
#include "volFieldsFwd.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace regionModels
{
namespace surfaceFilmModels
{
/*---------------------------------------------------------------------------*\
Class standardRadiation Declaration
\*---------------------------------------------------------------------------*/
class standardRadiation
:
public filmRadiationModel
{
private:
// Private data
//- Radiative flux mapped from the primary region / [kg/s3]
volScalarField QrPrimary_;
//- Remaining radiative flux after removing local contribution
volScalarField QrNet_;
//- Reference to the film thickness field / [m]
const volScalarField& delta_;
// Model coefficients
//- Minimum thickness to apply radiation model
scalar deltaMin_;
//- Beta coefficient
scalar beta_;
//- Bar(kappa) coefficient
scalar kappaBar_;
// Private member functions
//- Disallow default bitwise copy construct
standardRadiation(const standardRadiation&);
//- Disallow default bitwise assignment
void operator=(const standardRadiation&);
public:
//- Runtime type information
TypeName("standardRadiation");
// Constructors
//- Construct from surface film model and dictionary
standardRadiation
(
const surfaceFilmModel& owner,
const dictionary& dict
);
//- Destructor
virtual ~standardRadiation();
// Member Functions
// Evolution
//- Correct
virtual void correct();
//- Return the radiation sensible enthalpy source
// Also updates QrNet
virtual tmp<volScalarField> Shs();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace surfaceFilmModels
} // End namespace regionModels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,113 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-2010 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 2 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 "constantHeatTransfer.H"
#include "volFields.H"
#include "addToRunTimeSelectionTable.H"
#include "zeroGradientFvPatchFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace regionModels
{
namespace surfaceFilmModels
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(constantHeatTransfer, 0);
addToRunTimeSelectionTable
(
heatTransferModel,
constantHeatTransfer,
dictionary
);
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
constantHeatTransfer::constantHeatTransfer
(
const surfaceFilmModel& owner,
const dictionary& dict
)
:
heatTransferModel(typeName, owner, dict),
c0_(readScalar(coeffs_.lookup("c0")))
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
constantHeatTransfer::~constantHeatTransfer()
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
void constantHeatTransfer::correct()
{
// do nothing
}
tmp<volScalarField> constantHeatTransfer::h() const
{
return tmp<volScalarField>
(
new volScalarField
(
IOobject
(
"htc",
owner_.time().timeName(),
owner_.regionMesh(),
IOobject::NO_READ,
IOobject::NO_WRITE,
false
),
owner_.regionMesh(),
dimensionedScalar
(
"c0",
dimEnergy/dimTime/sqr(dimLength)/dimTemperature,
c0_
),
zeroGradientFvPatchScalarField::typeName
)
);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace surfaceFilmModels
} // End namespace regionModels
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,118 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-2010 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 2 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::constantHeatTransfer
Description
Constant heat transfer model
SourceFiles
constantHeatTransfer.C
\*---------------------------------------------------------------------------*/
#ifndef constantHeatTransfer_H
#define constantHeatTransfer_H
#include "heatTransferModel.H"
#include "volFieldsFwd.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace regionModels
{
namespace surfaceFilmModels
{
/*---------------------------------------------------------------------------*\
Class constantHeatTransfer Declaration
\*---------------------------------------------------------------------------*/
class constantHeatTransfer
:
public heatTransferModel
{
private:
// Private data
//- Constant heat transfer coefficient [W/m2/K]
scalar c0_;
// Private member functions
//- Disallow default bitwise copy construct
constantHeatTransfer(const constantHeatTransfer&);
//- Disallow default bitwise assignment
void operator=(const constantHeatTransfer&);
public:
//- Runtime type information
TypeName("constant");
// Constructors
//- Construct from surface film model and dictionary
constantHeatTransfer
(
const surfaceFilmModel& owner,
const dictionary& dict
);
//- Destructor
virtual ~constantHeatTransfer();
// Member Functions
// Evolution
//- Correct
virtual void correct();
//- Return the heat transfer coefficient [W/m2/K]
virtual tmp<volScalarField> h() const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace surfaceFilmModels
} // End namespace regionModels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,77 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 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 2 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 "heatTransferModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace regionModels
{
namespace surfaceFilmModels
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(heatTransferModel, 0);
defineRunTimeSelectionTable(heatTransferModel, dictionary);
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
heatTransferModel::heatTransferModel
(
const surfaceFilmModel& owner
)
:
subModelBase(owner)
{}
heatTransferModel::heatTransferModel
(
const word& type,
const surfaceFilmModel& owner,
const dictionary& dict
)
:
subModelBase(type, owner, dict)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
heatTransferModel::~heatTransferModel()
{}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace surfaceFilmModels
} // End namespace regionModels
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,141 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 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 2 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::heatTransferModel
Description
Base class for film heat transfer models
SourceFiles
heatTransferModel.C
heatTransferModelNew.C
\*---------------------------------------------------------------------------*/
#ifndef heatTransferModel_H
#define heatTransferModel_H
#include "subModelBase.H"
#include "runTimeSelectionTables.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace regionModels
{
namespace surfaceFilmModels
{
/*---------------------------------------------------------------------------*\
Class heatTransferModel Declaration
\*---------------------------------------------------------------------------*/
class heatTransferModel
:
public subModelBase
{
private:
// Private Member Functions
//- Disallow default bitwise copy construct
heatTransferModel(const heatTransferModel&);
//- Disallow default bitwise assignment
void operator=(const heatTransferModel&);
public:
//- Runtime type information
TypeName("heatTransferModel");
// Declare runtime constructor selection table
declareRunTimeSelectionTable
(
autoPtr,
heatTransferModel,
dictionary,
(
const surfaceFilmModel& owner,
const dictionary& dict
),
(owner, dict)
);
// Constructors
//- Construct null
heatTransferModel(const surfaceFilmModel& owner);
//- Construct from type name, dictionary and surface film model
heatTransferModel
(
const word& type,
const surfaceFilmModel& owner,
const dictionary& dict
);
// Selectors
//- Return a reference to the selected phase change model
static autoPtr<heatTransferModel> New
(
const surfaceFilmModel& owner,
const dictionary& dict
);
//- Destructor
virtual ~heatTransferModel();
// Member Functions
// Evolution
//- Correct
virtual void correct() = 0;
//- Return the heat transfer coefficient [W/m2/K]
virtual tmp<volScalarField> h() const = 0;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace surfaceFilmModels
} // End namespace regionModels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,74 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 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 2 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 "heatTransferModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace regionModels
{
namespace surfaceFilmModels
{
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
autoPtr<heatTransferModel> heatTransferModel::New
(
const surfaceFilmModel& model,
const dictionary& dict
)
{
word modelType(dict.lookup("heatTransferModel"));
Info<< " Selecting heatTransferModel " << modelType << endl;
dictionaryConstructorTable::iterator cstrIter =
dictionaryConstructorTablePtr_->find(modelType);
if (cstrIter == dictionaryConstructorTablePtr_->end())
{
FatalErrorIn
(
"heatTransferModel::New(const surfaceFilmModel&, const dictionary&)"
) << "Unknown heatTransferModel type " << modelType << nl << nl
<< "Valid heatTransferModel types are:" << nl
<< dictionaryConstructorTablePtr_->toc()
<< exit(FatalError);
}
return autoPtr<heatTransferModel>(cstrIter()(model, dict));
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace surfaceFilmModels
} // End namespace regionModels
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,126 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 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 2 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 "mappedConvectiveHeatTransfer.H"
#include "zeroGradientFvPatchFields.H"
#include "addToRunTimeSelectionTable.H"
#include "kinematicSingleLayer.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace regionModels
{
namespace surfaceFilmModels
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(mappedConvectiveHeatTransfer, 0);
addToRunTimeSelectionTable
(
heatTransferModel,
mappedConvectiveHeatTransfer,
dictionary
);
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
mappedConvectiveHeatTransfer::mappedConvectiveHeatTransfer
(
const surfaceFilmModel& owner,
const dictionary& dict
)
:
heatTransferModel(owner),
htcConvPrimary_
(
IOobject
(
"htcConv",
owner.time().timeName(),
owner.primaryMesh(),
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
owner.primaryMesh()
),
htcConvFilm_
(
IOobject
(
htcConvPrimary_.name(), // must have same name as above for mapping
owner.time().timeName(),
owner.regionMesh(),
IOobject::NO_READ,
IOobject::NO_WRITE
),
owner.regionMesh(),
dimensionedScalar("zero", dimMass/pow3(dimTime)/dimTemperature, 0.0),
refCast<const kinematicSingleLayer>(owner).pSp().boundaryField().types()
)
{
// Update the primary-side convective heat transfer coefficient
htcConvPrimary_.correctBoundaryConditions();
// Pull the data from the primary region via direct mapped BCs
htcConvFilm_.correctBoundaryConditions();
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
mappedConvectiveHeatTransfer::~mappedConvectiveHeatTransfer()
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
void mappedConvectiveHeatTransfer::correct()
{
// Update the primary-side convective heat transfer coefficient
htcConvPrimary_.correctBoundaryConditions();
// Pull the data from the primary region via direct mapped BCs
htcConvFilm_.correctBoundaryConditions();
}
tmp<volScalarField> mappedConvectiveHeatTransfer::h() const
{
return htcConvFilm_;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace surfaceFilmModels
} // End namespace regionModels
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,124 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 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 2 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::mappedConvectiveHeatTransfer
Description
Convective heat transfer model based on a re-working of a Nusselt number
correlation
SourceFiles
mappedConvectiveHeatTransfer.C
\*---------------------------------------------------------------------------*/
#ifndef mappedConvectiveHeatTransfer_H
#define mappedConvectiveHeatTransfer_H
#include "heatTransferModel.H"
#include "volFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace regionModels
{
namespace surfaceFilmModels
{
/*---------------------------------------------------------------------------*\
Class mappedConvectiveHeatTransfer Declaration
\*---------------------------------------------------------------------------*/
class mappedConvectiveHeatTransfer
:
public heatTransferModel
{
private:
// Private data
//- Heat transfer coefficient - primary region [W/m2/K]
volScalarField htcConvPrimary_;
//- Heat transfer coefficient - film region [W/m2/K]
// Assumes that the primary regtion to film region boundaries are
// described as directMappedPushed types
volScalarField htcConvFilm_;
// Private member functions
//- Disallow default bitwise copy construct
mappedConvectiveHeatTransfer(const mappedConvectiveHeatTransfer&);
//- Disallow default bitwise assignment
void operator=(const mappedConvectiveHeatTransfer&);
public:
//- Runtime type information
TypeName("mappedConvectiveHeatTransfer");
// Constructors
//- Construct from surface film model and dictionary
mappedConvectiveHeatTransfer
(
const surfaceFilmModel& owner,
const dictionary& dict
);
//- Destructor
virtual ~mappedConvectiveHeatTransfer();
// Member Functions
// Evolution
//- Correct
virtual void correct();
//- Return the heat transfer coefficient [W/m2/K]
virtual tmp<volScalarField> h() const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace surfaceFilmModels
} // End namespace regionModels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,81 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-2010 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 2 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 "noPhaseChange.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace regionModels
{
namespace surfaceFilmModels
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(noPhaseChange, 0);
addToRunTimeSelectionTable(phaseChangeModel, noPhaseChange, dictionary);
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
noPhaseChange::noPhaseChange
(
const surfaceFilmModel& owner,
const dictionary&
)
:
phaseChangeModel(owner)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
noPhaseChange::~noPhaseChange()
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
void noPhaseChange::correct
(
const scalar,
scalarField&,
scalarField&
)
{
// do nothing
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace surfaceFilmModels
} // End namespace regionModels
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,109 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-2010 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 2 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::noPhaseChange
Description
Dummy phase change model for 'none'
SourceFiles
noPhaseChange.C
\*---------------------------------------------------------------------------*/
#ifndef noPhaseChange_H
#define noPhaseChange_H
#include "phaseChangeModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace regionModels
{
namespace surfaceFilmModels
{
/*---------------------------------------------------------------------------*\
Class noPhaseChange Declaration
\*---------------------------------------------------------------------------*/
class noPhaseChange
:
public phaseChangeModel
{
private:
// Private member functions
//- Disallow default bitwise copy construct
noPhaseChange(const noPhaseChange&);
//- Disallow default bitwise assignment
void operator=(const noPhaseChange&);
public:
//- Runtime type information
TypeName("none");
// Constructors
//- Construct from surface film model
noPhaseChange(const surfaceFilmModel& owner, const dictionary& dict);
//- Destructor
virtual ~noPhaseChange();
// Member Functions
// Evolution
//- Correct
virtual void correct
(
const scalar dt,
scalarField& dMass,
scalarField& dEnergy
);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace surfaceFilmModels
} // End namespace regionModels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,77 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-2010 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 2 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 "phaseChangeModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace regionModels
{
namespace surfaceFilmModels
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(phaseChangeModel, 0);
defineRunTimeSelectionTable(phaseChangeModel, dictionary);
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
phaseChangeModel::phaseChangeModel
(
const surfaceFilmModel& owner
)
:
subModelBase(owner)
{}
phaseChangeModel::phaseChangeModel
(
const word& type,
const surfaceFilmModel& owner,
const dictionary& dict
)
:
subModelBase(type, owner, dict)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
phaseChangeModel::~phaseChangeModel()
{}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // end namespace surfaceFilmModels
} // end namespace regionModels
} // end namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,144 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-2010 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 2 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::phaseChangeModel
Description
Base class for surface film phase change models
SourceFiles
phaseChangeModel.C
phaseChangeModelNew.C
\*---------------------------------------------------------------------------*/
#ifndef phaseChangeModel_H
#define phaseChangeModel_H
#include "subModelBase.H"
#include "runTimeSelectionTables.H"
#include "scalarField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace regionModels
{
namespace surfaceFilmModels
{
/*---------------------------------------------------------------------------*\
Class phaseChangeModel Declaration
\*---------------------------------------------------------------------------*/
class phaseChangeModel
:
public subModelBase
{
private:
// Private Member Functions
//- Disallow default bitwise copy construct
phaseChangeModel(const phaseChangeModel&);
//- Disallow default bitwise assignment
void operator=(const phaseChangeModel&);
public:
//- Runtime type information
TypeName("phaseChangeModel");
// Declare runtime constructor selection table
declareRunTimeSelectionTable
(
autoPtr,
phaseChangeModel,
dictionary,
(
const surfaceFilmModel& owner,
const dictionary& dict
),
(owner, dict)
);
// Constructors
//- Construct null
phaseChangeModel(const surfaceFilmModel& owner);
//- Construct from type name, dictionary and surface film model
phaseChangeModel
(
const word& type,
const surfaceFilmModel& owner,
const dictionary& dict
);
// Selectors
//- Return a reference to the selected phase change model
static autoPtr<phaseChangeModel> New
(
const surfaceFilmModel& owner,
const dictionary& dict
);
//- Destructor
virtual ~phaseChangeModel();
// Member Functions
// Evolution
//- Correct
virtual void correct
(
const scalar dt,
scalarField& dMass,
scalarField& dEnergy
) = 0;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace surfaceFilmModels
} // End namespace regionModels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,74 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-2010 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 2 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 "phaseChangeModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace regionModels
{
namespace surfaceFilmModels
{
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
autoPtr<phaseChangeModel> phaseChangeModel::New
(
const surfaceFilmModel& model,
const dictionary& dict
)
{
word modelType(dict.lookup("phaseChangeModel"));
Info<< " Selecting phaseChangeModel " << modelType << endl;
dictionaryConstructorTable::iterator cstrIter =
dictionaryConstructorTablePtr_->find(modelType);
if (cstrIter == dictionaryConstructorTablePtr_->end())
{
FatalErrorIn
(
"phaseChangeModel::New(const surfaceFilmModel&, const dictionary&)"
) << "Unknown phaseChangeModel type " << modelType
<< nl << nl << "Valid phaseChangeModel types are:" << nl
<< dictionaryConstructorTablePtr_->toc()
<< exit(FatalError);
}
return autoPtr<phaseChangeModel>(cstrIter()(model, dict));
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // end namespace surfaceFilmModels
} // end namespace regionModels
} // end namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,224 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 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 2 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 "standardPhaseChange.H"
#include "addToRunTimeSelectionTable.H"
#include "thermoSingleLayer.H"
#include "specie.H"
#include "heatTransferModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace regionModels
{
namespace surfaceFilmModels
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(standardPhaseChange, 0);
addToRunTimeSelectionTable
(
phaseChangeModel,
standardPhaseChange,
dictionary
);
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
scalar standardPhaseChange::Sh
(
const scalar Re,
const scalar Sc
) const
{
if (Re < 5.0E+05)
{
return 0.664*sqrt(Re)*cbrt(Sc);
}
else
{
return 0.037*pow(Re, 0.8)*cbrt(Sc);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
standardPhaseChange::standardPhaseChange
(
const surfaceFilmModel& owner,
const dictionary& dict
)
:
phaseChangeModel(typeName, owner, dict),
Tb_(readScalar(coeffs_.lookup("Tb"))),
deltaMin_(readScalar(coeffs_.lookup("deltaMin"))),
L_(readScalar(coeffs_.lookup("L"))),
TbFactor_(coeffs_.lookupOrDefault<scalar>("TbFactor", 1.1)),
totalMass_(0.0),
vapourRate_(0.0)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
standardPhaseChange::~standardPhaseChange()
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
void standardPhaseChange::correct
(
const scalar dt,
scalarField& dMass,
scalarField& dEnergy
)
{
const thermoSingleLayer& film = refCast<const thermoSingleLayer>(owner_);
// set local thermo properties
const SLGThermo& thermo = film.thermo();
const label liqId = film.liquidId();
const liquid& liq = thermo.liquids().properties()[liqId];
const label vapId = thermo.carrierId(thermo.liquids().components()[liqId]);
// retrieve fields from film model
const scalarField& delta = film.delta();
const scalarField& YInf = film.YPrimary()[vapId];
const scalarField& pInf = film.pPrimary();
const scalarField& T = film.T();
const scalarField& Tw = film.Tw();
const scalarField& rho = film.rho();
const scalarField& TInf = film.TPrimary();
const scalarField& rhoInf = film.rhoPrimary();
const scalarField& muInf = film.muPrimary();
const scalarField& magSf = film.magSf();
const scalarField hInf = film.htcs().h();
const scalarField hFilm = film.htcw().h();
const vectorField dU = film.UPrimary() - film.Us();
const scalarField availableMass = (delta - deltaMin_)*rho*magSf;
forAll(dMass, cellI)
{
if (delta[cellI] > deltaMin_)
{
// cell pressure [Pa]
const scalar pc = pInf[cellI];
// local temperature - impose lower limit of 200 K for stability
const scalar Tloc = min(TbFactor_*Tb_, max(200.0, T[cellI]));
// saturation pressure [Pa]
const scalar pSat = liq.pv(pc, Tloc);
// latent heat [J/kg]
const scalar hVap = liq.hl(pc, Tloc);
// calculate mass transfer
if (pSat >= 0.95*pc)
{
// boiling
const scalar qDotInf = hInf[cellI]*(TInf[cellI] - T[cellI]);
const scalar qDotFilm = hFilm[cellI]*(T[cellI] - Tw[cellI]);
const scalar Cp = liq.Cp(pc, Tloc);
const scalar Tcorr = max(0.0, T[cellI] - Tb_);
const scalar qCorr = availableMass[cellI]*Cp*(Tcorr);
dMass[cellI] =
dt*magSf[cellI]/hVap*(qDotInf + qDotFilm)
+ qCorr/hVap;
}
else
{
// Primary region density [kg/m3]
const scalar rhoInfc = rhoInf[cellI];
// Primary region viscosity [Pa.s]
const scalar muInfc = muInf[cellI];
// Reynolds number
const scalar Re = rhoInfc*mag(dU[cellI])*L_/muInfc;
// molecular weight of vapour [kg/kmol]
const scalar Wvap = thermo.carrier().W(vapId);
// molecular weight of liquid [kg/kmol]
const scalar Wliq = liq.W();
// vapour mass fraction at interface
const scalar Ys = Wliq*pSat/(Wliq*pSat + Wvap*(pc - pSat));
// vapour diffusivity [m2/s]
const scalar Dab = liq.D(pc, Tloc);
// Schmidt number
const scalar Sc = muInfc/(rhoInfc*(Dab + ROOTVSMALL));
// Sherwood number
const scalar Sh = this->Sh(Re, Sc);
// mass transfer coefficient [m/s]
const scalar hm = Sh*Dab/(L_ + ROOTVSMALL);
// add mass contribution to source
dMass[cellI] =
dt*magSf[cellI]*rhoInfc*hm*(Ys - YInf[cellI])/(1.0 - Ys);
}
dMass[cellI] = min(availableMass[cellI], max(0.0, dMass[cellI]));
dEnergy[cellI] = dMass[cellI]*hVap;
}
}
const scalar sumdMass = sum(dMass);
totalMass_ += sumdMass;
vapourRate_ = sumdMass/owner().time().deltaTValue();
}
void standardPhaseChange::info() const
{
Info<< indent << "mass phase change = "
<< returnReduce(totalMass_, sumOp<scalar>()) << nl
<< indent << "vapourisation rate = "
<< returnReduce(vapourRate_, sumOp<scalar>()) << nl;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace surfaceFilmModels
} // End namespace regionModels
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,149 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 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 2 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::standardPhaseChange
Description
Standard phase change model with modification for boiling
SourceFiles
standardPhaseChange.C
\*---------------------------------------------------------------------------*/
#ifndef standardPhaseChange_H
#define standardPhaseChange_H
#include "phaseChangeModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace regionModels
{
namespace surfaceFilmModels
{
/*---------------------------------------------------------------------------*\
Class standardPhaseChange Declaration
\*---------------------------------------------------------------------------*/
class standardPhaseChange
:
public phaseChangeModel
{
private:
// Private member functions
//- Disallow default bitwise copy construct
standardPhaseChange(const standardPhaseChange&);
//- Disallow default bitwise assignment
void operator=(const standardPhaseChange&);
protected:
// Protected data
//- Boiling temperature / [K]
const scalar Tb_;
//- Minimum film height for model to be active
const scalar deltaMin_;
//- Length scale / [m]
const scalar L_;
//- Boiling temperature factor / []
// Used to set max limit on temperature to Tb*TbFactor
const scalar TbFactor_;
//- Total mass evolved / [kg]
scalar totalMass_;
//- Vapouristaion rate / kg/s
scalar vapourRate_;
// Protected member functions
//- Return Sherwood number as a function of Reynolds and Schmidt numbers
scalar Sh(const scalar Re, const scalar Sc) const;
public:
//- Runtime type information
TypeName("standardPhaseChange");
// Constructors
//- Construct from surface film model
standardPhaseChange
(
const surfaceFilmModel& owner,
const dictionary& dict
);
//- Destructor
virtual ~standardPhaseChange();
// Member Functions
// Evolution
//- Correct
virtual void correct
(
const scalar dt,
scalarField& dMass,
scalarField& dEnergy
);
// Input/output
//- Output model statistics
virtual void info() const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace surfaceFilmModels
} // End namespace regionModels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,166 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-2010 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 2 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 "surfaceFilmModel.H"
#include "fvMesh.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<>
const char* Foam::NamedEnum
<
Foam::regionModels::surfaceFilmModels::surfaceFilmModel::thermoModelType,
2
>::names[] =
{
"constant",
"singleComponent"
};
const Foam::NamedEnum
<
Foam::regionModels::surfaceFilmModels::surfaceFilmModel::thermoModelType,
2
>
Foam::regionModels::surfaceFilmModels::surfaceFilmModel::thermoModelTypeNames_;
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace regionModels
{
namespace surfaceFilmModels
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(surfaceFilmModel, 0);
defineRunTimeSelectionTable(surfaceFilmModel, mesh);
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
bool surfaceFilmModel::read()
{
if (singleLayerRegion::read())
{
thermoModel_ =
thermoModelTypeNames_.read(coeffs_.lookup("thermoModel"));
return true;
}
else
{
return false;
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
surfaceFilmModel::surfaceFilmModel(const fvMesh& mesh)
:
singleLayerRegion(mesh),
g_(vector::zero),
thermoModel_(tmConstant)
{}
surfaceFilmModel::surfaceFilmModel
(
const word& modelType,
const fvMesh& mesh,
const dimensionedVector& g
)
:
singleLayerRegion(mesh, "surfaceFilm", modelType),
g_(g),
thermoModel_(tmConstant)
{
if (active_)
{
read();
}
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
surfaceFilmModel::~surfaceFilmModel()
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
Foam::scalar surfaceFilmModel::CourantNumber() const
{
return ROOTVSMALL;
}
tmp<DimensionedField<scalar, volMesh> > surfaceFilmModel::Srho() const
{
notImplemented
(
"tmp<DimensionedField<scalar, volMesh> > surfaceFilmModel::Srho() const"
)
return tmp<DimensionedField<scalar, volMesh> >(NULL);
}
tmp<DimensionedField<scalar, volMesh> >
surfaceFilmModel::Srho(const label) const
{
notImplemented
(
"tmp<DimensionedField<scalar, volMesh> > surfaceFilmModel::Srho"
"(const label) const"
)
return tmp<DimensionedField<scalar, volMesh> >(NULL);
}
tmp<DimensionedField<scalar, volMesh> > surfaceFilmModel::Sh() const
{
notImplemented
(
"tmp<DimensionedField<scalar, volMesh> > surfaceFilmModel::Sh() const"
)
return tmp<DimensionedField<scalar, volMesh> >(NULL);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace surfaceFilmModels
} // End namespace regionModels
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,263 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-2010 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 2 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::surfaceFilmModel
Description
Base class for surface film models
SourceFiles
surfaceFilmModelI.H
surfaceFilmModel.C
surfaceFilmModelNew.C
\*---------------------------------------------------------------------------*/
#ifndef surfaceFilmModel_H
#define surfaceFilmModel_H
#include "singleLayerRegion.H"
#include "dimensionedVector.H"
#include "runTimeSelectionTables.H"
#include "volFieldsFwd.H"
#include "DimensionedField.H"
#include "labelList.H"
#include "NamedEnum.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace regionModels
{
namespace surfaceFilmModels
{
/*---------------------------------------------------------------------------*\
Class surfaceFilmModel Declaration
\*---------------------------------------------------------------------------*/
class surfaceFilmModel
:
public singleLayerRegion
{
public:
// Data types
//- Enumeration listing the possible thermo types
enum thermoModelType
{
tmConstant,
tmSingleComponent
};
//- Named enumeration for the thermoType
static const NamedEnum<thermoModelType, 2> thermoModelTypeNames_;
private:
// Private Member Functions
//- Disallow default bitwise copy construct
surfaceFilmModel(const surfaceFilmModel&);
//- Disallow default bitwise assignment
void operator=(const surfaceFilmModel&);
protected:
// Protected data
//- Acceleration due to gravity [m/s2]
const dimensionedVector& g_;
//- Thermo type
thermoModelType thermoModel_;
// Protected member functions
//- Read control parameters from dictionary
virtual bool read();
public:
//- Runtime type information
TypeName("surfaceFilmModel");
// Declare runtime constructor selection table
declareRunTimeSelectionTable
(
autoPtr,
surfaceFilmModel,
mesh,
(
const word& modelType,
const fvMesh& mesh,
const dimensionedVector& g
),
(modelType, mesh, g)
);
// Constructors
//- Construct null
surfaceFilmModel(const fvMesh& mesh);
//- Construct from type name, mesh and gravity vector
surfaceFilmModel
(
const word& modelType,
const fvMesh& mesh,
const dimensionedVector& g
);
// Selectors
//- Return a reference to the selected surface film model
static autoPtr<surfaceFilmModel> New
(
const fvMesh& mesh,
const dimensionedVector& g
);
//- Destructor
virtual ~surfaceFilmModel();
// Member Functions
// Access
//- Return the thermo type
inline const thermoModelType& thermoModel() const;
//- External hook to add sources to the film
virtual void addSources
(
const label patchI,
const label faceI,
const scalar massSource,
const vector& momentumSource,
const scalar pressureSource,
const scalar energySource
) = 0;
// Solution parameters
//- Courant number evaluation
virtual scalar CourantNumber() const;
// Fields
//- Return the film thickness [m]
virtual const volScalarField& delta() const = 0;
//- Return the film velocity [m/s]
virtual const volVectorField& U() const = 0;
//- Return the film surface velocity [m/s]
virtual const volVectorField& Us() const = 0;
//- Return the film wall velocity [m/s]
virtual const volVectorField& Uw() const = 0;
//- Return the film density [kg/m3]
virtual const volScalarField& rho() const = 0;
//- Return the film mean temperature [K]
virtual const volScalarField& T() const = 0;
//- Return the film surface temperature [K]
virtual const volScalarField& Ts() const = 0;
//- Return the film wall temperature [K]
virtual const volScalarField& Tw() const = 0;
//- Return the film specific heat capacity [J/kg/K]
virtual const volScalarField& Cp() const = 0;
//- Return the film thermal conductivity [W/m/K]
virtual const volScalarField& kappa() const = 0;
// Transfer fields - to the primary region
//- Return the film mass available for transfer
virtual const volScalarField& massForPrimary() const = 0;
//- Return the parcel diameters originating from film
virtual const volScalarField& diametersForPrimary() const = 0;
//- Return the film mass evolved via phase change
virtual const volScalarField& massPhaseChangeForPrimary()
const = 0;
// Source fields
// Mapped into primary region
//- Return total mass source - Eulerian phase only
virtual tmp<DimensionedField<scalar, volMesh> > Srho() const;
//- Return mass source for specie i - Eulerian phase only
virtual tmp<DimensionedField<scalar, volMesh> > Srho
(
const label i
) const;
//- Return enthalpy source - Eulerian phase only
virtual tmp<DimensionedField<scalar, volMesh> > Sh() const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace surfaceFilmModels
} // End namespace regionModels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "surfaceFilmModelI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,53 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-2010 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 2 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 "surfaceFilmModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace regionModels
{
namespace surfaceFilmModels
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
inline const surfaceFilmModel::thermoModelType&
surfaceFilmModel::thermoModel() const
{
return thermoModel_;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace surfaceFilmModels
} // End namespace regionModels
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,93 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-2010 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 2 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 "surfaceFilmModel.H"
#include "fvMesh.H"
#include "Time.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace regionModels
{
namespace surfaceFilmModels
{
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
autoPtr<surfaceFilmModel> surfaceFilmModel::New
(
const fvMesh& mesh,
const dimensionedVector& g
)
{
word modelType;
{
IOdictionary surfaceFilmPropertiesDict
(
IOobject
(
"surfaceFilmProperties",
mesh.time().constant(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE,
false
)
);
surfaceFilmPropertiesDict.lookup("surfaceFilmModel") >> modelType;
}
Info<< "Selecting surfaceFilmModel " << modelType << endl;
meshConstructorTable::iterator cstrIter =
meshConstructorTablePtr_->find(modelType);
if (cstrIter == meshConstructorTablePtr_->end())
{
FatalErrorIn
(
"surfaceFilmModel::New(const fvMesh&, const dimensionedVector&)"
) << "Unknown surfaceFilmModel type " << modelType
<< nl << nl << "Valid surfaceFilmModel types are:" << nl
<< meshConstructorTablePtr_->toc()
<< exit(FatalError);
}
return autoPtr<surfaceFilmModel>(cstrIter()(modelType, mesh, g));
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace surfaceFilmModels
} // End namespace regionModels
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,741 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-2010 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 2 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 "thermoSingleLayer.H"
#include "fvcDiv.H"
#include "fvcLaplacian.H"
#include "fvm.H"
#include "addToRunTimeSelectionTable.H"
#include "zeroGradientFvPatchFields.H"
#include "directMappedFieldFvPatchField.H"
#include "mapDistribute.H"
// Sub-models
#include "heatTransferModel.H"
#include "phaseChangeModel.H"
#include "filmRadiationModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace regionModels
{
namespace surfaceFilmModels
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(thermoSingleLayer, 0);
addToRunTimeSelectionTable(surfaceFilmModel, thermoSingleLayer, mesh);
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
wordList thermoSingleLayer::hsBoundaryTypes()
{
wordList bTypes(T_.boundaryField().types());
forAll(bTypes, patchI)
{
if (bTypes[patchI] == directMappedFieldFvPatchField<scalar>::typeName)
{
bTypes[patchI] = fixedValueFvPatchField<scalar>::typeName;
}
}
return bTypes;
}
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
bool thermoSingleLayer::read()
{
// no additional properties to read
return kinematicSingleLayer::read();
}
void thermoSingleLayer::resetPrimaryRegionSourceTerms()
{
kinematicSingleLayer::resetPrimaryRegionSourceTerms();
hsSpPrimary_ == dimensionedScalar("zero", hsSp_.dimensions(), 0.0);
}
void thermoSingleLayer::correctThermoFields()
{
switch (thermoModel_)
{
case tmConstant:
{
rho_ == dimensionedScalar(coeffs_.lookup("rho0"));
mu_ == dimensionedScalar(coeffs_.lookup("mu0"));
sigma_ == dimensionedScalar(coeffs_.lookup("sigma0"));
Cp_ == dimensionedScalar(coeffs_.lookup("Cp0"));
kappa_ == dimensionedScalar(coeffs_.lookup("kappa0"));
break;
}
case tmSingleComponent:
{
const liquid& liq = thermo_.liquids().properties()[liquidId_];
forAll(rho_, cellI)
{
const scalar T = T_[cellI];
const scalar p = pPrimary_[cellI];
rho_[cellI] = liq.rho(p, T);
mu_[cellI] = liq.mu(p, T);
sigma_[cellI] = liq.sigma(p, T);
Cp_[cellI] = liq.Cp(p, T);
kappa_[cellI] = liq.K(p, T);
}
rho_.correctBoundaryConditions();
mu_.correctBoundaryConditions();
sigma_.correctBoundaryConditions();
Cp_.correctBoundaryConditions();
kappa_.correctBoundaryConditions();
break;
}
default:
{
FatalErrorIn
(
"void thermoSingleLayer::"
"correctThermoFields()"
) << "Unknown thermoType enumeration" << abort(FatalError);
}
}
}
void thermoSingleLayer::correctHsForMappedT()
{
T_.correctBoundaryConditions();
forAll(T_.boundaryField(), patchI)
{
const fvPatchField<scalar>& Tp = T_.boundaryField()[patchI];
if (isA<directMappedFieldFvPatchField<scalar> >(Tp))
{
hs_.boundaryField()[patchI] == hs(Tp, patchI);
}
}
}
void thermoSingleLayer::updateSurfaceTemperatures()
{
correctHsForMappedT();
// Push boundary film temperature into wall temperature internal field
for (label i=0; i<intCoupledPatchIDs_.size(); i++)
{
label patchI = intCoupledPatchIDs_[i];
const polyPatch& pp = regionMesh().boundaryMesh()[patchI];
UIndirectList<scalar>(Tw_, pp.faceCells()) =
T_.boundaryField()[patchI];
}
Tw_.correctBoundaryConditions();
// Update film surface temperature
Ts_ = T_;
Ts_.correctBoundaryConditions();
}
void thermoSingleLayer::transferPrimaryRegionThermoFields()
{
kinematicSingleLayer::transferPrimaryRegionThermoFields();
// Update primary region fields on local region via direct mapped (coupled)
// boundary conditions
TPrimary_.correctBoundaryConditions();
forAll(YPrimary_, i)
{
YPrimary_[i].correctBoundaryConditions();
}
}
void thermoSingleLayer::transferPrimaryRegionSourceFields()
{
kinematicSingleLayer::transferPrimaryRegionSourceFields();
// Retrieve the source fields from the primary region via direct mapped
// (coupled) boundary conditions
// - fields require transfer of values for both patch AND to push the
// values into the first layer of internal cells
hsSp_.correctBoundaryConditions();
// Convert accummulated source terms into per unit area per unit time
// Note: boundary values will still have original (neat) values
const scalar deltaT = time_.deltaTValue();
hsSp_.field() /= magSf()*deltaT;
}
void thermoSingleLayer::updateSubmodels()
{
// Update heat transfer coefficient sub-models
htcs_->correct();
htcw_->correct();
// Update phase change
massPhaseChangeForPrimary_.internalField() = 0.0;
energyPhaseChangeForPrimary_.internalField() = 0.0;
phaseChange_->correct
(
time_.deltaTValue(),
massPhaseChangeForPrimary_,
energyPhaseChangeForPrimary_
);
massPhaseChangeForPrimary_.correctBoundaryConditions();
totalMassPhaseChange_ += sum(massPhaseChangeForPrimary_).value();
// Update radiation
radiation_->correct();
// Update kinematic sub-models
kinematicSingleLayer::updateSubmodels();
// Update source fields
hsSp_ -= energyPhaseChangeForPrimary_/magSf()/time().deltaT();
}
tmp<fvScalarMatrix> thermoSingleLayer::q
(
volScalarField& hs
) const
{
dimensionedScalar Tstd("Tstd", dimTemperature, 298.15);
return
(
- fvm::Sp(htcs_->h()/Cp_, hs) - htcs_->h()*(Tstd - TPrimary_)
- fvm::Sp(htcw_->h()/Cp_, hs) - htcw_->h()*(Tstd - Tw_)
);
}
void thermoSingleLayer::solveEnergy()
{
if (debug)
{
Info<< "thermoSingleLayer::solveEnergy()" << endl;
}
updateSurfaceTemperatures();
dimensionedScalar hs0("SMALL", hs_.dimensions(), SMALL);
solve
(
fvm::ddt(deltaRho_, hs_)
+ fvm::div(phi_, hs_)
==
fvm::Sp(hsSp_/(hs_ + hs0), hs_)
+ q(hs_)
+ radiation_->Shs()
- fvm::Sp(massForPrimary_/magSf()/time().deltaT(), hs_)
);
correctThermoFields();
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
thermoSingleLayer::thermoSingleLayer
(
const word& modelType,
const fvMesh& mesh,
const dimensionedVector& g,
const bool readFields
)
:
kinematicSingleLayer(modelType, mesh, g, false),
thermo_(mesh.lookupObject<SLGThermo>("SLGThermo")),
liquidId_(thermo_.liquidId(coeffs_.lookup("liquid"))),
Cp_
(
IOobject
(
"Cp",
time().timeName(),
regionMesh(),
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
regionMesh(),
dimensionedScalar("Cp", dimEnergy/dimMass/dimTemperature, 0.0),
zeroGradientFvPatchScalarField::typeName
),
kappa_
(
IOobject
(
"kappa",
time().timeName(),
regionMesh(),
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
regionMesh(),
dimensionedScalar
(
"kappa",
dimEnergy/dimTime/dimLength/dimTemperature,
0.0
),
zeroGradientFvPatchScalarField::typeName
),
T_
(
IOobject
(
"Tf",
time().timeName(),
regionMesh(),
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
regionMesh()
),
Ts_
(
IOobject
(
"Tsf",
time().timeName(),
regionMesh(),
IOobject::NO_READ,
IOobject::NO_WRITE
),
T_,
zeroGradientFvPatchScalarField::typeName
),
Tw_
(
IOobject
(
"Twf",
time().timeName(),
regionMesh(),
IOobject::NO_READ,
IOobject::NO_WRITE
),
T_,
zeroGradientFvPatchScalarField::typeName
),
hs_
(
IOobject
(
"hsf",
time().timeName(),
regionMesh(),
IOobject::NO_READ,
IOobject::NO_WRITE
),
regionMesh(),
dimensionedScalar("zero", dimEnergy/dimMass, 0.0),
// T_.boundaryField().types()
hsBoundaryTypes()
),
hsSp_
(
IOobject
(
"hsSp",
time().timeName(),
regionMesh(),
IOobject::NO_READ,
IOobject::NO_WRITE
),
regionMesh(),
dimensionedScalar("zero", dimEnergy/dimArea/dimTime, 0.0),
this->mappedPushedFieldPatchTypes<scalar>()
),
hsSpPrimary_
(
IOobject
(
hsSp_.name(), // must have same name as hSp_ to enable mapping
time().timeName(),
primaryMesh(),
IOobject::NO_READ,
IOobject::NO_WRITE
),
primaryMesh(),
dimensionedScalar("zero", hsSp_.dimensions(), 0.0)
),
TPrimary_
(
IOobject
(
"T", // same name as T on primary region to enable mapping
time().timeName(),
regionMesh(),
IOobject::NO_READ,
IOobject::NO_WRITE
),
regionMesh(),
dimensionedScalar("zero", dimTemperature, 0.0),
this->mappedFieldAndInternalPatchTypes<scalar>()
),
YPrimary_(),
htcs_
(
heatTransferModel::New(*this, coeffs().subDict("upperSurfaceModels"))
),
htcw_
(
heatTransferModel::New(*this, coeffs().subDict("lowerSurfaceModels"))
),
phaseChange_(phaseChangeModel::New(*this, coeffs())),
radiation_(filmRadiationModel::New(*this, coeffs())),
totalMassPhaseChange_(0.0),
energyPhaseChangeForPrimary_
(
IOobject
(
"energyPhaseChangeForPrimary",
time().timeName(),
regionMesh(),
IOobject::NO_READ,
IOobject::NO_WRITE
),
regionMesh(),
dimensionedScalar("zero", dimEnergy, 0),
zeroGradientFvPatchScalarField::typeName
)
{
if (thermo_.hasMultiComponentCarrier())
{
YPrimary_.setSize(thermo_.carrier().species().size());
forAll(thermo_.carrier().species(), i)
{
YPrimary_.set
(
i,
new volScalarField
(
IOobject
(
thermo_.carrier().species()[i],
time().timeName(),
regionMesh(),
IOobject::NO_READ,
IOobject::NO_WRITE
),
regionMesh(),
dimensionedScalar("zero", dimless, 0.0),
pSp_.boundaryField().types()
)
);
}
}
if (readFields)
{
transferPrimaryRegionThermoFields();
correctThermoFields();
// Update derived fields
hs_ == hs(T_);
deltaRho_ == delta_*rho_;
phi_ = fvc::interpolate(deltaRho_*U_) & regionMesh().Sf();
}
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
thermoSingleLayer::~thermoSingleLayer()
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
void thermoSingleLayer::addSources
(
const label patchI,
const label faceI,
const scalar massSource,
const vector& momentumSource,
const scalar pressureSource,
const scalar energySource
)
{
kinematicSingleLayer::addSources
(
patchI,
faceI,
massSource,
momentumSource,
pressureSource,
energySource
);
if (debug)
{
Info<< " energy = " << energySource << nl << endl;
}
hsSpPrimary_.boundaryField()[patchI][faceI] += energySource;
}
void thermoSingleLayer::preEvolveRegion()
{
transferPrimaryRegionThermoFields();
// correctHsForMappedT();
correctThermoFields();
transferPrimaryRegionSourceFields();
}
void thermoSingleLayer::evolveRegion()
{
updateSubmodels();
// Solve continuity for deltaRho_
solveContinuity();
for (int oCorr=0; oCorr<nOuterCorr_; oCorr++)
{
// Explicit pressure source contribution
tmp<volScalarField> tpu(this->pu());
// Implicit pressure source coefficient
tmp<volScalarField> tpp(this->pp());
// Solve for momentum for U_
tmp<fvVectorMatrix> UEqn = solveMomentum(tpu(), tpp());
// Solve energy for hs_ - also updates thermo
solveEnergy();
// Film thickness correction loop
for (int corr=1; corr<=nCorr_; corr++)
{
// Solve thickness for delta_
solveThickness(tpu(), tpp(), UEqn());
}
}
// Update deltaRho_ with new delta_
deltaRho_ == delta_*rho_;
// Update temperature using latest hs_
T_ == T(hs_);
// Update film wall and surface velocities
updateSurfaceVelocities();
// Update film wall and surface temperatures
updateSurfaceTemperatures();
// Reset source terms for next time integration
resetPrimaryRegionSourceTerms();
}
const volScalarField& thermoSingleLayer::Cp() const
{
return Cp_;
}
const volScalarField& thermoSingleLayer::kappa() const
{
return kappa_;
}
const volScalarField& thermoSingleLayer::T() const
{
return T_;
}
const volScalarField& thermoSingleLayer::Ts() const
{
return Ts_;
}
const volScalarField& thermoSingleLayer::Tw() const
{
return Tw_;
}
const volScalarField& thermoSingleLayer::hs() const
{
return hs_;
}
void thermoSingleLayer::info() const
{
kinematicSingleLayer::info();
Info<< indent << "min/max(T) = " << min(T_).value() << ", "
<< max(T_).value() << nl
<< indent << "mass phase change = "
<< returnReduce(totalMassPhaseChange_, sumOp<scalar>()) << nl
<< indent << "vapourisation rate = "
<< sum(massPhaseChangeForPrimary_).value()/time_.deltaTValue() << nl;
}
tmp<DimensionedField<scalar, volMesh> > thermoSingleLayer::Srho
(
const label i
) const
{
const label vapId =
thermo_.carrierId(thermo_.liquids().components()[liquidId_]);
tmp<DimensionedField<scalar, volMesh> > tSrho
(
new DimensionedField<scalar, volMesh>
(
IOobject
(
"thermoSingleLayer::Srho(i)",
time_.timeName(),
primaryMesh(),
IOobject::NO_READ,
IOobject::NO_WRITE,
false
),
primaryMesh(),
dimensionedScalar("zero", dimMass/dimVolume/dimTime, 0.0)
)
);
if (vapId == i)
{
scalarField& Srho = tSrho();
const scalarField& V = primaryMesh().V();
const scalar dt = time().deltaTValue();
forAll(intCoupledPatchIDs_, i)
{
const label filmPatchI = intCoupledPatchIDs_[i];
const mapDistribute& distMap = mappedPatches_[filmPatchI].map();
scalarField patchMass =
massPhaseChangeForPrimary_.boundaryField()[filmPatchI];
distMap.distribute(patchMass);
const label primaryPatchI = primaryPatchIDs()[i];
const unallocLabelList& cells =
primaryMesh().boundaryMesh()[primaryPatchI].faceCells();
forAll(patchMass, j)
{
Srho[cells[j]] = patchMass[j]/(V[cells[j]]*dt);
}
}
}
return tSrho;
}
tmp<DimensionedField<scalar, volMesh> > thermoSingleLayer::Sh() const
{
tmp<DimensionedField<scalar, volMesh> > tSh
(
new DimensionedField<scalar, volMesh>
(
IOobject
(
"thermoSingleLayer::Sh",
time().timeName(),
primaryMesh(),
IOobject::NO_READ,
IOobject::NO_WRITE,
false
),
primaryMesh(),
dimensionedScalar("zero", dimEnergy/dimVolume/dimTime, 0.0)
)
);
/*
scalarField& Sh = tSh();
const scalarField& V = mesh_.V();
const scalar dt = time_.deltaTValue();
forAll(intCoupledPatchIDs_, i)
{
const label filmPatchI = intCoupledPatchIDs_[i];
const mapDistribute& distMap = mappedPatches_[filmPatchI].map();
scalarField patchEnergy =
energyPhaseChangeForPrimary_.boundaryField()[filmPatchI];
distMap.distribute(patchEnergy);
const label primaryPatchI = primaryPatchIDs()[i];
const unallocLabelList& cells =
primaryMesh().boundaryMesh()[primaryPatchI].faceCells();
forAll(patchMass, j)
{
Sh[cells[j]] += patchEnergy[j]/(V[cells[j]]*dt);
}
}
*/
return tSh;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // end namespace Foam
} // end namespace regionModels
} // end namespace surfaceFilmModels
// ************************************************************************* //

View File

@ -0,0 +1,379 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-2010 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 2 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::thermoSingleLayer
Description
Thermodynamic form of single-cell layer surface film model
Note: defining enthalpy as Cp(T - Tstd) - when using liquids from the
thermophysical library, their enthalpies are calculated similarly, where
Tstd = 298.15 K
SourceFiles
thermoSingleLayer.C
\*---------------------------------------------------------------------------*/
#ifndef thermoSingleLayer_H
#define thermoSingleLayer_H
#include "kinematicSingleLayer.H"
#include "SLGThermo.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace regionModels
{
namespace surfaceFilmModels
{
// Forward declaration of classes
class heatTransferModel;
class phaseChangeModel;
class filmRadiationModel;
/*---------------------------------------------------------------------------*\
Class thermoSingleLayer Declaration
\*---------------------------------------------------------------------------*/
class thermoSingleLayer
:
public kinematicSingleLayer
{
private:
// Private member functions
//- Disallow default bitwise copy construct
thermoSingleLayer(const thermoSingleLayer&);
//- Disallow default bitwise assignment
void operator=(const thermoSingleLayer&);
//- Return boundary types for sensible enthalpy field
wordList hsBoundaryTypes();
protected:
// Protected data
// Thermo properties
//- Reference to the SLGThermo
const SLGThermo& thermo_;
// Single component
//- Id of component in thermo database
label liquidId_;
// Fields
//- Specific heat capacity / [J/kg/K]
volScalarField Cp_;
//- Thermal conductivity / [W/m/K]
volScalarField kappa_;
//- Temperature - mean / [K]
volScalarField T_;
//- Temperature - surface / [K]
volScalarField Ts_;
//- Temperature - wall / [K]
volScalarField Tw_;
//- Sensible enthalpy / [J/kg]
volScalarField hs_;
// Source term fields
// Film region - registered to the film region mesh
// Note: need boundary value mapped from primary region, and then
// pushed into the patch internal field
//- Energy / [J/m2/s]
volScalarField hsSp_;
// Primary region - registered to the primary region mesh
// Internal use only - not read-in
//- Energy / [J/m2/s]
volScalarField hsSpPrimary_;
// Fields mapped from primary region - registered to the film region
// Note: need both boundary AND patch internal fields to be mapped
//- Temperature / [K]
volScalarField TPrimary_;
//- List of specie mass fractions / [0-1]
PtrList<volScalarField> YPrimary_;
// Sub-models
//- Heat transfer coefficient bewteen film surface and primary
// region [W/m2/K]
autoPtr<heatTransferModel> htcs_;
//- Heat transfer coefficient bewteen wall and film [W/m2/K]
autoPtr<heatTransferModel> htcw_;
//- Phase change
autoPtr<phaseChangeModel> phaseChange_;
//- Radiation
autoPtr<filmRadiationModel> radiation_;
//- Total mass transferred to primary region [kg]
scalar totalMassPhaseChange_;
//- Film energy evolved via phase change
volScalarField energyPhaseChangeForPrimary_;
// Protected member functions
//- Read control parameters from dictionary
virtual bool read();
//- Correct the thermo fields
virtual void correctThermoFields();
//- Correct sensible enthalpy for mapped temperature fields
virtual void correctHsForMappedT();
//- Correct the film surface and wall temperatures
virtual void updateSurfaceTemperatures();
//- Reset source term fields
virtual void resetPrimaryRegionSourceTerms();
//- Transfer thermo fields from the primary region to the film region
virtual void transferPrimaryRegionThermoFields();
//- Transfer source fields from the primary region to the film region
virtual void transferPrimaryRegionSourceFields();
//- Update the film sub-models
virtual void updateSubmodels();
//- Return the wall/surface heat transfer term for the enthalpy equation
virtual tmp<fvScalarMatrix> q(volScalarField& hs) const;
// Equations
//- Solve energy equation
virtual void solveEnergy();
public:
//- Runtime type information
TypeName("thermoSingleLayer");
// Constructors
//- Construct from components
thermoSingleLayer
(
const word& modelType,
const fvMesh& mesh,
const dimensionedVector& g,
const bool readFields = true
);
//- Destructor
virtual ~thermoSingleLayer();
// Member Functions
// Thermo properties
//- Return const reference to the SLGThermo object
inline const SLGThermo& thermo() const;
// Single component
//- Return the Id of component in thermo database
inline label liquidId() const;
// Fields
//- Return the film specific heat capacity [J/kg/K]
virtual const volScalarField& Cp() const;
//- Return the film thermal conductivity [W/m/K]
virtual const volScalarField& kappa() const;
//- Return the film mean temperature [K]
virtual const volScalarField& T() const;
//- Return the film surface temperature [K]
virtual const volScalarField& Ts() const;
//- Return the film wall temperature [K]
virtual const volScalarField& Tw() const;
//- Return the film sensible enthalpy [J/kg]
virtual const volScalarField& hs() const;
// Helper functions
//- Return sensible enthalpy as a function of temperature
// for a patch
inline tmp<scalarField> hs
(
const scalarField& T,
const label patchI
) const;
//- Return sensible enthalpy as a function of temperature
inline tmp<volScalarField> hs
(
const volScalarField& T
) const;
//- Return temperature as a function of sensible enthalpy
inline tmp<volScalarField> T
(
const volScalarField& hs
) const;
// Source fields (read/write access)
//- External hook to add sources to the film
virtual void addSources
(
const label patchI, // patchI on primary region
const label faceI, // faceI of patchI
const scalar massSource, // [kg]
const vector& momentumSource, // [kg.m/s] (tangential momentum)
const scalar pressureSource, // [kg.m/s] (normal momentum)
const scalar energySource // [J]
);
// Source term fields
// Film region
//- Energy / [J/m2/s]
inline const volScalarField& hsSp() const;
// Primary region
//- Energy / [J/m2/s]
inline const volScalarField& hsSpPrimary() const;
// Fields mapped from the primary region
//- Temperature / [K]
inline const volScalarField& TPrimary() const;
//- Specie mass fractions / [0-1]
inline const PtrList<volScalarField>& YPrimary() const;
// Sub-models
//- Return const access to the (surface) heat transfer model
inline const heatTransferModel& htcs() const;
//- Return const access to the (wall) heat transfer model
inline const heatTransferModel& htcw() const;
//- Return const access to the phase change model
inline const phaseChangeModel& phaseChange() const;
//- Return const access to the radiation model
inline const filmRadiationModel& radiation() const;
// Evolution
//- Pre-evolve film hook
virtual void preEvolveRegion();
//- Evolve the film equations
virtual void evolveRegion();
// Source fields
// Mapped into primary region
//- Return mass source for specie i - Eulerian phase only
virtual tmp<DimensionedField<scalar, volMesh> > Srho
(
const label i
) const;
//- Return enthalpy source - Eulerian phase only
virtual tmp<DimensionedField<scalar, volMesh> > Sh() const;
// I-O
//- Provide some feedback
virtual void info() const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace surfaceFilmModels
} // End namespace regionModels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "thermoSingleLayerI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,165 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-2010 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 2 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 "thermoSingleLayer.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace regionModels
{
namespace surfaceFilmModels
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
inline const SLGThermo& thermoSingleLayer::thermo() const
{
return thermo_;
}
inline label thermoSingleLayer::liquidId() const
{
return liquidId_;
}
inline tmp<scalarField> thermoSingleLayer::hs
(
const scalarField& T,
const label patchI
) const
{
const scalarField& Cp = Cp_.boundaryField()[patchI];
return Cp*(T - 298.15);
}
inline tmp<volScalarField> thermoSingleLayer::hs
(
const volScalarField& T
) const
{
return tmp<volScalarField>
(
new volScalarField
(
IOobject
(
"hs(" + T.name() + ")",
time().timeName(),
regionMesh(),
IOobject::NO_READ,
IOobject::NO_WRITE
),
Cp_*(T - (dimensionedScalar("Tstd", dimTemperature, 298.15))),
zeroGradientFvPatchScalarField::typeName
)
);
}
inline tmp<volScalarField> thermoSingleLayer::T
(
const volScalarField& hs
) const
{
return tmp<volScalarField>
(
new volScalarField
(
IOobject
(
"T(" + hs.name() + ")",
time().timeName(),
regionMesh(),
IOobject::NO_READ,
IOobject::NO_WRITE
),
hs/Cp_ + dimensionedScalar("Tstd", dimTemperature, 298.15),
zeroGradientFvPatchScalarField::typeName
)
);
}
inline const volScalarField& thermoSingleLayer::hsSp() const
{
return hsSp_;
}
inline const volScalarField& thermoSingleLayer::hsSpPrimary() const
{
return hsSpPrimary_;
}
inline const volScalarField& thermoSingleLayer::TPrimary() const
{
return TPrimary_;
}
inline const PtrList<volScalarField>& thermoSingleLayer::YPrimary() const
{
return YPrimary_;
}
inline const heatTransferModel& thermoSingleLayer::htcs() const
{
return htcs_();
}
inline const heatTransferModel& thermoSingleLayer::htcw() const
{
return htcw_();
}
inline const phaseChangeModel& thermoSingleLayer::phaseChange() const
{
return phaseChange_();
}
inline const filmRadiationModel& thermoSingleLayer::radiation() const
{
return radiation_();
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace surfaceFilmModels
} // End namespace regionModels
} // End namespace Foam
// ************************************************************************* //