From 101285018b49fba83293ccbad1df3653699c58af Mon Sep 17 00:00:00 2001 From: andy Date: Wed, 26 Jan 2011 12:21:09 +0000 Subject: [PATCH 01/41] 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 --- src/Allwmake | 2 +- src/regionModels/Allwmake | 11 + src/regionModels/regionModel/Make/files | 14 + src/regionModels/regionModel/Make/options | 7 + .../directMappedFieldFvPatchField.C | 313 +++++ .../directMappedFieldFvPatchField.H | 201 +++ .../directMappedFieldFvPatchFields.C | 43 + .../directMappedFieldFvPatchFields.H | 49 + .../directMappedFieldFvPatchFieldsFwd.H | 50 + ...rectMappedFixedInternalValueFvPatchField.C | 157 +++ ...rectMappedFixedInternalValueFvPatchField.H | 151 +++ ...ectMappedFixedInternalValueFvPatchFields.C | 44 + ...ectMappedFixedInternalValueFvPatchFields.H | 50 + ...MappedFixedInternalValueFvPatchFieldsFwd.H | 51 + ...ppedFixedPushedInternalValueFvPatchField.C | 126 ++ ...ppedFixedPushedInternalValueFvPatchField.H | 158 +++ ...pedFixedPushedInternalValueFvPatchFields.C | 44 + ...pedFixedPushedInternalValueFvPatchFields.H | 50 + ...FixedPushedInternalValueFvPatchFieldsFwd.H | 51 + .../directMappedNamedFixedValueFvPatchField.C | 336 +++++ .../directMappedNamedFixedValueFvPatchField.H | 165 +++ ...directMappedNamedFixedValueFvPatchFields.C | 44 + ...directMappedNamedFixedValueFvPatchFields.H | 50 + ...ectMappedNamedFixedValueFvPatchFieldsFwd.H | 51 + ...ectMappedNamesFixedValueFvPatchFieldsFwd.H | 51 + ...gionMappedFixedInternalValueFvPatchField.C | 170 +++ ...gionMappedFixedInternalValueFvPatchField.H | 162 +++ ...ionMappedFixedInternalValueFvPatchFields.C | 44 + ...ionMappedFixedInternalValueFvPatchFields.H | 50 + ...MappedFixedInternalValueFvPatchFieldsFwd.H | 51 + .../regionModel/regionModel/regionModel.C | 283 ++++ .../regionModel/regionModel/regionModel.H | 236 ++++ .../regionModel/regionModel/regionModelI.H | 154 +++ .../regionModel/regionModel1D/regionModel1D.C | 308 +++++ .../regionModel/regionModel1D/regionModel1D.H | 176 +++ .../regionModel1D/regionModel1DI.H | 68 + .../singleLayerRegion/singleLayerRegion.C | 238 ++++ .../singleLayerRegion/singleLayerRegion.H | 174 +++ .../singleLayerRegionTemplates.C | 72 ++ src/regionModels/surfaceFilmModels/Make/files | 45 + .../surfaceFilmModels/Make/options | 25 + ...ilmHeightInletVelocityFvPatchVectorField.C | 168 +++ ...ilmHeightInletVelocityFvPatchVectorField.H | 199 +++ .../htcConv/htcConvFvPatchScalarField.C | 166 +++ .../htcConv/htcConvFvPatchScalarField.H | 160 +++ ...alphatFilmWallFunctionFvPatchScalarField.C | 240 ++++ ...alphatFilmWallFunctionFvPatchScalarField.H | 173 +++ .../mutkFilmWallFunctionFvPatchScalarField.C | 238 ++++ .../mutkFilmWallFunctionFvPatchScalarField.H | 172 +++ .../kinematicSingleLayer.C | 1135 +++++++++++++++++ .../kinematicSingleLayer.H | 524 ++++++++ .../kinematicSingleLayerI.H | 250 ++++ .../kinematicSingleLayerTemplates.C | 78 ++ .../surfaceFilmModels/noFilm/noFilm.C | 291 +++++ .../surfaceFilmModels/noFilm/noFilm.H | 187 +++ .../cloudInjection/cloudInjection.C | 118 ++ .../cloudInjection/cloudInjection.H | 126 ++ .../injectionModel/injectionModel.C | 74 ++ .../injectionModel/injectionModel.H | 143 +++ .../injectionModel/injectionModelNew.C | 74 ++ .../injectionModel/noInjection/noInjection.C | 81 ++ .../injectionModel/noInjection/noInjection.H | 108 ++ .../removeInjection/removeInjection.C | 80 ++ .../removeInjection/removeInjection.H | 108 ++ .../submodels/subModelBase.C | 71 ++ .../submodels/subModelBase.H | 125 ++ .../submodels/subModelBaseI.H | 58 + .../filmRadiationModel/filmRadiationModel.C | 77 ++ .../filmRadiationModel/filmRadiationModel.H | 141 ++ .../filmRadiationModelNew.C | 78 ++ .../noRadiation/noRadiation.C | 106 ++ .../noRadiation/noRadiation.H | 112 ++ .../standardRadiation/standardRadiation.C | 151 +++ .../standardRadiation/standardRadiation.H | 137 ++ .../constantHeatTransfer.C | 113 ++ .../constantHeatTransfer.H | 118 ++ .../heatTransferModel/heatTransferModel.C | 77 ++ .../heatTransferModel/heatTransferModel.H | 141 ++ .../heatTransferModel/heatTransferModelNew.C | 74 ++ .../mappedConvectiveHeatTransfer.C | 126 ++ .../mappedConvectiveHeatTransfer.H | 124 ++ .../noPhaseChange/noPhaseChange.C | 81 ++ .../noPhaseChange/noPhaseChange.H | 109 ++ .../phaseChangeModel/phaseChangeModel.C | 77 ++ .../phaseChangeModel/phaseChangeModel.H | 144 +++ .../phaseChangeModel/phaseChangeModelNew.C | 74 ++ .../standardPhaseChange/standardPhaseChange.C | 224 ++++ .../standardPhaseChange/standardPhaseChange.H | 149 +++ .../surfaceFilmModel/surfaceFilmModel.C | 166 +++ .../surfaceFilmModel/surfaceFilmModel.H | 263 ++++ .../surfaceFilmModel/surfaceFilmModelI.H | 53 + .../surfaceFilmModel/surfaceFilmModelNew.C | 93 ++ .../thermoSingleLayer/thermoSingleLayer.C | 741 +++++++++++ .../thermoSingleLayer/thermoSingleLayer.H | 379 ++++++ .../thermoSingleLayer/thermoSingleLayerI.H | 165 +++ 95 files changed, 13964 insertions(+), 1 deletion(-) create mode 100755 src/regionModels/Allwmake create mode 100644 src/regionModels/regionModel/Make/files create mode 100644 src/regionModels/regionModel/Make/options create mode 100644 src/regionModels/regionModel/derivedFvPatchFields/directMappedField/directMappedFieldFvPatchField.C create mode 100644 src/regionModels/regionModel/derivedFvPatchFields/directMappedField/directMappedFieldFvPatchField.H create mode 100644 src/regionModels/regionModel/derivedFvPatchFields/directMappedField/directMappedFieldFvPatchFields.C create mode 100644 src/regionModels/regionModel/derivedFvPatchFields/directMappedField/directMappedFieldFvPatchFields.H create mode 100644 src/regionModels/regionModel/derivedFvPatchFields/directMappedField/directMappedFieldFvPatchFieldsFwd.H create mode 100644 src/regionModels/regionModel/derivedFvPatchFields/directMappedFixedInternalValue/directMappedFixedInternalValueFvPatchField.C create mode 100644 src/regionModels/regionModel/derivedFvPatchFields/directMappedFixedInternalValue/directMappedFixedInternalValueFvPatchField.H create mode 100644 src/regionModels/regionModel/derivedFvPatchFields/directMappedFixedInternalValue/directMappedFixedInternalValueFvPatchFields.C create mode 100644 src/regionModels/regionModel/derivedFvPatchFields/directMappedFixedInternalValue/directMappedFixedInternalValueFvPatchFields.H create mode 100644 src/regionModels/regionModel/derivedFvPatchFields/directMappedFixedInternalValue/directMappedFixedInternalValueFvPatchFieldsFwd.H create mode 100644 src/regionModels/regionModel/derivedFvPatchFields/directMappedFixedPushedInternalValue/directMappedFixedPushedInternalValueFvPatchField.C create mode 100644 src/regionModels/regionModel/derivedFvPatchFields/directMappedFixedPushedInternalValue/directMappedFixedPushedInternalValueFvPatchField.H create mode 100644 src/regionModels/regionModel/derivedFvPatchFields/directMappedFixedPushedInternalValue/directMappedFixedPushedInternalValueFvPatchFields.C create mode 100644 src/regionModels/regionModel/derivedFvPatchFields/directMappedFixedPushedInternalValue/directMappedFixedPushedInternalValueFvPatchFields.H create mode 100644 src/regionModels/regionModel/derivedFvPatchFields/directMappedFixedPushedInternalValue/directMappedFixedPushedInternalValueFvPatchFieldsFwd.H create mode 100644 src/regionModels/regionModel/derivedFvPatchFields/directMappedNamedFixedValue/directMappedNamedFixedValueFvPatchField.C create mode 100644 src/regionModels/regionModel/derivedFvPatchFields/directMappedNamedFixedValue/directMappedNamedFixedValueFvPatchField.H create mode 100644 src/regionModels/regionModel/derivedFvPatchFields/directMappedNamedFixedValue/directMappedNamedFixedValueFvPatchFields.C create mode 100644 src/regionModels/regionModel/derivedFvPatchFields/directMappedNamedFixedValue/directMappedNamedFixedValueFvPatchFields.H create mode 100644 src/regionModels/regionModel/derivedFvPatchFields/directMappedNamedFixedValue/directMappedNamedFixedValueFvPatchFieldsFwd.H create mode 100644 src/regionModels/regionModel/derivedFvPatchFields/directMappedNamedFixedValue/directMappedNamesFixedValueFvPatchFieldsFwd.H create mode 100644 src/regionModels/regionModel/derivedFvPatchFields/filmMappedFixedInternalValue/regionMappedFixedInternalValueFvPatchField.C create mode 100644 src/regionModels/regionModel/derivedFvPatchFields/filmMappedFixedInternalValue/regionMappedFixedInternalValueFvPatchField.H create mode 100644 src/regionModels/regionModel/derivedFvPatchFields/filmMappedFixedInternalValue/regionMappedFixedInternalValueFvPatchFields.C create mode 100644 src/regionModels/regionModel/derivedFvPatchFields/filmMappedFixedInternalValue/regionMappedFixedInternalValueFvPatchFields.H create mode 100644 src/regionModels/regionModel/derivedFvPatchFields/filmMappedFixedInternalValue/regionMappedFixedInternalValueFvPatchFieldsFwd.H create mode 100644 src/regionModels/regionModel/regionModel/regionModel.C create mode 100644 src/regionModels/regionModel/regionModel/regionModel.H create mode 100644 src/regionModels/regionModel/regionModel/regionModelI.H create mode 100644 src/regionModels/regionModel/regionModel1D/regionModel1D.C create mode 100644 src/regionModels/regionModel/regionModel1D/regionModel1D.H create mode 100644 src/regionModels/regionModel/regionModel1D/regionModel1DI.H create mode 100644 src/regionModels/regionModel/singleLayerRegion/singleLayerRegion.C create mode 100644 src/regionModels/regionModel/singleLayerRegion/singleLayerRegion.H create mode 100644 src/regionModels/regionModel/singleLayerRegion/singleLayerRegionTemplates.C create mode 100644 src/regionModels/surfaceFilmModels/Make/files create mode 100644 src/regionModels/surfaceFilmModels/Make/options create mode 100644 src/regionModels/surfaceFilmModels/derivedFvPatchFields/filmHeightInletVelocity/filmHeightInletVelocityFvPatchVectorField.C create mode 100644 src/regionModels/surfaceFilmModels/derivedFvPatchFields/filmHeightInletVelocity/filmHeightInletVelocityFvPatchVectorField.H create mode 100644 src/regionModels/surfaceFilmModels/derivedFvPatchFields/htcConv/htcConvFvPatchScalarField.C create mode 100644 src/regionModels/surfaceFilmModels/derivedFvPatchFields/htcConv/htcConvFvPatchScalarField.H create mode 100644 src/regionModels/surfaceFilmModels/derivedFvPatchFields/wallFunctions/alphatFilmWallFunction/alphatFilmWallFunctionFvPatchScalarField.C create mode 100644 src/regionModels/surfaceFilmModels/derivedFvPatchFields/wallFunctions/alphatFilmWallFunction/alphatFilmWallFunctionFvPatchScalarField.H create mode 100644 src/regionModels/surfaceFilmModels/derivedFvPatchFields/wallFunctions/mutkFilmWallFunction/mutkFilmWallFunctionFvPatchScalarField.C create mode 100644 src/regionModels/surfaceFilmModels/derivedFvPatchFields/wallFunctions/mutkFilmWallFunction/mutkFilmWallFunctionFvPatchScalarField.H create mode 100644 src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.C create mode 100644 src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.H create mode 100644 src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayerI.H create mode 100644 src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayerTemplates.C create mode 100644 src/regionModels/surfaceFilmModels/noFilm/noFilm.C create mode 100644 src/regionModels/surfaceFilmModels/noFilm/noFilm.H create mode 100644 src/regionModels/surfaceFilmModels/submodels/kinematic/injectionModel/cloudInjection/cloudInjection.C create mode 100644 src/regionModels/surfaceFilmModels/submodels/kinematic/injectionModel/cloudInjection/cloudInjection.H create mode 100644 src/regionModels/surfaceFilmModels/submodels/kinematic/injectionModel/injectionModel/injectionModel.C create mode 100644 src/regionModels/surfaceFilmModels/submodels/kinematic/injectionModel/injectionModel/injectionModel.H create mode 100644 src/regionModels/surfaceFilmModels/submodels/kinematic/injectionModel/injectionModel/injectionModelNew.C create mode 100644 src/regionModels/surfaceFilmModels/submodels/kinematic/injectionModel/noInjection/noInjection.C create mode 100644 src/regionModels/surfaceFilmModels/submodels/kinematic/injectionModel/noInjection/noInjection.H create mode 100644 src/regionModels/surfaceFilmModels/submodels/kinematic/injectionModel/removeInjection/removeInjection.C create mode 100644 src/regionModels/surfaceFilmModels/submodels/kinematic/injectionModel/removeInjection/removeInjection.H create mode 100644 src/regionModels/surfaceFilmModels/submodels/subModelBase.C create mode 100644 src/regionModels/surfaceFilmModels/submodels/subModelBase.H create mode 100644 src/regionModels/surfaceFilmModels/submodels/subModelBaseI.H create mode 100644 src/regionModels/surfaceFilmModels/submodels/thermo/filmRadiationModel/filmRadiationModel/filmRadiationModel.C create mode 100644 src/regionModels/surfaceFilmModels/submodels/thermo/filmRadiationModel/filmRadiationModel/filmRadiationModel.H create mode 100644 src/regionModels/surfaceFilmModels/submodels/thermo/filmRadiationModel/filmRadiationModel/filmRadiationModelNew.C create mode 100644 src/regionModels/surfaceFilmModels/submodels/thermo/filmRadiationModel/noRadiation/noRadiation.C create mode 100644 src/regionModels/surfaceFilmModels/submodels/thermo/filmRadiationModel/noRadiation/noRadiation.H create mode 100644 src/regionModels/surfaceFilmModels/submodels/thermo/filmRadiationModel/standardRadiation/standardRadiation.C create mode 100644 src/regionModels/surfaceFilmModels/submodels/thermo/filmRadiationModel/standardRadiation/standardRadiation.H create mode 100644 src/regionModels/surfaceFilmModels/submodels/thermo/heatTransferModel/constantHeatTransfer/constantHeatTransfer.C create mode 100644 src/regionModels/surfaceFilmModels/submodels/thermo/heatTransferModel/constantHeatTransfer/constantHeatTransfer.H create mode 100644 src/regionModels/surfaceFilmModels/submodels/thermo/heatTransferModel/heatTransferModel/heatTransferModel.C create mode 100644 src/regionModels/surfaceFilmModels/submodels/thermo/heatTransferModel/heatTransferModel/heatTransferModel.H create mode 100644 src/regionModels/surfaceFilmModels/submodels/thermo/heatTransferModel/heatTransferModel/heatTransferModelNew.C create mode 100644 src/regionModels/surfaceFilmModels/submodels/thermo/heatTransferModel/mappedConvectiveHeatTransfer/mappedConvectiveHeatTransfer.C create mode 100644 src/regionModels/surfaceFilmModels/submodels/thermo/heatTransferModel/mappedConvectiveHeatTransfer/mappedConvectiveHeatTransfer.H create mode 100644 src/regionModels/surfaceFilmModels/submodels/thermo/phaseChangeModel/noPhaseChange/noPhaseChange.C create mode 100644 src/regionModels/surfaceFilmModels/submodels/thermo/phaseChangeModel/noPhaseChange/noPhaseChange.H create mode 100644 src/regionModels/surfaceFilmModels/submodels/thermo/phaseChangeModel/phaseChangeModel/phaseChangeModel.C create mode 100644 src/regionModels/surfaceFilmModels/submodels/thermo/phaseChangeModel/phaseChangeModel/phaseChangeModel.H create mode 100644 src/regionModels/surfaceFilmModels/submodels/thermo/phaseChangeModel/phaseChangeModel/phaseChangeModelNew.C create mode 100644 src/regionModels/surfaceFilmModels/submodels/thermo/phaseChangeModel/standardPhaseChange/standardPhaseChange.C create mode 100644 src/regionModels/surfaceFilmModels/submodels/thermo/phaseChangeModel/standardPhaseChange/standardPhaseChange.H create mode 100644 src/regionModels/surfaceFilmModels/surfaceFilmModel/surfaceFilmModel.C create mode 100644 src/regionModels/surfaceFilmModels/surfaceFilmModel/surfaceFilmModel.H create mode 100644 src/regionModels/surfaceFilmModels/surfaceFilmModel/surfaceFilmModelI.H create mode 100644 src/regionModels/surfaceFilmModels/surfaceFilmModel/surfaceFilmModelNew.C create mode 100644 src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayer.C create mode 100644 src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayer.H create mode 100644 src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayerI.H diff --git a/src/Allwmake b/src/Allwmake index f3c4420474..9070e42da0 100755 --- a/src/Allwmake +++ b/src/Allwmake @@ -58,7 +58,7 @@ wmake libso randomProcesses thermophysicalModels/Allwmake transportModels/Allwmake turbulenceModels/Allwmake -wmake libso surfaceFilmModels +regionModels/Allwmake lagrangian/Allwmake postProcessing/Allwmake mesh/Allwmake diff --git a/src/regionModels/Allwmake b/src/regionModels/Allwmake new file mode 100755 index 0000000000..7713ded586 --- /dev/null +++ b/src/regionModels/Allwmake @@ -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 diff --git a/src/regionModels/regionModel/Make/files b/src/regionModels/regionModel/Make/files new file mode 100644 index 0000000000..e2989ef8fc --- /dev/null +++ b/src/regionModels/regionModel/Make/files @@ -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 diff --git a/src/regionModels/regionModel/Make/options b/src/regionModels/regionModel/Make/options new file mode 100644 index 0000000000..d27c95d033 --- /dev/null +++ b/src/regionModels/regionModel/Make/options @@ -0,0 +1,7 @@ +EXE_INC = \ + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude + +EXE_LIBS = \ + -lfiniteVolume \ + -lmeshTools diff --git a/src/regionModels/regionModel/derivedFvPatchFields/directMappedField/directMappedFieldFvPatchField.C b/src/regionModels/regionModel/derivedFvPatchFields/directMappedField/directMappedFieldFvPatchField.C new file mode 100644 index 0000000000..f9be131628 --- /dev/null +++ b/src/regionModels/regionModel/derivedFvPatchFields/directMappedField/directMappedFieldFvPatchField.C @@ -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 . + +\*---------------------------------------------------------------------------*/ + +#include "directMappedFieldFvPatchField.H" + +#include "volFields.H" +#include "interpolationCell.H" +#include "mapDistribute.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +directMappedFieldFvPatchField::directMappedFieldFvPatchField +( + const fvPatch& p, + const DimensionedField& iF +) +: + directMappedPatchBase(p.patch()), + fixedValueFvPatchField(p, iF), + fieldName_(iF.name()), + setAverage_(false), + average_(pTraits::zero) +{} + + +template +directMappedFieldFvPatchField::directMappedFieldFvPatchField +( + const directMappedFieldFvPatchField& ptf, + const fvPatch& p, + const DimensionedField& iF, + const fvPatchFieldMapper& mapper +) +: + directMappedPatchBase(p.patch(), ptf), + fixedValueFvPatchField(ptf, p, iF, mapper), + fieldName_(ptf.fieldName_), + setAverage_(ptf.setAverage_), + average_(ptf.average_) +{} + + +template +directMappedFieldFvPatchField::directMappedFieldFvPatchField +( + const fvPatch& p, + const DimensionedField& iF, + const dictionary& dict +) +: + directMappedPatchBase(p.patch(), dict), + fixedValueFvPatchField(p, iF, dict), + fieldName_(dict.template lookupOrDefault("fieldName", iF.name())), + setAverage_(readBool(dict.lookup("setAverage"))), + average_(pTraits(dict.lookup("average"))) +{} + + +template +directMappedFieldFvPatchField::directMappedFieldFvPatchField +( + const fvPatch& p, + const DimensionedField& 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(p, iF), + fieldName_(fieldName), + setAverage_(setAverage), + average_(average) +{} + + +template +directMappedFieldFvPatchField::directMappedFieldFvPatchField +( + const directMappedFieldFvPatchField& ptf +) +: + directMappedPatchBase(ptf.patch().patch(), ptf), + fixedValueFvPatchField(ptf), + fieldName_(ptf.fieldName_), + setAverage_(ptf.setAverage_), + average_(ptf.average_) +{} + + +template +directMappedFieldFvPatchField::directMappedFieldFvPatchField +( + const directMappedFieldFvPatchField& ptf, + const DimensionedField& iF +) +: + directMappedPatchBase(ptf.patch().patch(), ptf), + fixedValueFvPatchField(ptf, iF), + fieldName_(ptf.fieldName_), + setAverage_(ptf.setAverage_), + average_(ptf.average_) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +const GeometricField& +directMappedFieldFvPatchField::sampleField() const +{ + typedef GeometricField fieldType; + + const fvMesh& nbrMesh = refCast(sampleMesh()); + + if (sameRegion()) + { + if (fieldName_ == this->dimensionedInternalField().name()) + { + // Optimisation: bypass field lookup + return + dynamic_cast + ( + this->dimensionedInternalField() + ); + } + else + { + const fvMesh& thisMesh = this->patch().boundaryMesh().mesh(); + return thisMesh.template lookupObject(fieldName_); + } + } + else + { + return nbrMesh.template lookupObject(fieldName_); + } +} + + +template +void directMappedFieldFvPatchField::updateCoeffs() +{ + if (this->updated()) + { + return; + } + + typedef GeometricField fieldType; + + const fvMesh& nbrMesh = refCast(sampleMesh()); + const mapDistribute& distMap = directMappedPatchBase::map(); + + // Result of obtaining remote values + Field 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::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 allValues(nbrMesh.nFaces(), pTraits::zero); + + const fieldType& nbrField = sampleField(); + + forAll(nbrField.boundaryField(), patchI) + { + const fvPatchField& 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::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::updateCoeffs(); +} + + +template +void directMappedFieldFvPatchField::write(Ostream& os) const +{ + fvPatchField::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 + +// ************************************************************************* // diff --git a/src/regionModels/regionModel/derivedFvPatchFields/directMappedField/directMappedFieldFvPatchField.H b/src/regionModels/regionModel/derivedFvPatchFields/directMappedField/directMappedFieldFvPatchField.H new file mode 100644 index 0000000000..c11a8e71a9 --- /dev/null +++ b/src/regionModels/regionModel/derivedFvPatchFields/directMappedField/directMappedFieldFvPatchField.H @@ -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 . + +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 directMappedFieldFvPatchField +: + public directMappedPatchBase, + public fixedValueFvPatchField +{ + // 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& sampleField() const; + + +public: + + //- Runtime type information + TypeName("directMappedField"); + + + // Constructors + + //- Construct from patch and internal field + directMappedFieldFvPatchField + ( + const fvPatch&, + const DimensionedField& + ); + + //- Construct from patch, internal field and dictionary + directMappedFieldFvPatchField + ( + const fvPatch&, + const DimensionedField&, + const dictionary& + ); + + //- Construct from patch, internal field and distance for normal type + // sampling + directMappedFieldFvPatchField + ( + const fvPatch&, + const DimensionedField&, + + // 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&, + const fvPatch&, + const DimensionedField&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + directMappedFieldFvPatchField + ( + const directMappedFieldFvPatchField& + ); + + //- Construct and return a clone + virtual tmp > clone() const + { + return tmp > + ( + new directMappedFieldFvPatchField + ( + *this + ) + ); + } + + //- Construct as copy setting internal field reference + directMappedFieldFvPatchField + ( + const directMappedFieldFvPatchField&, + const DimensionedField& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp > clone + ( + const DimensionedField& iF + ) const + { + return tmp > + ( + new directMappedFieldFvPatchField + ( + *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 + +// ************************************************************************* // diff --git a/src/regionModels/regionModel/derivedFvPatchFields/directMappedField/directMappedFieldFvPatchFields.C b/src/regionModels/regionModel/derivedFvPatchFields/directMappedField/directMappedFieldFvPatchFields.C new file mode 100644 index 0000000000..92b3a99576 --- /dev/null +++ b/src/regionModels/regionModel/derivedFvPatchFields/directMappedField/directMappedFieldFvPatchFields.C @@ -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 . + +\*---------------------------------------------------------------------------*/ + +#include "directMappedFieldFvPatchFields.H" +#include "volMesh.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +makePatchFields(directMappedField); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/regionModels/regionModel/derivedFvPatchFields/directMappedField/directMappedFieldFvPatchFields.H b/src/regionModels/regionModel/derivedFvPatchFields/directMappedField/directMappedFieldFvPatchFields.H new file mode 100644 index 0000000000..45517fb557 --- /dev/null +++ b/src/regionModels/regionModel/derivedFvPatchFields/directMappedField/directMappedFieldFvPatchFields.H @@ -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 . + +\*---------------------------------------------------------------------------*/ + +#ifndef directMappedFieldFvPatchFields_H +#define directMappedFieldFvPatchFields_H + +#include "directMappedFieldFvPatchField.H" +#include "fieldTypes.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +makePatchTypeFieldTypedefs(directMappedField) + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/regionModels/regionModel/derivedFvPatchFields/directMappedField/directMappedFieldFvPatchFieldsFwd.H b/src/regionModels/regionModel/derivedFvPatchFields/directMappedField/directMappedFieldFvPatchFieldsFwd.H new file mode 100644 index 0000000000..82b5fe7a14 --- /dev/null +++ b/src/regionModels/regionModel/derivedFvPatchFields/directMappedField/directMappedFieldFvPatchFieldsFwd.H @@ -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 . + +\*---------------------------------------------------------------------------*/ + +#ifndef directMappedFieldFvPatchFieldsFwd_H +#define directMappedFieldFvPatchFieldsFwd_H + +#include "fieldTypes.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +template class directMappedFieldFvPatchField; + +makePatchTypeFieldTypedefs(directMappedField) + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/regionModels/regionModel/derivedFvPatchFields/directMappedFixedInternalValue/directMappedFixedInternalValueFvPatchField.C b/src/regionModels/regionModel/derivedFvPatchFields/directMappedFixedInternalValue/directMappedFixedInternalValueFvPatchField.C new file mode 100644 index 0000000000..ee04c6ff94 --- /dev/null +++ b/src/regionModels/regionModel/derivedFvPatchFields/directMappedFixedInternalValue/directMappedFixedInternalValueFvPatchField.C @@ -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 +Foam::directMappedFixedInternalValueFvPatchField:: +directMappedFixedInternalValueFvPatchField +( + const fvPatch& p, + const DimensionedField& iF +) +: + directMappedFixedValueFvPatchField(p, iF) +{} + + +template +Foam::directMappedFixedInternalValueFvPatchField:: +directMappedFixedInternalValueFvPatchField +( + const directMappedFixedInternalValueFvPatchField& ptf, + const fvPatch& p, + const DimensionedField& iF, + const fvPatchFieldMapper& mapper +) +: + directMappedFixedValueFvPatchField(ptf, p, iF, mapper) +{} + + +template +Foam::directMappedFixedInternalValueFvPatchField:: +directMappedFixedInternalValueFvPatchField +( + const fvPatch& p, + const DimensionedField& iF, + const dictionary& dict +) +: + directMappedFixedValueFvPatchField(p, iF, dict) +{} + + +template +Foam::directMappedFixedInternalValueFvPatchField:: +directMappedFixedInternalValueFvPatchField +( + const directMappedFixedInternalValueFvPatchField& ptf +) +: + directMappedFixedValueFvPatchField(ptf) +{} + + +template +Foam::directMappedFixedInternalValueFvPatchField:: +directMappedFixedInternalValueFvPatchField +( + const directMappedFixedInternalValueFvPatchField& ptf, + const DimensionedField& iF +) +: + directMappedFixedValueFvPatchField(ptf, iF) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +void Foam::directMappedFixedInternalValueFvPatchField::updateCoeffs() +{ + typedef GeometricField FieldType; + + if (this->updated()) + { + return; + } + + // Retrieve the neighbour values and assign to this patch boundary field + directMappedFixedValueFvPatchField::updateCoeffs(); + + // Get the coupling information from the directMappedPatchBase + const directMappedPatchBase& mpp = + refCast(this->patch().patch()); + const polyMesh& nbrMesh = mpp.sampleMesh(); + const fvPatch& nbrPatch = + refCast + ( + nbrMesh + ).boundary()[mpp.samplePolyPatch().index()]; + + // Force recalculation of mapping and schedule + const mapDistribute& distMap = mpp.map(); + + // Retrieve the neighbour field + const fvPatchField& nbrField = + nbrPatch.template lookupPatchField + ( + this->dimensionedInternalField().name() + ); + + // Retrieve the neighbour patch internal field + Field 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& intFld = const_cast&>(this->internalField()); + UIndirectList(intFld, this->patch().faceCells()) = nbrIntFld; +} + + +template +void Foam::directMappedFixedInternalValueFvPatchField::write +( + Ostream& os +) const +{ + directMappedFixedValueFvPatchField::write(os); +} + + +// ************************************************************************* // diff --git a/src/regionModels/regionModel/derivedFvPatchFields/directMappedFixedInternalValue/directMappedFixedInternalValueFvPatchField.H b/src/regionModels/regionModel/derivedFvPatchFields/directMappedFixedInternalValue/directMappedFixedInternalValueFvPatchField.H new file mode 100644 index 0000000000..bdc887e185 --- /dev/null +++ b/src/regionModels/regionModel/derivedFvPatchFields/directMappedFixedInternalValue/directMappedFixedInternalValueFvPatchField.H @@ -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 directMappedFixedInternalValueFvPatchField +: + public directMappedFixedValueFvPatchField +{ + +public: + + //- Runtime type information + TypeName("directMappedFixedInternalValue"); + + + // Constructors + + //- Construct from patch and internal field + directMappedFixedInternalValueFvPatchField + ( + const fvPatch&, + const DimensionedField& + ); + + //- Construct from patch, internal field and dictionary + directMappedFixedInternalValueFvPatchField + ( + const fvPatch&, + const DimensionedField&, + const dictionary& + ); + + //- Construct by mapping given + // directMappedFixedInternalValueFvPatchField onto a new patch + directMappedFixedInternalValueFvPatchField + ( + const directMappedFixedInternalValueFvPatchField&, + const fvPatch&, + const DimensionedField&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + directMappedFixedInternalValueFvPatchField + ( + const directMappedFixedInternalValueFvPatchField& + ); + + //- Construct and return a clone + virtual tmp > clone() const + { + return tmp > + ( + new directMappedFixedInternalValueFvPatchField(*this) + ); + } + + //- Construct as copy setting internal field reference + directMappedFixedInternalValueFvPatchField + ( + const directMappedFixedInternalValueFvPatchField&, + const DimensionedField& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp > clone + ( + const DimensionedField& iF + ) const + { + return tmp > + ( + new directMappedFixedInternalValueFvPatchField(*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 + +// ************************************************************************* // diff --git a/src/regionModels/regionModel/derivedFvPatchFields/directMappedFixedInternalValue/directMappedFixedInternalValueFvPatchFields.C b/src/regionModels/regionModel/derivedFvPatchFields/directMappedFixedInternalValue/directMappedFixedInternalValueFvPatchFields.C new file mode 100644 index 0000000000..e43d668c37 --- /dev/null +++ b/src/regionModels/regionModel/derivedFvPatchFields/directMappedFixedInternalValue/directMappedFixedInternalValueFvPatchFields.C @@ -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 + +// ************************************************************************* // diff --git a/src/regionModels/regionModel/derivedFvPatchFields/directMappedFixedInternalValue/directMappedFixedInternalValueFvPatchFields.H b/src/regionModels/regionModel/derivedFvPatchFields/directMappedFixedInternalValue/directMappedFixedInternalValueFvPatchFields.H new file mode 100644 index 0000000000..199df76640 --- /dev/null +++ b/src/regionModels/regionModel/derivedFvPatchFields/directMappedFixedInternalValue/directMappedFixedInternalValueFvPatchFields.H @@ -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 + +// ************************************************************************* // diff --git a/src/regionModels/regionModel/derivedFvPatchFields/directMappedFixedInternalValue/directMappedFixedInternalValueFvPatchFieldsFwd.H b/src/regionModels/regionModel/derivedFvPatchFields/directMappedFixedInternalValue/directMappedFixedInternalValueFvPatchFieldsFwd.H new file mode 100644 index 0000000000..6433bf0606 --- /dev/null +++ b/src/regionModels/regionModel/derivedFvPatchFields/directMappedFixedInternalValue/directMappedFixedInternalValueFvPatchFieldsFwd.H @@ -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 directMappedFixedInternalValueFvPatchField; + +makePatchTypeFieldTypedefs(directMappedFixedInternalValue) + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/regionModels/regionModel/derivedFvPatchFields/directMappedFixedPushedInternalValue/directMappedFixedPushedInternalValueFvPatchField.C b/src/regionModels/regionModel/derivedFvPatchFields/directMappedFixedPushedInternalValue/directMappedFixedPushedInternalValueFvPatchField.C new file mode 100644 index 0000000000..b3eacffa08 --- /dev/null +++ b/src/regionModels/regionModel/derivedFvPatchFields/directMappedFixedPushedInternalValue/directMappedFixedPushedInternalValueFvPatchField.C @@ -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 +Foam::directMappedFixedPushedInternalValueFvPatchField:: +directMappedFixedPushedInternalValueFvPatchField +( + const fvPatch& p, + const DimensionedField& iF +) +: + directMappedFixedValueFvPatchField(p, iF) +{} + + +template +Foam::directMappedFixedPushedInternalValueFvPatchField:: +directMappedFixedPushedInternalValueFvPatchField +( + const directMappedFixedPushedInternalValueFvPatchField& ptf, + const fvPatch& p, + const DimensionedField& iF, + const fvPatchFieldMapper& mapper +) +: + directMappedFixedValueFvPatchField(ptf, p, iF, mapper) +{} + + +template +Foam::directMappedFixedPushedInternalValueFvPatchField:: +directMappedFixedPushedInternalValueFvPatchField +( + const fvPatch& p, + const DimensionedField& iF, + const dictionary& dict +) +: + directMappedFixedValueFvPatchField(p, iF, dict) +{} + + +template +Foam::directMappedFixedPushedInternalValueFvPatchField:: +directMappedFixedPushedInternalValueFvPatchField +( + const directMappedFixedPushedInternalValueFvPatchField& ptf +) +: + directMappedFixedValueFvPatchField(ptf) +{} + + +template +Foam::directMappedFixedPushedInternalValueFvPatchField:: +directMappedFixedPushedInternalValueFvPatchField +( + const directMappedFixedPushedInternalValueFvPatchField& ptf, + const DimensionedField& iF +) +: + directMappedFixedValueFvPatchField(ptf, iF) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +void +Foam::directMappedFixedPushedInternalValueFvPatchField::updateCoeffs() +{ + typedef GeometricField FieldType; + + if (this->updated()) + { + return; + } + + // Retrieve the neighbour values and assign to this patch boundary field + directMappedFixedValueFvPatchField::updateCoeffs(); + + // Assign the patch internal field to its boundary value + Field& intFld = const_cast&>(this->internalField()); + UIndirectList(intFld, this->patch().faceCells()) = *this; +} + + +template +void Foam::directMappedFixedPushedInternalValueFvPatchField::write +( + Ostream& os +) const +{ + directMappedFixedValueFvPatchField::write(os); +} + + +// ************************************************************************* // diff --git a/src/regionModels/regionModel/derivedFvPatchFields/directMappedFixedPushedInternalValue/directMappedFixedPushedInternalValueFvPatchField.H b/src/regionModels/regionModel/derivedFvPatchFields/directMappedFixedPushedInternalValue/directMappedFixedPushedInternalValueFvPatchField.H new file mode 100644 index 0000000000..1b8ff45c44 --- /dev/null +++ b/src/regionModels/regionModel/derivedFvPatchFields/directMappedFixedPushedInternalValue/directMappedFixedPushedInternalValueFvPatchField.H @@ -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 directMappedFixedPushedInternalValueFvPatchField +: + public directMappedFixedValueFvPatchField +{ + +public: + + //- Runtime type information + TypeName("directMappedFixedPushedInternalValue"); + + + // Constructors + + //- Construct from patch and internal field + directMappedFixedPushedInternalValueFvPatchField + ( + const fvPatch&, + const DimensionedField& + ); + + //- Construct from patch, internal field and dictionary + directMappedFixedPushedInternalValueFvPatchField + ( + const fvPatch&, + const DimensionedField&, + const dictionary& + ); + + //- Construct by mapping given a + // directMappedFixedPushedInternalValueFvPatchField onto a new patch + directMappedFixedPushedInternalValueFvPatchField + ( + const directMappedFixedPushedInternalValueFvPatchField&, + const fvPatch&, + const DimensionedField&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + directMappedFixedPushedInternalValueFvPatchField + ( + const directMappedFixedPushedInternalValueFvPatchField& + ); + + //- Construct and return a clone + virtual tmp > clone() const + { + return tmp > + ( + new directMappedFixedPushedInternalValueFvPatchField + ( + *this + ) + ); + } + + //- Construct as copy setting internal field reference + directMappedFixedPushedInternalValueFvPatchField + ( + const directMappedFixedPushedInternalValueFvPatchField&, + const DimensionedField& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp > clone + ( + const DimensionedField& iF + ) const + { + return tmp > + ( + new directMappedFixedPushedInternalValueFvPatchField + ( + *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 + +// ************************************************************************* // diff --git a/src/regionModels/regionModel/derivedFvPatchFields/directMappedFixedPushedInternalValue/directMappedFixedPushedInternalValueFvPatchFields.C b/src/regionModels/regionModel/derivedFvPatchFields/directMappedFixedPushedInternalValue/directMappedFixedPushedInternalValueFvPatchFields.C new file mode 100644 index 0000000000..ba56536a60 --- /dev/null +++ b/src/regionModels/regionModel/derivedFvPatchFields/directMappedFixedPushedInternalValue/directMappedFixedPushedInternalValueFvPatchFields.C @@ -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 + +// ************************************************************************* // diff --git a/src/regionModels/regionModel/derivedFvPatchFields/directMappedFixedPushedInternalValue/directMappedFixedPushedInternalValueFvPatchFields.H b/src/regionModels/regionModel/derivedFvPatchFields/directMappedFixedPushedInternalValue/directMappedFixedPushedInternalValueFvPatchFields.H new file mode 100644 index 0000000000..e333000ed0 --- /dev/null +++ b/src/regionModels/regionModel/derivedFvPatchFields/directMappedFixedPushedInternalValue/directMappedFixedPushedInternalValueFvPatchFields.H @@ -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 + +// ************************************************************************* // diff --git a/src/regionModels/regionModel/derivedFvPatchFields/directMappedFixedPushedInternalValue/directMappedFixedPushedInternalValueFvPatchFieldsFwd.H b/src/regionModels/regionModel/derivedFvPatchFields/directMappedFixedPushedInternalValue/directMappedFixedPushedInternalValueFvPatchFieldsFwd.H new file mode 100644 index 0000000000..9c1e26a315 --- /dev/null +++ b/src/regionModels/regionModel/derivedFvPatchFields/directMappedFixedPushedInternalValue/directMappedFixedPushedInternalValueFvPatchFieldsFwd.H @@ -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 directMappedFixedPushedInternalValueFvPatchField; + +makePatchTypeFieldTypedefs(directMappedFixedInternalValue) + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/regionModels/regionModel/derivedFvPatchFields/directMappedNamedFixedValue/directMappedNamedFixedValueFvPatchField.C b/src/regionModels/regionModel/derivedFvPatchFields/directMappedNamedFixedValue/directMappedNamedFixedValueFvPatchField.C new file mode 100644 index 0000000000..edbd419b83 --- /dev/null +++ b/src/regionModels/regionModel/derivedFvPatchFields/directMappedNamedFixedValue/directMappedNamedFixedValueFvPatchField.C @@ -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 +directMappedNamedFixedValueFvPatchField:: +directMappedNamedFixedValueFvPatchField +( + const fvPatch& p, + const DimensionedField& iF +) +: + fixedValueFvPatchField(p, iF), + fieldName_(iF.name()), + setAverage_(false), + average_(pTraits::zero) +{} + + +template +directMappedNamedFixedValueFvPatchField:: +directMappedNamedFixedValueFvPatchField +( + const directMappedNamedFixedValueFvPatchField& ptf, + const fvPatch& p, + const DimensionedField& iF, + const fvPatchFieldMapper& mapper +) +: + fixedValueFvPatchField(ptf, p, iF, mapper), + fieldName_(ptf.fieldName_), + setAverage_(ptf.setAverage_), + average_(ptf.average_) +{ + if (!isA(this->patch().patch())) + { + FatalErrorIn + ( + "directMappedNamedFixedValueFvPatchField::" + "directMappedNamedFixedValueFvPatchField\n" + "(\n" + " const directMappedNamedFixedValueFvPatchField&,\n" + " const fvPatch&,\n" + " const Field&,\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 +directMappedNamedFixedValueFvPatchField:: +directMappedNamedFixedValueFvPatchField +( + const fvPatch& p, + const DimensionedField& iF, + const dictionary& dict +) +: + fixedValueFvPatchField(p, iF, dict), + fieldName_(dict.lookupOrDefault("fieldName", iF.name())), + setAverage_(readBool(dict.lookup("setAverage"))), + average_(pTraits(dict.lookup("average"))) +{ + if (!isA(this->patch().patch())) + { + FatalErrorIn + ( + "directMappedNamedFixedValueFvPatchField::" + "directMappedNamedFixedValueFvPatchField" + "(" + " const fvPatch&, " + " const DimensionedField& 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 + //( + // this->patch().patch() + //); + //(void)mpp.map().schedule(); +} + + +template +directMappedNamedFixedValueFvPatchField:: +directMappedNamedFixedValueFvPatchField +( + const directMappedNamedFixedValueFvPatchField& ptf +) +: + fixedValueFvPatchField(ptf), + fieldName_(ptf.fieldName_), + setAverage_(ptf.setAverage_), + average_(ptf.average_) +{} + + +template +directMappedNamedFixedValueFvPatchField:: +directMappedNamedFixedValueFvPatchField +( + const directMappedNamedFixedValueFvPatchField& ptf, + const DimensionedField& iF +) +: + fixedValueFvPatchField(ptf, iF), + fieldName_(ptf.fieldName_), + setAverage_(ptf.setAverage_), + average_(ptf.average_) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +void directMappedNamedFixedValueFvPatchField::updateCoeffs() +{ + if (this->updated()) + { + return; + } + + typedef GeometricField fieldType; + + // Get the scheduling information from the directMappedPatchBase + const directMappedPatchBase& mpp = refCast + ( + directMappedNamedFixedValueFvPatchField::patch().patch() + ); + const mapDistribute& distMap = mpp.map(); + + // Force recalculation of schedule + (void)distMap.schedule(); + + const fvMesh& nbrMesh = refCast(mpp.sampleMesh()); + + // Result of obtaining remote values + Field newValues; + + switch (mpp.mode()) + { + case directMappedPatchBase::NEARESTCELL: + { + if (mpp.sameRegion()) + { + newValues = this->internalField(); + } + else + { + newValues = nbrMesh.lookupObject + ( + 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::" + "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(fieldName_); + newValues = nbrField.boundaryField()[nbrPatchID]; + mapDistribute::distribute + ( + Pstream::defaultCommsType, + distMap.schedule(), + distMap.constructSize(), + distMap.subMap(), + distMap.constructMap(), + newValues + ); + + break; + } + case directMappedPatchBase::NEARESTFACE: + { + Field allValues(nbrMesh.nFaces(), pTraits::zero); + + const fieldType& nbrField = + nbrMesh.lookupObject(fieldName_); + forAll(nbrField.boundaryField(), patchI) + { + const fvPatchField& 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::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::updateCoeffs(); +} + + +template +void directMappedNamedFixedValueFvPatchField::write(Ostream& os) const +{ + fvPatchField::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 + +// ************************************************************************* // diff --git a/src/regionModels/regionModel/derivedFvPatchFields/directMappedNamedFixedValue/directMappedNamedFixedValueFvPatchField.H b/src/regionModels/regionModel/derivedFvPatchFields/directMappedNamedFixedValue/directMappedNamedFixedValueFvPatchField.H new file mode 100644 index 0000000000..248c6690ff --- /dev/null +++ b/src/regionModels/regionModel/derivedFvPatchFields/directMappedNamedFixedValue/directMappedNamedFixedValueFvPatchField.H @@ -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 directMappedNamedFixedValueFvPatchField +: + public fixedValueFvPatchField +{ + // 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& + ); + + //- Construct from patch, internal field and dictionary + directMappedNamedFixedValueFvPatchField + ( + const fvPatch&, + const DimensionedField&, + const dictionary& + ); + + //- Construct by mapping given directMappedNamedFixedValueFvPatchField + // onto a new patch + directMappedNamedFixedValueFvPatchField + ( + const directMappedNamedFixedValueFvPatchField&, + const fvPatch&, + const DimensionedField&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + directMappedNamedFixedValueFvPatchField + ( + const directMappedNamedFixedValueFvPatchField& + ); + + //- Construct and return a clone + virtual tmp > clone() const + { + return tmp > + ( + new directMappedNamedFixedValueFvPatchField(*this) + ); + } + + //- Construct as copy setting internal field reference + directMappedNamedFixedValueFvPatchField + ( + const directMappedNamedFixedValueFvPatchField&, + const DimensionedField& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp > clone + ( + const DimensionedField& iF + ) const + { + return tmp > + ( + new directMappedNamedFixedValueFvPatchField(*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 + +// ************************************************************************* // diff --git a/src/regionModels/regionModel/derivedFvPatchFields/directMappedNamedFixedValue/directMappedNamedFixedValueFvPatchFields.C b/src/regionModels/regionModel/derivedFvPatchFields/directMappedNamedFixedValue/directMappedNamedFixedValueFvPatchFields.C new file mode 100644 index 0000000000..5725af6d74 --- /dev/null +++ b/src/regionModels/regionModel/derivedFvPatchFields/directMappedNamedFixedValue/directMappedNamedFixedValueFvPatchFields.C @@ -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 + +// ************************************************************************* // diff --git a/src/regionModels/regionModel/derivedFvPatchFields/directMappedNamedFixedValue/directMappedNamedFixedValueFvPatchFields.H b/src/regionModels/regionModel/derivedFvPatchFields/directMappedNamedFixedValue/directMappedNamedFixedValueFvPatchFields.H new file mode 100644 index 0000000000..cd61e50493 --- /dev/null +++ b/src/regionModels/regionModel/derivedFvPatchFields/directMappedNamedFixedValue/directMappedNamedFixedValueFvPatchFields.H @@ -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 + +// ************************************************************************* // diff --git a/src/regionModels/regionModel/derivedFvPatchFields/directMappedNamedFixedValue/directMappedNamedFixedValueFvPatchFieldsFwd.H b/src/regionModels/regionModel/derivedFvPatchFields/directMappedNamedFixedValue/directMappedNamedFixedValueFvPatchFieldsFwd.H new file mode 100644 index 0000000000..75e3046e24 --- /dev/null +++ b/src/regionModels/regionModel/derivedFvPatchFields/directMappedNamedFixedValue/directMappedNamedFixedValueFvPatchFieldsFwd.H @@ -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 directMappedNamedFixedValueFvPatchField; + +makePatchTypeFieldTypedefs(directMappedNamedFixedValue) + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/regionModels/regionModel/derivedFvPatchFields/directMappedNamedFixedValue/directMappedNamesFixedValueFvPatchFieldsFwd.H b/src/regionModels/regionModel/derivedFvPatchFields/directMappedNamedFixedValue/directMappedNamesFixedValueFvPatchFieldsFwd.H new file mode 100644 index 0000000000..75e3046e24 --- /dev/null +++ b/src/regionModels/regionModel/derivedFvPatchFields/directMappedNamedFixedValue/directMappedNamesFixedValueFvPatchFieldsFwd.H @@ -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 directMappedNamedFixedValueFvPatchField; + +makePatchTypeFieldTypedefs(directMappedNamedFixedValue) + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/regionModels/regionModel/derivedFvPatchFields/filmMappedFixedInternalValue/regionMappedFixedInternalValueFvPatchField.C b/src/regionModels/regionModel/derivedFvPatchFields/filmMappedFixedInternalValue/regionMappedFixedInternalValueFvPatchField.C new file mode 100644 index 0000000000..733e156862 --- /dev/null +++ b/src/regionModels/regionModel/derivedFvPatchFields/filmMappedFixedInternalValue/regionMappedFixedInternalValueFvPatchField.C @@ -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 +Foam::regionMappedFixedInternalValueFvPatchField:: +regionMappedFixedInternalValueFvPatchField +( + const fvPatch& p, + const DimensionedField& iF +) +: + fixedValueFvPatchField(p, iF) +{} + + +template +Foam::regionMappedFixedInternalValueFvPatchField:: +regionMappedFixedInternalValueFvPatchField +( + const regionMappedFixedInternalValueFvPatchField& ptf, + const fvPatch& p, + const DimensionedField& iF, + const fvPatchFieldMapper& mapper +) +: + fixedValueFvPatchField(ptf, p, iF, mapper) +{} + + +template +Foam::regionMappedFixedInternalValueFvPatchField:: +regionMappedFixedInternalValueFvPatchField +( + const fvPatch& p, + const DimensionedField& iF, + const dictionary& dict +) +: + fixedValueFvPatchField(p, iF, dict) +{} + + +template +Foam::regionMappedFixedInternalValueFvPatchField:: +regionMappedFixedInternalValueFvPatchField +( + const regionMappedFixedInternalValueFvPatchField& ptf +) +: + fixedValueFvPatchField(ptf) +{} + + +template +Foam::regionMappedFixedInternalValueFvPatchField:: +regionMappedFixedInternalValueFvPatchField +( + const regionMappedFixedInternalValueFvPatchField& ptf, + const DimensionedField& iF +) +: + fixedValueFvPatchField(ptf, iF) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +void Foam::regionMappedFixedInternalValueFvPatchField::updateCoeffs() +{ + typedef GeometricField FieldType; + + if (this->updated()) + { + return; + } + + const regionModels::regionModel& region = + this->db.lookupObject + ( + "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(nbrMesh).boundary()[samplePatchI]; + + + // Retrieve the neighbour field + Field nbrField = + nbrPatch.lookupPatchField(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 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& intField = const_cast&>(this->internalField()); + UIndirectList(intFld, this->patch().faceCells()) = nbrIntField; + + fixedValueFvPatchField::updateCoeffs(); +} + + +template +void Foam::regionMappedFixedInternalValueFvPatchField::write +( + Ostream& os +) const +{ + fixedValueFvPatchField::write(os); +} + + +// ************************************************************************* // diff --git a/src/regionModels/regionModel/derivedFvPatchFields/filmMappedFixedInternalValue/regionMappedFixedInternalValueFvPatchField.H b/src/regionModels/regionModel/derivedFvPatchFields/filmMappedFixedInternalValue/regionMappedFixedInternalValueFvPatchField.H new file mode 100644 index 0000000000..b9d149f88d --- /dev/null +++ b/src/regionModels/regionModel/derivedFvPatchFields/filmMappedFixedInternalValue/regionMappedFixedInternalValueFvPatchField.H @@ -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 regionMappedFixedInternalValueFvPatchField +: + public fixedValueFvPatchField +{ + +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& + ); + + //- Construct from patch, internal field and dictionary + regionMappedFixedInternalValueFvPatchField + ( + const fvPatch&, + const DimensionedField&, + const dictionary& + ); + + //- Construct by mapping given + // regionMappedFixedInternalValueFvPatchField onto a new patch + regionMappedFixedInternalValueFvPatchField + ( + const regionMappedFixedInternalValueFvPatchField&, + const fvPatch&, + const DimensionedField&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + regionMappedFixedInternalValueFvPatchField + ( + const regionMappedFixedInternalValueFvPatchField& + ); + + //- Construct and return a clone + virtual tmp > clone() const + { + return tmp > + ( + new regionMappedFixedInternalValueFvPatchField(*this) + ); + } + + //- Construct as copy setting internal field reference + regionMappedFixedInternalValueFvPatchField + ( + const regionMappedFixedInternalValueFvPatchField&, + const DimensionedField& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp > clone + ( + const DimensionedField& iF + ) const + { + return tmp > + ( + new regionMappedFixedInternalValueFvPatchField(*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 + +// ************************************************************************* // diff --git a/src/regionModels/regionModel/derivedFvPatchFields/filmMappedFixedInternalValue/regionMappedFixedInternalValueFvPatchFields.C b/src/regionModels/regionModel/derivedFvPatchFields/filmMappedFixedInternalValue/regionMappedFixedInternalValueFvPatchFields.C new file mode 100644 index 0000000000..b4d84e85e5 --- /dev/null +++ b/src/regionModels/regionModel/derivedFvPatchFields/filmMappedFixedInternalValue/regionMappedFixedInternalValueFvPatchFields.C @@ -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 + +// ************************************************************************* // diff --git a/src/regionModels/regionModel/derivedFvPatchFields/filmMappedFixedInternalValue/regionMappedFixedInternalValueFvPatchFields.H b/src/regionModels/regionModel/derivedFvPatchFields/filmMappedFixedInternalValue/regionMappedFixedInternalValueFvPatchFields.H new file mode 100644 index 0000000000..e19b9722e8 --- /dev/null +++ b/src/regionModels/regionModel/derivedFvPatchFields/filmMappedFixedInternalValue/regionMappedFixedInternalValueFvPatchFields.H @@ -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 + +// ************************************************************************* // diff --git a/src/regionModels/regionModel/derivedFvPatchFields/filmMappedFixedInternalValue/regionMappedFixedInternalValueFvPatchFieldsFwd.H b/src/regionModels/regionModel/derivedFvPatchFields/filmMappedFixedInternalValue/regionMappedFixedInternalValueFvPatchFieldsFwd.H new file mode 100644 index 0000000000..ce18b9e158 --- /dev/null +++ b/src/regionModels/regionModel/derivedFvPatchFields/filmMappedFixedInternalValue/regionMappedFixedInternalValueFvPatchFieldsFwd.H @@ -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 regionMappedFixedInternalValueFvPatchField; + +makePatchTypeFieldTypedefs(directMappedFixedInternalValue) + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/regionModels/regionModel/regionModel/regionModel.C b/src/regionModels/regionModel/regionModel/regionModel.C new file mode 100644 index 0000000000..8a62195de3 --- /dev/null +++ b/src/regionModels/regionModel/regionModel/regionModel.C @@ -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