From 67cf9ca6606476c5990396dcaabd9931a991a0f6 Mon Sep 17 00:00:00 2001 From: andy Date: Tue, 1 Jun 2010 15:26:04 +0100 Subject: [PATCH 1/8] STYLE: use of notImplemented() --- .../parcels/Templates/KinematicParcel/KinematicParcel.C | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.C b/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.C index 4d89dedde1..d5e202a188 100644 --- a/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.C +++ b/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.C @@ -315,18 +315,15 @@ bool Foam::KinematicParcel::move(TrackData& td) case TrackData::tpRotationalTrack: { - Info<< "No rotational tracking implementation" << endl; + notImplemented("TrackData::tpRotationalTrack"); break; } default: { - FatalErrorIn - ( - "KinematicParcel::move(TrackData& td)" - ) << td.part() - << " is an invalid part of the tracking method." + FatalErrorIn("KinematicParcel::move(TrackData& td)") + << td.part() << " is an invalid part of the tracking method." << abort(FatalError); } } From 81189ebd4c092f886e51a5628d845452a7612434 Mon Sep 17 00:00:00 2001 From: andy Date: Tue, 1 Jun 2010 15:26:56 +0100 Subject: [PATCH 2/8] ENH: wallHeatFlux utility - using basicPsiThermo instead of hCombustionThermo --- .../utilities/postProcessing/wall/wallHeatFlux/createFields.H | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/applications/utilities/postProcessing/wall/wallHeatFlux/createFields.H b/applications/utilities/postProcessing/wall/wallHeatFlux/createFields.H index 64eac51eaa..609d4c3776 100644 --- a/applications/utilities/postProcessing/wall/wallHeatFlux/createFields.H +++ b/applications/utilities/postProcessing/wall/wallHeatFlux/createFields.H @@ -1,6 +1,6 @@ -autoPtr thermo +autoPtr thermo ( - hCombustionThermo::New(mesh) + basicPsiThermo::New(mesh) ); const volScalarField& h = thermo->h(); From ad18857c8b5315b7b68529caf20460bcb48984d7 Mon Sep 17 00:00:00 2001 From: andy Date: Tue, 1 Jun 2010 15:27:40 +0100 Subject: [PATCH 3/8] STYLE: minor code formatting --- .../KinematicParcel/CollisionRecordList/CollisionRecordList.C | 1 + src/mesh/blockMesh/curvedEdges/polyLine.H | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/CollisionRecordList/CollisionRecordList.C b/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/CollisionRecordList/CollisionRecordList.C index f0b4804cf5..f5d321a023 100644 --- a/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/CollisionRecordList/CollisionRecordList.C +++ b/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/CollisionRecordList/CollisionRecordList.C @@ -108,4 +108,5 @@ void Foam::CollisionRecordList::update() DynamicList >::operator=(updatedRecords); } + // ************************************************************************* // diff --git a/src/mesh/blockMesh/curvedEdges/polyLine.H b/src/mesh/blockMesh/curvedEdges/polyLine.H index 07b55b231b..c27556b066 100644 --- a/src/mesh/blockMesh/curvedEdges/polyLine.H +++ b/src/mesh/blockMesh/curvedEdges/polyLine.H @@ -62,6 +62,7 @@ class polyLine //- Disallow default bitwise assignment void operator=(const polyLine&); + protected: // Protected data @@ -75,17 +76,18 @@ protected: //- The rational (0-1) cumulative parameter value for each point scalarList param_; + // Protected Member Functions //- Precalculate the rational cumulative parameter value // and the line-length void calcParam(); - //- Return the line segment and the local parameter [0..1] // corresponding to the global lambda [0..1] label localParameter(scalar& lambda) const; + public: // Constructors From a850467bb6bd2dacc328d3806396991eea515368 Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 21 Jun 2010 17:01:56 +0100 Subject: [PATCH 4/8] BUG: removed redundant newDispersionModel.C file --- .../dispersionModel/newDispersionModel.C | 75 ------------------- 1 file changed, 75 deletions(-) delete mode 100644 src/lagrangian/dieselSpray/spraySubModels/dispersionModel/dispersionModel/newDispersionModel.C diff --git a/src/lagrangian/dieselSpray/spraySubModels/dispersionModel/dispersionModel/newDispersionModel.C b/src/lagrangian/dieselSpray/spraySubModels/dispersionModel/dispersionModel/newDispersionModel.C deleted file mode 100644 index 4c3c6664d2..0000000000 --- a/src/lagrangian/dieselSpray/spraySubModels/dispersionModel/dispersionModel/newDispersionModel.C +++ /dev/null @@ -1,75 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-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 "error.H" - -#include "dispersionModel.H" -#include "noDispersion.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -autoPtr dispersionModel::New -( - const dictionary& dict, - spray& sm -) -{ - word dispersionModelType - ( - dict.lookup("dispersionModel") - ); - - Info<< "Selecting dispersionModel " - << dispersionModelType << endl; - - dictionaryConstructorTable::iterator cstrIter = - dictionaryConstructorTablePtr_->find(dispersionModelType); - - if (cstrIter == dictionaryConstructorTablePtr_->end()) - { - FatalError - << "dispersionModel::New(const dictionary&, const spray&) : " - << endl - << " unknown dispersionModelType type " - << dispersionModelType - << ", constructor not in hash table" << endl << endl - << " Valid dispersionModel types are :" << endl; - Info<< dictionaryConstructorTablePtr_->sortedToc() << abort(FatalError); - } - - return autoPtr(cstrIter()(dict, sm)); -} - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// ************************************************************************* // From ddcf2ee99735607ee55638af3682873ae7578c01 Mon Sep 17 00:00:00 2001 From: sergio Date: Tue, 22 Jun 2010 15:21:12 +0100 Subject: [PATCH 5/8] ENH: Adding: 1) basicSource for explicit sources(ActuationDisk and explicit source so far) 2) cylindricalInlet BC 3) swirlMassFlowRate BC 4) dynamicLagrangian LES incompressible turbulence model 5) atmospheric boundary layer inlet BC for velocity and epsilon --- src/finiteVolume/Make/files | 10 + .../actuationDiskSource/actuationDiskSource.C | 196 +++++++++ .../actuationDiskSource/actuationDiskSource.H | 213 ++++++++++ .../actuationDiskSourceTemplates.C | 64 +++ .../basicSource/IObasicSourceList.C | 65 +++ .../basicSource/IObasicSourceList.H | 99 +++++ .../basicSource/basicSource/basicSource.C | 292 +++++++++++++ .../basicSource/basicSource/basicSource.H | 384 ++++++++++++++++++ .../basicSource/basicSource/basicSourceI.H | 147 +++++++ .../basicSource/basicSource/basicSourceIO.C | 83 ++++ .../basicSource/basicSource/basicSourceList.C | 180 ++++++++ .../basicSource/basicSource/basicSourceList.H | 137 +++++++ .../explicitSource/explicitSource.C | 321 +++++++++++++++ .../explicitSource/explicitSource.H | 289 +++++++++++++ .../explicitSource/explicitSourceI.H | 49 +++ .../explicitSource/explicitSourceIO.C | 83 ++++ ...lindricalInletVelocityFvPatchVectorField.C | 173 ++++++++ ...lindricalInletVelocityFvPatchVectorField.H | 175 ++++++++ ...sFlowRateInletVelocityFvPatchVectorField.H | 2 +- .../incompressible/LES/Make/files | 1 + .../LES/dynLagrangian/dynLagrangian.C | 194 +++++++++ .../LES/dynLagrangian/dynLagrangian.H | 184 +++++++++ .../incompressible/RAS/Make/files | 4 +- ...daryLayerInletEpsilonFvPatchScalarField.C} | 46 ++- ...daryLayerInletEpsilonFvPatchScalarField.H} | 42 +- ...aryLayerInletVelocityFvPatchVectorField.C} | 86 +++- ...aryLayerInletVelocityFvPatchVectorField.H} | 50 ++- 27 files changed, 3489 insertions(+), 80 deletions(-) create mode 100644 src/finiteVolume/cfdTools/general/fieldSources/basicSource/actuationDiskSource/actuationDiskSource.C create mode 100644 src/finiteVolume/cfdTools/general/fieldSources/basicSource/actuationDiskSource/actuationDiskSource.H create mode 100644 src/finiteVolume/cfdTools/general/fieldSources/basicSource/actuationDiskSource/actuationDiskSourceTemplates.C create mode 100644 src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/IObasicSourceList.C create mode 100644 src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/IObasicSourceList.H create mode 100644 src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/basicSource.C create mode 100644 src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/basicSource.H create mode 100644 src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/basicSourceI.H create mode 100644 src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/basicSourceIO.C create mode 100644 src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/basicSourceList.C create mode 100644 src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/basicSourceList.H create mode 100644 src/finiteVolume/cfdTools/general/fieldSources/basicSource/explicitSource/explicitSource.C create mode 100644 src/finiteVolume/cfdTools/general/fieldSources/basicSource/explicitSource/explicitSource.H create mode 100644 src/finiteVolume/cfdTools/general/fieldSources/basicSource/explicitSource/explicitSourceI.H create mode 100644 src/finiteVolume/cfdTools/general/fieldSources/basicSource/explicitSource/explicitSourceIO.C create mode 100644 src/finiteVolume/fields/fvPatchFields/derived/cylindricalInletVelocity/cylindricalInletVelocityFvPatchVectorField.C create mode 100644 src/finiteVolume/fields/fvPatchFields/derived/cylindricalInletVelocity/cylindricalInletVelocityFvPatchVectorField.H create mode 100644 src/turbulenceModels/incompressible/LES/dynLagrangian/dynLagrangian.C create mode 100644 src/turbulenceModels/incompressible/LES/dynLagrangian/dynLagrangian.H rename src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/{ABLInletEpsilon/ABLInletEpsilonFvPatchScalarField.C => atmBoundaryLayerInletEpsilon/atmBoundaryLayerInletEpsilonFvPatchScalarField.C} (72%) rename src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/{ABLInletEpsilon/ABLInletEpsilonFvPatchScalarField.H => atmBoundaryLayerInletEpsilon/atmBoundaryLayerInletEpsilonFvPatchScalarField.H} (78%) rename src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/{ABLInletVelocity/ABLInletVelocityFvPatchVectorField.C => atmBoundaryLayerInletVelocity/atmBoundaryLayerInletVelocityFvPatchVectorField.C} (60%) rename src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/{ABLInletVelocity/ABLInletVelocityFvPatchVectorField.H => atmBoundaryLayerInletVelocity/atmBoundaryLayerInletVelocityFvPatchVectorField.H} (77%) diff --git a/src/finiteVolume/Make/files b/src/finiteVolume/Make/files index c7e13255f6..74a7a60433 100644 --- a/src/finiteVolume/Make/files +++ b/src/finiteVolume/Make/files @@ -157,6 +157,7 @@ $(derivedFvPatchFields)/uniformFixedValue/uniformFixedValueFvPatchFields.C $(derivedFvPatchFields)/waveTransmissive/waveTransmissiveFvPatchFields.C $(derivedFvPatchFields)/uniformDensityHydrostaticPressure/uniformDensityHydrostaticPressureFvPatchScalarField.C $(derivedFvPatchFields)/swirlMassFlowRateInletVelocity/swirlMassFlowRateInletVelocityFvPatchVectorField.C +$(derivedFvPatchFields)/cylindricalInletVelocity/cylindricalInletVelocityFvPatchVectorField.C fvsPatchFields = fields/fvsPatchFields $(fvsPatchFields)/fvsPatchField/fvsPatchFields.C @@ -355,4 +356,13 @@ fieldSources = $(general)/fieldSources $(fieldSources)/pressureGradientExplicitSource/pressureGradientExplicitSource.C $(fieldSources)/timeActivatedExplicitSource/timeActivatedExplicitSource.C +basicSource = $(general)/fieldSources/basicSource +$(basicSource)/basicSource/basicSource.C +$(basicSource)/basicSource/basicSourceIO.C +$(basicSource)/basicSource/basicSourceList.C +$(basicSource)/basicSource/IObasicSourceList.C +$(basicSource)/actuationDiskSource/actuationDiskSource.C +$(basicSource)/explicitSource/explicitSource.C + + LIB = $(FOAM_LIBBIN)/libfiniteVolume diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/actuationDiskSource/actuationDiskSource.C b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/actuationDiskSource/actuationDiskSource.C new file mode 100644 index 0000000000..44f46f9de3 --- /dev/null +++ b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/actuationDiskSource/actuationDiskSource.C @@ -0,0 +1,196 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*----------------------------------------------------------------------------*/ + +#include "actuationDiskSource.H" +#include "fvMesh.H" +#include "fvMatrices.H" +#include "geometricOneField.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + +defineTypeNameAndDebug(actuationDiskSource, 0); +addToRunTimeSelectionTable(basicSource, actuationDiskSource, dictionary); + +} + + +// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +void Foam::actuationDiskSource::checkData() +{ + if + ( + magSqr(diskArea_) <= VSMALL + || Cp_ <= VSMALL + || Ct_ <= VSMALL + || diskDir_ == vector::zero + ) + { + FatalIOErrorIn + ( + "Foam::actuationDiskSource::checkData()", + dict_ + ) << "diskArea, Cp or Ct is small " + << "or disk direction not specified" + << exit(FatalIOError); + } +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::actuationDiskSource::actuationDiskSource +( + const word& name, + const dictionary& dict, + const fvMesh& mesh +) +: + basicSource(name, dict, mesh), + cellZoneID_(mesh.cellZones().findZoneID(this->cellSetName())), + diskDir_(vector::zero), + Cp_(0), + Ct_(0), + diskArea_(0), + dict_(dict.subDict(typeName + "Coeffs")) +{ + Info<< " - creating actuation disk zone: " + << this->name() << endl; + + bool foundZone = (cellZoneID_ != -1); + + reduce(foundZone, orOp()); + + if (!foundZone && Pstream::master()) + { + FatalErrorIn + ( + "Foam::actuationDiskSource::actuationDiskSource" + "(const word&, const dictionary&, const fvMesh&)" + ) << "cannot find porous cellZone " << this->name() + << exit(FatalError); + } + + dict_.readIfPresent("diskDir", diskDir_); + dict_.readIfPresent("Cp", Cp_); + dict_.readIfPresent("Ct", Ct_); + dict_.readIfPresent("diskArea", diskArea_); + + checkData(); +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::actuationDiskSource::addSu(fvMatrix& UEqn) +{ + if (cellZoneID_ == -1) + { + return; + } + + bool compressible = false; + if (UEqn.dimensions() == dimensionSet(1, 1, -2, 0, 0)) + { + compressible = true; + } + + const labelList& cells = mesh_.cellZones()[cellZoneID_]; + const scalarField& V = this->mesh().V(); + vectorField& Usource = UEqn.source(); + const vectorField& U = UEqn.psi(); + + if (compressible) + { + addActuationDiskAxialInertialResistance + ( + Usource, + cells,//this->cells(), + V, + this->mesh().lookupObject("rho"), + U + ); + } + else + { + addActuationDiskAxialInertialResistance + ( + Usource, + cells,//this->cells(), + V, + geometricOneField(), + U + ); + } +} + + +void Foam::actuationDiskSource::writeData(Ostream& os) const +{ + + os << indent << token::BEGIN_BLOCK << incrIndent << nl; + os.writeKeyword("name") << this->name() << token::END_STATEMENT << nl; + + if (dict_.found("note")) + { + os.writeKeyword("note") << string(dict_.lookup("note")) + << token::END_STATEMENT << nl; + } + + os << indent << "actuationDisk"; + + dict_.write(os); + + os << decrIndent << indent << token::END_BLOCK << endl; +} + + +bool Foam::actuationDiskSource::read(const dictionary& dict) +{ + if (basicSource::read(dict)) + { + const dictionary& sourceDict = dict.subDict(name()); + const dictionary& subDictCoeffs = + sourceDict.subDict(typeName + "Coeffs"); + subDictCoeffs.readIfPresent("diskDir", diskDir_); + subDictCoeffs.readIfPresent("Cp", Cp_); + subDictCoeffs.readIfPresent("Ct", Ct_); + subDictCoeffs.readIfPresent("diskArea", diskArea_); + + checkData(); + + return true; + } + else + { + return false; + } +} +// ************************************************************************* // diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/actuationDiskSource/actuationDiskSource.H b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/actuationDiskSource/actuationDiskSource.H new file mode 100644 index 0000000000..661fc99a54 --- /dev/null +++ b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/actuationDiskSource/actuationDiskSource.H @@ -0,0 +1,213 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + Foam::actuationDiskSource + +Description + Actuation disk zone definition. + Constant values for momentum source for actuation disk + + T = 2*rho*A*sqr(Uo)*a*(1-a) + U1 = (1 -a)Uo + where: + A: disk area + Uo: upstream velocity + a: 1 - Cp/Ct + U1: velocity at the disk + +SourceFiles + actuationDiskSource.C + actuationDiskSourceTemplates.C + +\*---------------------------------------------------------------------------*/ + +#ifndef actuationDiskSource_H +#define actuationDiskSource_H + +#include "IOdictionary.H" +#include "coordinateSystem.H" +#include "coordinateSystems.H" +#include "wordList.H" +#include "labelList.H" +#include "DimensionedField.H" +#include "volFieldsFwd.H" +#include "fvMatricesFwd.H" +#include "basicSource.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class actuationDiskSource Declaration +\*---------------------------------------------------------------------------*/ + +class actuationDiskSource +: + public basicSource +{ + // Private data + + //- Cell zone ID + label cellZoneID_; + + //- Disk area normal + vector diskDir_; + + //- Power coefficient + scalar Cp_; + + //- Thrust coefficient + scalar Ct_; + + //- Disk area + scalar diskArea_; + + //- Sub dictionary with actuationDisk information + const dictionary& dict_; + + + // Private Member Functions + + //- Check data + void checkData(); + + //- Add resistance to the UEqn + template + void addActuationDiskAxialInertialResistance + ( + vectorField& Usource, + const labelList& cells, + const scalarField& V, + const RhoFieldType& rho, + const vectorField& U + ) const; + + //- Disallow default bitwise copy construct + actuationDiskSource(const actuationDiskSource&); + + //- Disallow default bitwise assignment + void operator=(const actuationDiskSource&); + + +public: + + //- Runtime type information + TypeName("actuationDiskSource"); + + + // Constructors + + //- Construct from components + actuationDiskSource + ( + const word& name, + const dictionary& dict, + const fvMesh& mesh + ); + + + //- Destructor + virtual ~actuationDiskSource() + {} + + + // Member Functions + + // Access + + //- cellZone number + label zoneId() const + { + return cellZoneID_; + } + + //- Return Cp + scalar Cp() const + { + return Cp_; + } + + //- Return Ct + scalar Ct() const + { + return Ct_; + } + + //- Normal disk direction + const vector& diskDir() const + { + return diskDir_; + } + + //- Disk area + scalar diskArea() const + { + return diskArea_; + } + + + // Public Functions + + //-Source term to fvMatrix + virtual void addSu(fvMatrix& UEqn); + + //-Source term to fvMatrix + virtual void addSu(fvMatrix& UEqn){} + + //- Add all explicit source + virtual void addExplicitSources(){} + + //- Add source to scalar field + virtual void addSu(DimensionedField& field){} + + //- Add source to vector field + virtual void addSu(DimensionedField& field){} + + + // I-O + + //- Write data + virtual void writeData(Ostream&) const; + + //- Read dictionary + virtual bool read(const dictionary& dict); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +# include "actuationDiskSourceTemplates.C" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/actuationDiskSource/actuationDiskSourceTemplates.C b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/actuationDiskSource/actuationDiskSourceTemplates.C new file mode 100644 index 0000000000..17fcbf6fd0 --- /dev/null +++ b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/actuationDiskSource/actuationDiskSourceTemplates.C @@ -0,0 +1,64 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*----------------------------------------------------------------------------*/ + +#include "actuationDiskSource.H" +#include "volFields.H" +#include "fvMatrix.H" +#include "fvm.H" + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +void Foam::actuationDiskSource::addActuationDiskAxialInertialResistance +( + vectorField& Usource, + const labelList& cells, + const scalarField& V, + const RhoFieldType& rho, + const vectorField& U +) const +{ + scalar a = 1.0 - Cp_/Ct_; + scalar totVol = 0.0; + scalarField T(cells.size()); + vector uniDiskDir = diskDir_/mag(diskDir_); + tensor E(tensor::zero); + E.xx() = uniDiskDir.x(); + E.yy() = uniDiskDir.y(); + E.zz() = uniDiskDir.z(); + vectorField U1 = (1.0 - a)*U; + forAll(cells, i) + { + totVol += V[cells[i]]; + T[i] = 2.0*rho[cells[i]]*diskArea_*mag(U1[cells[i]])*a/(1.0 - a); + } + forAll(cells, i) + { + Usource[cells[i]] += ((V[cells[i]]/totVol)*T[i]*E) & U1[cells[i]]; + } +} + +// ************************************************************************* // diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/IObasicSourceList.C b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/IObasicSourceList.C new file mode 100644 index 0000000000..8ce372e8ff --- /dev/null +++ b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/IObasicSourceList.C @@ -0,0 +1,65 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 "IObasicSourceList.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::IObasicSourceList::IObasicSourceList +( + const fvMesh& mesh +) +: + IOdictionary + ( + IOobject + ( + "sourcesProperties", + mesh.time().constant(), + mesh, + IOobject::MUST_READ, + IOobject::NO_WRITE + ) + ), + basicSourceList(mesh, *this) +{} + + +bool Foam::IObasicSourceList::read() +{ + if (regIOobject::read()) + { + basicSourceList::read(*this); + return true; + } + else + { + return false; + } +} + + +// ************************************************************************* // + diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/IObasicSourceList.H b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/IObasicSourceList.H new file mode 100644 index 0000000000..c291c37356 --- /dev/null +++ b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/IObasicSourceList.H @@ -0,0 +1,99 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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::IObasicSourceList + +Description + IObasicSourceList + +SourceFiles + IObasicSourceList.C + +\*---------------------------------------------------------------------------*/ + +#ifndef IObasicSourceList_H +#define IObasicSourceList_H + +#include "basicSourceList.H" +#include "IOdictionary.H" +#include "autoPtr.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class IObasicSourceList Declaration +\*---------------------------------------------------------------------------*/ + +class IObasicSourceList +: + public IOdictionary, + public basicSourceList +{ +private: + + // Private Member Functions + + //- Disallow default bitwise copy construct + IObasicSourceList + ( + const IObasicSourceList& + ); + + //- Disallow default bitwise assignment + void operator=(const IObasicSourceList&); + + +public: + + // Constructors + + //- Construct from components with list of field names + IObasicSourceList + ( + const fvMesh& mesh + ); + + + // Destructor + virtual ~IObasicSourceList() + {} + + + //- Read dictionary + virtual bool read(); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/basicSource.C b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/basicSource.C new file mode 100644 index 0000000000..d74ce2b352 --- /dev/null +++ b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/basicSource.C @@ -0,0 +1,292 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 "basicSource.H" +#include "fvMesh.H" +#include "volFields.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(basicSource, 0); + defineRunTimeSelectionTable(basicSource, dictionary); +} + + +// * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * * // + +const Foam::wordList Foam::basicSource:: +selectionModeTypeNames_ +( + IStringStream("(points cellSet cellZone all)")() +); + + +// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // + +Foam::basicSource::selectionModeType +Foam::basicSource::wordToSelectionModeType +( + const word& smtName +) const +{ + forAll(selectionModeTypeNames_, i) + { + if (smtName == selectionModeTypeNames_[i]) + { + return selectionModeType(i); + } + } + + FatalErrorIn + ( + "basicSource::selectionModeType" + "basicSource::wordToSelectionModeType" + "(" + "const word&" + ")" + ) << "Unknown selectionMode type " << smtName + << ". Valid selectionMode types are:" << nl << selectionModeTypeNames_ + << exit(FatalError); + + return selectionModeType(0); +} + + +Foam::word Foam::basicSource::selectionModeTypeToWord +( + const selectionModeType& smtType +) const +{ + if (smtType > selectionModeTypeNames_.size()) + { + return "UNKNOWN"; + } + else + { + return selectionModeTypeNames_[smtType]; + } +} + + +void Foam::basicSource::setSelection +( + const dictionary& dict +) +{ + switch (selectionMode_) + { + case smPoints: + { + //Do nothing. It should be sorted out by derived class// + break; + } + case smCellSet: + { + dict.lookup("cellSet") >> cellSetName_; + break; + } + case smCellZone: + { + dict.lookup("cellZone") >> cellSetName_; + break; + } + case smAll: + { + break; + } + default: + { + FatalErrorIn + ( + "basicSource::setSelection(const dictionary&)" + ) << "Unknown selectionMode " + << selectionModeTypeNames_[selectionMode_] + << ". Valid selectionMode types are" << selectionModeTypeNames_ + << exit(FatalError); + } + } +} + + +void Foam::basicSource::setCellSet() +{ + Info<< incrIndent << indent << "Source: " << name_ << endl; + switch (selectionMode_) + { + case smPoints: + { + break; + } + case smCellSet: + { + Info<< indent << "- selecting cells using cellSet " + << cellSetName_ << endl; + + cellSet selectedCells(mesh_, cellSetName_); + cells_ = selectedCells.toc(); + + break; + } + case smCellZone: + { + Info<< indent << "- selecting cells using cellZone " + << cellSetName_ << endl; + label zoneID = mesh_.cellZones().findZoneID(cellSetName_); + if (zoneID == -1) + { + FatalErrorIn("basicSource::setCellIds()") + << "Cannot find cellZone " << cellSetName_ << endl + << "Valid cellZones are " << mesh_.cellZones().names() + << exit(FatalError); + } + cells_ = mesh_.cellZones()[zoneID]; + + break; + } + case smAll: + { + Info<< indent << "- selecting all cells" << endl; + cells_ = identity(mesh_.nCells()); + + break; + } + default: + { + FatalErrorIn("basicSource::setCellIds()") + << "Unknown selectionMode " + << selectionModeTypeNames_[selectionMode_] + << ". Valid selectionMode types are" << selectionModeTypeNames_ + << exit(FatalError); + } + } + + // Set volume information + if (selectionMode_ != smPoints) + { + V_ = 0.0; + forAll(cells_, i) + { + V_ += mesh_.V()[cells_[i]]; + } + reduce(V_, sumOp()); + + Info<< indent << "- selected " + << returnReduce(cells_.size(), sumOp