diff --git a/applications/utilities/parallelProcessing/decomposePar/fvFieldDecomposerTemplates.C b/applications/utilities/parallelProcessing/decomposePar/fvFieldDecomposerTemplates.C index bc4f0b4491..e43b26eeb4 100644 --- a/applications/utilities/parallelProcessing/decomposePar/fvFieldDecomposerTemplates.C +++ b/applications/utilities/parallelProcessing/decomposePar/fvFieldDecomposerTemplates.C @@ -197,7 +197,8 @@ Foam::fvFieldDecomposer::decomposeVolField procMeshes_[proci], field.dimensions(), Field(field.primitiveField(), cellProcAddressing_[proci]), - patchFields + patchFields, + field.sources().table() ) ); diff --git a/applications/utilities/parallelProcessing/reconstructPar/fvFieldReconstructorTemplates.C b/applications/utilities/parallelProcessing/reconstructPar/fvFieldReconstructorTemplates.C index 2412a6955b..a105666e60 100644 --- a/applications/utilities/parallelProcessing/reconstructPar/fvFieldReconstructorTemplates.C +++ b/applications/utilities/parallelProcessing/reconstructPar/fvFieldReconstructorTemplates.C @@ -292,7 +292,8 @@ Foam::fvFieldReconstructor::reconstructVolField completeMesh_, procFields[0].dimensions(), internalField, - patchFields + patchFields, + procFields[0].sources().table() ) ); } diff --git a/applications/utilities/parallelProcessing/redistributePar/redistributePar.C b/applications/utilities/parallelProcessing/redistributePar/redistributePar.C index b3478ef7b2..a7b02fddeb 100644 --- a/applications/utilities/parallelProcessing/redistributePar/redistributePar.C +++ b/applications/utilities/parallelProcessing/redistributePar/redistributePar.C @@ -50,6 +50,7 @@ Description #include "timeSelector.H" #include "decompositionMethod.H" #include "PstreamReduceOps.H" +#include "volFields.H" #include "fvMeshDistribute.H" #include "polyDistributionMap.H" #include "IOobjectList.H" diff --git a/src/MomentumTransportModels/momentumTransportModels/Make/files b/src/MomentumTransportModels/momentumTransportModels/Make/files index ab992e7ca9..0e326c6cc2 100644 --- a/src/MomentumTransportModels/momentumTransportModels/Make/files +++ b/src/MomentumTransportModels/momentumTransportModels/Make/files @@ -56,11 +56,15 @@ fWallFunctions = $(wallFunctions)/fWallFunctions $(fWallFunctions)/fWallFunction/fWallFunctionFvPatchScalarField.C -RASBCs = RAS/derivedFvPatchFields - # Inlet turbulence BCs -$(RASBCs)/turbulentMixingLengthDissipationRateInlet/turbulentMixingLengthDissipationRateInletFvPatchScalarField.C -$(RASBCs)/turbulentMixingLengthFrequencyInlet/turbulentMixingLengthFrequencyInletFvPatchScalarField.C +RAS/derivedFvPatchFields/turbulentMixingLengthDissipationRateInlet/turbulentMixingLengthDissipationRateInletFvPatchScalarField.C +RAS/derivedFvPatchFields/turbulentMixingLengthFrequencyInlet/turbulentMixingLengthFrequencyInletFvPatchScalarField.C + + +# Turbulence model values +RAS/derivedFvFieldSources/turbulentMixingLengthDissipationRate/turbulentMixingLengthDissipationRateFvScalarFieldSource.C +RAS/derivedFvFieldSources/turbulentMixingLengthFrequency/turbulentMixingLengthFrequencyFvScalarFieldSource.C + generalisedNewtonianViscosityModels = laminar/generalisedNewtonian/generalisedNewtonianViscosityModels $(generalisedNewtonianViscosityModels)/generalisedNewtonianViscosityModel/generalisedNewtonianViscosityModel.C diff --git a/src/MomentumTransportModels/momentumTransportModels/RAS/derivedFvFieldSources/turbulentMixingLengthDissipationRate/turbulentMixingLengthDissipationRateFvScalarFieldSource.C b/src/MomentumTransportModels/momentumTransportModels/RAS/derivedFvFieldSources/turbulentMixingLengthDissipationRate/turbulentMixingLengthDissipationRateFvScalarFieldSource.C new file mode 100644 index 0000000000..530c710447 --- /dev/null +++ b/src/MomentumTransportModels/momentumTransportModels/RAS/derivedFvFieldSources/turbulentMixingLengthDissipationRate/turbulentMixingLengthDissipationRateFvScalarFieldSource.C @@ -0,0 +1,123 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2023 OpenFOAM Foundation + \\/ 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 "turbulentMixingLengthDissipationRateFvScalarFieldSource.H" +#include "addToRunTimeSelectionTable.H" +#include "fvCellSet.H" +#include "volFields.H" +#include "momentumTransportModel.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::turbulentMixingLengthDissipationRateFvScalarFieldSource:: +turbulentMixingLengthDissipationRateFvScalarFieldSource +( + const DimensionedField& iF, + const dictionary& dict +) +: + fvScalarFieldSource(iF, dict), + mixingLength_(dict.lookup("mixingLength")), + kName_(dict.lookupOrDefault("k", "k")) +{} + + +Foam::turbulentMixingLengthDissipationRateFvScalarFieldSource:: +turbulentMixingLengthDissipationRateFvScalarFieldSource +( + const turbulentMixingLengthDissipationRateFvScalarFieldSource& field, + const DimensionedField& iF +) +: + fvScalarFieldSource(field, iF), + mixingLength_(field.mixingLength_), + kName_(field.kName_) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::turbulentMixingLengthDissipationRateFvScalarFieldSource:: +~turbulentMixingLengthDissipationRateFvScalarFieldSource() +{} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +Foam::tmp +Foam::turbulentMixingLengthDissipationRateFvScalarFieldSource::sourceValue +( + const fvSource& source +) const +{ + const scalarField ks(this->value(kName_, source)); + + const momentumTransportModel& turbModel = + db().lookupType(internalField().group()); + + const scalar Cmu = + turbModel.coeffDict().lookupOrDefault("Cmu", 0.09); + + const scalar Cmu75 = pow(Cmu, 0.75); + + return Cmu75*ks*sqrt(ks)/mixingLength_; +} + + +Foam::tmp +Foam::turbulentMixingLengthDissipationRateFvScalarFieldSource::internalCoeff +( + const fvSource& source +) const +{ + return + neg0(source.source(internalField().name())) + *scalarField(source.nCells(), scalar(1)); +} + + +void Foam::turbulentMixingLengthDissipationRateFvScalarFieldSource::write +( + Ostream& os +) const +{ + fvScalarFieldSource::write(os); + writeEntry(os, "mixingLength", mixingLength_); + writeEntryIfDifferent(os, "k", "k", kName_); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + makeTypeFieldSource + ( + fvScalarFieldSource, + turbulentMixingLengthDissipationRateFvScalarFieldSource + ); +} + +// ************************************************************************* // diff --git a/src/MomentumTransportModels/momentumTransportModels/RAS/derivedFvFieldSources/turbulentMixingLengthDissipationRate/turbulentMixingLengthDissipationRateFvScalarFieldSource.H b/src/MomentumTransportModels/momentumTransportModels/RAS/derivedFvFieldSources/turbulentMixingLengthDissipationRate/turbulentMixingLengthDissipationRateFvScalarFieldSource.H new file mode 100644 index 0000000000..8556627d0a --- /dev/null +++ b/src/MomentumTransportModels/momentumTransportModels/RAS/derivedFvFieldSources/turbulentMixingLengthDissipationRate/turbulentMixingLengthDissipationRateFvScalarFieldSource.H @@ -0,0 +1,161 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2023 OpenFOAM Foundation + \\/ 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::turbulentMixingLengthDissipationRateFvScalarFieldSource + +Description + This source condition provides a turbulence dissipation, \f$\epsilon\f$ + (epsilon), based on a specified mixing length. The source values are + calculated using: + + \f[ + \epsilon = \frac{C_{\mu}^{0.75} k^{1.5}}{L} + \f] + + where + + \vartable + \epsilon | epsilon values + C_{\mu} | Model coefficient, set to 0.09 + k | turbulence kinetic energy + L | length scale + \endvartable + + In the case of a sink, the current cell values are used instead. + +Usage + \table + Property | Description | Required | Default value + mixingLength | Length scale [m] | yes | + k | turbulence kinetic energy field name | no | k + \endtable + + Example of the source condition specification: + \verbatim + + { + type turbulentMixingLengthDissipationRate; + mixingLength 0.005; + } + \endverbatim + +SourceFiles + turbulentMixingLengthDissipationRateFvScalarFieldSource.C + +\*---------------------------------------------------------------------------*/ + +#ifndef turbulentMixingLengthDissipationRateFvScalarFieldSource_H +#define turbulentMixingLengthDissipationRateFvScalarFieldSource_H + +#include "fvFieldSources.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class turbulentMixingLengthDissipationRateFvScalarFieldSource Declaration +\*---------------------------------------------------------------------------*/ + +class turbulentMixingLengthDissipationRateFvScalarFieldSource +: + public fvScalarFieldSource +{ +private: + + // Private Data + + //- Turbulent length scale + scalar mixingLength_; + + //- Name of the turbulent kinetic energy field + word kName_; + + +public: + + //- Runtime type information + TypeName("turbulentMixingLengthDissipationRate"); + + + // Constructors + + //- Construct from internal field and dictionary + turbulentMixingLengthDissipationRateFvScalarFieldSource + ( + const DimensionedField&, + const dictionary& dict + ); + + //- Copy constructor setting internal field reference + turbulentMixingLengthDissipationRateFvScalarFieldSource + ( + const turbulentMixingLengthDissipationRateFvScalarFieldSource&, + const DimensionedField& + ); + + //- Construct and return a clone setting internal field reference + virtual autoPtr clone + ( + const DimensionedField& iF + ) const + { + return autoPtr + ( + new turbulentMixingLengthDissipationRateFvScalarFieldSource + ( + *this, + iF + ) + ); + } + + + //- Destructor + virtual ~turbulentMixingLengthDissipationRateFvScalarFieldSource(); + + + // Member Functions + + //- Return the source value + virtual tmp sourceValue(const fvSource&) const; + + //- Return the internal coefficient + virtual tmp internalCoeff(const fvSource&) const; + + //- Write + virtual void write(Ostream&) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/MomentumTransportModels/momentumTransportModels/RAS/derivedFvFieldSources/turbulentMixingLengthFrequency/turbulentMixingLengthFrequencyFvScalarFieldSource.C b/src/MomentumTransportModels/momentumTransportModels/RAS/derivedFvFieldSources/turbulentMixingLengthFrequency/turbulentMixingLengthFrequencyFvScalarFieldSource.C new file mode 100644 index 0000000000..c381f7ecf2 --- /dev/null +++ b/src/MomentumTransportModels/momentumTransportModels/RAS/derivedFvFieldSources/turbulentMixingLengthFrequency/turbulentMixingLengthFrequencyFvScalarFieldSource.C @@ -0,0 +1,123 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2023 OpenFOAM Foundation + \\/ 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 "turbulentMixingLengthFrequencyFvScalarFieldSource.H" +#include "addToRunTimeSelectionTable.H" +#include "fvCellSet.H" +#include "volFields.H" +#include "momentumTransportModel.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::turbulentMixingLengthFrequencyFvScalarFieldSource:: +turbulentMixingLengthFrequencyFvScalarFieldSource +( + const DimensionedField& iF, + const dictionary& dict +) +: + fvScalarFieldSource(iF, dict), + mixingLength_(dict.lookup("mixingLength")), + kName_(dict.lookupOrDefault("k", "k")) +{} + + +Foam::turbulentMixingLengthFrequencyFvScalarFieldSource:: +turbulentMixingLengthFrequencyFvScalarFieldSource +( + const turbulentMixingLengthFrequencyFvScalarFieldSource& field, + const DimensionedField& iF +) +: + fvScalarFieldSource(field, iF), + mixingLength_(field.mixingLength_), + kName_(field.kName_) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::turbulentMixingLengthFrequencyFvScalarFieldSource:: +~turbulentMixingLengthFrequencyFvScalarFieldSource() +{} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +Foam::tmp +Foam::turbulentMixingLengthFrequencyFvScalarFieldSource::sourceValue +( + const fvSource& source +) const +{ + const scalarField ks(this->value(kName_, source)); + + const momentumTransportModel& turbModel = + db().lookupType(internalField().group()); + + const scalar Cmu = + turbModel.coeffDict().lookupOrDefault("Cmu", 0.09); + + const scalar Cmu25 = pow(Cmu, 0.25); + + return ks*sqrt(ks)/(Cmu25*mixingLength_); +} + + +Foam::tmp +Foam::turbulentMixingLengthFrequencyFvScalarFieldSource::internalCoeff +( + const fvSource& source +) const +{ + return + neg0(source.source(internalField().name())) + *scalarField(source.nCells(), scalar(1)); +} + + +void Foam::turbulentMixingLengthFrequencyFvScalarFieldSource::write +( + Ostream& os +) const +{ + fvScalarFieldSource::write(os); + writeEntry(os, "mixingLength", mixingLength_); + writeEntryIfDifferent(os, "k", "k", kName_); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + makeTypeFieldSource + ( + fvScalarFieldSource, + turbulentMixingLengthFrequencyFvScalarFieldSource + ); +} + +// ************************************************************************* // diff --git a/src/MomentumTransportModels/momentumTransportModels/RAS/derivedFvFieldSources/turbulentMixingLengthFrequency/turbulentMixingLengthFrequencyFvScalarFieldSource.H b/src/MomentumTransportModels/momentumTransportModels/RAS/derivedFvFieldSources/turbulentMixingLengthFrequency/turbulentMixingLengthFrequencyFvScalarFieldSource.H new file mode 100644 index 0000000000..914f9a24a3 --- /dev/null +++ b/src/MomentumTransportModels/momentumTransportModels/RAS/derivedFvFieldSources/turbulentMixingLengthFrequency/turbulentMixingLengthFrequencyFvScalarFieldSource.H @@ -0,0 +1,161 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2023 OpenFOAM Foundation + \\/ 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::turbulentMixingLengthFrequencyFvScalarFieldSource + +Description + This source condition provides a turbulence specific dissipation, + \f$\omega\f$ (omega), based on a specified mixing length. The source values + are calculated using: + + \f[ + \omega = \frac{k^{0.5}}{C_{\mu}^{0.25} L} + \f] + + where + + \vartable + \omega | omega values + C_{\mu} | Model coefficient, set to 0.09 + k | turbulence kinetic energy + L | length scale + \endvartable + + In the case of a sink, the current cell values are used instead. + +Usage + \table + Property | Description | Required | Default value + mixingLength | Length scale [m] | yes | + k | turbulence kinetic energy field name | no | k + \endtable + + Example of the source condition specification: + \verbatim + + { + type turbulentMixingLengthFrequency; + mixingLength 0.005; + } + \endverbatim + +SourceFiles + turbulentMixingLengthFrequencyFvScalarFieldSource.C + +\*---------------------------------------------------------------------------*/ + +#ifndef turbulentMixingLengthFrequencyFvScalarFieldSource_H +#define turbulentMixingLengthFrequencyFvScalarFieldSource_H + +#include "fvFieldSources.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class turbulentMixingLengthFrequencyFvScalarFieldSource Declaration +\*---------------------------------------------------------------------------*/ + +class turbulentMixingLengthFrequencyFvScalarFieldSource +: + public fvScalarFieldSource +{ +private: + + // Private Data + + //- Turbulent length scale + scalar mixingLength_; + + //- Name of the turbulent kinetic energy field + word kName_; + + +public: + + //- Runtime type information + TypeName("turbulentMixingLengthFrequency"); + + + // Constructors + + //- Construct from internal field and dictionary + turbulentMixingLengthFrequencyFvScalarFieldSource + ( + const DimensionedField&, + const dictionary& dict + ); + + //- Copy constructor setting internal field reference + turbulentMixingLengthFrequencyFvScalarFieldSource + ( + const turbulentMixingLengthFrequencyFvScalarFieldSource&, + const DimensionedField& + ); + + //- Construct and return a clone setting internal field reference + virtual autoPtr clone + ( + const DimensionedField& iF + ) const + { + return autoPtr + ( + new turbulentMixingLengthFrequencyFvScalarFieldSource + ( + *this, + iF + ) + ); + } + + + //- Destructor + virtual ~turbulentMixingLengthFrequencyFvScalarFieldSource(); + + + // Member Functions + + //- Return the source value + virtual tmp sourceValue(const fvSource&) const; + + //- Return the internal coefficient + virtual tmp internalCoeff(const fvSource&) const; + + //- Write + virtual void write(Ostream&) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.C b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.C index 00f201c873..1b59e0a796 100644 --- a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.C +++ b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.C @@ -55,6 +55,17 @@ void Foam::GeometricField::readFields boundaryField_.readField(*this, dict.subDict("boundaryField")); + // Don't use subOrEmptyDict here, or line numbers will be lost from any IO + // error messages. Use an actual sub-dict reference here if possible. + if (dict.found("sources")) + { + sources_.readField(*this, dict.subDict("sources")); + } + else + { + sources_.readField(*this, dictionary(dict, dictionary())); + } + if (dict.found("referenceLevel")) { Type fieldAverage(pTraits(dict.lookup("referenceLevel"))); @@ -191,7 +202,8 @@ Foam::GeometricField::GeometricField timeIndex_(this->time().timeIndex()), field0Ptr_(nullptr), fieldPrevIterPtr_(nullptr), - boundaryField_(mesh.boundary(), *this, patchFieldType) + boundaryField_(mesh.boundary(), *this, patchFieldType), + sources_() { if (debug) { @@ -209,14 +221,16 @@ Foam::GeometricField::GeometricField const Mesh& mesh, const dimensionSet& ds, const wordList& patchFieldTypes, - const wordList& actualPatchTypes + const wordList& actualPatchTypes, + const HashTable& fieldSourceTypes ) : Internal(io, mesh, ds, false), timeIndex_(this->time().timeIndex()), field0Ptr_(nullptr), fieldPrevIterPtr_(nullptr), - boundaryField_(mesh.boundary(), *this, patchFieldTypes, actualPatchTypes) + boundaryField_(mesh.boundary(), *this, patchFieldTypes, actualPatchTypes), + sources_(*this, fieldSourceTypes) { if (debug) { @@ -240,7 +254,8 @@ Foam::GeometricField::GeometricField timeIndex_(this->time().timeIndex()), field0Ptr_(nullptr), fieldPrevIterPtr_(nullptr), - boundaryField_(mesh.boundary(), *this, patchFieldType) + boundaryField_(mesh.boundary(), *this, patchFieldType), + sources_() { if (debug) { @@ -260,14 +275,16 @@ Foam::GeometricField::GeometricField const Mesh& mesh, const dimensioned& dt, const wordList& patchFieldTypes, - const wordList& actualPatchTypes + const wordList& actualPatchTypes, + const HashTable& fieldSourceTypes ) : Internal(io, mesh, dt, false), timeIndex_(this->time().timeIndex()), field0Ptr_(nullptr), fieldPrevIterPtr_(nullptr), - boundaryField_(mesh.boundary(), *this, patchFieldTypes, actualPatchTypes) + boundaryField_(mesh.boundary(), *this, patchFieldTypes, actualPatchTypes), + sources_(*this, fieldSourceTypes) { if (debug) { @@ -285,14 +302,16 @@ Foam::GeometricField::GeometricField ( const IOobject& io, const Internal& diField, - const PtrList>& ptfl + const PtrList>& ptfl, + const HashPtrTable& stft ) : Internal(io, diField), timeIndex_(this->time().timeIndex()), field0Ptr_(nullptr), fieldPrevIterPtr_(nullptr), - boundaryField_(this->mesh().boundary(), *this, ptfl) + boundaryField_(this->mesh().boundary(), *this, ptfl), + sources_(*this, stft) { if (debug) { @@ -311,14 +330,16 @@ Foam::GeometricField::GeometricField const Mesh& mesh, const dimensionSet& ds, const Field& iField, - const PtrList>& ptfl + const PtrList>& ptfl, + const HashPtrTable& stft ) : Internal(io, mesh, ds, iField), timeIndex_(this->time().timeIndex()), field0Ptr_(nullptr), fieldPrevIterPtr_(nullptr), - boundaryField_(mesh.boundary(), *this, ptfl) + boundaryField_(mesh.boundary(), *this, ptfl), + sources_(*this, stft) { if (debug) { @@ -341,7 +362,8 @@ Foam::GeometricField::GeometricField timeIndex_(this->time().timeIndex()), field0Ptr_(nullptr), fieldPrevIterPtr_(nullptr), - boundaryField_(mesh.boundary()) + boundaryField_(mesh.boundary()), + sources_() { readFields(); @@ -377,7 +399,8 @@ Foam::GeometricField::GeometricField timeIndex_(this->time().timeIndex()), field0Ptr_(nullptr), fieldPrevIterPtr_(nullptr), - boundaryField_(mesh.boundary()) + boundaryField_(mesh.boundary()), + sources_() { readFields(dict); @@ -410,7 +433,8 @@ Foam::GeometricField::GeometricField timeIndex_(gf.timeIndex()), field0Ptr_(nullptr), fieldPrevIterPtr_(nullptr), - boundaryField_(*this, gf.boundaryField_) + boundaryField_(*this, gf.boundaryField_), + sources_(*this, gf.sources_) { if (debug) { @@ -440,7 +464,8 @@ Foam::GeometricField::GeometricField timeIndex_(gf.timeIndex()), field0Ptr_(nullptr), fieldPrevIterPtr_(nullptr), - boundaryField_(*this, gf.boundaryField_) + boundaryField_(*this, gf.boundaryField_), + sources_(*this, gf.sources_) { if (debug) { @@ -472,7 +497,8 @@ Foam::GeometricField::GeometricField timeIndex_(tgf().timeIndex()), field0Ptr_(nullptr), fieldPrevIterPtr_(nullptr), - boundaryField_(*this, tgf().boundaryField_) + boundaryField_(*this, tgf().boundaryField_), + sources_(*this, tgf().sources_) { if (debug) { @@ -497,7 +523,8 @@ Foam::GeometricField::GeometricField timeIndex_(gf.timeIndex()), field0Ptr_(nullptr), fieldPrevIterPtr_(nullptr), - boundaryField_(*this, gf.boundaryField_) + boundaryField_(*this, gf.boundaryField_), + sources_(*this, gf.sources_) { if (debug) { @@ -533,7 +560,8 @@ Foam::GeometricField::GeometricField timeIndex_(tgf().timeIndex()), field0Ptr_(nullptr), fieldPrevIterPtr_(nullptr), - boundaryField_(*this, tgf().boundaryField_) + boundaryField_(*this, tgf().boundaryField_), + sources_(*this, tgf().sources_) { if (debug) { @@ -559,7 +587,8 @@ Foam::GeometricField::GeometricField timeIndex_(gf.timeIndex()), field0Ptr_(nullptr), fieldPrevIterPtr_(nullptr), - boundaryField_(*this, gf.boundaryField_) + boundaryField_(*this, gf.boundaryField_), + sources_(*this, gf.sources_) { if (debug) { @@ -595,7 +624,8 @@ Foam::GeometricField::GeometricField timeIndex_(tgf().timeIndex()), field0Ptr_(nullptr), fieldPrevIterPtr_(nullptr), - boundaryField_(*this, tgf().boundaryField_) + boundaryField_(*this, tgf().boundaryField_), + sources_(*this, tgf().sources_) { if (debug) { @@ -620,7 +650,8 @@ Foam::GeometricField::GeometricField timeIndex_(gf.timeIndex()), field0Ptr_(nullptr), fieldPrevIterPtr_(nullptr), - boundaryField_(this->mesh().boundary(), *this, patchFieldType) + boundaryField_(this->mesh().boundary(), *this, patchFieldType), + sources_(*this, gf.sources_) { if (debug) { @@ -648,8 +679,8 @@ Foam::GeometricField::GeometricField const IOobject& io, const GeometricField& gf, const wordList& patchFieldTypes, - const wordList& actualPatchTypes - + const wordList& actualPatchTypes, + const HashTable& fieldSourceTypes ) : Internal(io, gf), @@ -662,7 +693,8 @@ Foam::GeometricField::GeometricField *this, patchFieldTypes, actualPatchTypes - ) + ), + sources_(*this, fieldSourceTypes) { if (debug) { @@ -690,7 +722,8 @@ Foam::GeometricField::GeometricField const IOobject& io, const tmp>& tgf, const wordList& patchFieldTypes, - const wordList& actualPatchTypes + const wordList& actualPatchTypes, + const HashTable& fieldSourceTypes ) : Internal @@ -708,7 +741,8 @@ Foam::GeometricField::GeometricField *this, patchFieldTypes, actualPatchTypes - ) + ), + sources_(*this, fieldSourceTypes) { if (debug) { @@ -766,7 +800,8 @@ Foam::GeometricField::New ( const word& name, const Internal& diField, - const PtrList>& ptfl + const PtrList>& ptfl, + const HashPtrTable& stft ) { const bool cacheTmp = diField.mesh().thisDb().cacheTemporaryObject(name); @@ -785,7 +820,8 @@ Foam::GeometricField::New cacheTmp ), diField, - ptfl + ptfl, + stft ), cacheTmp ); @@ -869,7 +905,8 @@ Foam::GeometricField::New const Mesh& mesh, const dimensioned& dt, const wordList& patchFieldTypes, - const wordList& actualPatchTypes + const wordList& actualPatchTypes, + const HashTable& fieldSourceTypes ) { const bool cacheTmp = mesh.thisDb().cacheTemporaryObject(name); @@ -890,7 +927,8 @@ Foam::GeometricField::New mesh, dt, patchFieldTypes, - actualPatchTypes + actualPatchTypes, + fieldSourceTypes ), cacheTmp ); @@ -968,7 +1006,8 @@ Foam::GeometricField::New const word& newName, const tmp>& tgf, const wordList& patchFieldTypes, - const wordList& actualPatchTypes + const wordList& actualPatchTypes, + const HashTable& fieldSourceTypes ) { const bool cacheTmp = tgf().db().cacheTemporaryObject(newName); @@ -989,7 +1028,8 @@ Foam::GeometricField::New ), tgf, patchFieldTypes, - actualPatchTypes + actualPatchTypes, + fieldSourceTypes ), cacheTmp ); @@ -1297,6 +1337,7 @@ void Foam::GeometricField::reset Internal::reset(gf); boundaryField_.reset(gf.boundaryField()); + sources_.reset(gf.sources()); tgf.clear(); } @@ -1785,6 +1826,12 @@ Foam::Ostream& Foam::operator<< os << nl; gf.boundaryField().writeEntry("boundaryField", os); + if (!gf.sources_.empty()) + { + os << nl; + gf.sources().writeEntry("sources", os); + } + // Check state of IOstream os.check ( diff --git a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.H b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.H index fe9a73c322..cb7a6eaf02 100644 --- a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.H +++ b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -41,6 +41,7 @@ SourceFiles #include "lduInterfaceFieldPtrsList.H" #include "LduInterfaceFieldPtrsList.H" #include "GeometricBoundaryField.H" +#include "GeometricFieldSources.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -103,6 +104,12 @@ public: //- Type of the boundary field typedef GeometricBoundaryField Boundary; + //- Type of the field source of which the Sources is composed + typedef typename GeoMesh::template FieldSource Source; + + //- Type of the field sources + typedef GeometricFieldSources Sources; + private: @@ -121,6 +128,9 @@ private: //- Boundary Type field containing boundary field values Boundary boundaryField_; + //- Type field sources containing field source values + Sources sources_; + // Private Member Functions @@ -163,7 +173,7 @@ public: const IOobject&, const Mesh&, const dimensionSet&, - const word& patchFieldType=PatchField::calculatedType() + const word& patchFieldType = PatchField::calculatedType() ); //- Constructor given IOobject, mesh, dimensions and patch field types. @@ -175,7 +185,8 @@ public: const Mesh&, const dimensionSet&, const wordList& wantedPatchTypes, - const wordList& actualPatchTypes = wordList() + const wordList& actualPatchTypes = wordList(), + const HashTable& fieldSourceTypes = HashTable() ); //- Constructor given IOobject, mesh, dimensioned @@ -185,7 +196,7 @@ public: const IOobject&, const Mesh&, const dimensioned&, - const word& patchFieldType=PatchField::calculatedType() + const word& patchFieldType = PatchField::calculatedType() ); //- Constructor given IOobject, mesh, dimensioned @@ -196,7 +207,8 @@ public: const Mesh&, const dimensioned&, const wordList& wantedPatchTypes, - const wordList& actualPatchTypes = wordList() + const wordList& actualPatchTypes = wordList(), + const HashTable& fieldSourceTypes = HashTable() ); //- Constructor from components @@ -204,7 +216,8 @@ public: ( const IOobject&, const Internal&, - const PtrList>& + const PtrList>&, + const HashPtrTable& = HashPtrTable() ); //- Constructor from components @@ -214,7 +227,8 @@ public: const Mesh&, const dimensionSet&, const Field&, - const PtrList>& + const PtrList>&, + const HashPtrTable& = HashPtrTable() ); //- Construct and read given IOobject @@ -283,7 +297,8 @@ public: const IOobject&, const GeometricField&, const wordList& patchFieldTypes, - const wordList& actualPatchTypes = wordList() + const wordList& actualPatchTypes = wordList(), + const HashTable& fieldSourceTypes = HashTable() ); //- Construct as copy resetting IO parameters and boundary types @@ -292,7 +307,8 @@ public: const IOobject&, const tmp>&, const wordList& patchFieldTypes, - const wordList& actualPatchTypes = wordList() + const wordList& actualPatchTypes = wordList(), + const HashTable& fieldSourceTypes = HashTable() ); //- Clone @@ -307,7 +323,8 @@ public: ( const word& name, const Internal&, - const PtrList>& + const PtrList>&, + const HashPtrTable& = HashPtrTable() ); //- Return a temporary field constructed from name, mesh, dimensionSet @@ -317,7 +334,7 @@ public: const word& name, const Mesh&, const dimensionSet&, - const word& patchFieldType=PatchField::calculatedType() + const word& patchFieldType = PatchField::calculatedType() ); //- Return a temporary field constructed from mesh, dimensioned @@ -327,7 +344,7 @@ public: const word& name, const Mesh&, const dimensioned&, - const word& patchFieldType=PatchField::calculatedType() + const word& patchFieldType = PatchField::calculatedType() ); //- Return a temporary field constructed from mesh, dimensioned @@ -338,7 +355,8 @@ public: const Mesh&, const dimensioned&, const wordList& patchFieldTypes, - const wordList& actualPatchTypes = wordList() + const wordList& actualPatchTypes = wordList(), + const HashTable& fieldSourceTypes = HashTable() ); //- Rename temporary field and return @@ -353,7 +371,7 @@ public: ( const word& newName, const tmp>&, - const word& + const word& patchFieldType ); //- Rename and reset patch fields types of temporary field and return @@ -362,7 +380,8 @@ public: const word& newName, const tmp>&, const wordList& patchFieldTypes, - const wordList& actualPatchTypes = wordList() + const wordList& actualPatchTypes = wordList(), + const HashTable& fieldSourceTypes = HashTable() ); @@ -401,6 +420,9 @@ public: //- Return const-reference to the boundary field inline const Boundary& boundaryField() const; + //- Return const-reference to the sources + inline const Sources& sources() const; + //- Return the time index of the field inline label timeIndex() const; diff --git a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricFieldI.H b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricFieldI.H index 67143f3d18..1b88057180 100644 --- a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricFieldI.H +++ b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricFieldI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -63,6 +63,15 @@ Foam::GeometricField::boundaryField() const } +template class PatchField, class GeoMesh> +inline const typename +Foam::GeometricField::Sources& +Foam::GeometricField::sources() const +{ + return sources_; +} + + template class PatchField, class GeoMesh> inline Foam::label Foam::GeometricField::timeIndex() const diff --git a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricFieldSources.C b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricFieldSources.C new file mode 100644 index 0000000000..b2678e2bd9 --- /dev/null +++ b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricFieldSources.C @@ -0,0 +1,260 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2023 OpenFOAM Foundation + \\/ 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 "GeometricFieldSources.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +Foam::GeometricFieldSources::GeometricFieldSources() +: + HashPtrTable(), + errorLocation_() +{} + + +template +Foam::GeometricFieldSources::GeometricFieldSources +( + const DimensionedField& iF, + const HashPtrTable& mtf +) +: + HashPtrTable(mtf.capacity()), + errorLocation_() +{ + forAllConstIter(typename HashPtrTable, mtf, iter) + { + this->set(iter.key(), iter()->clone(iF).ptr()); + } +} + + +template +Foam::GeometricFieldSources::GeometricFieldSources +( + const DimensionedField& iF, + const GeometricFieldSources& mtf +) +: + GeometricFieldSources(iF, static_cast&>(mtf)) +{} + + +template +Foam::GeometricFieldSources::GeometricFieldSources +( + const DimensionedField& iF, + const dictionary& dict +) +: + HashPtrTable(), + errorLocation_() +{ + readField(iF, dict); +} + + +template +Foam::GeometricFieldSources::GeometricFieldSources +( + const DimensionedField& iF, + const HashTable& types +) +: + HashPtrTable(), + errorLocation_() +{ + forAllConstIter(typename HashTable, types, iter) + { + this->set + ( + iter.key(), + Source::New(iter(), iF).ptr() + ); + } +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +template +Foam::GeometricFieldSources:: +~GeometricFieldSources() +{} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +template +const Foam::HashPtrTable +< + typename Foam::GeometricFieldSources::Source +>& +Foam::GeometricFieldSources::table() const +{ + return *this; +} + + +template +Foam::HashPtrTable +< + typename Foam::GeometricFieldSources::Source +>& +Foam::GeometricFieldSources::table() +{ + return *this; +} + + +template +Foam::HashTable +Foam::GeometricFieldSources::types() const +{ + HashTable result; + + forAllConstIter(typename HashPtrTable, *this, iter) + { + result.insert(iter.key(), iter()->type()); + } + + return result; +} + + +template +void Foam::GeometricFieldSources::readField +( + const DimensionedField& field, + const dictionary& dict +) +{ + this->clear(); + + errorLocation_ = IOerrorLocation(dict); + + forAllConstIter(dictionary, dict, iter) + { + if (iter().isDict()) + { + this->set + ( + iter().keyword(), + Source::New(field, iter().dict()).ptr() + ); + } + } +} + + +template +void Foam::GeometricFieldSources::reset +( + const GeometricFieldSources& mtf +) +{ + this->clear(); + + if (mtf.empty()) return; + + const DimensionedField& iF = + (**mtf.HashPtrTable::begin()).internalField(); + + errorLocation_ = mtf.errorLocation_; + + forAllConstIter(typename HashPtrTable, mtf, iter) + { + this->set(iter.key(), iter()->clone(iF).ptr()); + } +} + + +template +void Foam::GeometricFieldSources::writeEntry +( + const word& keyword, + Ostream& os +) const +{ + os << keyword << nl << token::BEGIN_BLOCK << incrIndent << nl; + + forAllConstIter(typename HashPtrTable, *this, iter) + { + os << indent << iter.key() << nl + << indent << token::BEGIN_BLOCK << nl + << incrIndent << *iter() << decrIndent + << indent << token::END_BLOCK << endl; + } + + os << decrIndent << token::END_BLOCK << endl; + + // Check state of IOstream + os.check + ( + "GeometricFieldSources::" + "writeEntry(const word& keyword, Ostream& os) const" + ); +} + + +// * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * * // + +template +const typename Foam::GeometricFieldSources::Source& +Foam::GeometricFieldSources::operator[] +( + const word& sourceName +) const +{ + typename HashPtrTable::const_iterator iter = this->find(sourceName); + + if (iter == this->end()) + { + FatalIOErrorInFunction(errorLocation_) + << "Cannot find fieldSource entry for " << sourceName + << exit(FatalIOError); + } + + return **iter; +} + + +// * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * * // + +template +Foam::Ostream& Foam::operator<< +( + Ostream& os, + const GeometricFieldSources& bf +) +{ + typedef typename GeoMesh::template FieldSource Source; + os << static_cast&>(bf); + return os; +} + + +// ************************************************************************* // diff --git a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricFieldSources.H b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricFieldSources.H new file mode 100644 index 0000000000..ca649931b0 --- /dev/null +++ b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricFieldSources.H @@ -0,0 +1,252 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2023 OpenFOAM Foundation + \\/ 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::GeometricFieldSources + +Description + Part of a geometric field used for setting the values associated with + optional sources + +SourceFiles + GeometricFieldSources.C + +\*---------------------------------------------------------------------------*/ + +#ifndef GeometricFieldSources_H +#define GeometricFieldSources_H + +#include "dimensionedTypes.H" +#include "DimensionedField.H" +#include "HashPtrTable.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +class dictionary; + +/*---------------------------------------------------------------------------*\ + Class GeometricFieldSources Declaration +\*---------------------------------------------------------------------------*/ + +template +class GeometricFieldSources +: + private HashPtrTable> +{ +public: + + // Public Typedefs + + //- Type of the internal field from which this GeometricField is derived + typedef DimensionedField Internal; + + //- Type of the field source of which this field sources is composed + typedef typename GeoMesh::template FieldSource Source; + + +private: + + // Private Data + + //- Cached IO error location for delayed error messages + IOerrorLocation errorLocation_; + + +public: + + // Constructors + + //- Construct null + GeometricFieldSources(); + + //- Construct from a table of field sources + GeometricFieldSources(const Internal&, const HashPtrTable&); + + //- Construct as copy setting the reference to the internal field + GeometricFieldSources(const Internal&, const GeometricFieldSources&); + + //- Construct from dictionary + GeometricFieldSources(const Internal&, const dictionary&); + + //- Construct from types + GeometricFieldSources(const Internal&, const HashTable&); + + //- Copy constructor deleted + // as it would not set the internalField reference correctly + GeometricFieldSources(const GeometricFieldSources&) = delete; + + //- Move constructor deleted + // as it would not set the internalField reference correctly + GeometricFieldSources(GeometricFieldSources&&) = delete; + + + //- Destructor + ~GeometricFieldSources(); + + + // Member Functions + + //- Access the underlying field table + const HashPtrTable& table() const; + + //- Access the underlying field table + HashPtrTable& table(); + + //- Inherit empty test + using HashPtrTable::empty; + + //- Return a map from the source name to the field source type + HashTable types() const; + + //- Read the sources + void readField(const Internal& field, const dictionary& dict); + + //- Reset the boundary field contents to the given field + // Used for mesh to mesh mapping + void reset(const GeometricFieldSources&); + + //- Write sources as dictionary entry + void writeEntry(const word& keyword, Ostream& os) const; + + + // Member operators + + //- Find and return a field source + const Source& operator[](const word& sourceName) const; +}; + + +template +Ostream& operator<< +( + Ostream&, + const GeometricFieldSources& +); + + +/*---------------------------------------------------------------------------*\ + Class NoFieldSource Declaration +\*---------------------------------------------------------------------------*/ + +template +class NoFieldSource +{ + // Private Data + + //- Reference to internal field + const DimensionedField& internalField_; + + +public: + + // Constructors + + //- Construct from internal field + NoFieldSource + ( + const DimensionedField& iF + ) + : + internalField_(iF) + {} + + //- Dummy clone + autoPtr> clone + ( + const DimensionedField& iF + ) const + { + return + autoPtr> + ( + new NoFieldSource(iF) + ); + } + + + // Selectors + + //- Dummy selector + static autoPtr> New + ( + const word& fieldSourceType, + const DimensionedField& iF + ) + { + return + autoPtr> + ( + new NoFieldSource(iF) + ); + } + + //- Dummy selector + static autoPtr> New + ( + const DimensionedField& iF, + const dictionary& dict + ) + { + return + autoPtr> + ( + new NoFieldSource(iF) + ); + } + + + // Member Functions + + //- Return the internal field reference + const DimensionedField& internalField() const + { + return internalField_; + } +}; + + +template +Ostream& operator<<(Ostream& os, const NoFieldSource&) +{ + return os; +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository + #include "GeometricFieldSources.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/OpenFOAM/fields/GeometricFields/pointFields/pointFieldsFwd.H b/src/OpenFOAM/fields/GeometricFields/pointFields/pointFieldsFwd.H index 24130d0d72..31ba8dfe45 100644 --- a/src/OpenFOAM/fields/GeometricFields/pointFields/pointFieldsFwd.H +++ b/src/OpenFOAM/fields/GeometricFields/pointFields/pointFieldsFwd.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -48,12 +48,18 @@ class pointMesh; template class pointPatchField; +template +class NoFieldSource; + template class PatchField, class GeoMesh> class GeometricField; template using PointField = GeometricField; +template +using pointFieldSource = NoFieldSource; + typedef PointField