From 4413212d9996324427dd515c46c8331cc414f492 Mon Sep 17 00:00:00 2001 From: andy Date: Tue, 12 Nov 2013 10:13:43 +0000 Subject: [PATCH 1/3] ENH: regionModel - AMI list now mutable to allow const access --- .../regionModel/regionModel/regionModel.C | 2 +- .../regionModel/regionModel/regionModel.H | 13 +++++++------ .../regionModel/regionModel/regionModelTemplates.C | 8 ++++---- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/regionModels/regionModel/regionModel/regionModel.C b/src/regionModels/regionModel/regionModel/regionModel.C index 388559c18b..5bf2951451 100644 --- a/src/regionModels/regionModel/regionModel/regionModel.C +++ b/src/regionModels/regionModel/regionModel/regionModel.C @@ -197,7 +197,7 @@ Foam::regionModels::regionModel::interRegionAMI const label regionPatchI, const label nbrPatchI, const bool flip -) +) const { label nbrRegionID = findIndex(interRegionAMINames_, nbrRegion.name()); diff --git a/src/regionModels/regionModel/regionModel/regionModel.H b/src/regionModels/regionModel/regionModel/regionModel.H index 1b8fecabab..83afc6898b 100644 --- a/src/regionModels/regionModel/regionModel/regionModel.H +++ b/src/regionModels/regionModel/regionModel/regionModel.H @@ -125,10 +125,11 @@ protected: // Inter-region AMI interpolation caching //- List of region names this region is coupled to - wordList interRegionAMINames_; + mutable wordList interRegionAMINames_; //- List of AMI objects per coupled region - PtrList > interRegionAMI_; + mutable PtrList > + interRegionAMI_; // Protected member functions @@ -146,7 +147,7 @@ protected: const label regionPatchI, const label nbrPatchI, const bool flip - ); + ) const; public: @@ -257,7 +258,7 @@ public: const label nbrPatchI, const Field& nbrField, const bool flip = false - ); + ) const; //- Map patch field from another region model to local patch template @@ -267,7 +268,7 @@ public: const word& fieldName, const label regionPatchI, const bool flip = false - ); + ) const; //- Map patch internal field from another region model to local // patch @@ -278,7 +279,7 @@ public: const word& fieldName, const label regionPatchI, const bool flip = false - ); + ) const; //- Convert a local region field to the primary region template diff --git a/src/regionModels/regionModel/regionModel/regionModelTemplates.C b/src/regionModels/regionModel/regionModel/regionModelTemplates.C index 5855ee5906..dad46878ab 100644 --- a/src/regionModels/regionModel/regionModel/regionModelTemplates.C +++ b/src/regionModels/regionModel/regionModel/regionModelTemplates.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -32,7 +32,7 @@ Foam::regionModels::regionModel::mapRegionPatchField const label nbrPatchI, const Field& nbrField, const bool flip -) +) const { int oldTag = UPstream::msgType(); UPstream::msgType() = oldTag + 1; @@ -56,7 +56,7 @@ Foam::regionModels::regionModel::mapRegionPatchField const word& fieldName, const label regionPatchI, const bool flip -) +) const { typedef GeometricField fieldType; @@ -108,7 +108,7 @@ Foam::regionModels::regionModel::mapRegionPatchInternalField const word& fieldName, const label regionPatchI, const bool flip -) +) const { typedef GeometricField fieldType; From 969dd7e7a33e6ad2c20e5c242a37f94b0b73e560 Mon Sep 17 00:00:00 2001 From: andy Date: Tue, 12 Nov 2013 10:14:21 +0000 Subject: [PATCH 2/3] ENH: film-pyrolysic BC updates --- ...sRadiativeCoupledMixedFvPatchScalarField.C | 69 +++++++++++-------- ...sRadiativeCoupledMixedFvPatchScalarField.H | 8 +-- 2 files changed, 41 insertions(+), 36 deletions(-) diff --git a/src/regionModels/regionCoupling/derivedFvPatchFields/filmPyrolysisRadiativeCoupledMixed/filmPyrolysisRadiativeCoupledMixedFvPatchScalarField.C b/src/regionModels/regionCoupling/derivedFvPatchFields/filmPyrolysisRadiativeCoupledMixed/filmPyrolysisRadiativeCoupledMixedFvPatchScalarField.C index adac03499b..c3424ff451 100644 --- a/src/regionModels/regionCoupling/derivedFvPatchFields/filmPyrolysisRadiativeCoupledMixed/filmPyrolysisRadiativeCoupledMixedFvPatchScalarField.C +++ b/src/regionModels/regionCoupling/derivedFvPatchFields/filmPyrolysisRadiativeCoupledMixed/filmPyrolysisRadiativeCoupledMixedFvPatchScalarField.C @@ -122,7 +122,6 @@ filmPyrolysisRadiativeCoupledMixedFvPatchScalarField filmRegionName_("surfaceFilmProperties"), pyrolysisRegionName_("pyrolysisProperties"), TnbrName_("undefined-Tnbr"), - QrNbrName_("undefined-QrNbr"), QrName_("undefined-Qr"), convectiveScaling_(1.0), filmDeltaDry_(0.0), @@ -148,7 +147,6 @@ filmPyrolysisRadiativeCoupledMixedFvPatchScalarField filmRegionName_(psf.filmRegionName_), pyrolysisRegionName_(psf.pyrolysisRegionName_), TnbrName_(psf.TnbrName_), - QrNbrName_(psf.QrNbrName_), QrName_(psf.QrName_), convectiveScaling_(psf.convectiveScaling_), filmDeltaDry_(psf.filmDeltaDry_), @@ -175,7 +173,6 @@ filmPyrolysisRadiativeCoupledMixedFvPatchScalarField dict.lookupOrDefault("pyrolysisRegion", "pyrolysisProperties") ), TnbrName_(dict.lookup("Tnbr")), - QrNbrName_(dict.lookup("QrNbr")), QrName_(dict.lookup("Qr")), convectiveScaling_(dict.lookupOrDefault("convectiveScaling", 1.0)), filmDeltaDry_(readScalar(dict.lookup("filmDeltaDry"))), @@ -231,7 +228,6 @@ filmPyrolysisRadiativeCoupledMixedFvPatchScalarField filmRegionName_(psf.filmRegionName_), pyrolysisRegionName_(psf.pyrolysisRegionName_), TnbrName_(psf.TnbrName_), - QrNbrName_(psf.QrNbrName_), QrName_(psf.QrName_), convectiveScaling_(psf.convectiveScaling_), filmDeltaDry_(psf.filmDeltaDry_), @@ -241,8 +237,7 @@ filmPyrolysisRadiativeCoupledMixedFvPatchScalarField // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -void filmPyrolysisRadiativeCoupledMixedFvPatchScalarField:: -updateCoeffs() +void filmPyrolysisRadiativeCoupledMixedFvPatchScalarField::updateCoeffs() { if (updated()) { @@ -294,34 +289,49 @@ updateCoeffs() const pyrolysisModelType& pyrolysis = pyrModel(); const filmModelType& film = filmModel(); - label myPatchINrbPatchI = -1; - // Obtain Rad heat (Qr) scalarField Qr(patch().size(), 0.0); - if (QrName_ != "none") // primary region (region0) + + label coupledPatchI = -1; + if (pyrolysisRegionName_ == mesh.name()) { - Qr = patch().lookupPatchField(QrName_); - myPatchINrbPatchI = nbrPatch.index(); + coupledPatchI = patchI; + if (QrName_ != "none") + { + Qr = nbrPatch.lookupPatchField(QrName_); + mpp.distribute(Qr); + } + } + else if (pyrolysis.primaryMesh().name() == mesh.name()) + { + coupledPatchI = nbrPatch.index(); + if (QrName_ != "none") + { + Qr = patch().lookupPatchField(QrName_); + } + } + else + { + FatalErrorIn + ( + "void filmPyrolysisRadiativeCoupledMixedFvPatchScalarField::" + "updateCoeffs()" + ) + << type() << " condition is intended to be applied to either the " + << "primary or pyrolysis regions only" + << exit(FatalError); } - if (QrNbrName_ != "none") // pyrolysis region - { - Qr = nbrPatch.lookupPatchField(QrNbrName_); - mpp.distribute(Qr); - myPatchINrbPatchI = patchI; - } - - const label filmPatchI = - pyrolysis.nbrCoupledPatchID(film, myPatchINrbPatchI); + const label filmPatchI = pyrolysis.nbrCoupledPatchID(film, coupledPatchI); const scalarField htcw(film.htcw().h()().boundaryField()[filmPatchI]); // Obtain htcw htcwfilm = - const_cast(pyrolysis).mapRegionPatchField + pyrolysis.mapRegionPatchField ( film, - myPatchINrbPatchI, + coupledPatchI, filmPatchI, htcw, true @@ -335,11 +345,11 @@ updateCoeffs() // Obtain delta filmDelta = - const_cast(pyrolysis).mapRegionPatchField + pyrolysis.mapRegionPatchField ( film, "deltaf", - myPatchINrbPatchI, + coupledPatchI, true ); @@ -414,14 +424,13 @@ void filmPyrolysisRadiativeCoupledMixedFvPatchScalarField::write pyrolysisRegionName_ ); os.writeKeyword("Tnbr")<< TnbrName_ << token::END_STATEMENT << nl; - os.writeKeyword("QrNbr")<< QrNbrName_ << token::END_STATEMENT << nl; os.writeKeyword("Qr")<< QrName_ << token::END_STATEMENT << nl; os.writeKeyword("convectiveScaling") << convectiveScaling_ - << token::END_STATEMENT << nl; - os.writeKeyword("filmDeltaDry") << filmDeltaDry_ << - token::END_STATEMENT << nl; - os.writeKeyword("filmDeltaWet") << filmDeltaWet_ << - token::END_STATEMENT << endl; + << token::END_STATEMENT << nl; + os.writeKeyword("filmDeltaDry") << filmDeltaDry_ + << token::END_STATEMENT << nl; + os.writeKeyword("filmDeltaWet") << filmDeltaWet_ + << token::END_STATEMENT << endl; temperatureCoupledBase::write(os); } diff --git a/src/regionModels/regionCoupling/derivedFvPatchFields/filmPyrolysisRadiativeCoupledMixed/filmPyrolysisRadiativeCoupledMixedFvPatchScalarField.H b/src/regionModels/regionCoupling/derivedFvPatchFields/filmPyrolysisRadiativeCoupledMixed/filmPyrolysisRadiativeCoupledMixedFvPatchScalarField.H index e4161e1bfc..67788bd3c7 100644 --- a/src/regionModels/regionCoupling/derivedFvPatchFields/filmPyrolysisRadiativeCoupledMixed/filmPyrolysisRadiativeCoupledMixedFvPatchScalarField.H +++ b/src/regionModels/regionCoupling/derivedFvPatchFields/filmPyrolysisRadiativeCoupledMixed/filmPyrolysisRadiativeCoupledMixedFvPatchScalarField.H @@ -38,7 +38,6 @@ Description type filmPyrolysisRadiativeCoupledMixed; Tnbr T; kappa fluidThermo; - QrNbr none; Qr Qr; kappaName none; filmDeltaDry 0.0; @@ -91,7 +90,7 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class filmPyrolysisRadiativeCoupledMixedFvPatchScalarField Declaration + Class filmPyrolysisRadiativeCoupledMixedFvPatchScalarField Declaration \*---------------------------------------------------------------------------*/ class filmPyrolysisRadiativeCoupledMixedFvPatchScalarField @@ -121,10 +120,7 @@ private: //- Name of field on the neighbour region const word TnbrName_; - //- Name of the radiative heat flux in the neighbout region - const word QrNbrName_; - - //- Name of the radiative heat flux in local region + //- Name of the radiative heat flux const word QrName_; //- Convective Scaling Factor (as determined by Prateep's tests) From a242ce726708cea1475acec085de4b45fa7246ff Mon Sep 17 00:00:00 2001 From: andy Date: Tue, 12 Nov 2013 10:37:22 +0000 Subject: [PATCH 3/3] BUG: nearWallFields - added missing file to Make/files --- src/postProcessing/functionObjects/field/Make/files | 1 + 1 file changed, 1 insertion(+) diff --git a/src/postProcessing/functionObjects/field/Make/files b/src/postProcessing/functionObjects/field/Make/files index 38232bb0fc..dd138902e3 100644 --- a/src/postProcessing/functionObjects/field/Make/files +++ b/src/postProcessing/functionObjects/field/Make/files @@ -20,6 +20,7 @@ fieldValues/cellSource/cellSourceFunctionObject.C nearWallFields/nearWallFields.C nearWallFields/nearWallFieldsFunctionObject.C +nearWallFields/findCellParticle.C nearWallFields/findCellParticleCloud.C processorField/processorField.C