diff --git a/applications/utilities/postProcessing/miscellaneous/execFlowFunctionObjects/execFlowFunctionObjects.C b/applications/utilities/postProcessing/miscellaneous/execFlowFunctionObjects/execFlowFunctionObjects.C index 3fede4ab66..8985861582 100644 --- a/applications/utilities/postProcessing/miscellaneous/execFlowFunctionObjects/execFlowFunctionObjects.C +++ b/applications/utilities/postProcessing/miscellaneous/execFlowFunctionObjects/execFlowFunctionObjects.C @@ -27,6 +27,7 @@ Global Description Execute the set of functionObjects specified in the selected dictionary (which defaults to system/controlDict) for the selected set of times. + Alternative dictionaries should be placed in the system/ folder. The flow (p-U) and optionally turbulence fields are available for the function objects to operate on allowing forces and other related properties @@ -144,12 +145,12 @@ void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh) false ); - singlePhaseTransportModel laminarTransport(U, phi); - if (RASPropertiesHeader.headerOk()) { IOdictionary RASProperties(RASPropertiesHeader); + singlePhaseTransportModel laminarTransport(U, phi); + autoPtr RASModel ( incompressible::RASModel::New @@ -165,6 +166,8 @@ void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh) { IOdictionary LESProperties(LESPropertiesHeader); + singlePhaseTransportModel laminarTransport(U, phi); + autoPtr sgsModel ( incompressible::LESModel::New(U, phi, laminarTransport) diff --git a/applications/utilities/postProcessing/sampling/sample/sampleDict b/applications/utilities/postProcessing/sampling/sample/sampleDict index c69f609c39..e892508a92 100644 --- a/applications/utilities/postProcessing/sampling/sample/sampleDict +++ b/applications/utilities/postProcessing/sampling/sample/sampleDict @@ -60,7 +60,7 @@ fields // midPoint one point per cell, inbetween two face intersections // midPointAndFace combination of face and midPoint // -// curve specified points, not nessecary on line, uses +// polyLine specified points, not nessecary on line, uses // tracking // cloud specified points, uses findCell // triSurfaceMeshPointSet points of triSurface @@ -75,7 +75,7 @@ fields // type specific: // uniform, face, midPoint, midPointAndFace : start and end coordinate // uniform: extra number of sampling points -// curve, cloud: list of coordinates +// polyLine, cloud: list of coordinates sets ( lineX1 diff --git a/src/OpenFOAM/db/functionObjects/IOOutputFilter/IOOutputFilter.H b/src/OpenFOAM/db/functionObjects/IOOutputFilter/IOOutputFilter.H index d0eb49303e..b4e35c43a0 100644 --- a/src/OpenFOAM/db/functionObjects/IOOutputFilter/IOOutputFilter.H +++ b/src/OpenFOAM/db/functionObjects/IOOutputFilter/IOOutputFilter.H @@ -107,7 +107,7 @@ public: return IOdictionary::name(); } - //- Read the probes + //- Read output filter properties virtual bool read(); //- Sample and write diff --git a/src/OpenFOAM/db/functionObjects/functionObject/functionObject.H b/src/OpenFOAM/db/functionObjects/functionObject/functionObject.H index 4fa7404da5..8f4baa22b8 100644 --- a/src/OpenFOAM/db/functionObjects/functionObject/functionObject.H +++ b/src/OpenFOAM/db/functionObjects/functionObject/functionObject.H @@ -51,7 +51,7 @@ namespace Foam class Time; /*---------------------------------------------------------------------------*\ - Class functionObject Declaration + Class functionObject Declaration \*---------------------------------------------------------------------------*/ class functionObject diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeInjection/ConeInjection.C b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeInjection/ConeInjection.C index 4dc98e9dea..2230e01e65 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeInjection/ConeInjection.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeInjection/ConeInjection.C @@ -58,7 +58,7 @@ Foam::scalar Foam::ConeInjection::volumeToInject { if ((time0 >= 0.0) && (time0 < duration_)) { - return volumeFlowRate_().integrate(time0, time1); + return flowRateProfile_().integrate(time0, time1); } else { @@ -85,11 +85,11 @@ Foam::ConeInjection::ConeInjection ( readScalar(this->coeffDict().lookup("parcelsPerSecond")) ), - volumeFlowRate_ + flowRateProfile_ ( DataEntry::New ( - "volumeFlowRate", + "flowRateProfile", this->coeffDict() ) ), @@ -147,7 +147,7 @@ Foam::ConeInjection::ConeInjection tanVec2_ = direction_^tanVec1_; // Set total volume to inject - this->volumeTotal_ = volumeFlowRate_().integrate(0.0, duration_); + this->volumeTotal_ = flowRateProfile_().integrate(0.0, duration_); // Set/cache the injector cell this->findCellAtPosition(injectorCell_, position_); diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeInjection/ConeInjection.H b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeInjection/ConeInjection.H index 80e333040f..006159ec20 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeInjection/ConeInjection.H +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeInjection/ConeInjection.H @@ -83,8 +83,8 @@ class ConeInjection //- Number of parcels to introduce per second [] const label parcelsPerSecond_; - //- Volume flow rate of parcels to introduce relative to SOI [m^3] - const autoPtr > volumeFlowRate_; + //- Flow rate profile relative to SOI [] + const autoPtr > flowRateProfile_; //- Parcel velocity magnitude relative to SOI [m/s] const autoPtr > Umag_; diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeInjectionMP/ConeInjectionMP.C b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeInjectionMP/ConeInjectionMP.C index 9b2c87ad35..802d624047 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeInjectionMP/ConeInjectionMP.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeInjectionMP/ConeInjectionMP.C @@ -40,7 +40,7 @@ Foam::label Foam::ConeInjectionMP::parcelsToInject { if ((time0 >= 0.0) && (time0 < duration_)) { - const scalar targetVolume = volumeFlowRate_().integrate(0, time1); + const scalar targetVolume = flowRateProfile_().integrate(0, time1); const label targetParcels = parcelsPerInjector_*targetVolume/this->volumeTotal_; @@ -67,7 +67,7 @@ Foam::scalar Foam::ConeInjectionMP::volumeToInject { if ((time0 >= 0.0) && (time0 < duration_)) { - return volumeFlowRate_().integrate(time0, time1); + return flowRateProfile_().integrate(time0, time1); } else { @@ -116,11 +116,11 @@ Foam::ConeInjectionMP::ConeInjectionMP ( readScalar(this->coeffDict().lookup("parcelsPerInjector")) ), - volumeFlowRate_ + flowRateProfile_ ( DataEntry::New ( - "volumeFlowRate", + "flowRateProfile", this->coeffDict() ) ), @@ -182,7 +182,7 @@ Foam::ConeInjectionMP::ConeInjectionMP } // Set total volume to inject - this->volumeTotal_ = volumeFlowRate_().integrate(0.0, duration_); + this->volumeTotal_ = flowRateProfile_().integrate(0.0, duration_); // Set/cache the injector cells forAll(positions_, i) diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeInjectionMP/ConeInjectionMP.H b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeInjectionMP/ConeInjectionMP.H index 81cecda980..451ed6d1cb 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeInjectionMP/ConeInjectionMP.H +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeInjectionMP/ConeInjectionMP.H @@ -90,8 +90,8 @@ class ConeInjectionMP //- Number of parcels to introduce per injector const label parcelsPerInjector_; - //- Volume flow rate of parcels to introduce relative to SOI [m^3] - const autoPtr > volumeFlowRate_; + //- Flow rate profile relative to SOI [] + const autoPtr > flowRateProfile_; //- Parcel velocity magnitude relative to SOI [m/s] const autoPtr > Umag_; diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/PatchInjection/PatchInjection.C b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/PatchInjection/PatchInjection.C index 048179a30a..661c7e566f 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/PatchInjection/PatchInjection.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/PatchInjection/PatchInjection.C @@ -56,7 +56,7 @@ Foam::scalar Foam::PatchInjection::volumeToInject { if ((time0 >= 0.0) && (time0 < duration_)) { - return fraction_*volumeFlowRate_().integrate(time0, time1); + return fraction_*flowRateProfile_().integrate(time0, time1); } else { @@ -82,11 +82,11 @@ Foam::PatchInjection::PatchInjection readScalar(this->coeffDict().lookup("parcelsPerSecond")) ), U0_(this->coeffDict().lookup("U0")), - volumeFlowRate_ + flowRateProfile_ ( DataEntry::New ( - "volumeFlowRate", + "flowRateProfile", this->coeffDict() ) ), @@ -127,7 +127,7 @@ Foam::PatchInjection::PatchInjection fraction_ = scalar(patchSize)/totalPatchSize; // Set total volume/mass to inject - this->volumeTotal_ = fraction_*volumeFlowRate_().integrate(0.0, duration_); + this->volumeTotal_ = fraction_*flowRateProfile_().integrate(0.0, duration_); this->massTotal_ *= fraction_; } diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/PatchInjection/PatchInjection.H b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/PatchInjection/PatchInjection.H index 88ae42801c..fc6c8d86cb 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/PatchInjection/PatchInjection.H +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/PatchInjection/PatchInjection.H @@ -79,8 +79,8 @@ class PatchInjection //- Initial parcel velocity [m/s] const vector U0_; - //- Volume flow rate of parcels to introduce relative to SOI [m^3/s] - const autoPtr > volumeFlowRate_; + //- Flow rate profile relative to SOI [] + const autoPtr > flowRateProfile_; //- Parcel size PDF model const autoPtr parcelPDF_; diff --git a/src/postProcessing/functionObjects/field/Make/files b/src/postProcessing/functionObjects/field/Make/files index 6195b98a41..bfed281015 100644 --- a/src/postProcessing/functionObjects/field/Make/files +++ b/src/postProcessing/functionObjects/field/Make/files @@ -12,6 +12,9 @@ fieldValues/faceSource/faceSourceFunctionObject.C fieldValues/cellSource/cellSource.C fieldValues/cellSource/cellSourceFunctionObject.C +readFields/readFields.C +readFields/readFieldsFunctionObject.C + streamLine/streamLine.C streamLine/streamLineParticle.C streamLine/streamLineParticleCloud.C diff --git a/src/postProcessing/functionObjects/field/readFields/IOreadFields.H b/src/postProcessing/functionObjects/field/readFields/IOreadFields.H new file mode 100644 index 0000000000..b3bdfa521e --- /dev/null +++ b/src/postProcessing/functionObjects/field/readFields/IOreadFields.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 . + +Typedef + Foam::IOreadFields + +Description + Instance of the generic IOOutputFilter for readFields. + +\*---------------------------------------------------------------------------*/ + +#ifndef IOreadFields_H +#define IOreadFields_H + +#include "readFields.H" +#include "IOOutputFilter.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + typedef IOOutputFilter IOreadFields; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/field/readFields/postProcessingDict b/src/postProcessing/functionObjects/field/readFields/postProcessingDict new file mode 100644 index 0000000000..aa304a259f --- /dev/null +++ b/src/postProcessing/functionObjects/field/readFields/postProcessingDict @@ -0,0 +1,52 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.6 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object postProcessingDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +functions +( + readFields1 + { + type readFields; + functionObjectLibs ("libfieldFunctionObjects.so"); + enabled true; + outputControl timeStep; + outputInterval 1; + fields + ( + interpolateU + ); + } + faceObj2 + { + type faceSource; + functionObjectLibs ("libfieldFunctionObjects.so"); + enabled true; + outputControl timeStep; + outputInterval 1; + log true; + valueOutput true; + source faceZone; + sourceName f0; + operation areaAverage; + fields + ( + interpolateU + ); + } +); + + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/field/readFields/readFields.C b/src/postProcessing/functionObjects/field/readFields/readFields.C new file mode 100644 index 0000000000..17b46f1a52 --- /dev/null +++ b/src/postProcessing/functionObjects/field/readFields/readFields.C @@ -0,0 +1,116 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 "readFields.H" +#include "dictionary.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(readFields, 0); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::readFields::readFields +( + const word& name, + const objectRegistry& obr, + const dictionary& dict, + const bool loadFromFiles +) +: + name_(name), + obr_(obr), + active_(true), + fieldSet_() +{ + // Check if the available mesh is an fvMesh otherise deactivate + if (!isA(obr_)) + { + active_ = false; + WarningIn + ( + "readFields::readFields" + "(" + "const word&, " + "const objectRegistry&, " + "const dictionary&, " + "const bool" + ")" + ) << "No fvMesh available, deactivating." + << endl; + } + + read(dict); +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::readFields::~readFields() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::readFields::read(const dictionary& dict) +{ + if (active_) + { + dict.lookup("fields") >> fieldSet_; + } +} + + +void Foam::readFields::execute() +{ + Info<< type() << " " << name_ << ":" << nl; + forAll(fieldSet_, fieldI) + { + setField(fieldSet_[fieldI]); + setField(fieldSet_[fieldI]); + setField(fieldSet_[fieldI]); + setField(fieldSet_[fieldI]); + setField(fieldSet_[fieldI]); + } +} + + +void Foam::readFields::end() +{ + // Do nothing +} + + +void Foam::readFields::write() +{ + // Do nothing +} + + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/field/readFields/readFields.H b/src/postProcessing/functionObjects/field/readFields/readFields.H new file mode 100644 index 0000000000..52ee6a47ae --- /dev/null +++ b/src/postProcessing/functionObjects/field/readFields/readFields.H @@ -0,0 +1,154 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 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::readFields + +Description + Reads fields from the time folders and adds them to the mesh database + for further post-processing. + +SourceFiles + readFields.C + IOreadFields.H + +\*---------------------------------------------------------------------------*/ + +#ifndef readFields_H +#define readFields_H + +#include "OFstream.H" +#include "pointFieldFwd.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// Forward declaration of classes +class objectRegistry; +class dictionary; +class mapPolyMesh; + +/*---------------------------------------------------------------------------*\ + Class readFields Declaration +\*---------------------------------------------------------------------------*/ + +class readFields +{ +protected: + + // Protected data + + //- Name of this set of readFields object + word name_; + + const objectRegistry& obr_; + + //- on/off switch + bool active_; + + //- Fields to assess min/max + wordList fieldSet_; + + + // Protected Member Functions + + //- Disallow default bitwise copy construct + readFields(const readFields&); + + //- Disallow default bitwise assignment + void operator=(const readFields&); + + template + void setField(const word& fieldName); + + +public: + + //- Runtime type information + TypeName("readFields"); + + + // Constructors + + //- Construct for given objectRegistry and dictionary. + // Allow the possibility to load fields from files + readFields + ( + const word& name, + const objectRegistry&, + const dictionary&, + const bool loadFromFiles = false + ); + + + //- Destructor + virtual ~readFields(); + + + // Member Functions + + //- Return name of the readFields object + virtual const word& name() const + { + return name_; + } + + //- Read the field min/max data + virtual void read(const dictionary&); + + //- Execute, currently does nothing + virtual void execute(); + + //- Execute at the final time-loop, currently does nothing + virtual void end(); + + //- Write + virtual void write(); + + //- Update for changes of mesh + virtual void updateMesh(const mapPolyMesh&) + {} + + //- Update for changes of mesh + virtual void movePoints(const pointField&) + {} +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "readFieldsTemplates.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/field/readFields/readFieldsFunctionObject.C b/src/postProcessing/functionObjects/field/readFields/readFieldsFunctionObject.C new file mode 100644 index 0000000000..970dfe24c2 --- /dev/null +++ b/src/postProcessing/functionObjects/field/readFields/readFieldsFunctionObject.C @@ -0,0 +1,42 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 "readFieldsFunctionObject.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineNamedTemplateTypeNameAndDebug(readFieldsFunctionObject, 0); + + addToRunTimeSelectionTable + ( + functionObject, + readFieldsFunctionObject, + dictionary + ); +} + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/field/readFields/readFieldsFunctionObject.H b/src/postProcessing/functionObjects/field/readFields/readFieldsFunctionObject.H new file mode 100644 index 0000000000..9ddca2a65d --- /dev/null +++ b/src/postProcessing/functionObjects/field/readFields/readFieldsFunctionObject.H @@ -0,0 +1,54 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 . + +Typedef + Foam::readFieldsFunctionObject + +Description + FunctionObject wrapper around readFields to allow them to be created via + the functions entry within controlDict. + +SourceFiles + readFieldsFunctionObject.C + +\*---------------------------------------------------------------------------*/ + +#ifndef readFieldsFunctionObject_H +#define readFieldsFunctionObject_H + +#include "readFields.H" +#include "OutputFilterFunctionObject.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + typedef OutputFilterFunctionObject + readFieldsFunctionObject; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/field/readFields/readFieldsTemplates.C b/src/postProcessing/functionObjects/field/readFields/readFieldsTemplates.C new file mode 100644 index 0000000000..f78859d769 --- /dev/null +++ b/src/postProcessing/functionObjects/field/readFields/readFieldsTemplates.C @@ -0,0 +1,94 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 "readFields.H" +#include "volFields.H" +#include "surfaceFields.H" +#include "Time.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +template +void Foam::readFields::setField(const word& fieldName) +{ + typedef GeometricField vfType; + typedef GeometricField sfType; + + if (obr_.foundObject(fieldName)) + { + if (debug) + { + Info<< "Field " << fieldName << " already in database" << endl; + } + + vfType& vf = const_cast(obr_.lookupObject(fieldName)); + vf.checkOut(); + } + if (obr_.foundObject(fieldName)) + { + if (debug) + { + Info<< "Field " << fieldName << " already in database" << endl; + } + + sfType& sf = const_cast(obr_.lookupObject(fieldName)); + sf.checkOut(); + } + + const fvMesh& mesh = refCast(obr_); + + IOobject fieldHeader + ( + fieldName, + mesh.time().timeName(), + mesh, + IOobject::MUST_READ, + IOobject::NO_WRITE + ); + + if + ( + fieldHeader.headerOk() + && fieldHeader.headerClassName() == vfType::typeName + ) + { + // store field on the mesh database + Info<< " Reading " << fieldName << endl; + obr_.store(new vfType(fieldHeader, mesh)); + } + else if + ( + fieldHeader.headerOk() + && fieldHeader.headerClassName() == sfType::typeName + ) + { + // store field on the mesh database + Info<< " Reading " << fieldName << endl; + obr_.store(new sfType(fieldHeader, mesh)); + } +} + + +// ************************************************************************* // diff --git a/src/postProcessing/postCalc/postCalc.C b/src/postProcessing/postCalc/postCalc.C index 5612287353..32fe0f2269 100644 --- a/src/postProcessing/postCalc/postCalc.C +++ b/src/postProcessing/postCalc/postCalc.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -68,10 +68,10 @@ int main(int argc, char *argv[]) "dictionary name" ); -# include "setRootCase.H" -# include "createTime.H" + #include "setRootCase.H" + #include "createTime.H" Foam::instantList timeDirs = Foam::timeSelector::select0(runTime, args); -# include "createMesh.H" + #include "createMesh.H" forAll(timeDirs, timeI) { diff --git a/src/sampling/Make/files b/src/sampling/Make/files index 2c7920d29e..c385e9aa93 100644 --- a/src/sampling/Make/files +++ b/src/sampling/Make/files @@ -4,7 +4,7 @@ probes/probesFunctionObject/probesFunctionObject.C sampledSet/cloud/cloudSet.C sampledSet/coordSet/coordSet.C -sampledSet/curve/curveSet.C +sampledSet/polyLine/polyLineSet.C sampledSet/face/faceOnlySet.C sampledSet/midPoint/midPointSet.C sampledSet/midPointAndFace/midPointAndFaceSet.C diff --git a/src/sampling/sampledSet/curve/curveSet.C b/src/sampling/sampledSet/polyLine/polyLineSet.C similarity index 94% rename from src/sampling/sampledSet/curve/curveSet.C rename to src/sampling/sampledSet/polyLine/polyLineSet.C index d5be7c09a7..1783d227a0 100644 --- a/src/sampling/sampledSet/curve/curveSet.C +++ b/src/sampling/sampledSet/polyLine/polyLineSet.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -23,7 +23,7 @@ License \*---------------------------------------------------------------------------*/ -#include "curveSet.H" +#include "polyLineSet.H" #include "meshSearch.H" #include "DynamicList.H" #include "polyMesh.H" @@ -38,15 +38,15 @@ License namespace Foam { - defineTypeNameAndDebug(curveSet, 0); - addToRunTimeSelectionTable(sampledSet, curveSet, word); + defineTypeNameAndDebug(polyLineSet, 0); + addToRunTimeSelectionTable(sampledSet, polyLineSet, word); } // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // Sample till hits boundary. -bool Foam::curveSet::trackToBoundary +bool Foam::polyLineSet::trackToBoundary ( Particle& singleParticle, label& sampleI, @@ -127,7 +127,7 @@ bool Foam::curveSet::trackToBoundary } -void Foam::curveSet::calcSamples +void Foam::polyLineSet::calcSamples ( DynamicList& samplingPts, DynamicList