mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'master' of develop.openfoam.com:Development/OpenFOAM-plus into feature-shared-file
Conflicts: applications/utilities/mesh/advanced/refinementLevel/refinementLevel.C applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/initialPointsMethod/pointFile/pointFile.C applications/utilities/miscellaneous/foamHelp/helpTypes/helpBoundary/helpBoundary.C applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamUpdateInfo.C applications/utilities/postProcessing/graphics/PV4Readers/PV4FoamReader/vtkPV4Foam/vtkPV4FoamUpdateInfo.C applications/utilities/postProcessing/turbulence/createTurbulenceFields/createTurbulenceFields.C applications/utilities/postProcessing/velocityField/Co/Co.C applications/utilities/postProcessing/velocityField/Pe/Pe.C applications/utilities/preProcessing/applyBoundaryLayer/applyBoundaryLayer.C applications/utilities/preProcessing/changeDictionary/changeDictionary.C applications/utilities/preProcessing/setFields/setFields.C applications/utilities/surface/surfaceMeshConvert/surfaceMeshConvert.C applications/utilities/surface/surfaceMeshExport/surfaceMeshExport.C applications/utilities/surface/surfaceMeshImport/surfaceMeshImport.C applications/utilities/surface/surfaceRedistributePar/surfaceRedistributePar.C src/OpenFOAM/db/IOobject/IOobject.C src/OpenFOAM/db/IOobjects/CompactIOList/CompactIOList.C src/OpenFOAM/db/IOobjects/IOField/IOField.C src/OpenFOAM/db/IOobjects/IOList/IOList.C src/OpenFOAM/db/IOobjects/IOPtrList/IOPtrList.C src/OpenFOAM/db/IOobjects/IOdictionary/IOdictionary.C src/OpenFOAM/db/Time/findInstance.C src/OpenFOAM/db/regIOobject/regIOobject.C src/OpenFOAM/db/regIOobject/regIOobjectI.H src/OpenFOAM/db/regIOobject/regIOobjectRead.C src/OpenFOAM/db/regIOobject/regIOobjectWrite.C src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/IOmapDistribute.C src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C src/OpenFOAM/meshes/polyMesh/zones/ZoneMesh/ZoneMesh.C src/dynamicMesh/fvMeshDistribute/IOmapDistributePolyMesh.C src/dynamicMesh/motionSolver/componentDisplacement/componentDisplacementMotionSolver.C src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8/hexRef8Data.C src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8/refinementHistory.C src/dynamicMesh/polyTopoChange/polyTopoChanger/polyTopoChanger.C src/edgeMesh/edgeMeshFormats/edgeMesh/edgeMeshFormat.C src/edgeMesh/extendedEdgeMesh/extendedEdgeMeshFormats/extendedEdgeMeshFormat/extendedEdgeMeshFormat.C src/edgeMesh/extendedEdgeMesh/extendedFeatureEdgeMesh/extendedFeatureEdgeMesh.C src/fvMotionSolver/fvMotionSolvers/displacement/interpolation/displacementInterpolationMotionSolver.C src/fvMotionSolver/pointPatchFields/derived/uniformInterpolatedDisplacement/uniformInterpolatedDisplacementPointPatchVectorField.C src/lagrangian/basic/Cloud/CloudIO.C src/meshTools/sets/cellSources/fieldToCell/fieldToCell.C src/postProcessing/foamCalcFunctions/basic/addSubtract/addSubtract.C src/postProcessing/functionObjects/field/fieldCoordinateSystemTransform/fieldCoordinateSystemTransformTemplates.C src/postProcessing/functionObjects/field/readFields/readFieldsTemplates.C src/thermophysicalModels/radiation/radiationModels/fvDOM/radiativeIntensityRay/radiativeIntensityRay.C src/triSurface/triSurface/surfacePatch/surfacePatchIOList.C
This commit is contained in:
@ -15,4 +15,6 @@ wmake $targetType jobControl
|
||||
wmake $targetType systemCall
|
||||
wmake $targetType utilities
|
||||
|
||||
./graphics/Allwmake
|
||||
|
||||
# ----------------------------------------------------------------- end-of-file
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: dev |
|
||||
| \\ / A nd | Web: www.OpenFOAM.org |
|
||||
| \\ / O peration | Version: plus |
|
||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
|
||||
@ -2,8 +2,8 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2014 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\ / A nd | Copyright (C) 2013-2014 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -49,7 +49,8 @@ Foam::partialWrite::partialWrite
|
||||
)
|
||||
:
|
||||
name_(name),
|
||||
obr_(obr)
|
||||
obr_(obr),
|
||||
log_(true)
|
||||
{
|
||||
read(dict);
|
||||
}
|
||||
@ -65,21 +66,44 @@ Foam::partialWrite::~partialWrite()
|
||||
|
||||
void Foam::partialWrite::read(const dictionary& dict)
|
||||
{
|
||||
log_.readIfPresent("log", dict);
|
||||
dict.lookup("objectNames") >> objectNames_;
|
||||
dict.lookup("writeInterval") >> writeInterval_;
|
||||
writeInstance_ = 0;
|
||||
|
||||
Info<< type() << " " << name() << ":" << nl
|
||||
<< " dumping every " << writeInterval_
|
||||
<< " th outputTime : " << nl << endl ;
|
||||
forAllConstIter(HashSet<word>, objectNames_, iter)
|
||||
if (log_)
|
||||
{
|
||||
Info<< ' ' << iter.key();
|
||||
Info<< type() << " " << name() << ":" << nl
|
||||
<< " dumping every outputTime :";
|
||||
|
||||
forAllConstIter(HashSet<word>, objectNames_, iter)
|
||||
{
|
||||
Info<< ' ' << iter.key();
|
||||
}
|
||||
|
||||
word postStr = "";
|
||||
if (writeInterval_ == 2)
|
||||
{
|
||||
postStr = "nd ";
|
||||
}
|
||||
else if (writeInterval_ == 3)
|
||||
{
|
||||
postStr = "rd ";
|
||||
}
|
||||
else
|
||||
{
|
||||
postStr = "th ";
|
||||
}
|
||||
|
||||
Info<< nl
|
||||
<< " dumping all other fields every "
|
||||
<< writeInterval_ << postStr << " outputTime" << nl
|
||||
<< endl;
|
||||
}
|
||||
|
||||
if (writeInterval_ < 1)
|
||||
{
|
||||
FatalIOErrorIn("partialWrite::read(const dictionary&)", dict)
|
||||
FatalIOErrorInFunction(dict)
|
||||
<< "Illegal value for writeInterval " << writeInterval_
|
||||
<< ". It should be >= 1."
|
||||
<< exit(FatalIOError);
|
||||
@ -111,12 +135,12 @@ void Foam::partialWrite::read(const dictionary& dict)
|
||||
|
||||
void Foam::partialWrite::execute()
|
||||
{
|
||||
// Do nothing - only valid on write
|
||||
}
|
||||
|
||||
|
||||
void Foam::partialWrite::end()
|
||||
{
|
||||
//Pout<< "end at time " << obr_.time().timeName() << endl;
|
||||
// Do nothing - only valid on write
|
||||
}
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -50,6 +50,7 @@ Description
|
||||
type | type name: partialWrite | yes |
|
||||
objectNames | objects to write | yes |
|
||||
writeInterval | write interval | yes |
|
||||
log | Log to standard output | no | yes
|
||||
\endtable
|
||||
|
||||
SeeAlso
|
||||
@ -91,11 +92,15 @@ protected:
|
||||
|
||||
// Private data
|
||||
|
||||
//- Name of this set of partialWrite
|
||||
//- Name of this set of partialWrite object
|
||||
word name_;
|
||||
|
||||
//- Refefence to the database
|
||||
const objectRegistry& obr_;
|
||||
|
||||
//- Switch to send output to Info as well as to file
|
||||
Switch log_;
|
||||
|
||||
//- Loaded fields
|
||||
UPtrList<volScalarField> vsf_;
|
||||
UPtrList<volVectorField> vvf_;
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2013-2014 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -68,7 +68,7 @@ void Foam::partialWrite::loadField
|
||||
<< " found in database" << endl;
|
||||
}
|
||||
|
||||
sfType& sField =
|
||||
sfType& sField =
|
||||
const_cast<sfType&>
|
||||
(
|
||||
obr_.lookupObject<sfType>(fieldName)
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2013-2014 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -31,7 +31,7 @@ License
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(removeRegisteredObject, 0);
|
||||
defineTypeNameAndDebug(removeRegisteredObject, 0);
|
||||
}
|
||||
|
||||
|
||||
@ -47,7 +47,8 @@ Foam::removeRegisteredObject::removeRegisteredObject
|
||||
:
|
||||
name_(name),
|
||||
obr_(obr),
|
||||
objectNames_()
|
||||
objectNames_(),
|
||||
log_(true)
|
||||
{
|
||||
read(dict);
|
||||
}
|
||||
@ -78,7 +79,8 @@ void Foam::removeRegisteredObject::execute()
|
||||
|
||||
if (obj.ownedByRegistry())
|
||||
{
|
||||
Info<< type() << " " << name_ << " output:" << nl
|
||||
if (log_) Info
|
||||
<< type() << " " << name_ << " output:" << nl
|
||||
<< " removing object " << obj.name() << nl
|
||||
<< endl;
|
||||
|
||||
@ -92,7 +94,7 @@ void Foam::removeRegisteredObject::execute()
|
||||
|
||||
void Foam::removeRegisteredObject::end()
|
||||
{
|
||||
execute();
|
||||
// Do nothing - only valid on execute
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2013-2014 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -46,6 +46,7 @@ Description
|
||||
Property | Description | Required | Default value
|
||||
type | type name: removeRegisteredObject | yes |
|
||||
objectNames | objects to remove | yes |
|
||||
log | Log to standard output | no | yes
|
||||
\endtable
|
||||
|
||||
SeeAlso
|
||||
@ -63,6 +64,7 @@ SourceFiles
|
||||
|
||||
#include "wordList.H"
|
||||
#include "runTimeSelectionTables.H"
|
||||
#include "Switch.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -85,9 +87,10 @@ protected:
|
||||
|
||||
// Private data
|
||||
|
||||
//- Name of this set of removeRegisteredObject
|
||||
//- Name of this set of removeRegisteredObject object
|
||||
word name_;
|
||||
|
||||
//- Refefence to the database
|
||||
const objectRegistry& obr_;
|
||||
|
||||
// Read from dictionary
|
||||
@ -95,6 +98,9 @@ protected:
|
||||
//- Names of objects to control
|
||||
wordList objectNames_;
|
||||
|
||||
//- Switch to send output to Info as well as to file
|
||||
Switch log_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2013-2014 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -195,7 +195,7 @@ void Foam::writeDictionary::execute()
|
||||
|
||||
void Foam::writeDictionary::end()
|
||||
{
|
||||
execute();
|
||||
// do nothing
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -2,8 +2,8 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -31,7 +31,7 @@ License
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(writeRegisteredObject, 0);
|
||||
defineTypeNameAndDebug(writeRegisteredObject, 0);
|
||||
}
|
||||
|
||||
|
||||
@ -48,7 +48,8 @@ Foam::writeRegisteredObject::writeRegisteredObject
|
||||
name_(name),
|
||||
exclusiveWriting_(false),
|
||||
obr_(obr),
|
||||
objectNames_()
|
||||
objectNames_(),
|
||||
log_(true)
|
||||
{
|
||||
read(dict);
|
||||
}
|
||||
@ -64,6 +65,8 @@ Foam::writeRegisteredObject::~writeRegisteredObject()
|
||||
|
||||
void Foam::writeRegisteredObject::read(const dictionary& dict)
|
||||
{
|
||||
log_.readIfPresent("log", dict);
|
||||
|
||||
dict.lookup("objectNames") >> objectNames_;
|
||||
dict.readIfPresent("exclusiveWriting", exclusiveWriting_);
|
||||
}
|
||||
@ -89,7 +92,7 @@ void Foam::writeRegisteredObject::timeSet()
|
||||
|
||||
void Foam::writeRegisteredObject::write()
|
||||
{
|
||||
Info<< type() << " " << name_ << " output:" << nl;
|
||||
if (log_) Info<< type() << " " << name_ << " output:" << nl;
|
||||
|
||||
DynamicList<word> allNames(obr_.toc().size());
|
||||
forAll(objectNames_, i)
|
||||
@ -102,7 +105,7 @@ void Foam::writeRegisteredObject::write()
|
||||
}
|
||||
else
|
||||
{
|
||||
WarningIn("Foam::writeRegisteredObject::write()")
|
||||
WarningInFunction
|
||||
<< "Object " << objectNames_[i] << " not found in "
|
||||
<< "database. Available objects:" << nl << obr_.sortedToc()
|
||||
<< endl;
|
||||
@ -123,7 +126,7 @@ void Foam::writeRegisteredObject::write()
|
||||
obj.writeOpt() = IOobject::NO_WRITE;
|
||||
}
|
||||
|
||||
Info<< " writing object " << obj.name() << nl << endl;
|
||||
if (log_) Info<< " writing object " << obj.name() << nl << endl;
|
||||
|
||||
obj.write();
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -30,13 +30,13 @@ Group
|
||||
Description
|
||||
This function object allows specification of different writing frequency
|
||||
of objects registered to the database. It has similar functionality
|
||||
as the main time database through the outputControl setting:
|
||||
timeStep
|
||||
outputTime
|
||||
adjustableTime
|
||||
runTime
|
||||
clockTime
|
||||
cpuTime
|
||||
as the main time database through the \c outputControl setting:
|
||||
- timeStep
|
||||
- outputTime
|
||||
- adjustableTime
|
||||
- runTime
|
||||
- clockTime
|
||||
- cpuTime
|
||||
|
||||
Example of function object specification:
|
||||
\verbatim
|
||||
@ -56,6 +56,7 @@ Description
|
||||
type | type name: writeRegisteredObject | yes |
|
||||
objectNames | objects to write | yes |
|
||||
exclusiveWriting | Takes over object writing | no | yes
|
||||
log | Log to standard output | no | yes
|
||||
\endtable
|
||||
|
||||
exclusiveWriting disables automatic writing (i.e through database) of the
|
||||
@ -76,6 +77,7 @@ SourceFiles
|
||||
|
||||
#include "wordReList.H"
|
||||
#include "runTimeSelectionTables.H"
|
||||
#include "Switch.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -104,7 +106,7 @@ protected:
|
||||
//- Takes over the writing from Db
|
||||
bool exclusiveWriting_;
|
||||
|
||||
//- Refererence to Db
|
||||
//- Refererence to the database
|
||||
const objectRegistry& obr_;
|
||||
|
||||
// Read from dictionary
|
||||
@ -112,6 +114,9 @@ protected:
|
||||
//- Names of objects to control
|
||||
wordReList objectNames_;
|
||||
|
||||
//- Switch to send output to Info as well as to file
|
||||
Switch log_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012-2015 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -111,7 +111,6 @@ void Foam::cloudInfo::read(const dictionary& dict)
|
||||
if (writeToFile())
|
||||
{
|
||||
filePtrs_.setSize(cloudNames_.size());
|
||||
filePtrs_.clear();
|
||||
forAll(filePtrs_, fileI)
|
||||
{
|
||||
const word& cloudName = cloudNames_[fileI];
|
||||
@ -160,10 +159,11 @@ void Foam::cloudInfo::write()
|
||||
scalar D10 = cloud.Dij(1, 0);
|
||||
scalar D32 = cloud.Dij(3, 2);
|
||||
|
||||
if (Pstream::master())
|
||||
if (Pstream::master() && writeToFile())
|
||||
{
|
||||
writeTime(filePtrs_[cloudI]);
|
||||
filePtrs_[cloudI]
|
||||
<< obr_.time().value() << token::TAB
|
||||
<< token::TAB
|
||||
<< nParcels << token::TAB
|
||||
<< massInSystem << token::TAB
|
||||
<< Dmax << token::TAB
|
||||
@ -172,16 +172,14 @@ void Foam::cloudInfo::write()
|
||||
<< endl;
|
||||
}
|
||||
|
||||
if (log_)
|
||||
{
|
||||
Info<< type() << " " << name_ << " output:" << nl
|
||||
<< " number of parcels : " << nParcels << nl
|
||||
<< " mass in system : " << massInSystem << nl
|
||||
<< " maximum diameter : " << Dmax << nl
|
||||
<< " D10 diameter : " << D10 << nl
|
||||
<< " D32 diameter : " << D32 << nl
|
||||
<< endl;
|
||||
}
|
||||
if (log_) Info
|
||||
<< type() << " " << name_ << " output:" << nl
|
||||
<< " number of parcels : " << nParcels << nl
|
||||
<< " mass in system : " << massInSystem << nl
|
||||
<< " maximum diameter : " << Dmax << nl
|
||||
<< " D10 diameter : " << D10 << nl
|
||||
<< " D32 diameter : " << D32 << nl
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012-2015 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: dev |
|
||||
| \\ / A nd | Web: www.OpenFOAM.org |
|
||||
| \\ / O peration | Version: plus |
|
||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012-2014 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -40,6 +40,7 @@ The current range of features comprises of:
|
||||
- \ref grpFieldFunctionObjects
|
||||
- \ref grpForcesFunctionObjects
|
||||
- \ref grpFVFunctionObjects
|
||||
- \ref grpGraphicsFunctionObjects
|
||||
- \ref grpIOFunctionObjects
|
||||
- \ref grpJobControlFunctionObjects
|
||||
- \ref grpUtilitiesFunctionObjects
|
||||
|
||||
@ -30,20 +30,24 @@ readFields/readFields.C
|
||||
readFields/readFieldsFunctionObject.C
|
||||
|
||||
streamLine/streamLine.C
|
||||
streamLine/streamLineBase.C
|
||||
streamLine/streamLineParticle.C
|
||||
streamLine/streamLineParticleCloud.C
|
||||
streamLine/streamLineFunctionObject.C
|
||||
|
||||
wallBoundedStreamLine/wallBoundedStreamLine.C
|
||||
wallBoundedStreamLine/wallBoundedStreamLineFunctionObject.C
|
||||
wallBoundedStreamLine/wallBoundedStreamLineParticle.C
|
||||
wallBoundedStreamLine/wallBoundedStreamLineParticleCloud.C
|
||||
wallBoundedStreamLine/wallBoundedParticle.C
|
||||
|
||||
surfaceInterpolateFields/surfaceInterpolateFields.C
|
||||
surfaceInterpolateFields/surfaceInterpolateFieldsFunctionObject.C
|
||||
|
||||
regionSizeDistribution/regionSizeDistribution.C
|
||||
regionSizeDistribution/regionSizeDistributionFunctionObject.C
|
||||
|
||||
valueAverage/valueAverage.C
|
||||
valueAverage/valueAverageFunctionObject.C
|
||||
|
||||
wallBoundedStreamLine/wallBoundedStreamLine.C
|
||||
wallBoundedStreamLine/wallBoundedStreamLineFunctionObject.C
|
||||
wallBoundedStreamLine/wallBoundedStreamLineParticle.C
|
||||
wallBoundedStreamLine/wallBoundedStreamLineParticleCloud.C
|
||||
wallBoundedStreamLine/wallBoundedParticle.C
|
||||
|
||||
LIB = $(FOAM_LIBBIN)/libfieldFunctionObjects
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: dev |
|
||||
| \\ / A nd | Web: www.OpenFOAM.org |
|
||||
| \\ / O peration | Version: plus |
|
||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -90,7 +90,7 @@ void Foam::fieldAverage::initialize()
|
||||
{
|
||||
if (!faItems_[fieldI].active())
|
||||
{
|
||||
WarningIn("void Foam::fieldAverage::initialize()")
|
||||
WarningInFunction
|
||||
<< "Field " << faItems_[fieldI].fieldName()
|
||||
<< " not found in database for averaging";
|
||||
}
|
||||
@ -124,11 +124,9 @@ void Foam::fieldAverage::calcAverages()
|
||||
prevTimeIndex_ = currentTimeIndex;
|
||||
}
|
||||
|
||||
if (log_)
|
||||
{
|
||||
Info<< type() << " " << name_ << " output:" << nl
|
||||
<< " Calculating averages" << nl;
|
||||
}
|
||||
if (log_) Info
|
||||
<< type() << " " << name_ << " output:" << nl
|
||||
<< " Calculating averages" << nl;
|
||||
|
||||
addMeanSqrToPrime2Mean<scalar, scalar>();
|
||||
addMeanSqrToPrime2Mean<vector, symmTensor>();
|
||||
@ -204,21 +202,17 @@ void Foam::fieldAverage::readAveragingProperties()
|
||||
totalIter_[fieldI] = readLabel(fieldDict.lookup("totalIter"));
|
||||
totalTime_[fieldI] = readScalar(fieldDict.lookup("totalTime"));
|
||||
|
||||
if (log_)
|
||||
{
|
||||
Info<< " " << fieldName
|
||||
<< " iters = " << totalIter_[fieldI]
|
||||
<< " time = " << totalTime_[fieldI] << nl;
|
||||
}
|
||||
if (log_) Info
|
||||
<< " " << fieldName
|
||||
<< " iters = " << totalIter_[fieldI]
|
||||
<< " time = " << totalTime_[fieldI] << nl;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (log_)
|
||||
{
|
||||
Info<< " " << fieldName
|
||||
<< ": starting averaging at time "
|
||||
<< obr_.time().timeName() << endl;
|
||||
}
|
||||
if (log_) Info
|
||||
<< " " << fieldName
|
||||
<< ": starting averaging at time "
|
||||
<< obr_.time().timeName() << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -294,12 +288,7 @@ void Foam::fieldAverage::execute()
|
||||
|
||||
|
||||
void Foam::fieldAverage::end()
|
||||
{
|
||||
if (active_)
|
||||
{
|
||||
execute();
|
||||
}
|
||||
}
|
||||
{}
|
||||
|
||||
|
||||
void Foam::fieldAverage::timeSet()
|
||||
@ -315,11 +304,9 @@ void Foam::fieldAverage::write()
|
||||
|
||||
if (resetOnOutput_)
|
||||
{
|
||||
if (log_)
|
||||
{
|
||||
Info<< " Restarting averaging at time " << obr_.time().timeName()
|
||||
<< nl << endl;
|
||||
}
|
||||
if (log_) Info
|
||||
<< " Restarting averaging at time " << obr_.time().timeName()
|
||||
<< nl << endl;
|
||||
|
||||
totalIter_.clear();
|
||||
totalIter_.setSize(faItems_.size(), 1);
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -46,12 +46,10 @@ void Foam::fieldAverage::addMeanFieldType(const label fieldI)
|
||||
}
|
||||
else if (obr_.found(meanFieldName))
|
||||
{
|
||||
if (log_)
|
||||
{
|
||||
Info<< " Cannot allocate average field " << meanFieldName
|
||||
<< " since an object with that name already exists."
|
||||
<< " Disabling averaging for field." << endl;
|
||||
}
|
||||
if (log_) Info
|
||||
<< " Cannot allocate average field " << meanFieldName
|
||||
<< " since an object with that name already exists."
|
||||
<< " Disabling averaging for field." << endl;
|
||||
|
||||
faItems_[fieldI].mean() = false;
|
||||
}
|
||||
@ -110,10 +108,8 @@ void Foam::fieldAverage::addPrime2MeanFieldType(const label fieldI)
|
||||
const word& meanFieldName = faItems_[fieldI].meanFieldName();
|
||||
const word& prime2MeanFieldName = faItems_[fieldI].prime2MeanFieldName();
|
||||
|
||||
if (log_)
|
||||
{
|
||||
Info << " Reading/initialising field " << prime2MeanFieldName << nl;
|
||||
}
|
||||
if (log_) Info
|
||||
<< " Reading/initialising field " << prime2MeanFieldName << endl;
|
||||
|
||||
if (obr_.foundObject<Type2>(prime2MeanFieldName))
|
||||
{
|
||||
@ -121,12 +117,10 @@ void Foam::fieldAverage::addPrime2MeanFieldType(const label fieldI)
|
||||
}
|
||||
else if (obr_.found(prime2MeanFieldName))
|
||||
{
|
||||
if (log_)
|
||||
{
|
||||
Info<< " Cannot allocate average field " << prime2MeanFieldName
|
||||
<< " since an object with that name already exists."
|
||||
<< " Disabling averaging for field." << nl;
|
||||
}
|
||||
if (log_) Info
|
||||
<< " Cannot allocate average field " << prime2MeanFieldName
|
||||
<< " since an object with that name already exists."
|
||||
<< " Disabling averaging for field." << endl;
|
||||
|
||||
faItems_[fieldI].prime2Mean() = false;
|
||||
}
|
||||
@ -172,10 +166,7 @@ void Foam::fieldAverage::addPrime2MeanField(const label fieldI)
|
||||
|
||||
if (!faItems_[fieldI].mean())
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"void Foam::fieldAverage::addPrime2MeanField(const label) const"
|
||||
)
|
||||
FatalErrorInFunction
|
||||
<< "To calculate the prime-squared average, the "
|
||||
<< "mean average must also be selected for field "
|
||||
<< fieldName << nl << exit(FatalError);
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -92,10 +92,8 @@ void Foam::fieldAverageItem::operator=(const fieldAverageItem& rhs)
|
||||
// Check for assignment to self
|
||||
if (this == &rhs)
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"Foam::fieldAverageItem::operator=(const Foam::fieldAverageItem&)"
|
||||
) << "Attempted assignment to self" << nl
|
||||
FatalErrorInFunction
|
||||
<< "Attempted assignment to self" << nl
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
|
||||
@ -2,8 +2,8 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -30,7 +30,7 @@ License
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(fieldCoordinateSystemTransform, 0);
|
||||
defineTypeNameAndDebug(fieldCoordinateSystemTransform, 0);
|
||||
}
|
||||
|
||||
|
||||
@ -48,30 +48,24 @@ Foam::fieldCoordinateSystemTransform::fieldCoordinateSystemTransform
|
||||
obr_(obr),
|
||||
active_(true),
|
||||
fieldSet_(),
|
||||
coordSys_(obr, dict)
|
||||
coordSys_(obr, dict),
|
||||
log_(true)
|
||||
{
|
||||
// Check if the available mesh is an fvMesh otherise deactivate
|
||||
if (isA<fvMesh>(obr_))
|
||||
{
|
||||
read(dict);
|
||||
|
||||
Info<< type() << " " << name_ << ":" << nl
|
||||
if (log_) Info
|
||||
<< type() << " " << name_ << ":" << nl
|
||||
<< " Applying transformation from global Cartesian to local "
|
||||
<< coordSys_ << nl << endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
active_ = false;
|
||||
WarningIn
|
||||
(
|
||||
"fieldCoordinateSystemTransform::fieldCoordinateSystemTransform"
|
||||
"("
|
||||
"const word&, "
|
||||
"const objectRegistry&, "
|
||||
"const dictionary&, "
|
||||
"const bool"
|
||||
")"
|
||||
) << "No fvMesh available, deactivating " << name_
|
||||
WarningInFunction
|
||||
<< "No fvMesh available, deactivating " << name_
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
@ -89,6 +83,7 @@ void Foam::fieldCoordinateSystemTransform::read(const dictionary& dict)
|
||||
{
|
||||
if (active_)
|
||||
{
|
||||
log_.readIfPresent("log", dict);
|
||||
dict.lookup("fields") >> fieldSet_;
|
||||
}
|
||||
}
|
||||
@ -98,7 +93,7 @@ void Foam::fieldCoordinateSystemTransform::execute()
|
||||
{
|
||||
if (active_)
|
||||
{
|
||||
Info<< type() << " " << name_ << " output:" << nl;
|
||||
if (log_) Info<< type() << " " << name_ << " output:" << nl;
|
||||
|
||||
forAll(fieldSet_, fieldI)
|
||||
{
|
||||
@ -115,10 +110,7 @@ void Foam::fieldCoordinateSystemTransform::execute()
|
||||
|
||||
void Foam::fieldCoordinateSystemTransform::end()
|
||||
{
|
||||
if (active_)
|
||||
{
|
||||
execute();
|
||||
}
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
|
||||
@ -132,7 +124,7 @@ void Foam::fieldCoordinateSystemTransform::write()
|
||||
{
|
||||
if (active_)
|
||||
{
|
||||
Info<< type() << " " << name_ << " output:" << nl;
|
||||
if (log_) Info<< type() << " " << name_ << " output:" << nl;
|
||||
|
||||
forAll(fieldSet_, fieldI)
|
||||
{
|
||||
@ -141,12 +133,12 @@ void Foam::fieldCoordinateSystemTransform::write()
|
||||
const regIOobject& field =
|
||||
obr_.lookupObject<regIOobject>(fieldName);
|
||||
|
||||
Info<< " writing field " << field.name() << nl;
|
||||
if (log_) Info << " writing field " << field.name() << nl;
|
||||
|
||||
field.write();
|
||||
}
|
||||
|
||||
Info<< endl;
|
||||
if (log_) Info<< endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -45,9 +45,11 @@ Description
|
||||
UMean
|
||||
UPrime2Mean
|
||||
);
|
||||
coordinateSystem
|
||||
origin (0.001 0 0);
|
||||
|
||||
coordinateRotation
|
||||
{
|
||||
origin (0.001 0 0);
|
||||
type axesRotation;
|
||||
e1 (1 0.15 0);
|
||||
e3 (0 0 -1);
|
||||
}
|
||||
@ -59,7 +61,9 @@ Description
|
||||
Property | Description | Required | Default value
|
||||
type | type name: fieldCoordinateSystemTransform | yes |
|
||||
fields | list of fields to be transformed |yes |
|
||||
coordinateSystem | local co-ordinate system | yes |
|
||||
origin | origin of local co-ordinate system | yes |
|
||||
coordinateRotation | orientation of local co-ordinate system | yes |
|
||||
log | Log to standard output | no | yes
|
||||
\endtable
|
||||
|
||||
SeeAlso
|
||||
@ -117,6 +121,9 @@ protected:
|
||||
//- Co-ordinate system to transform to
|
||||
coordinateSystem coordSys_;
|
||||
|
||||
//- Switch to send output to Info as well as to file
|
||||
Switch log_;
|
||||
|
||||
|
||||
// Protected Member Functions
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -67,7 +67,7 @@ void Foam::fieldCoordinateSystemTransform::transformField
|
||||
|
||||
Foam::transform(transField, R, transField);
|
||||
|
||||
Info<< " writing field " << transField.name() << nl << endl;
|
||||
if (log_) Info<< " writing field " << transField.name() << nl << endl;
|
||||
|
||||
transField.write();
|
||||
}
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: dev |
|
||||
| \\ / A nd | Web: www.OpenFOAM.org |
|
||||
| \\ / O peration | Version: plus |
|
||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
@ -38,9 +38,11 @@ functions
|
||||
UPrime2Mean
|
||||
);
|
||||
|
||||
coordinateSystem
|
||||
origin (0.001 0 0);
|
||||
|
||||
coordinateRotation
|
||||
{
|
||||
origin (0.001 0 0);
|
||||
type axesRotation;
|
||||
e1 (1 0.15 0);
|
||||
e3 (0 0 -1);
|
||||
}
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: dev |
|
||||
| \\ / A nd | Web: www.OpenFOAM.org |
|
||||
| \\ / O peration | Version: plus |
|
||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -160,7 +160,8 @@ void Foam::fieldMinMax::write()
|
||||
{
|
||||
if (active_)
|
||||
{
|
||||
if (!writeLocation_) file()<< obr_.time().value();
|
||||
if (!writeLocation_) writeTime(file());
|
||||
|
||||
if (log_) Info<< type() << " " << name_ << " output:" << nl;
|
||||
|
||||
forAll(fieldSet_, fieldI)
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -45,7 +45,7 @@ void Foam::fieldMinMax::output
|
||||
|
||||
if (writeLocation_)
|
||||
{
|
||||
file<< obr_.time().value();
|
||||
writeTime(file());
|
||||
|
||||
writeTabbed(file, fieldName);
|
||||
|
||||
@ -278,14 +278,7 @@ void Foam::fieldMinMax::calcMinMaxFields
|
||||
}
|
||||
default:
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"Foam::fieldMinMax::calcMinMaxFields"
|
||||
"("
|
||||
"const word&, "
|
||||
"const modeType&"
|
||||
")"
|
||||
)
|
||||
FatalErrorInFunction
|
||||
<< "Unknown min/max mode: " << modeTypeNames_[mode_]
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
@ -83,7 +83,7 @@ void Foam::fieldValues::cellSource::setCellZoneCells()
|
||||
|
||||
if (zoneId < 0)
|
||||
{
|
||||
FatalErrorIn("cellSource::cellSource::setCellZoneCells()")
|
||||
FatalErrorInFunction
|
||||
<< "Unknown cell zone name: " << sourceName_
|
||||
<< ". Valid cell zones are: " << mesh().cellZones().names()
|
||||
<< nl << exit(FatalError);
|
||||
@ -103,7 +103,7 @@ void Foam::fieldValues::cellSource::setCellZoneCells()
|
||||
|
||||
default:
|
||||
{
|
||||
FatalErrorIn("cellSource::setCellZoneCells()")
|
||||
FatalErrorInFunction
|
||||
<< "Unknown source type. Valid source types are:"
|
||||
<< sourceTypeNames_ << nl << exit(FatalError);
|
||||
}
|
||||
@ -130,10 +130,7 @@ void Foam::fieldValues::cellSource::initialise(const dictionary& dict)
|
||||
|
||||
if (nCells_ == 0)
|
||||
{
|
||||
WarningIn
|
||||
(
|
||||
"Foam::fieldValues::cellSource::initialise(const dictionary&)"
|
||||
)
|
||||
WarningInFunction
|
||||
<< type() << " " << name_ << ": "
|
||||
<< sourceTypeNames_[source_] << "(" << sourceName_ << "):" << nl
|
||||
<< " Source has no cells - deactivating" << endl;
|
||||
@ -144,14 +141,12 @@ void Foam::fieldValues::cellSource::initialise(const dictionary& dict)
|
||||
|
||||
volume_ = volume();
|
||||
|
||||
if (log_)
|
||||
{
|
||||
Info<< type() << " " << name_ << ":"
|
||||
<< sourceTypeNames_[source_] << "(" << sourceName_ << "):" << nl
|
||||
<< " total cells = " << nCells_ << nl
|
||||
<< " total volume = " << volume_
|
||||
<< nl << endl;
|
||||
}
|
||||
if (log_) Info
|
||||
<< type() << " " << name_ << ":"
|
||||
<< sourceTypeNames_[source_] << "(" << sourceName_ << "):" << nl
|
||||
<< " total cells = " << nCells_ << nl
|
||||
<< " total volume = " << volume_
|
||||
<< nl << endl;
|
||||
|
||||
if (dict.readIfPresent("weightField", weightFieldName_))
|
||||
{
|
||||
@ -239,7 +234,7 @@ void Foam::fieldValues::cellSource::write()
|
||||
|
||||
if (active_)
|
||||
{
|
||||
file() << obr_.time().value();
|
||||
writeTime(file());
|
||||
|
||||
// Construct weight field. Note: zero size indicates unweighted
|
||||
scalarField weightField;
|
||||
@ -268,7 +263,7 @@ void Foam::fieldValues::cellSource::write()
|
||||
|
||||
if (!ok)
|
||||
{
|
||||
WarningIn("void Foam::fieldValues::cellSource::write()")
|
||||
WarningInFunction
|
||||
<< "Requested field " << fieldName
|
||||
<< " not found in database and not processed"
|
||||
<< endl;
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
@ -58,15 +58,8 @@ Foam::tmp<Foam::Field<Type> > Foam::fieldValues::cellSource::setFieldValues
|
||||
|
||||
if (mustGet)
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"Foam::tmp<Foam::Field<Type> > "
|
||||
"Foam::fieldValues::cellSource::setFieldValues"
|
||||
"("
|
||||
"const word&, "
|
||||
"const bool"
|
||||
") const"
|
||||
) << "Field " << fieldName << " not found in database"
|
||||
FatalErrorInFunction
|
||||
<< "Field " << fieldName << " not found in database"
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
@ -217,12 +210,10 @@ bool Foam::fieldValues::cellSource::writeValues
|
||||
|
||||
file()<< tab << result;
|
||||
|
||||
if (log_)
|
||||
{
|
||||
Info<< " " << operationTypeNames_[operation_]
|
||||
<< "(" << sourceName_ << ") of " << fieldName
|
||||
<< " = " << result << endl;
|
||||
}
|
||||
if (log_) Info
|
||||
<< " " << operationTypeNames_[operation_]
|
||||
<< "(" << sourceName_ << ") of " << fieldName
|
||||
<< " = " << result << endl;
|
||||
|
||||
// write state/results information
|
||||
const word& opName = operationTypeNames_[operation_];
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: dev |
|
||||
| \\ / A nd | Web: www.OpenFOAM.org |
|
||||
| \\ / O peration | Version: plus |
|
||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
|
||||
@ -90,7 +90,7 @@ void Foam::fieldValues::faceSource::setFaceZoneFaces()
|
||||
|
||||
if (zoneId < 0)
|
||||
{
|
||||
FatalErrorIn("faceSource::faceSource::setFaceZoneFaces()")
|
||||
FatalErrorInFunction
|
||||
<< type() << " " << name_ << ": "
|
||||
<< sourceTypeNames_[source_] << "(" << sourceName_ << "):" << nl
|
||||
<< " Unknown face zone name: " << sourceName_
|
||||
@ -175,7 +175,7 @@ void Foam::fieldValues::faceSource::setPatchFaces()
|
||||
|
||||
if (patchId < 0)
|
||||
{
|
||||
FatalErrorIn("faceSource::constructFaceAddressing()")
|
||||
FatalErrorInFunction
|
||||
<< type() << " " << name_ << ": "
|
||||
<< sourceTypeNames_[source_] << "(" << sourceName_ << "):" << nl
|
||||
<< " Unknown patch name: " << sourceName_
|
||||
@ -419,7 +419,7 @@ void Foam::fieldValues::faceSource::initialise(const dictionary& dict)
|
||||
}
|
||||
default:
|
||||
{
|
||||
FatalErrorIn("faceSource::initialise()")
|
||||
FatalErrorInFunction
|
||||
<< type() << " " << name_ << ": "
|
||||
<< sourceTypeNames_[source_] << "(" << sourceName_ << "):"
|
||||
<< nl << " Unknown source type. Valid source types are:"
|
||||
@ -429,10 +429,7 @@ void Foam::fieldValues::faceSource::initialise(const dictionary& dict)
|
||||
|
||||
if (nFaces_ == 0)
|
||||
{
|
||||
WarningIn
|
||||
(
|
||||
"Foam::fieldValues::faceSource::initialise(const dictionary&)"
|
||||
)
|
||||
WarningInFunction
|
||||
<< type() << " " << name_ << ": "
|
||||
<< sourceTypeNames_[source_] << "(" << sourceName_ << "):" << nl
|
||||
<< " Source has no faces - deactivating" << endl;
|
||||
@ -459,14 +456,7 @@ void Foam::fieldValues::faceSource::initialise(const dictionary& dict)
|
||||
|
||||
if (source_ == stSampledSurface)
|
||||
{
|
||||
FatalIOErrorIn
|
||||
(
|
||||
"void Foam::fieldValues::faceSource::initialise"
|
||||
"("
|
||||
"const dictionary&"
|
||||
")",
|
||||
dict
|
||||
)
|
||||
FatalIOErrorInFunction(dict)
|
||||
<< "Cannot use weightField for a sampledSurface"
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
@ -482,14 +472,7 @@ void Foam::fieldValues::faceSource::initialise(const dictionary& dict)
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalIOErrorIn
|
||||
(
|
||||
"void Foam::fieldValues::faceSource::initialise"
|
||||
"("
|
||||
"const dictionary&"
|
||||
")",
|
||||
dict
|
||||
)
|
||||
FatalIOErrorInFunction(dict)
|
||||
<< "Either weightField or orientedWeightField can be supplied, "
|
||||
<< "but not both"
|
||||
<< exit(FatalIOError);
|
||||
@ -684,7 +667,7 @@ void Foam::fieldValues::faceSource::write()
|
||||
surfacePtr_().update();
|
||||
}
|
||||
|
||||
file() << obr_.time().value();
|
||||
writeTime(file());
|
||||
|
||||
if (writeArea_)
|
||||
{
|
||||
@ -722,7 +705,7 @@ void Foam::fieldValues::faceSource::write()
|
||||
|
||||
if (!ok)
|
||||
{
|
||||
WarningIn("void Foam::fieldValues::faceSource::write()")
|
||||
WarningInFunction
|
||||
<< "Requested field " << fieldName
|
||||
<< " not found in database and not processed"
|
||||
<< endl;
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -110,16 +110,8 @@ Foam::tmp<Foam::Field<Type> > Foam::fieldValues::faceSource::setFieldValues
|
||||
|
||||
if (mustGet)
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"Foam::tmp<Foam::Field<Type> > "
|
||||
"Foam::fieldValues::faceSource::setFieldValues"
|
||||
"("
|
||||
"const word&, "
|
||||
"const bool, "
|
||||
"const bool"
|
||||
") const"
|
||||
) << "Field " << fieldName << " not found in database"
|
||||
FatalErrorInFunction
|
||||
<< "Field " << fieldName << " not found in database"
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
@ -150,16 +142,7 @@ Type Foam::fieldValues::faceSource::processSameTypeValues
|
||||
}
|
||||
case opSumDirection:
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"template<class Type>"
|
||||
"Type Foam::fieldValues::faceSource::processSameTypeValues"
|
||||
"("
|
||||
"const Field<Type>&, "
|
||||
"const vectorField&, "
|
||||
"const scalarField&"
|
||||
") const"
|
||||
)
|
||||
FatalErrorInFunction
|
||||
<< "Operation " << operationTypeNames_[operation_]
|
||||
<< " not available for values of type "
|
||||
<< pTraits<Type>::typeName
|
||||
@ -170,16 +153,7 @@ Type Foam::fieldValues::faceSource::processSameTypeValues
|
||||
}
|
||||
case opSumDirectionBalance:
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"template<class Type>"
|
||||
"Type Foam::fieldValues::faceSource::processSameTypeValues"
|
||||
"("
|
||||
"const Field<Type>&, "
|
||||
"const vectorField&, "
|
||||
"const scalarField&"
|
||||
") const"
|
||||
)
|
||||
FatalErrorInFunction
|
||||
<< "Operation " << operationTypeNames_[operation_]
|
||||
<< " not available for values of type "
|
||||
<< pTraits<Type>::typeName
|
||||
@ -366,12 +340,10 @@ bool Foam::fieldValues::faceSource::writeValues
|
||||
|
||||
file()<< tab << result;
|
||||
|
||||
if (log_)
|
||||
{
|
||||
Info<< " " << operationTypeNames_[operation_]
|
||||
<< "(" << sourceName_ << ") for " << fieldName
|
||||
<< " = " << result << endl;
|
||||
}
|
||||
if (log_) Info
|
||||
<< " " << operationTypeNames_[operation_]
|
||||
<< "(" << sourceName_ << ") for " << fieldName
|
||||
<< " = " << result << endl;
|
||||
|
||||
// Write state/results information
|
||||
const word& opName = operationTypeNames_[operation_];
|
||||
@ -403,14 +375,8 @@ Foam::tmp<Foam::Field<Type> > Foam::fieldValues::faceSource::filterField
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"fieldValues::faceSource::filterField"
|
||||
"("
|
||||
"const GeometricField<Type, fvPatchField, volMesh>&, "
|
||||
"const bool"
|
||||
") const"
|
||||
) << type() << " " << name_ << ": "
|
||||
FatalErrorInFunction
|
||||
<< type() << " " << name_ << ": "
|
||||
<< sourceTypeNames_[source_] << "(" << sourceName_ << "):"
|
||||
<< nl
|
||||
<< " Unable to process internal faces for volume field "
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012-2015 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -48,16 +48,8 @@ Foam::autoPtr<Foam::fieldValue> Foam::fieldValue::New
|
||||
|
||||
if (cstrIter == dictionaryConstructorTablePtr_->end())
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"fieldValue::New"
|
||||
"("
|
||||
"const word&, "
|
||||
"const objectRegistry&, "
|
||||
"const dictionary&, "
|
||||
"const bool"
|
||||
")"
|
||||
) << "Unknown " << typeName << " type "
|
||||
FatalErrorInFunction
|
||||
<< "Unknown " << typeName << " type "
|
||||
<< modelType << nl << nl
|
||||
<< "Valid " << typeName << " types are:" << nl
|
||||
<< dictionaryConstructorTablePtr_->sortedToc()
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012-2015 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -168,7 +168,7 @@ void Foam::fieldValues::fieldValueDelta::execute()
|
||||
source1Ptr_->write();
|
||||
source2Ptr_->write();
|
||||
|
||||
file()<< obr_.time().value();
|
||||
writeTime(file());
|
||||
|
||||
if (log_) Info << type() << " " << name_ << " output:" << endl;
|
||||
|
||||
@ -180,7 +180,7 @@ void Foam::fieldValues::fieldValueDelta::execute()
|
||||
|
||||
if (entries1.size() != entries2.size())
|
||||
{
|
||||
FatalErrorIn("void Foam::fieldValues::fieldValueDelta::execute()")
|
||||
FatalErrorInFunction
|
||||
<< name_ << ": objects must generate the same number of results"
|
||||
<< nl
|
||||
<< " " << name1 << " objects: " << entries1 << nl
|
||||
@ -197,10 +197,7 @@ void Foam::fieldValues::fieldValueDelta::execute()
|
||||
|
||||
if (type1 != type2)
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"void Foam::fieldValues::fieldValueDelta::execute()"
|
||||
)
|
||||
FatalErrorInFunction
|
||||
<< name_
|
||||
<< ": input values for operation must be of the same type"
|
||||
<< nl
|
||||
@ -242,10 +239,7 @@ void Foam::fieldValues::fieldValueDelta::execute()
|
||||
|
||||
void Foam::fieldValues::fieldValueDelta::end()
|
||||
{
|
||||
if (active_)
|
||||
{
|
||||
execute();
|
||||
}
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012-2015 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -77,20 +77,9 @@ void Foam::fieldValues::fieldValueDelta::apply
|
||||
}
|
||||
default:
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"void Foam::fieldValues::fieldValueDelta::applyOperation"
|
||||
"("
|
||||
"const word&, "
|
||||
"const word&, "
|
||||
"const word&, "
|
||||
"const word&, "
|
||||
"const word&"
|
||||
"bool&"
|
||||
") const"
|
||||
)
|
||||
<< "Operation not supported: "
|
||||
<< opName
|
||||
FatalErrorInFunction
|
||||
<< "Unable to process operation "
|
||||
<< operationTypeNames_[operation_]
|
||||
<< abort(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: dev |
|
||||
| \\ / A nd | Web: www.OpenFOAM.org |
|
||||
| \\ / O peration | Version: plus |
|
||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -242,16 +242,8 @@ Foam::nearWallFields::nearWallFields
|
||||
else
|
||||
{
|
||||
active_ = false;
|
||||
WarningIn
|
||||
(
|
||||
"nearWallFields::nearWallFields"
|
||||
"("
|
||||
"const word&, "
|
||||
"const objectRegistry&, "
|
||||
"const dictionary&, "
|
||||
"const bool"
|
||||
")"
|
||||
) << "No fvMesh available, deactivating " << name_
|
||||
WarningInFunction
|
||||
<< "No fvMesh available, deactivating " << name_
|
||||
<< endl;
|
||||
}
|
||||
|
||||
@ -369,15 +361,7 @@ void Foam::nearWallFields::execute()
|
||||
|
||||
void Foam::nearWallFields::end()
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Info<< "nearWallFields:end()" << endl;
|
||||
}
|
||||
|
||||
if (active_)
|
||||
{
|
||||
execute();
|
||||
}
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -55,9 +55,10 @@ Description
|
||||
\table
|
||||
Property | Description | Required | Default value
|
||||
type | type name: nearWallFields | yes |
|
||||
fields | list of fields with correspoding output field names | yes |
|
||||
fields | list of fields with corresponding output field names | yes |
|
||||
patches | list of patches to sample | yes |
|
||||
distance | distance from patch to sample | yes |
|
||||
log | Log to standard output | no | yes
|
||||
\endtable
|
||||
|
||||
SeeAlso
|
||||
@ -111,6 +112,9 @@ protected:
|
||||
//- Fields to process
|
||||
List<Tuple2<word, word> > fieldSet_;
|
||||
|
||||
//- Switch to send output to Info as well as to file
|
||||
Switch log_;
|
||||
|
||||
//- Patches to sample
|
||||
labelHashSet patchSet_;
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -47,8 +47,9 @@ void Foam::nearWallFields::createFields
|
||||
|
||||
if (obr_.found(sampleFldName))
|
||||
{
|
||||
Info<< " a field " << sampleFldName
|
||||
<< " already exists on the mesh."
|
||||
WarningInFunction
|
||||
<< " a field named " << sampleFldName
|
||||
<< " already exists on the mesh"
|
||||
<< endl;
|
||||
}
|
||||
else
|
||||
@ -63,7 +64,8 @@ void Foam::nearWallFields::createFields
|
||||
|
||||
sflds.set(sz, new vfType(io, fld));
|
||||
|
||||
Info<< " created " << sflds[sz].name() << " to sample "
|
||||
if (log_) Info
|
||||
<< " created " << sflds[sz].name() << " to sample "
|
||||
<< fld.name() << endl;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: dev |
|
||||
| \\ / A nd | Web: www.OpenFOAM.org |
|
||||
| \\ / O peration | Version: plus |
|
||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
|
||||
@ -2,8 +2,8 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -31,7 +31,7 @@ License
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(processorField, 0);
|
||||
defineTypeNameAndDebug(processorField, 0);
|
||||
}
|
||||
|
||||
|
||||
@ -47,7 +47,9 @@ Foam::processorField::processorField
|
||||
:
|
||||
name_(name),
|
||||
obr_(obr),
|
||||
active_(true)
|
||||
active_(true),
|
||||
resultName_(name),
|
||||
log_(true)
|
||||
{
|
||||
// Check if the available mesh is an fvMesh otherise deactivate
|
||||
if (isA<fvMesh>(obr_))
|
||||
@ -62,7 +64,7 @@ Foam::processorField::processorField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"processorID",
|
||||
resultName_,
|
||||
mesh.time().timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
@ -78,16 +80,8 @@ Foam::processorField::processorField
|
||||
else
|
||||
{
|
||||
active_ = false;
|
||||
WarningIn
|
||||
(
|
||||
"processorField::processorField"
|
||||
"("
|
||||
"const word&, "
|
||||
"const objectRegistry&, "
|
||||
"const dictionary&, "
|
||||
"const bool"
|
||||
")"
|
||||
) << "No fvMesh available, deactivating " << name_
|
||||
WarningInFunction
|
||||
<< "No fvMesh available, deactivating " << name_
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
@ -103,7 +97,10 @@ Foam::processorField::~processorField()
|
||||
|
||||
void Foam::processorField::read(const dictionary& dict)
|
||||
{
|
||||
// do nothing
|
||||
if (active_)
|
||||
{
|
||||
log_.readIfPresent("log", dict);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -112,7 +109,7 @@ void Foam::processorField::execute()
|
||||
if (active_)
|
||||
{
|
||||
const volScalarField& procField =
|
||||
obr_.lookupObject<volScalarField>("processorID");
|
||||
obr_.lookupObject<volScalarField>(resultName_);
|
||||
|
||||
const_cast<volScalarField&>(procField) ==
|
||||
dimensionedScalar("procI", dimless, Pstream::myProcNo());
|
||||
@ -122,10 +119,7 @@ void Foam::processorField::execute()
|
||||
|
||||
void Foam::processorField::end()
|
||||
{
|
||||
if (active_)
|
||||
{
|
||||
execute();
|
||||
}
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
|
||||
@ -140,7 +134,12 @@ void Foam::processorField::write()
|
||||
if (active_)
|
||||
{
|
||||
const volScalarField& procField =
|
||||
obr_.lookupObject<volScalarField>("processorID");
|
||||
obr_.lookupObject<volScalarField>(resultName_);
|
||||
|
||||
if (log_) Info
|
||||
<< type() << " " << name_ << " output:" << nl
|
||||
<< " writing field " << procField.name() << nl
|
||||
<< endl;
|
||||
|
||||
procField.write();
|
||||
}
|
||||
|
||||
@ -45,6 +45,7 @@ Description
|
||||
\table
|
||||
Property | Description | Required | Default value
|
||||
type | type name: processorField | yes |
|
||||
log | Log to standard output | no | yes
|
||||
\endtable
|
||||
|
||||
SeeAlso
|
||||
@ -95,6 +96,12 @@ protected:
|
||||
//- on/off switch
|
||||
bool active_;
|
||||
|
||||
//- Result name
|
||||
word resultName_;
|
||||
|
||||
//- Switch to send output to Info as well as to file
|
||||
Switch log_;
|
||||
|
||||
|
||||
// Protected Member Functions
|
||||
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: dev |
|
||||
| \\ / A nd | Web: www.OpenFOAM.org |
|
||||
| \\ / O peration | Version: plus |
|
||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
|
||||
@ -2,8 +2,8 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -47,7 +47,8 @@ Foam::readFields::readFields
|
||||
name_(name),
|
||||
obr_(obr),
|
||||
active_(true),
|
||||
fieldSet_()
|
||||
fieldSet_(),
|
||||
log_(true)
|
||||
{
|
||||
// Check if the available mesh is an fvMesh otherise deactivate
|
||||
if (isA<fvMesh>(obr_))
|
||||
@ -57,16 +58,8 @@ Foam::readFields::readFields
|
||||
else
|
||||
{
|
||||
active_ = false;
|
||||
WarningIn
|
||||
(
|
||||
"readFields::readFields"
|
||||
"("
|
||||
"const word&, "
|
||||
"const objectRegistry&, "
|
||||
"const dictionary&, "
|
||||
"const bool"
|
||||
")"
|
||||
) << "No fvMesh available, deactivating " << name_
|
||||
WarningInFunction
|
||||
<< "No fvMesh available, deactivating " << name_
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
@ -84,6 +77,7 @@ void Foam::readFields::read(const dictionary& dict)
|
||||
{
|
||||
if (active_)
|
||||
{
|
||||
log_.readIfPresent("log", dict);
|
||||
dict.lookup("fields") >> fieldSet_;
|
||||
}
|
||||
}
|
||||
@ -93,29 +87,16 @@ void Foam::readFields::execute()
|
||||
{
|
||||
if (active_)
|
||||
{
|
||||
// Clear out any previously loaded fields
|
||||
vsf_.clear();
|
||||
vvf_.clear();
|
||||
vSpheretf_.clear();
|
||||
vSymmtf_.clear();
|
||||
vtf_.clear();
|
||||
|
||||
ssf_.clear();
|
||||
svf_.clear();
|
||||
sSpheretf_.clear();
|
||||
sSymmtf_.clear();
|
||||
stf_.clear();
|
||||
|
||||
forAll(fieldSet_, fieldI)
|
||||
{
|
||||
const word& fieldName = fieldSet_[fieldI];
|
||||
|
||||
// If necessary load field
|
||||
loadField<scalar>(fieldName, vsf_, ssf_);
|
||||
loadField<vector>(fieldName, vvf_, svf_);
|
||||
loadField<sphericalTensor>(fieldName, vSpheretf_, sSpheretf_);
|
||||
loadField<symmTensor>(fieldName, vSymmtf_, sSymmtf_);
|
||||
loadField<tensor>(fieldName, vtf_, stf_);
|
||||
loadField<scalar>(fieldName);
|
||||
loadField<vector>(fieldName);
|
||||
loadField<sphericalTensor>(fieldName);
|
||||
loadField<symmTensor>(fieldName);
|
||||
loadField<tensor>(fieldName);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -123,10 +104,7 @@ void Foam::readFields::execute()
|
||||
|
||||
void Foam::readFields::end()
|
||||
{
|
||||
if (active_)
|
||||
{
|
||||
execute();
|
||||
}
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -28,8 +28,8 @@ Group
|
||||
grpFieldFunctionObjects
|
||||
|
||||
Description
|
||||
This function object reads fields from the time directories and adds them to
|
||||
the mesh database for further post-processing.
|
||||
This function object reads fields from the time directories and adds them
|
||||
to the mesh database for further post-processing.
|
||||
|
||||
Example of function object specification:
|
||||
\verbatim
|
||||
@ -38,11 +38,7 @@ Description
|
||||
type readFields;
|
||||
functionObjectLibs ("libfieldFunctionObjects.so");
|
||||
...
|
||||
fields
|
||||
(
|
||||
U
|
||||
p
|
||||
);
|
||||
fields (U p);
|
||||
}
|
||||
\endverbatim
|
||||
|
||||
@ -51,6 +47,7 @@ Description
|
||||
Property | Description | Required | Default value
|
||||
type | type name: readFields | yes |
|
||||
fields | list of fields to read | no |
|
||||
log | Log to standard output | no | yes
|
||||
\endtable
|
||||
|
||||
SeeAlso
|
||||
@ -102,18 +99,8 @@ protected:
|
||||
//- Fields to load
|
||||
wordList fieldSet_;
|
||||
|
||||
//- Loaded fields
|
||||
PtrList<volScalarField> vsf_;
|
||||
PtrList<volVectorField> vvf_;
|
||||
PtrList<volSphericalTensorField> vSpheretf_;
|
||||
PtrList<volSymmTensorField> vSymmtf_;
|
||||
PtrList<volTensorField> vtf_;
|
||||
|
||||
PtrList<surfaceScalarField> ssf_;
|
||||
PtrList<surfaceVectorField> svf_;
|
||||
PtrList<surfaceSphericalTensorField> sSpheretf_;
|
||||
PtrList<surfaceSymmTensorField> sSymmtf_;
|
||||
PtrList<surfaceTensorField> stf_;
|
||||
//- Switch to send output to Info as well as to file
|
||||
Switch log_;
|
||||
|
||||
|
||||
// Protected Member Functions
|
||||
@ -125,12 +112,7 @@ protected:
|
||||
void operator=(const readFields&);
|
||||
|
||||
template<class Type>
|
||||
void loadField
|
||||
(
|
||||
const word&,
|
||||
PtrList<GeometricField<Type, fvPatchField, volMesh> >&,
|
||||
PtrList<GeometricField<Type, fvsPatchField, surfaceMesh> >&
|
||||
) const;
|
||||
void loadField(const word&) const;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -31,12 +31,7 @@ License
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
void Foam::readFields::loadField
|
||||
(
|
||||
const word& fieldName,
|
||||
PtrList<GeometricField<Type, fvPatchField, volMesh> >& vflds,
|
||||
PtrList<GeometricField<Type, fvsPatchField, surfaceMesh> >& sflds
|
||||
) const
|
||||
void Foam::readFields::loadField(const word& fieldName) const
|
||||
{
|
||||
typedef GeometricField<Type, fvPatchField, volMesh> vfType;
|
||||
typedef GeometricField<Type, fvsPatchField, surfaceMesh> sfType;
|
||||
@ -45,7 +40,8 @@ void Foam::readFields::loadField
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Info<< "readFields : Field " << fieldName << " already in database"
|
||||
Info<< "readFields: " << vfType::typeName << " "
|
||||
<< fieldName << " already exists in database"
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
@ -53,7 +49,8 @@ void Foam::readFields::loadField
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Info<< "readFields : Field " << fieldName << " already in database"
|
||||
Info<< "readFields: " << sfType::typeName << " "
|
||||
<< fieldName << " already exists in database"
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
@ -76,11 +73,10 @@ void Foam::readFields::loadField
|
||||
&& fieldHeader.headerClassName() == vfType::typeName
|
||||
)
|
||||
{
|
||||
// store field locally
|
||||
Info<< " Reading " << fieldName << endl;
|
||||
label sz = vflds.size();
|
||||
vflds.setSize(sz+1);
|
||||
vflds.set(sz, new vfType(fieldHeader, mesh));
|
||||
// Store field on mesh database
|
||||
if (log_) Info<< " Reading " << fieldName << endl;
|
||||
vfType* vfPtr = new vfType(fieldHeader, mesh);
|
||||
mesh.objectRegistry::store(vfPtr);
|
||||
}
|
||||
else if
|
||||
(
|
||||
@ -88,11 +84,10 @@ void Foam::readFields::loadField
|
||||
&& fieldHeader.headerClassName() == sfType::typeName
|
||||
)
|
||||
{
|
||||
// store field locally
|
||||
Info<< " Reading " << fieldName << endl;
|
||||
label sz = sflds.size();
|
||||
sflds.setSize(sz+1);
|
||||
sflds.set(sz, new sfType(fieldHeader, mesh));
|
||||
// Store field on mesh database
|
||||
if (log_) Info<< " Reading " << fieldName << endl;
|
||||
sfType* sfPtr = new sfType(fieldHeader, mesh);
|
||||
mesh.objectRegistry::store(sfPtr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2013-2015 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -72,11 +72,9 @@ void Foam::regionSizeDistribution::writeGraph
|
||||
|
||||
OFstream str(outputPath/formatterPtr_().getFileName(coords, valNames));
|
||||
|
||||
if (log_)
|
||||
{
|
||||
Info<< "Writing distribution of " << valueName << " to " << str.name()
|
||||
<< endl;
|
||||
}
|
||||
if (log_) Info
|
||||
<< "Writing distribution of " << valueName << " to " << str.name()
|
||||
<< endl;
|
||||
|
||||
List<const scalarField*> valPtrs(1);
|
||||
valPtrs[0] = &values;
|
||||
@ -162,16 +160,12 @@ void Foam::regionSizeDistribution::writeAlphaFields
|
||||
<< endl;
|
||||
}
|
||||
|
||||
if (log_)
|
||||
{
|
||||
Info<< "Writing liquid-core field to " << liquidCore.name() << endl;
|
||||
}
|
||||
if (log_) Info
|
||||
<< "Writing liquid-core field to " << liquidCore.name() << endl;
|
||||
liquidCore.write();
|
||||
|
||||
if (log_)
|
||||
{
|
||||
Info<< "Writing background field to " << backgroundAlpha.name() << endl;
|
||||
}
|
||||
if (log_) Info
|
||||
<< "Writing background field to " << backgroundAlpha.name() << endl;
|
||||
backgroundAlpha.write();
|
||||
}
|
||||
|
||||
@ -351,16 +345,8 @@ Foam::regionSizeDistribution::regionSizeDistribution
|
||||
else
|
||||
{
|
||||
active_ = false;
|
||||
WarningIn
|
||||
(
|
||||
"regionSizeDistribution::regionSizeDistribution"
|
||||
"("
|
||||
"const word&, "
|
||||
"const objectRegistry&, "
|
||||
"const dictionary&, "
|
||||
"const bool"
|
||||
")"
|
||||
) << "No fvMesh available, deactivating " << name_ << nl
|
||||
WarningInFunction
|
||||
<< "No fvMesh available, deactivating " << name_ << nl
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
@ -398,11 +384,9 @@ void Foam::regionSizeDistribution::read(const dictionary& dict)
|
||||
{
|
||||
coordSysPtr_.reset(new coordinateSystem(obr_, dict));
|
||||
|
||||
if (log_)
|
||||
{
|
||||
Info<< "Transforming all vectorFields with coordinate system "
|
||||
<< coordSysPtr_().name() << endl;
|
||||
}
|
||||
if (log_) Info
|
||||
<< "Transforming all vectorFields with coordinate system "
|
||||
<< coordSysPtr_().name() << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -467,24 +451,20 @@ void Foam::regionSizeDistribution::write()
|
||||
: obr_.lookupObject<volScalarField>(alphaName_)
|
||||
);
|
||||
|
||||
if (log_)
|
||||
{
|
||||
Info<< " Volume of alpha = "
|
||||
<< fvc::domainIntegrate(alpha).value()
|
||||
<< endl;
|
||||
}
|
||||
if (log_) Info
|
||||
<< " Volume of alpha = "
|
||||
<< fvc::domainIntegrate(alpha).value()
|
||||
<< endl;
|
||||
|
||||
const scalar meshVol = gSum(mesh.V());
|
||||
const scalar maxDropletVol = 1.0/6.0*pow(maxDiam_, 3);
|
||||
const scalar delta = (maxDiam_-minDiam_)/nBins_;
|
||||
|
||||
if (log_)
|
||||
{
|
||||
Info<< " Mesh volume = " << meshVol << nl
|
||||
<< " Maximum droplet diameter = " << maxDiam_ << nl
|
||||
<< " Maximum droplet volume = " << maxDropletVol
|
||||
<< endl;
|
||||
}
|
||||
if (log_) Info
|
||||
<< " Mesh volume = " << meshVol << nl
|
||||
<< " Maximum droplet diameter = " << maxDiam_ << nl
|
||||
<< " Maximum droplet volume = " << maxDropletVol
|
||||
<< endl;
|
||||
|
||||
|
||||
// Determine blocked faces
|
||||
@ -543,11 +523,9 @@ void Foam::regionSizeDistribution::write()
|
||||
|
||||
regionSplit regions(mesh, blockedFace);
|
||||
|
||||
if (log_)
|
||||
{
|
||||
Info<< " Determined " << regions.nRegions()
|
||||
<< " disconnected regions" << endl;
|
||||
}
|
||||
if (log_) Info
|
||||
<< " Determined " << regions.nRegions()
|
||||
<< " disconnected regions" << endl;
|
||||
|
||||
|
||||
if (debug)
|
||||
@ -566,12 +544,9 @@ void Foam::regionSizeDistribution::write()
|
||||
dimensionedScalar("zero", dimless, 0)
|
||||
);
|
||||
|
||||
if (log_)
|
||||
{
|
||||
Info<< " Dumping region as " << volScalarField::typeName
|
||||
<< " to " << region.name()
|
||||
<< endl;
|
||||
}
|
||||
if (log_) Info
|
||||
<< " Dumping region as " << volScalarField::typeName
|
||||
<< " to " << region.name() << endl;
|
||||
|
||||
forAll(regions, cellI)
|
||||
{
|
||||
@ -602,14 +577,12 @@ void Foam::regionSizeDistribution::write()
|
||||
|
||||
if (debug)
|
||||
{
|
||||
if (log_)
|
||||
{
|
||||
Info<< " " << token::TAB << "Region"
|
||||
<< token::TAB << "Volume(mesh)"
|
||||
<< token::TAB << "Volume(" << alpha.name() << "):"
|
||||
<< token::TAB << "nCells"
|
||||
<< endl;
|
||||
}
|
||||
if (log_) Info
|
||||
<< " " << token::TAB << "Region"
|
||||
<< token::TAB << "Volume(mesh)"
|
||||
<< token::TAB << "Volume(" << alpha.name() << "):"
|
||||
<< token::TAB << "nCells"
|
||||
<< endl;
|
||||
|
||||
scalar meshSumVol = 0.0;
|
||||
scalar alphaSumVol = 0.0;
|
||||
@ -626,28 +599,24 @@ void Foam::regionSizeDistribution::write()
|
||||
++vIter, ++aIter, ++numIter
|
||||
)
|
||||
{
|
||||
if (log_)
|
||||
{
|
||||
Info<< " " << token::TAB << vIter.key()
|
||||
<< token::TAB << vIter()
|
||||
<< token::TAB << aIter()
|
||||
<< token::TAB << numIter()
|
||||
<< endl;
|
||||
}
|
||||
if (log_) Info
|
||||
<< " " << token::TAB << vIter.key()
|
||||
<< token::TAB << vIter()
|
||||
<< token::TAB << aIter()
|
||||
<< token::TAB << numIter()
|
||||
<< endl;
|
||||
|
||||
meshSumVol += vIter();
|
||||
alphaSumVol += aIter();
|
||||
nCells += numIter();
|
||||
}
|
||||
|
||||
if (log_)
|
||||
{
|
||||
Info<< " " << token::TAB << "Total:"
|
||||
<< token::TAB << meshSumVol
|
||||
<< token::TAB << alphaSumVol
|
||||
<< token::TAB << nCells
|
||||
<< nl << endl;
|
||||
}
|
||||
if (log_) Info
|
||||
<< " " << token::TAB << "Total:"
|
||||
<< token::TAB << meshSumVol
|
||||
<< token::TAB << alphaSumVol
|
||||
<< token::TAB << nCells
|
||||
<< nl << endl;
|
||||
}
|
||||
|
||||
|
||||
@ -876,13 +845,10 @@ void Foam::regionSizeDistribution::write()
|
||||
|
||||
if (coordSysPtr_.valid())
|
||||
{
|
||||
if (log_)
|
||||
{
|
||||
Info<< "Transforming vector field " << fldName
|
||||
<< " with coordinate system "
|
||||
<< coordSysPtr_().name()
|
||||
<< endl;
|
||||
}
|
||||
if (log_) Info
|
||||
<< "Transforming vector field " << fldName
|
||||
<< " with coordinate system "
|
||||
<< coordSysPtr_().name() << endl;
|
||||
|
||||
fld = coordSysPtr_().localVector(fld);
|
||||
}
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: dev |
|
||||
| \\ / A nd | Web: www.OpenFOAM.org |
|
||||
| \\ / O peration | Version: plus |
|
||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
@ -84,6 +84,10 @@ functions
|
||||
// subcycling.
|
||||
nSubCycle 5;
|
||||
|
||||
|
||||
// Optional clipping
|
||||
//bounds (0.2 -10 -10)(0.22 10 10);
|
||||
|
||||
// Cloud name to use
|
||||
cloudName particleTracks;
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -23,18 +23,10 @@ License
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "Pstream.H"
|
||||
#include "functionObjectList.H"
|
||||
#include "streamLine.H"
|
||||
#include "fvMesh.H"
|
||||
#include "streamLineParticleCloud.H"
|
||||
#include "ReadFields.H"
|
||||
#include "meshSearch.H"
|
||||
#include "sampledSet.H"
|
||||
#include "globalIndex.H"
|
||||
#include "mapDistribute.H"
|
||||
#include "interpolationCellPoint.H"
|
||||
#include "PatchTools.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
@ -46,60 +38,8 @@ defineTypeNameAndDebug(streamLine, 0);
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
Foam::autoPtr<Foam::indirectPrimitivePatch>
|
||||
Foam::streamLine::wallPatch() const
|
||||
{
|
||||
const fvMesh& mesh = dynamic_cast<const fvMesh&>(obr_);
|
||||
|
||||
const polyBoundaryMesh& patches = mesh.boundaryMesh();
|
||||
|
||||
label nFaces = 0;
|
||||
|
||||
forAll(patches, patchI)
|
||||
{
|
||||
//if (!polyPatch::constraintType(patches[patchI].type()))
|
||||
if (isA<wallPolyPatch>(patches[patchI]))
|
||||
{
|
||||
nFaces += patches[patchI].size();
|
||||
}
|
||||
}
|
||||
|
||||
labelList addressing(nFaces);
|
||||
|
||||
nFaces = 0;
|
||||
|
||||
forAll(patches, patchI)
|
||||
{
|
||||
//if (!polyPatch::constraintType(patches[patchI].type()))
|
||||
if (isA<wallPolyPatch>(patches[patchI]))
|
||||
{
|
||||
const polyPatch& pp = patches[patchI];
|
||||
|
||||
forAll(pp, i)
|
||||
{
|
||||
addressing[nFaces++] = pp.start()+i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return autoPtr<indirectPrimitivePatch>
|
||||
(
|
||||
new indirectPrimitivePatch
|
||||
(
|
||||
IndirectList<face>
|
||||
(
|
||||
mesh.faces(),
|
||||
addressing
|
||||
),
|
||||
mesh.points()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
void Foam::streamLine::track()
|
||||
{
|
||||
const Time& runTime = obr_.time();
|
||||
const fvMesh& mesh = dynamic_cast<const fvMesh&>(obr_);
|
||||
|
||||
IDLList<streamLineParticle> initialParticles;
|
||||
@ -128,173 +68,26 @@ void Foam::streamLine::track()
|
||||
|
||||
label nSeeds = returnReduce(particles.size(), sumOp<label>());
|
||||
|
||||
Info << " seeded " << nSeeds << " particles" << endl;
|
||||
if (log_) Info<< " seeded " << nSeeds << " particles" << endl;
|
||||
|
||||
// Read or lookup fields
|
||||
PtrList<volScalarField> vsFlds;
|
||||
PtrList<interpolation<scalar> > vsInterp;
|
||||
PtrList<volVectorField> vvFlds;
|
||||
PtrList<interpolation<vector> > vvInterp;
|
||||
|
||||
label UIndex = -1;
|
||||
|
||||
if (loadFromFiles_)
|
||||
{
|
||||
IOobjectList allObjects(mesh, runTime.timeName());
|
||||
initInterpolations
|
||||
(
|
||||
nSeeds,
|
||||
UIndex,
|
||||
vsFlds,
|
||||
vsInterp,
|
||||
vvFlds,
|
||||
vvInterp
|
||||
);
|
||||
|
||||
IOobjectList objects(2*fields_.size());
|
||||
forAll(fields_, i)
|
||||
{
|
||||
objects.add(*allObjects[fields_[i]]);
|
||||
}
|
||||
|
||||
ReadFields(mesh, objects, vsFlds);
|
||||
vsInterp.setSize(vsFlds.size());
|
||||
forAll(vsFlds, i)
|
||||
{
|
||||
vsInterp.set
|
||||
(
|
||||
i,
|
||||
interpolation<scalar>::New
|
||||
(
|
||||
interpolationScheme_,
|
||||
vsFlds[i]
|
||||
)
|
||||
);
|
||||
}
|
||||
ReadFields(mesh, objects, vvFlds);
|
||||
vvInterp.setSize(vvFlds.size());
|
||||
forAll(vvFlds, i)
|
||||
{
|
||||
vvInterp.set
|
||||
(
|
||||
i,
|
||||
interpolation<vector>::New
|
||||
(
|
||||
interpolationScheme_,
|
||||
vvFlds[i]
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
label nScalar = 0;
|
||||
label nVector = 0;
|
||||
|
||||
forAll(fields_, i)
|
||||
{
|
||||
if (mesh.foundObject<volScalarField>(fields_[i]))
|
||||
{
|
||||
nScalar++;
|
||||
}
|
||||
else if (mesh.foundObject<volVectorField>(fields_[i]))
|
||||
{
|
||||
nVector++;
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorIn("streamLine::track()")
|
||||
<< "Cannot find field " << fields_[i] << nl
|
||||
<< "Valid scalar fields are:"
|
||||
<< mesh.names(volScalarField::typeName) << nl
|
||||
<< "Valid vector fields are:"
|
||||
<< mesh.names(volVectorField::typeName)
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
vsInterp.setSize(nScalar);
|
||||
nScalar = 0;
|
||||
vvInterp.setSize(nVector);
|
||||
nVector = 0;
|
||||
|
||||
forAll(fields_, i)
|
||||
{
|
||||
if (mesh.foundObject<volScalarField>(fields_[i]))
|
||||
{
|
||||
const volScalarField& f = mesh.lookupObject<volScalarField>
|
||||
(
|
||||
fields_[i]
|
||||
);
|
||||
vsInterp.set
|
||||
(
|
||||
nScalar++,
|
||||
interpolation<scalar>::New
|
||||
(
|
||||
interpolationScheme_,
|
||||
f
|
||||
)
|
||||
);
|
||||
}
|
||||
else if (mesh.foundObject<volVectorField>(fields_[i]))
|
||||
{
|
||||
const volVectorField& f = mesh.lookupObject<volVectorField>
|
||||
(
|
||||
fields_[i]
|
||||
);
|
||||
|
||||
if (f.name() == UName_)
|
||||
{
|
||||
UIndex = nVector;
|
||||
}
|
||||
|
||||
vvInterp.set
|
||||
(
|
||||
nVector++,
|
||||
interpolation<vector>::New
|
||||
(
|
||||
interpolationScheme_,
|
||||
f
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Store the names
|
||||
scalarNames_.setSize(vsInterp.size());
|
||||
forAll(vsInterp, i)
|
||||
{
|
||||
scalarNames_[i] = vsInterp[i].psi().name();
|
||||
}
|
||||
vectorNames_.setSize(vvInterp.size());
|
||||
forAll(vvInterp, i)
|
||||
{
|
||||
vectorNames_[i] = vvInterp[i].psi().name();
|
||||
}
|
||||
|
||||
// Check that we know the index of U in the interpolators.
|
||||
|
||||
if (UIndex == -1)
|
||||
{
|
||||
FatalErrorIn("streamLine::track()")
|
||||
<< "Cannot find field to move particles with : " << UName_ << nl
|
||||
<< "This field has to be present in the sampled fields " << fields_
|
||||
<< " and in the objectRegistry."
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
// Sampled data
|
||||
// ~~~~~~~~~~~~
|
||||
|
||||
// Size to maximum expected sizes.
|
||||
allTracks_.clear();
|
||||
allTracks_.setCapacity(nSeeds);
|
||||
allScalars_.setSize(vsInterp.size());
|
||||
forAll(allScalars_, i)
|
||||
{
|
||||
allScalars_[i].clear();
|
||||
allScalars_[i].setCapacity(nSeeds);
|
||||
}
|
||||
allVectors_.setSize(vvInterp.size());
|
||||
forAll(allVectors_, i)
|
||||
{
|
||||
allVectors_[i].clear();
|
||||
allVectors_[i].setCapacity(nSeeds);
|
||||
}
|
||||
|
||||
|
||||
// additional particle info
|
||||
// Additional particle info
|
||||
streamLineParticle::trackingData td
|
||||
(
|
||||
particles,
|
||||
@ -330,33 +123,13 @@ Foam::streamLine::streamLine
|
||||
const bool loadFromFiles
|
||||
)
|
||||
:
|
||||
dict_(dict),
|
||||
name_(name),
|
||||
obr_(obr),
|
||||
loadFromFiles_(loadFromFiles),
|
||||
active_(true),
|
||||
nSubCycle_(0)
|
||||
streamLineBase(name, obr, dict, loadFromFiles)
|
||||
{
|
||||
// Only active if a fvMesh is available
|
||||
if (isA<fvMesh>(obr_))
|
||||
// Check if the available mesh is an fvMesh otherise deactivate
|
||||
if (setActive<fvMesh>())
|
||||
{
|
||||
read(dict_);
|
||||
}
|
||||
else
|
||||
{
|
||||
active_ = false;
|
||||
WarningIn
|
||||
(
|
||||
"streamLine::streamLine\n"
|
||||
"(\n"
|
||||
"const word&,\n"
|
||||
"const objectRegistry&,\n"
|
||||
"const dictionary&,\n"
|
||||
"const bool\n"
|
||||
")"
|
||||
) << "No fvMesh available, deactivating."
|
||||
<< nl << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -372,59 +145,20 @@ void Foam::streamLine::read(const dictionary& dict)
|
||||
{
|
||||
if (active_)
|
||||
{
|
||||
Info<< type() << " " << name_ << ":" << nl;
|
||||
|
||||
//dict_ = dict;
|
||||
dict.lookup("fields") >> fields_;
|
||||
if (dict.found("UName"))
|
||||
{
|
||||
dict.lookup("UName") >> UName_;
|
||||
}
|
||||
else
|
||||
{
|
||||
UName_ = "U";
|
||||
if (dict.found("U"))
|
||||
{
|
||||
IOWarningIn("streamLine::read(const dictionary&)", dict)
|
||||
<< "Using deprecated entry \"U\"."
|
||||
<< " Please use \"UName\" instead."
|
||||
<< endl;
|
||||
dict.lookup("U") >> UName_;
|
||||
}
|
||||
}
|
||||
|
||||
if (findIndex(fields_, UName_) == -1)
|
||||
{
|
||||
FatalIOErrorIn("streamLine::read(const dictionary&)", dict)
|
||||
<< "Velocity field for tracking " << UName_
|
||||
<< " should be present in the list of fields " << fields_
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
|
||||
|
||||
dict.lookup("trackForward") >> trackForward_;
|
||||
dict.lookup("lifeTime") >> lifeTime_;
|
||||
if (lifeTime_ < 1)
|
||||
{
|
||||
FatalErrorIn(":streamLine::read(const dictionary&)")
|
||||
<< "Illegal value " << lifeTime_ << " for lifeTime"
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
streamLineBase::read(dict);
|
||||
|
||||
bool subCycling = dict.found("nSubCycle");
|
||||
bool fixedLength = dict.found("trackLength");
|
||||
|
||||
if (subCycling && fixedLength)
|
||||
{
|
||||
FatalIOErrorIn("streamLine::read(const dictionary&)", dict)
|
||||
FatalIOErrorInFunction(dict)
|
||||
<< "Cannot both specify automatic time stepping (through '"
|
||||
<< "nSubCycle' specification) and fixed track length (through '"
|
||||
<< "trackLength')"
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
|
||||
|
||||
nSubCycle_ = 1;
|
||||
if (dict.readIfPresent("nSubCycle", nSubCycle_))
|
||||
{
|
||||
@ -433,361 +167,14 @@ void Foam::streamLine::read(const dictionary& dict)
|
||||
{
|
||||
nSubCycle_ = 1;
|
||||
}
|
||||
Info<< " automatic track length specified through"
|
||||
<< " number of sub cycles : " << nSubCycle_ << nl << endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
dict.lookup("trackLength") >> trackLength_;
|
||||
|
||||
Info<< " fixed track length specified : "
|
||||
<< trackLength_ << nl << endl;
|
||||
}
|
||||
|
||||
|
||||
interpolationScheme_ = dict.lookupOrDefault
|
||||
(
|
||||
"interpolationScheme",
|
||||
interpolationCellPoint<scalar>::typeName
|
||||
);
|
||||
|
||||
//Info<< " using interpolation " << interpolationScheme_
|
||||
// << endl;
|
||||
|
||||
cloudName_ = dict.lookupOrDefault<word>("cloudName", "streamLine");
|
||||
dict.lookup("seedSampleSet") >> seedSet_;
|
||||
|
||||
const fvMesh& mesh = dynamic_cast<const fvMesh&>(obr_);
|
||||
|
||||
meshSearchPtr_.reset(new meshSearch(mesh));
|
||||
|
||||
const dictionary& coeffsDict = dict.subDict(seedSet_ + "Coeffs");
|
||||
sampledSetPtr_ = sampledSet::New
|
||||
(
|
||||
seedSet_,
|
||||
mesh,
|
||||
meshSearchPtr_(),
|
||||
coeffsDict
|
||||
);
|
||||
coeffsDict.lookup("axis") >> sampledSetAxis_;
|
||||
|
||||
scalarFormatterPtr_ = writer<scalar>::New(dict.lookup("setFormat"));
|
||||
vectorFormatterPtr_ = writer<vector>::New(dict.lookup("setFormat"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::streamLine::execute()
|
||||
{
|
||||
// const Time& runTime = obr_.time();
|
||||
// Pout<< "**streamLine::execute : time:" << runTime.timeName() << endl;
|
||||
//
|
||||
// bool isOutputTime = false;
|
||||
//
|
||||
// const functionObjectList& fobs = runTime.functionObjects();
|
||||
//
|
||||
// forAll(fobs, i)
|
||||
// {
|
||||
// if (isA<streamLineFunctionObject>(fobs[i]))
|
||||
// {
|
||||
// const streamLineFunctionObject& fo =
|
||||
// dynamic_cast<const streamLineFunctionObject&>(fobs[i]);
|
||||
//
|
||||
// if (fo.name() == name_)
|
||||
// {
|
||||
// Pout<< "found me:" << i << endl;
|
||||
// if (fo.outputControl().output())
|
||||
// {
|
||||
// isOutputTime = true;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//
|
||||
// if (active_ && isOutputTime)
|
||||
// {
|
||||
// track();
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
void Foam::streamLine::end()
|
||||
{}
|
||||
|
||||
|
||||
void Foam::streamLine::timeSet()
|
||||
{}
|
||||
|
||||
|
||||
void Foam::streamLine::write()
|
||||
{
|
||||
if (active_)
|
||||
{
|
||||
Info<< type() << " " << name_ << " output:" << nl;
|
||||
|
||||
const Time& runTime = obr_.time();
|
||||
const fvMesh& mesh = dynamic_cast<const fvMesh&>(obr_);
|
||||
|
||||
|
||||
// Do all injection and tracking
|
||||
track();
|
||||
|
||||
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
// Append slave tracks to master ones
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
globalIndex globalTrackIDs(allTracks_.size());
|
||||
|
||||
// Construct a distribution map to pull all to the master.
|
||||
labelListList sendMap(Pstream::nProcs());
|
||||
labelListList recvMap(Pstream::nProcs());
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
// Master: receive all. My own first, then consecutive
|
||||
// processors.
|
||||
label trackI = 0;
|
||||
|
||||
forAll(recvMap, procI)
|
||||
{
|
||||
labelList& fromProc = recvMap[procI];
|
||||
fromProc.setSize(globalTrackIDs.localSize(procI));
|
||||
forAll(fromProc, i)
|
||||
{
|
||||
fromProc[i] = trackI++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
labelList& toMaster = sendMap[0];
|
||||
toMaster.setSize(globalTrackIDs.localSize());
|
||||
forAll(toMaster, i)
|
||||
{
|
||||
toMaster[i] = i;
|
||||
}
|
||||
|
||||
const mapDistribute distMap
|
||||
(
|
||||
globalTrackIDs.size(),
|
||||
sendMap.xfer(),
|
||||
recvMap.xfer()
|
||||
);
|
||||
|
||||
|
||||
// Distribute the track positions. Note: use scheduled comms
|
||||
// to prevent buffering.
|
||||
allTracks_.shrink();
|
||||
mapDistributeBase::distribute
|
||||
(
|
||||
Pstream::scheduled,
|
||||
distMap.schedule(),
|
||||
distMap.constructSize(),
|
||||
distMap.subMap(),
|
||||
false,
|
||||
distMap.constructMap(),
|
||||
false,
|
||||
allTracks_,
|
||||
flipOp()
|
||||
);
|
||||
|
||||
// Distribute the scalars
|
||||
forAll(allScalars_, scalarI)
|
||||
{
|
||||
allScalars_[scalarI].shrink();
|
||||
mapDistributeBase::distribute
|
||||
(
|
||||
Pstream::scheduled,
|
||||
distMap.schedule(),
|
||||
distMap.constructSize(),
|
||||
distMap.subMap(),
|
||||
false,
|
||||
distMap.constructMap(),
|
||||
false,
|
||||
allScalars_[scalarI],
|
||||
flipOp()
|
||||
);
|
||||
allScalars_[scalarI].setCapacity(allScalars_[scalarI].size());
|
||||
}
|
||||
// Distribute the vectors
|
||||
forAll(allVectors_, vectorI)
|
||||
{
|
||||
allVectors_[vectorI].shrink();
|
||||
mapDistributeBase::distribute
|
||||
(
|
||||
Pstream::scheduled,
|
||||
distMap.schedule(),
|
||||
distMap.constructSize(),
|
||||
distMap.subMap(),
|
||||
false,
|
||||
distMap.constructMap(),
|
||||
false,
|
||||
allVectors_[vectorI],
|
||||
flipOp()
|
||||
);
|
||||
allVectors_[vectorI].setCapacity(allVectors_[vectorI].size());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
label n = 0;
|
||||
forAll(allTracks_, trackI)
|
||||
{
|
||||
n += allTracks_[trackI].size();
|
||||
}
|
||||
|
||||
Info<< " Tracks:" << allTracks_.size() << nl
|
||||
<< " Total samples:" << n
|
||||
<< endl;
|
||||
|
||||
|
||||
// Massage into form suitable for writers
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
if (Pstream::master() && allTracks_.size())
|
||||
{
|
||||
// Make output directory
|
||||
|
||||
fileName vtkPath
|
||||
(
|
||||
Pstream::parRun()
|
||||
? runTime.path()/".."/"postProcessing"/"sets"/name()
|
||||
: runTime.path()/"postProcessing"/"sets"/name()
|
||||
);
|
||||
if (mesh.name() != fvMesh::defaultRegion)
|
||||
{
|
||||
vtkPath = vtkPath/mesh.name();
|
||||
}
|
||||
vtkPath = vtkPath/mesh.time().timeName();
|
||||
|
||||
mkDir(vtkPath);
|
||||
|
||||
// Convert track positions
|
||||
|
||||
PtrList<coordSet> tracks(allTracks_.size());
|
||||
forAll(allTracks_, trackI)
|
||||
{
|
||||
tracks.set
|
||||
(
|
||||
trackI,
|
||||
new coordSet
|
||||
(
|
||||
"track" + Foam::name(trackI),
|
||||
sampledSetAxis_ //"xyz"
|
||||
)
|
||||
);
|
||||
tracks[trackI].transfer(allTracks_[trackI]);
|
||||
}
|
||||
|
||||
// Convert scalar values
|
||||
|
||||
if (allScalars_.size() > 0)
|
||||
{
|
||||
List<List<scalarField> > scalarValues(allScalars_.size());
|
||||
|
||||
forAll(allScalars_, scalarI)
|
||||
{
|
||||
DynamicList<scalarList>& allTrackVals =
|
||||
allScalars_[scalarI];
|
||||
scalarValues[scalarI].setSize(allTrackVals.size());
|
||||
|
||||
forAll(allTrackVals, trackI)
|
||||
{
|
||||
scalarList& trackVals = allTrackVals[trackI];
|
||||
scalarValues[scalarI][trackI].transfer(trackVals);
|
||||
}
|
||||
}
|
||||
|
||||
fileName vtkFile
|
||||
(
|
||||
vtkPath
|
||||
/ scalarFormatterPtr_().getFileName
|
||||
(
|
||||
tracks[0],
|
||||
scalarNames_
|
||||
)
|
||||
);
|
||||
|
||||
Info<< " Writing data to " << vtkFile.path() << endl;
|
||||
|
||||
scalarFormatterPtr_().write
|
||||
(
|
||||
true, // writeTracks
|
||||
tracks,
|
||||
scalarNames_,
|
||||
scalarValues,
|
||||
OFstream(vtkFile)()
|
||||
);
|
||||
}
|
||||
|
||||
// Convert vector values
|
||||
|
||||
if (allVectors_.size() > 0)
|
||||
{
|
||||
List<List<vectorField> > vectorValues(allVectors_.size());
|
||||
|
||||
forAll(allVectors_, vectorI)
|
||||
{
|
||||
DynamicList<vectorList>& allTrackVals =
|
||||
allVectors_[vectorI];
|
||||
vectorValues[vectorI].setSize(allTrackVals.size());
|
||||
|
||||
forAll(allTrackVals, trackI)
|
||||
{
|
||||
vectorList& trackVals = allTrackVals[trackI];
|
||||
vectorValues[vectorI][trackI].transfer(trackVals);
|
||||
}
|
||||
}
|
||||
|
||||
fileName vtkFile
|
||||
(
|
||||
vtkPath
|
||||
/ vectorFormatterPtr_().getFileName
|
||||
(
|
||||
tracks[0],
|
||||
vectorNames_
|
||||
)
|
||||
);
|
||||
|
||||
//Info<< " Writing vector data to " << vtkFile << endl;
|
||||
|
||||
vectorFormatterPtr_().write
|
||||
(
|
||||
true, // writeTracks
|
||||
tracks,
|
||||
vectorNames_,
|
||||
vectorValues,
|
||||
OFstream(vtkFile)()
|
||||
);
|
||||
}
|
||||
if (log_) Info
|
||||
<< " automatic track length specified through"
|
||||
<< " number of sub cycles : " << nSubCycle_ << nl
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::streamLine::updateMesh(const mapPolyMesh&)
|
||||
{
|
||||
read(dict_);
|
||||
}
|
||||
|
||||
|
||||
void Foam::streamLine::movePoints(const polyMesh&)
|
||||
{
|
||||
// Moving mesh affects the search tree
|
||||
read(dict_);
|
||||
}
|
||||
|
||||
|
||||
//void Foam::streamLine::readUpdate(const polyMesh::readUpdateState state)
|
||||
//{
|
||||
// if (state != UNCHANGED)
|
||||
// {
|
||||
// read(dict_);
|
||||
// }
|
||||
//}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -50,6 +50,7 @@ Description
|
||||
lifeTime 10000;
|
||||
trackLength 1e-3;
|
||||
nSubCycle 5;
|
||||
bounds (0.2 -10 -10)(0.22 10 10);
|
||||
cloudName particleTracks;
|
||||
seedSampleSet uniform;
|
||||
uniformCoeffs
|
||||
@ -74,6 +75,8 @@ Description
|
||||
trackLength | tracking segment length | no |
|
||||
nSubCycle | number of tracking steps per cell | no|
|
||||
cloudName | cloud name to use | yes |
|
||||
log | Log to standard output | no | yes
|
||||
bounds | Bounding box to trim tracks | no | greatBox
|
||||
seedSampleSet| seeding method (see below)| yes |
|
||||
\endtable
|
||||
|
||||
@ -94,6 +97,7 @@ SeeAlso
|
||||
Foam::OutputFilterFunctionObject
|
||||
Foam::sampledSet
|
||||
Foam::wallBoundedStreamLine
|
||||
Foam::streamLineBase
|
||||
|
||||
SourceFiles
|
||||
streamLine.C
|
||||
@ -103,15 +107,7 @@ SourceFiles
|
||||
#ifndef streamLine_H
|
||||
#define streamLine_H
|
||||
|
||||
#include "volFieldsFwd.H"
|
||||
#include "pointFieldFwd.H"
|
||||
#include "Switch.H"
|
||||
#include "DynamicList.H"
|
||||
#include "scalarList.H"
|
||||
#include "vectorList.H"
|
||||
#include "polyMesh.H"
|
||||
#include "writer.H"
|
||||
#include "indirectPrimitivePatch.H"
|
||||
#include "streamLineBase.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -121,103 +117,22 @@ namespace Foam
|
||||
// Forward declaration of classes
|
||||
class objectRegistry;
|
||||
class dictionary;
|
||||
class mapPolyMesh;
|
||||
class meshSearch;
|
||||
class sampledSet;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class streamLine Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class streamLine
|
||||
:
|
||||
public streamLineBase
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Input dictionary
|
||||
dictionary dict_;
|
||||
|
||||
//- Name of this set of field averages.
|
||||
word name_;
|
||||
|
||||
//- Database this class is registered to
|
||||
const objectRegistry& obr_;
|
||||
|
||||
//- Load fields from files (not from objectRegistry)
|
||||
bool loadFromFiles_;
|
||||
|
||||
//- On/off switch
|
||||
bool active_;
|
||||
|
||||
//- List of fields to sample
|
||||
wordList fields_;
|
||||
|
||||
//- Field to transport particle with
|
||||
word UName_;
|
||||
|
||||
//- Interpolation scheme to use
|
||||
word interpolationScheme_;
|
||||
|
||||
//- Whether to use +u or -u
|
||||
bool trackForward_;
|
||||
|
||||
//- Maximum lifetime (= number of cells) of particle
|
||||
label lifeTime_;
|
||||
|
||||
//- Number of subcycling steps
|
||||
label nSubCycle_;
|
||||
|
||||
//- Track length
|
||||
scalar trackLength_;
|
||||
|
||||
//- Optional specified name of particles
|
||||
word cloudName_;
|
||||
|
||||
//- Type of seed
|
||||
word seedSet_;
|
||||
|
||||
//- Names of scalar fields
|
||||
wordList scalarNames_;
|
||||
|
||||
//- Names of vector fields
|
||||
wordList vectorNames_;
|
||||
|
||||
|
||||
|
||||
// Demand driven
|
||||
|
||||
//- Mesh searching enigne
|
||||
autoPtr<meshSearch> meshSearchPtr_;
|
||||
|
||||
//- Seed set engine
|
||||
autoPtr<sampledSet> sampledSetPtr_;
|
||||
|
||||
//- Axis of the sampled points to output
|
||||
word sampledSetAxis_;
|
||||
|
||||
//- File writer for scalar data
|
||||
autoPtr<writer<scalar> > scalarFormatterPtr_;
|
||||
|
||||
//- File writer for vector data
|
||||
autoPtr<writer<vector> > vectorFormatterPtr_;
|
||||
|
||||
|
||||
// Generated data
|
||||
|
||||
//- All tracks. Per particle the points it passed through
|
||||
DynamicList<List<point> > allTracks_;
|
||||
|
||||
//- Per scalarField, per particle, the sampled value.
|
||||
List<DynamicList<scalarList> > allScalars_;
|
||||
|
||||
//- Per scalarField, per particle, the sampled value.
|
||||
List<DynamicList<vectorList> > allVectors_;
|
||||
|
||||
|
||||
//- Construct patch out of all wall patch faces
|
||||
autoPtr<indirectPrimitivePatch> wallPatch() const;
|
||||
|
||||
//- Do all seeding and tracking
|
||||
void track();
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
streamLine(const streamLine&);
|
||||
@ -251,35 +166,11 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return name of the set of field averages
|
||||
virtual const word& name() const
|
||||
{
|
||||
return name_;
|
||||
}
|
||||
|
||||
//- Read the field average data
|
||||
//- Read settings
|
||||
virtual void read(const dictionary&);
|
||||
|
||||
//- Execute the averaging
|
||||
virtual void execute();
|
||||
|
||||
//- Execute the averaging at the final time-loop, currently does nothing
|
||||
virtual void end();
|
||||
|
||||
//- Called when time was set at the end of the Time::operator++
|
||||
virtual void timeSet();
|
||||
|
||||
//- Calculate the field average data and write
|
||||
virtual void write();
|
||||
|
||||
//- Update for changes of mesh
|
||||
virtual void updateMesh(const mapPolyMesh&);
|
||||
|
||||
//- Update for mesh point-motion
|
||||
virtual void movePoints(const polyMesh&);
|
||||
|
||||
////- Update for changes of mesh due to readUpdate
|
||||
//virtual void readUpdate(const polyMesh::readUpdateState state);
|
||||
//- Do the actual tracking to fill the track data
|
||||
virtual void track();
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,977 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "streamLineBase.H"
|
||||
#include "fvMesh.H"
|
||||
#include "ReadFields.H"
|
||||
#include "sampledSet.H"
|
||||
#include "globalIndex.H"
|
||||
#include "mapDistribute.H"
|
||||
#include "interpolationCellPoint.H"
|
||||
#include "wallPolyPatch.H"
|
||||
#include "meshSearchMeshObject.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(streamLineBase, 0);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
Foam::autoPtr<Foam::indirectPrimitivePatch>
|
||||
Foam::streamLineBase::wallPatch() const
|
||||
{
|
||||
const fvMesh& mesh = dynamic_cast<const fvMesh&>(obr_);
|
||||
|
||||
const polyBoundaryMesh& patches = mesh.boundaryMesh();
|
||||
|
||||
label nFaces = 0;
|
||||
|
||||
forAll(patches, patchI)
|
||||
{
|
||||
//if (!polyPatch::constraintType(patches[patchI].type()))
|
||||
if (isA<wallPolyPatch>(patches[patchI]))
|
||||
{
|
||||
nFaces += patches[patchI].size();
|
||||
}
|
||||
}
|
||||
|
||||
labelList addressing(nFaces);
|
||||
|
||||
nFaces = 0;
|
||||
|
||||
forAll(patches, patchI)
|
||||
{
|
||||
//if (!polyPatch::constraintType(patches[patchI].type()))
|
||||
if (isA<wallPolyPatch>(patches[patchI]))
|
||||
{
|
||||
const polyPatch& pp = patches[patchI];
|
||||
|
||||
forAll(pp, i)
|
||||
{
|
||||
addressing[nFaces++] = pp.start()+i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return autoPtr<indirectPrimitivePatch>
|
||||
(
|
||||
new indirectPrimitivePatch
|
||||
(
|
||||
IndirectList<face>
|
||||
(
|
||||
mesh.faces(),
|
||||
addressing
|
||||
),
|
||||
mesh.points()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
void Foam::streamLineBase::initInterpolations
|
||||
(
|
||||
const label nSeeds,
|
||||
label& UIndex,
|
||||
PtrList<volScalarField>& vsFlds,
|
||||
PtrList<interpolation<scalar> >& vsInterp,
|
||||
PtrList<volVectorField>& vvFlds,
|
||||
PtrList<interpolation<vector> >& vvInterp
|
||||
)
|
||||
{
|
||||
const Time& runTime = obr_.time();
|
||||
const fvMesh& mesh = dynamic_cast<const fvMesh&>(obr_);
|
||||
|
||||
// Read or lookup fields
|
||||
|
||||
if (loadFromFiles_)
|
||||
{
|
||||
IOobjectList allObjects(mesh, runTime.timeName());
|
||||
|
||||
IOobjectList objects(2*fields_.size());
|
||||
forAll(fields_, i)
|
||||
{
|
||||
objects.add(*allObjects[fields_[i]]);
|
||||
}
|
||||
|
||||
ReadFields(mesh, objects, vsFlds);
|
||||
vsInterp.setSize(vsFlds.size());
|
||||
forAll(vsFlds, i)
|
||||
{
|
||||
vsInterp.set
|
||||
(
|
||||
i,
|
||||
interpolation<scalar>::New
|
||||
(
|
||||
interpolationScheme_,
|
||||
vsFlds[i]
|
||||
)
|
||||
);
|
||||
}
|
||||
ReadFields(mesh, objects, vvFlds);
|
||||
vvInterp.setSize(vvFlds.size());
|
||||
forAll(vvFlds, i)
|
||||
{
|
||||
vvInterp.set
|
||||
(
|
||||
i,
|
||||
interpolation<vector>::New
|
||||
(
|
||||
interpolationScheme_,
|
||||
vvFlds[i]
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
label nScalar = 0;
|
||||
label nVector = 0;
|
||||
|
||||
forAll(fields_, i)
|
||||
{
|
||||
if (mesh.foundObject<volScalarField>(fields_[i]))
|
||||
{
|
||||
nScalar++;
|
||||
}
|
||||
else if (mesh.foundObject<volVectorField>(fields_[i]))
|
||||
{
|
||||
nVector++;
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Cannot find field " << fields_[i] << nl
|
||||
<< "Valid scalar fields are:"
|
||||
<< mesh.names(volScalarField::typeName) << nl
|
||||
<< "Valid vector fields are:"
|
||||
<< mesh.names(volVectorField::typeName)
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
vsInterp.setSize(nScalar);
|
||||
nScalar = 0;
|
||||
vvInterp.setSize(nVector);
|
||||
nVector = 0;
|
||||
|
||||
forAll(fields_, i)
|
||||
{
|
||||
if (mesh.foundObject<volScalarField>(fields_[i]))
|
||||
{
|
||||
const volScalarField& f = mesh.lookupObject<volScalarField>
|
||||
(
|
||||
fields_[i]
|
||||
);
|
||||
vsInterp.set
|
||||
(
|
||||
nScalar++,
|
||||
interpolation<scalar>::New
|
||||
(
|
||||
interpolationScheme_,
|
||||
f
|
||||
)
|
||||
);
|
||||
}
|
||||
else if (mesh.foundObject<volVectorField>(fields_[i]))
|
||||
{
|
||||
const volVectorField& f = mesh.lookupObject<volVectorField>
|
||||
(
|
||||
fields_[i]
|
||||
);
|
||||
|
||||
if (f.name() == UName_)
|
||||
{
|
||||
UIndex = nVector;
|
||||
}
|
||||
|
||||
vvInterp.set
|
||||
(
|
||||
nVector++,
|
||||
interpolation<vector>::New
|
||||
(
|
||||
interpolationScheme_,
|
||||
f
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Store the names
|
||||
scalarNames_.setSize(vsInterp.size());
|
||||
forAll(vsInterp, i)
|
||||
{
|
||||
scalarNames_[i] = vsInterp[i].psi().name();
|
||||
}
|
||||
vectorNames_.setSize(vvInterp.size());
|
||||
forAll(vvInterp, i)
|
||||
{
|
||||
vectorNames_[i] = vvInterp[i].psi().name();
|
||||
}
|
||||
|
||||
// Check that we know the index of U in the interpolators.
|
||||
|
||||
if (UIndex == -1)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Cannot find field to move particles with : " << UName_ << nl
|
||||
<< "This field has to be present in the sampled fields " << fields_
|
||||
<< " and in the objectRegistry."
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
// Sampled data
|
||||
// ~~~~~~~~~~~~
|
||||
|
||||
// Size to maximum expected sizes.
|
||||
allTracks_.clear();
|
||||
allTracks_.setCapacity(nSeeds);
|
||||
allScalars_.setSize(vsInterp.size());
|
||||
forAll(allScalars_, i)
|
||||
{
|
||||
allScalars_[i].clear();
|
||||
allScalars_[i].setCapacity(nSeeds);
|
||||
}
|
||||
allVectors_.setSize(vvInterp.size());
|
||||
forAll(allVectors_, i)
|
||||
{
|
||||
allVectors_[i].clear();
|
||||
allVectors_[i].setCapacity(nSeeds);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::streamLineBase::storePoint
|
||||
(
|
||||
const label trackI,
|
||||
|
||||
const scalar w,
|
||||
const label leftI,
|
||||
const label rightI,
|
||||
|
||||
DynamicList<point>& newTrack,
|
||||
DynamicList<scalarList>& newScalars,
|
||||
DynamicList<vectorList>& newVectors
|
||||
) const
|
||||
{
|
||||
label sz = newTrack.size();
|
||||
|
||||
const List<point>& track = allTracks_[trackI];
|
||||
|
||||
newTrack.append((1.0-w)*track[leftI] + w*track[rightI]);
|
||||
|
||||
// Scalars
|
||||
{
|
||||
newScalars.append(scalarList(allScalars_.size()));
|
||||
scalarList& newVals = newScalars[sz];
|
||||
|
||||
forAll(allScalars_, scalarI)
|
||||
{
|
||||
const scalarList& trackVals = allScalars_[scalarI][trackI];
|
||||
newVals[scalarI] = (1.0-w)*trackVals[leftI] + w*trackVals[rightI];
|
||||
}
|
||||
}
|
||||
|
||||
// Vectors
|
||||
{
|
||||
newVectors.append(vectorList(allVectors_.size()));
|
||||
vectorList& newVals = newVectors[sz];
|
||||
|
||||
forAll(allVectors_, vectorI)
|
||||
{
|
||||
const vectorList& trackVals = allVectors_[vectorI][trackI];
|
||||
newVals[vectorI] = (1.0-w)*trackVals[leftI] + w*trackVals[rightI];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Can split a track into multiple tracks
|
||||
void Foam::streamLineBase::trimToBox
|
||||
(
|
||||
const treeBoundBox& bb,
|
||||
const label trackI,
|
||||
PtrList<DynamicList<point> >& newTracks,
|
||||
PtrList<DynamicList<scalarList> >& newScalars,
|
||||
PtrList<DynamicList<vectorList> >& newVectors
|
||||
) const
|
||||
{
|
||||
const List<point>& track = allTracks_[trackI];
|
||||
if (track.size())
|
||||
{
|
||||
for
|
||||
(
|
||||
label segmentI = 1;
|
||||
segmentI < track.size();
|
||||
segmentI++
|
||||
)
|
||||
{
|
||||
const point& startPt = track[segmentI-1];
|
||||
const point& endPt = track[segmentI];
|
||||
|
||||
const vector d(endPt-startPt);
|
||||
scalar magD = mag(d);
|
||||
if (magD > ROOTVSMALL)
|
||||
{
|
||||
if (bb.contains(startPt))
|
||||
{
|
||||
// Store 1.0*track[segmentI-1]+0*track[segmentI]
|
||||
storePoint
|
||||
(
|
||||
trackI,
|
||||
|
||||
0.0,
|
||||
segmentI-1,
|
||||
segmentI,
|
||||
|
||||
newTracks.last(),
|
||||
newScalars.last(),
|
||||
newVectors.last()
|
||||
);
|
||||
|
||||
if (!bb.contains(endPt))
|
||||
{
|
||||
point clipPt;
|
||||
if (bb.intersects(endPt, startPt, clipPt))
|
||||
{
|
||||
// End of track. Store point and interpolated
|
||||
// values
|
||||
storePoint
|
||||
(
|
||||
trackI,
|
||||
|
||||
mag(clipPt-startPt)/magD,
|
||||
segmentI-1,
|
||||
segmentI,
|
||||
|
||||
newTracks.last(),
|
||||
newScalars.last(),
|
||||
newVectors.last()
|
||||
);
|
||||
|
||||
newTracks.last().shrink();
|
||||
newScalars.last().shrink();
|
||||
newVectors.last().shrink();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// startPt outside box. New track. Get starting point
|
||||
|
||||
point clipPt;
|
||||
if (bb.intersects(startPt, endPt, clipPt))
|
||||
{
|
||||
// New track
|
||||
newTracks.append
|
||||
(
|
||||
new DynamicList<point>(track.size()/10)
|
||||
);
|
||||
newScalars.append
|
||||
(
|
||||
new DynamicList<scalarList>(track.size()/10)
|
||||
);
|
||||
newVectors.append
|
||||
(
|
||||
new DynamicList<vectorList>(track.size()/10)
|
||||
);
|
||||
|
||||
// Store point and interpolated values
|
||||
storePoint
|
||||
(
|
||||
trackI,
|
||||
|
||||
mag(clipPt-startPt)/magD,
|
||||
segmentI-1,
|
||||
segmentI,
|
||||
|
||||
newTracks.last(),
|
||||
newScalars.last(),
|
||||
newVectors.last()
|
||||
);
|
||||
|
||||
if (!bb.contains(endPt))
|
||||
{
|
||||
bb.intersects
|
||||
(
|
||||
endPt,
|
||||
point(clipPt),
|
||||
clipPt
|
||||
);
|
||||
|
||||
// Store point and interpolated values
|
||||
storePoint
|
||||
(
|
||||
trackI,
|
||||
|
||||
mag(clipPt-startPt)/magD,
|
||||
segmentI-1,
|
||||
segmentI,
|
||||
|
||||
newTracks.last(),
|
||||
newScalars.last(),
|
||||
newVectors.last()
|
||||
);
|
||||
|
||||
newTracks.last().shrink();
|
||||
newScalars.last().shrink();
|
||||
newVectors.last().shrink();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Last point
|
||||
if (bb.contains(track.last()))
|
||||
{
|
||||
storePoint
|
||||
(
|
||||
trackI,
|
||||
|
||||
1.0,
|
||||
track.size()-2,
|
||||
track.size()-1,
|
||||
|
||||
newTracks.last(),
|
||||
newScalars.last(),
|
||||
newVectors.last()
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::streamLineBase::trimToBox(const treeBoundBox& bb)
|
||||
{
|
||||
// Storage for new tracks. Per track, per sample the coordinate (newTracks)
|
||||
// or values for all the sampled fields (newScalars, newVectors)
|
||||
PtrList<DynamicList<point> > newTracks;
|
||||
PtrList<DynamicList<scalarList> > newScalars;
|
||||
PtrList<DynamicList<vectorList> > newVectors;
|
||||
|
||||
forAll(allTracks_, trackI)
|
||||
{
|
||||
const List<point>& track = allTracks_[trackI];
|
||||
|
||||
if (track.size())
|
||||
{
|
||||
// New track. Assume it consists of the whole track
|
||||
newTracks.append(new DynamicList<point>(track.size()));
|
||||
newScalars.append(new DynamicList<scalarList>(track.size()));
|
||||
newVectors.append(new DynamicList<vectorList>(track.size()));
|
||||
|
||||
// Trim, split and append to newTracks
|
||||
trimToBox(bb, trackI, newTracks, newScalars, newVectors);
|
||||
}
|
||||
}
|
||||
|
||||
// Transfer newTracks to allTracks_
|
||||
allTracks_.setSize(newTracks.size());
|
||||
forAll(allTracks_, trackI)
|
||||
{
|
||||
allTracks_[trackI].transfer(newTracks[trackI]);
|
||||
}
|
||||
// Replace track scalars
|
||||
forAll(allScalars_, scalarI)
|
||||
{
|
||||
DynamicList<scalarList>& fieldVals = allScalars_[scalarI];
|
||||
fieldVals.setSize(newTracks.size());
|
||||
|
||||
forAll(fieldVals, trackI)
|
||||
{
|
||||
scalarList& trackVals = allScalars_[scalarI][trackI];
|
||||
trackVals.setSize(newScalars[trackI].size());
|
||||
forAll(trackVals, sampleI)
|
||||
{
|
||||
trackVals[sampleI] = newScalars[trackI][sampleI][scalarI];
|
||||
}
|
||||
}
|
||||
}
|
||||
// Replace track vectors
|
||||
forAll(allVectors_, vectorI)
|
||||
{
|
||||
DynamicList<vectorList>& fieldVals = allVectors_[vectorI];
|
||||
fieldVals.setSize(newTracks.size());
|
||||
forAll(fieldVals, trackI)
|
||||
{
|
||||
vectorList& trackVals = allVectors_[vectorI][trackI];
|
||||
trackVals.setSize(newVectors[trackI].size());
|
||||
forAll(trackVals, sampleI)
|
||||
{
|
||||
trackVals[sampleI] = newVectors[trackI][sampleI][vectorI];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::streamLineBase::streamLineBase
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
const dictionary& dict,
|
||||
const bool loadFromFiles
|
||||
)
|
||||
:
|
||||
functionObjectState(obr, name),
|
||||
dict_(dict),
|
||||
obr_(obr),
|
||||
loadFromFiles_(loadFromFiles),
|
||||
log_(true)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::streamLineBase::~streamLineBase()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::streamLineBase::read(const dictionary& dict)
|
||||
{
|
||||
if (active_)
|
||||
{
|
||||
log_.readIfPresent("log", dict);
|
||||
|
||||
if (log_) Info<< type() << " " << name_ << ":" << nl;
|
||||
|
||||
dict.lookup("fields") >> fields_;
|
||||
if (dict.found("UName"))
|
||||
{
|
||||
dict.lookup("UName") >> UName_;
|
||||
}
|
||||
else
|
||||
{
|
||||
UName_ = "U";
|
||||
if (dict.found("U"))
|
||||
{
|
||||
IOWarningInFunction(dict)
|
||||
<< "Using deprecated entry \"U\"."
|
||||
<< " Please use \"UName\" instead."
|
||||
<< endl;
|
||||
dict.lookup("U") >> UName_;
|
||||
}
|
||||
}
|
||||
|
||||
if (findIndex(fields_, UName_) == -1)
|
||||
{
|
||||
FatalIOErrorInFunction(dict)
|
||||
<< "Velocity field for tracking " << UName_
|
||||
<< " should be present in the list of fields " << fields_
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
|
||||
|
||||
dict.lookup("trackForward") >> trackForward_;
|
||||
dict.lookup("lifeTime") >> lifeTime_;
|
||||
if (lifeTime_ < 1)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Illegal value " << lifeTime_ << " for lifeTime"
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
|
||||
trackLength_ = VGREAT;
|
||||
if (dict.found("trackLength"))
|
||||
{
|
||||
dict.lookup("trackLength") >> trackLength_;
|
||||
|
||||
if (log_)
|
||||
{
|
||||
Info<< type() << " : fixed track length specified : "
|
||||
<< trackLength_ << nl << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bounds_ = boundBox::greatBox;
|
||||
if (dict.readIfPresent("bounds", bounds_))
|
||||
{
|
||||
if (log_) Info<< " clipping all segments to " << bounds_ << nl << endl;
|
||||
}
|
||||
|
||||
|
||||
interpolationScheme_ = dict.lookupOrDefault
|
||||
(
|
||||
"interpolationScheme",
|
||||
interpolationCellPoint<scalar>::typeName
|
||||
);
|
||||
|
||||
//if (log_) Info<< " using interpolation " << interpolationScheme_
|
||||
// << endl;
|
||||
|
||||
cloudName_ = dict.lookupOrDefault<word>("cloudName", type());
|
||||
dict.lookup("seedSampleSet") >> seedSet_;
|
||||
|
||||
const fvMesh& mesh = dynamic_cast<const fvMesh&>(obr_);
|
||||
|
||||
const dictionary& coeffsDict = dict.subDict(seedSet_ + "Coeffs");
|
||||
|
||||
sampledSetPtr_ = sampledSet::New
|
||||
(
|
||||
seedSet_,
|
||||
mesh,
|
||||
meshSearchMeshObject::New(mesh),
|
||||
coeffsDict
|
||||
);
|
||||
coeffsDict.lookup("axis") >> sampledSetAxis_;
|
||||
|
||||
scalarFormatterPtr_ = writer<scalar>::New(dict.lookup("setFormat"));
|
||||
vectorFormatterPtr_ = writer<vector>::New(dict.lookup("setFormat"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::streamLineBase::execute()
|
||||
{}
|
||||
|
||||
|
||||
void Foam::streamLineBase::end()
|
||||
{}
|
||||
|
||||
|
||||
void Foam::streamLineBase::timeSet()
|
||||
{}
|
||||
|
||||
|
||||
void Foam::streamLineBase::write()
|
||||
{
|
||||
if (active_)
|
||||
{
|
||||
if (log_) Info<< type() << " " << name_ << " output:" << nl;
|
||||
|
||||
const Time& runTime = obr_.time();
|
||||
const fvMesh& mesh = dynamic_cast<const fvMesh&>(obr_);
|
||||
|
||||
|
||||
// Do all injection and tracking
|
||||
track();
|
||||
|
||||
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
// Append slave tracks to master ones
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
globalIndex globalTrackIDs(allTracks_.size());
|
||||
|
||||
// Construct a distribution map to pull all to the master.
|
||||
labelListList sendMap(Pstream::nProcs());
|
||||
labelListList recvMap(Pstream::nProcs());
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
// Master: receive all. My own first, then consecutive
|
||||
// processors.
|
||||
label trackI = 0;
|
||||
|
||||
forAll(recvMap, procI)
|
||||
{
|
||||
labelList& fromProc = recvMap[procI];
|
||||
fromProc.setSize(globalTrackIDs.localSize(procI));
|
||||
forAll(fromProc, i)
|
||||
{
|
||||
fromProc[i] = trackI++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
labelList& toMaster = sendMap[0];
|
||||
toMaster.setSize(globalTrackIDs.localSize());
|
||||
forAll(toMaster, i)
|
||||
{
|
||||
toMaster[i] = i;
|
||||
}
|
||||
|
||||
const mapDistribute distMap
|
||||
(
|
||||
globalTrackIDs.size(),
|
||||
sendMap.xfer(),
|
||||
recvMap.xfer()
|
||||
);
|
||||
|
||||
|
||||
// Distribute the track positions. Note: use scheduled comms
|
||||
// to prevent buffering.
|
||||
allTracks_.shrink();
|
||||
mapDistributeBase::distribute
|
||||
(
|
||||
Pstream::scheduled,
|
||||
distMap.schedule(),
|
||||
distMap.constructSize(),
|
||||
distMap.subMap(),
|
||||
false,
|
||||
distMap.constructMap(),
|
||||
false,
|
||||
allTracks_,
|
||||
flipOp()
|
||||
);
|
||||
allTracks_.setCapacity(allTracks_.size());
|
||||
|
||||
// Distribute the scalars
|
||||
forAll(allScalars_, scalarI)
|
||||
{
|
||||
allScalars_[scalarI].shrink();
|
||||
mapDistributeBase::distribute
|
||||
(
|
||||
Pstream::scheduled,
|
||||
distMap.schedule(),
|
||||
distMap.constructSize(),
|
||||
distMap.subMap(),
|
||||
false,
|
||||
distMap.constructMap(),
|
||||
false,
|
||||
allScalars_[scalarI],
|
||||
flipOp()
|
||||
);
|
||||
allScalars_[scalarI].setCapacity(allScalars_[scalarI].size());
|
||||
}
|
||||
// Distribute the vectors
|
||||
forAll(allVectors_, vectorI)
|
||||
{
|
||||
allVectors_[vectorI].shrink();
|
||||
mapDistributeBase::distribute
|
||||
(
|
||||
Pstream::scheduled,
|
||||
distMap.schedule(),
|
||||
distMap.constructSize(),
|
||||
distMap.subMap(),
|
||||
false,
|
||||
distMap.constructMap(),
|
||||
false,
|
||||
allVectors_[vectorI],
|
||||
flipOp()
|
||||
);
|
||||
allVectors_[vectorI].setCapacity(allVectors_[vectorI].size());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
if (bounds_ != boundBox::greatBox)
|
||||
{
|
||||
// Clip to bounding box
|
||||
trimToBox(treeBoundBox(bounds_));
|
||||
}
|
||||
|
||||
|
||||
label nTracks = 0;
|
||||
label n = 0;
|
||||
forAll(allTracks_, trackI)
|
||||
{
|
||||
if (allTracks_[trackI].size())
|
||||
{
|
||||
nTracks++;
|
||||
n += allTracks_[trackI].size();
|
||||
}
|
||||
}
|
||||
|
||||
if (log_)
|
||||
{
|
||||
Info<< " Tracks:" << nTracks << nl
|
||||
<< " Total samples:" << n
|
||||
<< endl;
|
||||
}
|
||||
|
||||
|
||||
// Massage into form suitable for writers
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
// Make output directory
|
||||
|
||||
fileName vtkPath
|
||||
(
|
||||
Pstream::parRun()
|
||||
? runTime.path()/".."/"postProcessing"/"sets"/name()
|
||||
: runTime.path()/"postProcessing"/"sets"/name()
|
||||
);
|
||||
if (mesh.name() != fvMesh::defaultRegion)
|
||||
{
|
||||
vtkPath = vtkPath/mesh.name();
|
||||
}
|
||||
vtkPath = vtkPath/mesh.time().timeName();
|
||||
|
||||
mkDir(vtkPath);
|
||||
|
||||
// Convert track positions (and compact out empty tracks)
|
||||
|
||||
PtrList<coordSet> tracks(nTracks);
|
||||
nTracks = 0;
|
||||
labelList oldToNewTrack(allTracks_.size(), -1);
|
||||
|
||||
forAll(allTracks_, trackI)
|
||||
{
|
||||
if (allTracks_[trackI].size())
|
||||
{
|
||||
tracks.set
|
||||
(
|
||||
nTracks,
|
||||
new coordSet
|
||||
(
|
||||
"track" + Foam::name(nTracks),
|
||||
sampledSetAxis_ //"xyz"
|
||||
)
|
||||
);
|
||||
oldToNewTrack[trackI] = nTracks;
|
||||
tracks[nTracks].transfer(allTracks_[trackI]);
|
||||
nTracks++;
|
||||
}
|
||||
}
|
||||
|
||||
// Convert scalar values
|
||||
|
||||
if (allScalars_.size() > 0)
|
||||
{
|
||||
List<List<scalarField> > scalarValues(allScalars_.size());
|
||||
|
||||
forAll(allScalars_, scalarI)
|
||||
{
|
||||
DynamicList<scalarList>& allTrackVals =
|
||||
allScalars_[scalarI];
|
||||
scalarValues[scalarI].setSize(nTracks);
|
||||
|
||||
forAll(allTrackVals, trackI)
|
||||
{
|
||||
scalarList& vals = allTrackVals[trackI];
|
||||
if (vals.size())
|
||||
{
|
||||
label newTrackI = oldToNewTrack[trackI];
|
||||
scalarValues[scalarI][newTrackI].transfer(vals);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fileName vtkFile
|
||||
(
|
||||
vtkPath
|
||||
/ scalarFormatterPtr_().getFileName
|
||||
(
|
||||
tracks[0],
|
||||
scalarNames_
|
||||
)
|
||||
);
|
||||
|
||||
if (log_) Info
|
||||
<< " Writing data to " << vtkFile.path() << endl;
|
||||
|
||||
scalarFormatterPtr_().write
|
||||
(
|
||||
true, // writeTracks
|
||||
tracks,
|
||||
scalarNames_,
|
||||
scalarValues,
|
||||
OFstream(vtkFile)()
|
||||
);
|
||||
|
||||
forAll(scalarNames_, nameI)
|
||||
{
|
||||
dictionary propsDict;
|
||||
propsDict.add("file", vtkFile);
|
||||
const word& fieldName = scalarNames_[nameI];
|
||||
setProperty(fieldName, propsDict);
|
||||
}
|
||||
}
|
||||
|
||||
// Convert vector values
|
||||
|
||||
if (allVectors_.size() > 0)
|
||||
{
|
||||
List<List<vectorField> > vectorValues(allVectors_.size());
|
||||
|
||||
forAll(allVectors_, vectorI)
|
||||
{
|
||||
DynamicList<vectorList>& allTrackVals =
|
||||
allVectors_[vectorI];
|
||||
vectorValues[vectorI].setSize(nTracks);
|
||||
|
||||
forAll(allTrackVals, trackI)
|
||||
{
|
||||
vectorList& vals = allTrackVals[trackI];
|
||||
if (vals.size())
|
||||
{
|
||||
label newTrackI = oldToNewTrack[trackI];
|
||||
vectorValues[vectorI][newTrackI].transfer(vals);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fileName vtkFile
|
||||
(
|
||||
vtkPath
|
||||
/ vectorFormatterPtr_().getFileName
|
||||
(
|
||||
tracks[0],
|
||||
vectorNames_
|
||||
)
|
||||
);
|
||||
|
||||
//if (log_) Info<< " Writing vector data to " << vtkFile << endl;
|
||||
|
||||
vectorFormatterPtr_().write
|
||||
(
|
||||
true, // writeTracks
|
||||
tracks,
|
||||
vectorNames_,
|
||||
vectorValues,
|
||||
OFstream(vtkFile)()
|
||||
);
|
||||
|
||||
forAll(vectorNames_, nameI)
|
||||
{
|
||||
dictionary propsDict;
|
||||
propsDict.add("file", vtkFile);
|
||||
const word& fieldName = vectorNames_[nameI];
|
||||
setProperty(fieldName, propsDict);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::streamLineBase::updateMesh(const mapPolyMesh&)
|
||||
{
|
||||
read(dict_);
|
||||
}
|
||||
|
||||
|
||||
void Foam::streamLineBase::movePoints(const polyMesh&)
|
||||
{
|
||||
// Moving mesh affects the search tree
|
||||
read(dict_);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,246 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::streamLineBase
|
||||
|
||||
SeeAlso
|
||||
Foam::streamLine
|
||||
Foam::wallBoundedStreamLine
|
||||
|
||||
SourceFiles
|
||||
streamLineBase.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef streamLineBase_H
|
||||
#define streamLineBase_H
|
||||
|
||||
#include "functionObjectState.H"
|
||||
#include "DynamicList.H"
|
||||
#include "scalarList.H"
|
||||
#include "vectorList.H"
|
||||
#include "writer.H"
|
||||
#include "indirectPrimitivePatch.H"
|
||||
#include "interpolation.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward declaration of classes
|
||||
class objectRegistry;
|
||||
class dictionary;
|
||||
class mapPolyMesh;
|
||||
class meshSearch;
|
||||
class sampledSet;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class streamLineBase Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class streamLineBase
|
||||
:
|
||||
public functionObjectState
|
||||
{
|
||||
protected:
|
||||
|
||||
//- Input dictionary
|
||||
dictionary dict_;
|
||||
|
||||
//- Database this class is registered to
|
||||
const objectRegistry& obr_;
|
||||
|
||||
//- Load fields from files (not from objectRegistry)
|
||||
bool loadFromFiles_;
|
||||
|
||||
//- Switch to send output to Info as well as to file
|
||||
Switch log_;
|
||||
|
||||
//- List of fields to sample
|
||||
wordList fields_;
|
||||
|
||||
//- Field to transport particle with
|
||||
word UName_;
|
||||
|
||||
//- Interpolation scheme to use
|
||||
word interpolationScheme_;
|
||||
|
||||
//- Whether to use +u or -u
|
||||
bool trackForward_;
|
||||
|
||||
//- Maximum lifetime (= number of cells) of particle
|
||||
label lifeTime_;
|
||||
|
||||
//- Track length
|
||||
scalar trackLength_;
|
||||
|
||||
//- Optional trimming of tracks
|
||||
boundBox bounds_;
|
||||
|
||||
//- Optional specified name of particles
|
||||
word cloudName_;
|
||||
|
||||
//- Type of seed
|
||||
word seedSet_;
|
||||
|
||||
//- Names of scalar fields
|
||||
wordList scalarNames_;
|
||||
|
||||
//- Names of vector fields
|
||||
wordList vectorNames_;
|
||||
|
||||
|
||||
// Demand driven
|
||||
|
||||
//- Mesh searching enigne
|
||||
autoPtr<meshSearch> meshSearchPtr_;
|
||||
|
||||
//- Seed set engine
|
||||
autoPtr<sampledSet> sampledSetPtr_;
|
||||
|
||||
//- Axis of the sampled points to output
|
||||
word sampledSetAxis_;
|
||||
|
||||
//- File writer for scalar data
|
||||
autoPtr<writer<scalar> > scalarFormatterPtr_;
|
||||
|
||||
//- File writer for vector data
|
||||
autoPtr<writer<vector> > vectorFormatterPtr_;
|
||||
|
||||
|
||||
// Generated data
|
||||
|
||||
//- All tracks. Per track the points it passed through
|
||||
DynamicList<List<point> > allTracks_;
|
||||
|
||||
//- Per scalarField, per track, the sampled values
|
||||
List<DynamicList<scalarList> > allScalars_;
|
||||
|
||||
//- Per vectorField, per track, the sampled values
|
||||
List<DynamicList<vectorList> > allVectors_;
|
||||
|
||||
|
||||
//- Construct patch out of all wall patch faces
|
||||
autoPtr<indirectPrimitivePatch> wallPatch() const;
|
||||
|
||||
//- Initialise fields, interpolators and track storage
|
||||
void initInterpolations
|
||||
(
|
||||
const label nSeeds,
|
||||
label& UIndex,
|
||||
PtrList<volScalarField>& vsFlds,
|
||||
PtrList<interpolation<scalar> >& vsInterp,
|
||||
PtrList<volVectorField>& vvFlds,
|
||||
PtrList<interpolation<vector> >& vvInterp
|
||||
);
|
||||
|
||||
//- Generate point and values by interpolating from existing values
|
||||
void storePoint
|
||||
(
|
||||
const label trackI,
|
||||
|
||||
const scalar w,
|
||||
const label leftI,
|
||||
const label rightI,
|
||||
|
||||
DynamicList<point>& newTrack,
|
||||
DynamicList<List<scalar> >& newScalars,
|
||||
DynamicList<List<vector> >& newVectors
|
||||
) const;
|
||||
|
||||
//- Trim and possibly split a track
|
||||
void trimToBox
|
||||
(
|
||||
const treeBoundBox& bb,
|
||||
const label trackI,
|
||||
PtrList<DynamicList<point> >& newTracks,
|
||||
PtrList<DynamicList<scalarList> >& newScalars,
|
||||
PtrList<DynamicList<vectorList> >& newVectors
|
||||
) const;
|
||||
|
||||
//- Trim tracks to bounding box
|
||||
void trimToBox(const treeBoundBox& bb);
|
||||
|
||||
//- Do the actual tracking to fill the track data
|
||||
virtual void track() = 0;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("streamLineBase");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct for given objectRegistry and dictionary.
|
||||
// Allow the possibility to load fields from files
|
||||
streamLineBase
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry&,
|
||||
const dictionary&,
|
||||
const bool loadFromFiles = false
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~streamLineBase();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Read the field average data
|
||||
virtual void read(const dictionary&);
|
||||
|
||||
//- Execute the averaging
|
||||
virtual void execute();
|
||||
|
||||
//- Execute the averaging at the final time-loop, currently does nothing
|
||||
virtual void end();
|
||||
|
||||
//- Called when time was set at the end of the Time::operator++
|
||||
virtual void timeSet();
|
||||
|
||||
//- Track and write
|
||||
virtual void write();
|
||||
|
||||
//- Update for changes of mesh
|
||||
virtual void updateMesh(const mapPolyMesh&);
|
||||
|
||||
//- Update for mesh point-motion
|
||||
virtual void movePoints(const polyMesh&);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -65,7 +65,7 @@ Foam::vector Foam::streamLineParticle::interpolateFields
|
||||
{
|
||||
if (cellI == -1)
|
||||
{
|
||||
FatalErrorIn("streamLineParticle::interpolateFields(..)")
|
||||
FatalErrorInFunction
|
||||
<< "Cell:" << cellI << abort(FatalError);
|
||||
}
|
||||
|
||||
|
||||
@ -2,8 +2,8 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -46,7 +46,8 @@ Foam::surfaceInterpolateFields::surfaceInterpolateFields
|
||||
name_(name),
|
||||
obr_(obr),
|
||||
active_(true),
|
||||
fieldSet_()
|
||||
fieldSet_(),
|
||||
log_(true)
|
||||
{
|
||||
// Check if the available mesh is an fvMesh otherise deactivate
|
||||
if (isA<fvMesh>(obr_))
|
||||
@ -56,16 +57,8 @@ Foam::surfaceInterpolateFields::surfaceInterpolateFields
|
||||
else
|
||||
{
|
||||
active_ = false;
|
||||
WarningIn
|
||||
(
|
||||
"surfaceInterpolateFields::surfaceInterpolateFields"
|
||||
"("
|
||||
"const word&, "
|
||||
"const objectRegistry&, "
|
||||
"const dictionary&, "
|
||||
"const bool"
|
||||
")"
|
||||
) << "No fvMesh available, deactivating " << name_
|
||||
WarningInFunction
|
||||
<< "No fvMesh available, deactivating " << name_
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
@ -83,6 +76,7 @@ void Foam::surfaceInterpolateFields::read(const dictionary& dict)
|
||||
{
|
||||
if (active_)
|
||||
{
|
||||
log_.readIfPresent("log", dict);
|
||||
dict.lookup("fields") >> fieldSet_;
|
||||
}
|
||||
}
|
||||
@ -92,7 +86,7 @@ void Foam::surfaceInterpolateFields::execute()
|
||||
{
|
||||
if (active_)
|
||||
{
|
||||
Info<< type() << " " << name_ << " output:" << nl;
|
||||
if (log_) Info<< type() << " " << name_ << " output:" << nl;
|
||||
|
||||
// Clear out any previously loaded fields
|
||||
ssf_.clear();
|
||||
@ -107,17 +101,14 @@ void Foam::surfaceInterpolateFields::execute()
|
||||
interpolateFields<symmTensor>(sSymmtf_);
|
||||
interpolateFields<tensor>(stf_);
|
||||
|
||||
Info<< endl;
|
||||
if (log_) Info<< endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::surfaceInterpolateFields::end()
|
||||
{
|
||||
if (active_)
|
||||
{
|
||||
execute();
|
||||
}
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
|
||||
@ -131,9 +122,9 @@ void Foam::surfaceInterpolateFields::write()
|
||||
{
|
||||
if (active_)
|
||||
{
|
||||
Info<< type() << " " << name_ << " output:" << nl;
|
||||
|
||||
Info<< " Writing interpolated surface fields to "
|
||||
if (log_) Info
|
||||
<< type() << " " << name_ << " output:" << nl
|
||||
<< " Writing interpolated surface fields to "
|
||||
<< obr_.time().timeName() << endl;
|
||||
|
||||
forAll(ssf_, i)
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -54,6 +54,7 @@ Description
|
||||
Property | Description | Required | Default value
|
||||
type | type name: nearWallFields | yes |
|
||||
fields | list of fields with correspoding output field names | yes |
|
||||
log | Log to standard output | no | yes
|
||||
\endtable
|
||||
|
||||
|
||||
@ -103,9 +104,11 @@ protected:
|
||||
bool active_;
|
||||
|
||||
//- Fields to process
|
||||
//wordList fieldSet_;
|
||||
List<Tuple2<word, word> > fieldSet_;
|
||||
|
||||
//- Switch to send output to Info as well as to file
|
||||
Switch log_;
|
||||
|
||||
//- Locally constructed fields
|
||||
PtrList<surfaceScalarField> ssf_;
|
||||
PtrList<surfaceVectorField> svf_;
|
||||
|
||||
@ -2,8 +2,8 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -59,7 +59,8 @@ void Foam::surfaceInterpolateFields::interpolateFields
|
||||
|
||||
if (obr_.found(sName))
|
||||
{
|
||||
Info<< " surface field " << sName << " already exists"
|
||||
if (log_) Info
|
||||
<< " surface field " << sName << " already exists"
|
||||
<< endl;
|
||||
}
|
||||
else
|
||||
@ -68,7 +69,8 @@ void Foam::surfaceInterpolateFields::interpolateFields
|
||||
sflds.setSize(sz+1);
|
||||
sflds.set(sz, new sfType(sName, linearInterpolate(fld)));
|
||||
|
||||
Info<< " interpolated " << fld.name() << " to create "
|
||||
if (log_) Info
|
||||
<< " interpolated " << fld.name() << " to create "
|
||||
<< sflds[sz].name() << endl;
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,49 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
Typedef
|
||||
Foam::IOvalueAverage
|
||||
|
||||
Description
|
||||
Instance of the generic IOOutputFilter for valueAverage.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef IOvalueAverage_H
|
||||
#define IOvalueAverage_H
|
||||
|
||||
#include "valueAverage.H"
|
||||
#include "IOOutputFilter.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
typedef IOOutputFilter<valueAverage> IOvalueAverage;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,199 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "valueAverage.H"
|
||||
#include "Time.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(valueAverage, 0);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * //
|
||||
|
||||
void Foam::valueAverage::writeFileHeader(Ostream& os) const
|
||||
{
|
||||
writeHeader(os, "Value averages");
|
||||
writeCommented(os, "Time");
|
||||
forAll(fieldNames_, fieldI)
|
||||
{
|
||||
writeTabbed(os, fieldNames_[fieldI]);
|
||||
}
|
||||
os << endl;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::valueAverage::valueAverage
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
const dictionary& dict,
|
||||
const bool loadFromFiles
|
||||
)
|
||||
:
|
||||
functionObjectState(obr, name),
|
||||
functionObjectFile(obr, name, typeName, dict),
|
||||
obr_(obr),
|
||||
functionObjectName_(dict.lookup("functionObjectName")),
|
||||
fieldNames_(dict.lookup("fields")),
|
||||
window_(dict.lookupOrDefault<scalar>("window", -1)),
|
||||
totalTime_(fieldNames_.size(), obr_.time().deltaTValue()),
|
||||
resetOnRestart_(false),
|
||||
log_(true)
|
||||
{
|
||||
if (resetOnRestart_)
|
||||
{
|
||||
forAll(fieldNames_, fieldI)
|
||||
{
|
||||
const word& fieldName = fieldNames_[fieldI];
|
||||
|
||||
if (dict.found(fieldName))
|
||||
{
|
||||
const dictionary& valueDict = dict.subDict(fieldName);
|
||||
totalTime_[fieldI] = readScalar(valueDict.lookup("totalTime"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
writeFileHeader(file());
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::valueAverage::~valueAverage()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Public Member Functions * * * * * * * * * * * //
|
||||
|
||||
void Foam::valueAverage::read(const dictionary& dict)
|
||||
{
|
||||
if (active_)
|
||||
{
|
||||
functionObjectFile::read(dict);
|
||||
|
||||
log_ = dict.lookupOrDefault<Switch>("log", true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::valueAverage::execute()
|
||||
{
|
||||
if (!active_)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
scalar dt = obr_.time().deltaTValue();
|
||||
|
||||
if (log_) Info<< type() << ": " << name_ << " averages:" << nl;
|
||||
|
||||
file() << obr_.time().timeName();
|
||||
|
||||
DynamicList<label> unprocessedFields(fieldNames_.size());
|
||||
|
||||
forAll(fieldNames_, fieldI)
|
||||
{
|
||||
const word& fieldName(fieldNames_[fieldI]);
|
||||
const word meanName(fieldName + "Mean");
|
||||
|
||||
scalar Dt = totalTime_[fieldI];
|
||||
scalar alpha = (Dt - dt)/Dt;
|
||||
scalar beta = dt/Dt;
|
||||
|
||||
if (window_ > 0)
|
||||
{
|
||||
if (Dt - dt >= window_)
|
||||
{
|
||||
alpha = (window_ - dt)/window_;
|
||||
beta = dt/window_;
|
||||
}
|
||||
}
|
||||
|
||||
bool processed = false;
|
||||
calc<scalar>(fieldName, meanName, alpha, beta, processed);
|
||||
calc<vector>(fieldName, meanName, alpha, beta, processed);
|
||||
calc<sphericalTensor>(fieldName, meanName, alpha, beta, processed);
|
||||
calc<symmTensor>(fieldName, meanName, alpha, beta, processed);
|
||||
calc<tensor>(fieldName, meanName, alpha, beta, processed);
|
||||
|
||||
if (!processed)
|
||||
{
|
||||
unprocessedFields.append(fieldI);
|
||||
|
||||
if (writeToFile())
|
||||
{
|
||||
file() << tab << "n/a";
|
||||
}
|
||||
}
|
||||
|
||||
totalTime_[fieldI] += dt;
|
||||
}
|
||||
|
||||
file()<< endl;
|
||||
|
||||
if (unprocessedFields.size())
|
||||
{
|
||||
WarningInFunction
|
||||
<< "From function object: " << functionObjectName_ << nl
|
||||
<< "Unprocessed fields:" << nl;
|
||||
|
||||
forAll(unprocessedFields, i)
|
||||
{
|
||||
label fieldI = unprocessedFields[i];
|
||||
Info<< " " << fieldNames_[fieldI] << nl;
|
||||
}
|
||||
Info<< endl;
|
||||
}
|
||||
|
||||
if (log_) Info<< endl;
|
||||
}
|
||||
|
||||
|
||||
void Foam::valueAverage::end()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
|
||||
void Foam::valueAverage::timeSet()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
|
||||
void Foam::valueAverage::write()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,209 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::valueAverage
|
||||
|
||||
Group
|
||||
grpFieldFunctionObjects
|
||||
|
||||
Description
|
||||
This function object calculates the average value from the output of
|
||||
function objects that generate singular values.
|
||||
|
||||
Example of function object specification:
|
||||
\verbatim
|
||||
valueAverage1
|
||||
{
|
||||
type valueAverage;
|
||||
functionObjectLibs ("libfieldFunctionObjects.so");
|
||||
...
|
||||
writeToFile yes;
|
||||
log yes;
|
||||
functionObjectName forceCoeffs1;
|
||||
fields (Cm Cd Cl);
|
||||
window 0.5;
|
||||
}
|
||||
\endverbatim
|
||||
|
||||
\heading Function object usage
|
||||
\table
|
||||
Property | Description | Required | Default value
|
||||
type | type name: valueAverage | yes |
|
||||
writeToFile | write average data to file | no | yes
|
||||
log | write average data to standard output | no | yes
|
||||
fields | list of fields to process | yes |
|
||||
\endtable
|
||||
|
||||
Output data is written to the file \<timeDir\>/valueAverage.dat
|
||||
|
||||
SeeAlso
|
||||
Foam::functionObject
|
||||
Foam::functionObjectFile
|
||||
Foam::functionObjectState
|
||||
Foam::OutputFilterFunctionObject
|
||||
|
||||
SourceFiles
|
||||
valueAverage.C
|
||||
valueAverageTemplates.C
|
||||
IOvalueAverage.H
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef valueAverage_H
|
||||
#define valueAverage_H
|
||||
|
||||
#include "functionObjectState.H"
|
||||
#include "functionObjectFile.H"
|
||||
#include "Switch.H"
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward declaration of classes
|
||||
class objectRegistry;
|
||||
class dictionary;
|
||||
class polyMesh;
|
||||
class mapPolyMesh;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class valueAverage Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class valueAverage
|
||||
:
|
||||
public functionObjectState,
|
||||
public functionObjectFile
|
||||
{
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
//- Reference to the database
|
||||
const objectRegistry& obr_;
|
||||
|
||||
//- Name of function object to retrueve data from
|
||||
word functionObjectName_;
|
||||
|
||||
//- List of fields on which to operate
|
||||
wordList fieldNames_;
|
||||
|
||||
//- Averaging window
|
||||
const scalar window_;
|
||||
|
||||
//- Average time per field
|
||||
List<scalar> totalTime_;
|
||||
|
||||
//- Reset the averaging process on restart flag
|
||||
Switch resetOnRestart_;
|
||||
|
||||
//- Switch to send output to Info as well
|
||||
Switch log_;
|
||||
|
||||
|
||||
// Protected Member Functions
|
||||
|
||||
//- Templated function to calculate the average
|
||||
template<class Type>
|
||||
void calc
|
||||
(
|
||||
const word& fieldName,
|
||||
const word& meanName,
|
||||
const scalar alpha,
|
||||
const scalar beta,
|
||||
bool& processed
|
||||
);
|
||||
|
||||
//- Output file header information
|
||||
virtual void writeFileHeader(Ostream& os) const;
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
valueAverage(const valueAverage&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const valueAverage&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("valueAverage");
|
||||
|
||||
//- Constructor
|
||||
valueAverage
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
const dictionary& dict,
|
||||
const bool loadFromFiles = false
|
||||
);
|
||||
|
||||
//- Destructor
|
||||
virtual ~valueAverage();
|
||||
|
||||
|
||||
// Public Member Functions
|
||||
|
||||
//- 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();
|
||||
|
||||
//- Called when time was set at the end of the Time::operator++
|
||||
virtual void timeSet();
|
||||
|
||||
//- Write the fieldMinMax
|
||||
virtual void write();
|
||||
|
||||
//- Update for changes of mesh
|
||||
virtual void updateMesh(const mapPolyMesh&)
|
||||
{}
|
||||
|
||||
//- Update for changes of mesh
|
||||
virtual void movePoints(const polyMesh&)
|
||||
{}
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
#include "valueAverageTemplates.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,42 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "valueAverageFunctionObject.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineNamedTemplateTypeNameAndDebug(valueAverageFunctionObject, 0);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
functionObject,
|
||||
valueAverageFunctionObject,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,54 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
Typedef
|
||||
Foam::valueAverageFunctionObject
|
||||
|
||||
Description
|
||||
FunctionObject wrapper around valueAverageFunctionObject to allow them
|
||||
to be created via the functions entry within controlDict.
|
||||
|
||||
SourceFiles
|
||||
fieldMinMaxFunctionObject.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef valueAverageFunctionObject_H
|
||||
#define valueAverageFunctionObject_H
|
||||
|
||||
#include "valueAverage.H"
|
||||
#include "OutputFilterFunctionObject.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
typedef OutputFilterFunctionObject<valueAverage>
|
||||
valueAverageFunctionObject;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,60 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
void Foam::valueAverage::calc
|
||||
(
|
||||
const word& fieldName,
|
||||
const word& meanName,
|
||||
const scalar alpha,
|
||||
const scalar beta,
|
||||
bool& processed
|
||||
)
|
||||
{
|
||||
const word valueType = objectResultType(functionObjectName_, fieldName);
|
||||
|
||||
if (pTraits<Type>::typeName != valueType)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Type currentValue = getObjectResult<Type>(functionObjectName_, fieldName);
|
||||
|
||||
Type meanValue = getResult<Type>(meanName);
|
||||
meanValue = alpha*meanValue + beta*currentValue;
|
||||
|
||||
setResult(meanName, meanValue);
|
||||
|
||||
file() << tab << meanValue;
|
||||
|
||||
if (log_) Info<< " " << meanName << ": " << meanValue << nl;
|
||||
|
||||
processed = true;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,8 +1,8 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: dev |
|
||||
| \\ / A nd | Web: www.OpenFOAM.org |
|
||||
| \\ / O peration | Version: plus |
|
||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
@ -112,6 +112,9 @@ functions
|
||||
// Size of single track segment [m]
|
||||
//trackLength 1e-3;
|
||||
|
||||
// Optional clipping
|
||||
//bounds (0.2 -10 -10)(0.22 10 10);
|
||||
|
||||
// Cloud name to use
|
||||
cloudName particleTracks;
|
||||
|
||||
|
||||
@ -39,7 +39,7 @@ Foam::edge Foam::wallBoundedParticle::currentEdge() const
|
||||
{
|
||||
if ((meshEdgeStart_ != -1) == (diagEdge_ != -1))
|
||||
{
|
||||
FatalErrorIn("wallBoundedParticle::currentEdge() const")
|
||||
FatalErrorInFunction
|
||||
<< "Particle:"
|
||||
<< info()
|
||||
<< "cannot both be on a mesh edge and a face-diagonal edge."
|
||||
@ -93,11 +93,8 @@ void Foam::wallBoundedParticle::crossEdgeConnectedFace
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"wallBoundedParticle::crossEdgeConnectedFace"
|
||||
"(const edge&)"
|
||||
) << "Problem :"
|
||||
FatalErrorInFunction
|
||||
<< "Problem :"
|
||||
<< " particle:"
|
||||
<< info()
|
||||
<< "face:" << tetFace()
|
||||
@ -113,11 +110,8 @@ void Foam::wallBoundedParticle::crossEdgeConnectedFace
|
||||
const edge eNew(f[meshEdgeStart_], f.nextLabel(meshEdgeStart_));
|
||||
if (eNew != meshEdge)
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"wallBoundedParticle::crossEdgeConnectedFace"
|
||||
"(const edge&)"
|
||||
) << "Problem" << abort(FatalError);
|
||||
FatalErrorInFunction
|
||||
<< "Problem" << abort(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
@ -126,14 +120,14 @@ void Foam::wallBoundedParticle::crossDiagonalEdge()
|
||||
{
|
||||
if (diagEdge_ == -1)
|
||||
{
|
||||
FatalErrorIn("wallBoundedParticle::crossDiagonalEdge()")
|
||||
FatalErrorInFunction
|
||||
<< "Particle:"
|
||||
<< info()
|
||||
<< "not on a diagonal edge" << abort(FatalError);
|
||||
}
|
||||
if (meshEdgeStart_ != -1)
|
||||
{
|
||||
FatalErrorIn("wallBoundedParticle::crossDiagonalEdge()")
|
||||
FatalErrorInFunction
|
||||
<< "Particle:"
|
||||
<< info()
|
||||
<< "meshEdgeStart_:" << meshEdgeStart_ << abort(FatalError);
|
||||
@ -156,7 +150,7 @@ void Foam::wallBoundedParticle::crossDiagonalEdge()
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorIn("wallBoundedParticle::crossDiagonalEdge()")
|
||||
FatalErrorInFunction
|
||||
<< "Particle:"
|
||||
<< info()
|
||||
<< "tetPt:" << tetPt()
|
||||
@ -190,9 +184,7 @@ Foam::scalar Foam::wallBoundedParticle::trackFaceTri
|
||||
currentE = currentEdge();
|
||||
}
|
||||
|
||||
// Determine path along line position+s*d to see where intersections
|
||||
// are.
|
||||
|
||||
// Determine path along line position+s*d to see where intersections are.
|
||||
forAll(tri, i)
|
||||
{
|
||||
label j = tri.fcIndex(i);
|
||||
@ -259,23 +251,17 @@ bool Foam::wallBoundedParticle::isTriAlongTrack
|
||||
const triFace triVerts(currentTetIndices().faceTriIs(mesh_));
|
||||
const edge currentE = currentEdge();
|
||||
|
||||
//if (debug)
|
||||
if
|
||||
(
|
||||
currentE[0] == currentE[1]
|
||||
|| findIndex(triVerts, currentE[0]) == -1
|
||||
|| findIndex(triVerts, currentE[1]) == -1
|
||||
)
|
||||
{
|
||||
if
|
||||
(
|
||||
currentE[0] == currentE[1]
|
||||
|| findIndex(triVerts, currentE[0]) == -1
|
||||
|| findIndex(triVerts, currentE[1]) == -1
|
||||
)
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"wallBoundedParticle::isTriAlongTrack"
|
||||
"(const point&)"
|
||||
) << "Edge " << currentE << " not on triangle " << triVerts
|
||||
<< info()
|
||||
<< abort(FatalError);
|
||||
}
|
||||
FatalErrorInFunction
|
||||
<< "Edge " << currentE << " not on triangle " << triVerts
|
||||
<< info()
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
|
||||
@ -298,11 +284,8 @@ bool Foam::wallBoundedParticle::isTriAlongTrack
|
||||
}
|
||||
}
|
||||
|
||||
FatalErrorIn
|
||||
(
|
||||
"wallBoundedParticle::isTriAlongTrack"
|
||||
"(const point&)"
|
||||
) << "Problem" << abort(FatalError);
|
||||
FatalErrorInFunction
|
||||
<< "Problem" << abort(FatalError);
|
||||
|
||||
return false;
|
||||
}
|
||||
@ -344,12 +327,7 @@ Foam::wallBoundedParticle::wallBoundedParticle
|
||||
}
|
||||
else
|
||||
{
|
||||
is.read
|
||||
(
|
||||
reinterpret_cast<char*>(&meshEdgeStart_),
|
||||
sizeof(meshEdgeStart_)
|
||||
+ sizeof(diagEdge_)
|
||||
);
|
||||
is.read(reinterpret_cast<char*>(&meshEdgeStart_), sizeofFields_);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -115,15 +115,6 @@ protected:
|
||||
//- Construct current edge
|
||||
edge currentEdge() const;
|
||||
|
||||
//- Check if inside current tet
|
||||
//void checkInside() const;
|
||||
|
||||
//- Check if on current edge
|
||||
//void checkOnEdge() const;
|
||||
|
||||
//- Check if point on triangle
|
||||
//void checkOnTriangle(const point&) const;
|
||||
|
||||
//- Cross mesh edge into different face on same cell
|
||||
void crossEdgeConnectedFace(const edge& meshEdge);
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -206,11 +206,8 @@ Foam::scalar Foam::wallBoundedParticle::trackToEdge
|
||||
|
||||
if (mesh_.isInternalFace(tetFace()))
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"wallBoundedParticle::trackToEdge"
|
||||
"(TrackData&, const vector&)"
|
||||
) << "Can only track on boundary faces."
|
||||
FatalErrorInFunction
|
||||
<< "Can only track on boundary faces."
|
||||
<< " Face:" << tetFace()
|
||||
<< " at:" << mesh_.faceCentres()[tetFace()]
|
||||
<< abort(FatalError);
|
||||
@ -286,7 +283,7 @@ Foam::scalar Foam::wallBoundedParticle::trackToEdge
|
||||
{
|
||||
//Note: should not happen since boundary face so owner
|
||||
//Pout<< "Real edge." << endl;
|
||||
FatalErrorIn("shold not happend") << info()
|
||||
FatalErrorInFunction
|
||||
<< abort(FatalError);
|
||||
|
||||
diagEdge_ = -1;
|
||||
@ -332,7 +329,7 @@ Foam::scalar Foam::wallBoundedParticle::trackToEdge
|
||||
{
|
||||
//Note: should not happen since boundary face so owner
|
||||
//Pout<< "Real edge." << endl;
|
||||
FatalErrorIn("shold not happend") << info()
|
||||
FatalErrorInFunction
|
||||
<< abort(FatalError);
|
||||
|
||||
diagEdge_ = -1;
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -23,82 +23,22 @@ License
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "Pstream.H"
|
||||
#include "functionObjectList.H"
|
||||
#include "wallBoundedStreamLine.H"
|
||||
#include "fvMesh.H"
|
||||
#include "wallBoundedStreamLineParticleCloud.H"
|
||||
#include "ReadFields.H"
|
||||
#include "meshSearch.H"
|
||||
#include "sampledSet.H"
|
||||
#include "globalIndex.H"
|
||||
#include "mapDistribute.H"
|
||||
#include "interpolationCellPoint.H"
|
||||
#include "PatchTools.H"
|
||||
#include "meshSearchMeshObject.H"
|
||||
#include "faceSet.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(wallBoundedStreamLine, 0);
|
||||
defineTypeNameAndDebug(wallBoundedStreamLine, 0);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
Foam::autoPtr<Foam::indirectPrimitivePatch>
|
||||
Foam::wallBoundedStreamLine::wallPatch() const
|
||||
{
|
||||
const fvMesh& mesh = dynamic_cast<const fvMesh&>(obr_);
|
||||
|
||||
const polyBoundaryMesh& patches = mesh.boundaryMesh();
|
||||
|
||||
label nFaces = 0;
|
||||
|
||||
forAll(patches, patchI)
|
||||
{
|
||||
//if (!polyPatch::constraintType(patches[patchI].type()))
|
||||
if (isA<wallPolyPatch>(patches[patchI]))
|
||||
{
|
||||
nFaces += patches[patchI].size();
|
||||
}
|
||||
}
|
||||
|
||||
labelList addressing(nFaces);
|
||||
|
||||
nFaces = 0;
|
||||
|
||||
forAll(patches, patchI)
|
||||
{
|
||||
//if (!polyPatch::constraintType(patches[patchI].type()))
|
||||
if (isA<wallPolyPatch>(patches[patchI]))
|
||||
{
|
||||
const polyPatch& pp = patches[patchI];
|
||||
|
||||
forAll(pp, i)
|
||||
{
|
||||
addressing[nFaces++] = pp.start()+i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return autoPtr<indirectPrimitivePatch>
|
||||
(
|
||||
new indirectPrimitivePatch
|
||||
(
|
||||
IndirectList<face>
|
||||
(
|
||||
mesh.faces(),
|
||||
addressing
|
||||
),
|
||||
mesh.points()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Foam::tetIndices Foam::wallBoundedStreamLine::findNearestTet
|
||||
(
|
||||
const PackedBoolList& isWallPatch,
|
||||
@ -158,7 +98,7 @@ Foam::tetIndices Foam::wallBoundedStreamLine::findNearestTet
|
||||
|
||||
void Foam::wallBoundedStreamLine::track()
|
||||
{
|
||||
const Time& runTime = obr_.time();
|
||||
//const Time& runTime = obr_.time();
|
||||
const fvMesh& mesh = dynamic_cast<const fvMesh&>(obr_);
|
||||
|
||||
|
||||
@ -227,14 +167,14 @@ void Foam::wallBoundedStreamLine::track()
|
||||
else
|
||||
{
|
||||
Pout<< type() << " : ignoring seed " << seedPt
|
||||
<< " since not in wall cell." << endl;
|
||||
<< " since not in wall cell" << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
label nSeeds = returnReduce(particles.size(), sumOp<label>());
|
||||
|
||||
Info<< type() << " : seeded " << nSeeds << " particles." << endl;
|
||||
if (log_) Info<< type() << " : seeded " << nSeeds << " particles" << endl;
|
||||
|
||||
|
||||
|
||||
@ -243,168 +183,19 @@ void Foam::wallBoundedStreamLine::track()
|
||||
PtrList<interpolation<scalar> > vsInterp;
|
||||
PtrList<volVectorField> vvFlds;
|
||||
PtrList<interpolation<vector> > vvInterp;
|
||||
|
||||
label UIndex = -1;
|
||||
|
||||
if (loadFromFiles_)
|
||||
{
|
||||
IOobjectList allObjects(mesh, runTime.timeName());
|
||||
initInterpolations
|
||||
(
|
||||
nSeeds,
|
||||
UIndex,
|
||||
vsFlds,
|
||||
vsInterp,
|
||||
vvFlds,
|
||||
vvInterp
|
||||
);
|
||||
|
||||
IOobjectList objects(2*fields_.size());
|
||||
forAll(fields_, i)
|
||||
{
|
||||
objects.add(*allObjects[fields_[i]]);
|
||||
}
|
||||
|
||||
ReadFields(mesh, objects, vsFlds);
|
||||
vsInterp.setSize(vsFlds.size());
|
||||
forAll(vsFlds, i)
|
||||
{
|
||||
vsInterp.set
|
||||
(
|
||||
i,
|
||||
interpolation<scalar>::New
|
||||
(
|
||||
interpolationScheme_,
|
||||
vsFlds[i]
|
||||
)
|
||||
);
|
||||
}
|
||||
ReadFields(mesh, objects, vvFlds);
|
||||
vvInterp.setSize(vvFlds.size());
|
||||
forAll(vvFlds, i)
|
||||
{
|
||||
vvInterp.set
|
||||
(
|
||||
i,
|
||||
interpolation<vector>::New
|
||||
(
|
||||
interpolationScheme_,
|
||||
vvFlds[i]
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
label nScalar = 0;
|
||||
label nVector = 0;
|
||||
|
||||
forAll(fields_, i)
|
||||
{
|
||||
if (mesh.foundObject<volScalarField>(fields_[i]))
|
||||
{
|
||||
nScalar++;
|
||||
}
|
||||
else if (mesh.foundObject<volVectorField>(fields_[i]))
|
||||
{
|
||||
nVector++;
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorIn("wallBoundedStreamLine::execute()")
|
||||
<< "Cannot find field " << fields_[i] << endl
|
||||
<< "Valid scalar fields are:"
|
||||
<< mesh.names(volScalarField::typeName) << endl
|
||||
<< "Valid vector fields are:"
|
||||
<< mesh.names(volVectorField::typeName)
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
vsInterp.setSize(nScalar);
|
||||
nScalar = 0;
|
||||
vvInterp.setSize(nVector);
|
||||
nVector = 0;
|
||||
|
||||
forAll(fields_, i)
|
||||
{
|
||||
if (mesh.foundObject<volScalarField>(fields_[i]))
|
||||
{
|
||||
const volScalarField& f = mesh.lookupObject<volScalarField>
|
||||
(
|
||||
fields_[i]
|
||||
);
|
||||
vsInterp.set
|
||||
(
|
||||
nScalar++,
|
||||
interpolation<scalar>::New
|
||||
(
|
||||
interpolationScheme_,
|
||||
f
|
||||
)
|
||||
);
|
||||
}
|
||||
else if (mesh.foundObject<volVectorField>(fields_[i]))
|
||||
{
|
||||
const volVectorField& f = mesh.lookupObject<volVectorField>
|
||||
(
|
||||
fields_[i]
|
||||
);
|
||||
|
||||
if (f.name() == UName_)
|
||||
{
|
||||
UIndex = nVector;
|
||||
}
|
||||
|
||||
vvInterp.set
|
||||
(
|
||||
nVector++,
|
||||
interpolation<vector>::New
|
||||
(
|
||||
interpolationScheme_,
|
||||
f
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Store the names
|
||||
scalarNames_.setSize(vsInterp.size());
|
||||
forAll(vsInterp, i)
|
||||
{
|
||||
scalarNames_[i] = vsInterp[i].psi().name();
|
||||
}
|
||||
vectorNames_.setSize(vvInterp.size());
|
||||
forAll(vvInterp, i)
|
||||
{
|
||||
vectorNames_[i] = vvInterp[i].psi().name();
|
||||
}
|
||||
|
||||
// Check that we know the index of U in the interpolators.
|
||||
|
||||
if (UIndex == -1)
|
||||
{
|
||||
FatalErrorIn("wallBoundedStreamLine::execute()")
|
||||
<< "Cannot find field to move particles with : " << UName_
|
||||
<< endl
|
||||
<< "This field has to be present in the sampled fields "
|
||||
<< fields_
|
||||
<< " and in the objectRegistry." << endl
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
// Sampled data
|
||||
// ~~~~~~~~~~~~
|
||||
|
||||
// Size to maximum expected sizes.
|
||||
allTracks_.clear();
|
||||
allTracks_.setCapacity(nSeeds);
|
||||
allScalars_.setSize(vsInterp.size());
|
||||
forAll(allScalars_, i)
|
||||
{
|
||||
allScalars_[i].clear();
|
||||
allScalars_[i].setCapacity(nSeeds);
|
||||
}
|
||||
allVectors_.setSize(vvInterp.size());
|
||||
forAll(allVectors_, i)
|
||||
{
|
||||
allVectors_[i].clear();
|
||||
allVectors_[i].setCapacity(nSeeds);
|
||||
}
|
||||
|
||||
|
||||
// additional particle info
|
||||
// Additional particle info
|
||||
wallBoundedStreamLineParticle::trackingData td
|
||||
(
|
||||
particles,
|
||||
@ -440,32 +231,13 @@ Foam::wallBoundedStreamLine::wallBoundedStreamLine
|
||||
const bool loadFromFiles
|
||||
)
|
||||
:
|
||||
dict_(dict),
|
||||
name_(name),
|
||||
obr_(obr),
|
||||
loadFromFiles_(loadFromFiles),
|
||||
active_(true)
|
||||
streamLineBase(name, obr, dict, loadFromFiles)
|
||||
{
|
||||
// Only active if a fvMesh is available
|
||||
if (isA<fvMesh>(obr_))
|
||||
// Check if the available mesh is an fvMesh otherise deactivate
|
||||
if (setActive<fvMesh>())
|
||||
{
|
||||
read(dict_);
|
||||
}
|
||||
else
|
||||
{
|
||||
active_ = false;
|
||||
WarningIn
|
||||
(
|
||||
"wallBoundedStreamLine::wallBoundedStreamLine\n"
|
||||
"("
|
||||
"const word&, "
|
||||
"const objectRegistry&, "
|
||||
"const dictionary&, "
|
||||
"const bool "
|
||||
")"
|
||||
) << "No fvMesh available, deactivating " << name_
|
||||
<< nl << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -481,94 +253,13 @@ void Foam::wallBoundedStreamLine::read(const dictionary& dict)
|
||||
{
|
||||
if (active_)
|
||||
{
|
||||
//dict_ = dict;
|
||||
dict.lookup("fields") >> fields_;
|
||||
if (dict.found("UName"))
|
||||
{
|
||||
dict.lookup("UName") >> UName_;
|
||||
}
|
||||
else
|
||||
{
|
||||
UName_ = "U";
|
||||
if (dict.found("U"))
|
||||
{
|
||||
IOWarningIn
|
||||
(
|
||||
"wallBoundedStreamLine::read(const dictionary&)",
|
||||
dict
|
||||
) << "Using deprecated entry \"U\"."
|
||||
<< " Please use \"UName\" instead."
|
||||
<< endl;
|
||||
dict.lookup("U") >> UName_;
|
||||
}
|
||||
}
|
||||
|
||||
if (findIndex(fields_, UName_) == -1)
|
||||
{
|
||||
FatalIOErrorIn
|
||||
(
|
||||
"wallBoundedStreamLine::read(const dictionary&)",
|
||||
dict
|
||||
) << "Velocity field for tracking " << UName_
|
||||
<< " should be present in the list of fields " << fields_
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
|
||||
|
||||
dict.lookup("trackForward") >> trackForward_;
|
||||
dict.lookup("lifeTime") >> lifeTime_;
|
||||
if (lifeTime_ < 1)
|
||||
{
|
||||
FatalErrorIn(":wallBoundedStreamLine::read(const dictionary&)")
|
||||
<< "Illegal value " << lifeTime_ << " for lifeTime"
|
||||
<< exit(FatalError);
|
||||
}
|
||||
trackLength_ = VGREAT;
|
||||
if (dict.found("trackLength"))
|
||||
{
|
||||
dict.lookup("trackLength") >> trackLength_;
|
||||
|
||||
Info<< type() << " : fixed track length specified : "
|
||||
<< trackLength_ << nl << endl;
|
||||
}
|
||||
|
||||
|
||||
interpolationScheme_ = dict.lookupOrDefault
|
||||
(
|
||||
"interpolationScheme",
|
||||
interpolationCellPoint<scalar>::typeName
|
||||
);
|
||||
|
||||
//Info<< typeName << " using interpolation " << interpolationScheme_
|
||||
// << endl;
|
||||
|
||||
cloudName_ = dict.lookupOrDefault<word>
|
||||
(
|
||||
"cloudName",
|
||||
"wallBoundedStreamLine"
|
||||
);
|
||||
dict.lookup("seedSampleSet") >> seedSet_;
|
||||
|
||||
const fvMesh& mesh = dynamic_cast<const fvMesh&>(obr_);
|
||||
|
||||
const dictionary& coeffsDict = dict.subDict(seedSet_ + "Coeffs");
|
||||
|
||||
sampledSetPtr_ = sampledSet::New
|
||||
(
|
||||
seedSet_,
|
||||
mesh,
|
||||
meshSearchMeshObject::New(mesh),
|
||||
coeffsDict
|
||||
);
|
||||
coeffsDict.lookup("axis") >> sampledSetAxis_;
|
||||
|
||||
scalarFormatterPtr_ = writer<scalar>::New(dict.lookup("setFormat"));
|
||||
vectorFormatterPtr_ = writer<vector>::New(dict.lookup("setFormat"));
|
||||
|
||||
streamLineBase::read(dict);
|
||||
|
||||
// Make sure that the mesh is trackable
|
||||
if (debug)
|
||||
{
|
||||
const fvMesh& mesh = dynamic_cast<const fvMesh&>(obr_);
|
||||
|
||||
// 1. positive volume decomposition tets
|
||||
faceSet faces(mesh, "lowQualityTetFaces", mesh.nFaces()/100+1);
|
||||
if
|
||||
@ -584,7 +275,7 @@ void Foam::wallBoundedStreamLine::read(const dictionary& dict)
|
||||
{
|
||||
label nFaces = returnReduce(faces.size(), sumOp<label>());
|
||||
|
||||
WarningIn("wallBoundedStreamLine::read(const dictionary&)")
|
||||
WarningInFunction
|
||||
<< "Found " << nFaces
|
||||
<<" faces with low quality or negative volume "
|
||||
<< "decomposition tets. Writing to faceSet " << faces.name()
|
||||
@ -623,10 +314,8 @@ void Foam::wallBoundedStreamLine::read(const dictionary& dict)
|
||||
{
|
||||
if (iter() != 2)
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"wallBoundedStreamLine::read(const dictionary&)"
|
||||
) << "problem cell:" << cellI
|
||||
FatalErrorInFunction
|
||||
<< "problem cell:" << cellI
|
||||
<< abort(FatalError);
|
||||
}
|
||||
}
|
||||
@ -636,283 +325,4 @@ void Foam::wallBoundedStreamLine::read(const dictionary& dict)
|
||||
}
|
||||
|
||||
|
||||
void Foam::wallBoundedStreamLine::execute()
|
||||
{}
|
||||
|
||||
|
||||
void Foam::wallBoundedStreamLine::end()
|
||||
{}
|
||||
|
||||
|
||||
void Foam::wallBoundedStreamLine::timeSet()
|
||||
{}
|
||||
|
||||
|
||||
void Foam::wallBoundedStreamLine::write()
|
||||
{
|
||||
if (active_)
|
||||
{
|
||||
const Time& runTime = obr_.time();
|
||||
const fvMesh& mesh = dynamic_cast<const fvMesh&>(obr_);
|
||||
|
||||
|
||||
// Do all injection and tracking
|
||||
track();
|
||||
|
||||
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
// Append slave tracks to master ones
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
globalIndex globalTrackIDs(allTracks_.size());
|
||||
|
||||
// Construct a distribution map to pull all to the master.
|
||||
labelListList sendMap(Pstream::nProcs());
|
||||
labelListList recvMap(Pstream::nProcs());
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
// Master: receive all. My own first, then consecutive
|
||||
// processors.
|
||||
label trackI = 0;
|
||||
|
||||
forAll(recvMap, procI)
|
||||
{
|
||||
labelList& fromProc = recvMap[procI];
|
||||
fromProc.setSize(globalTrackIDs.localSize(procI));
|
||||
forAll(fromProc, i)
|
||||
{
|
||||
fromProc[i] = trackI++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
labelList& toMaster = sendMap[0];
|
||||
toMaster.setSize(globalTrackIDs.localSize());
|
||||
forAll(toMaster, i)
|
||||
{
|
||||
toMaster[i] = i;
|
||||
}
|
||||
|
||||
const mapDistribute distMap
|
||||
(
|
||||
globalTrackIDs.size(),
|
||||
sendMap.xfer(),
|
||||
recvMap.xfer()
|
||||
);
|
||||
|
||||
|
||||
// Distribute the track positions. Note: use scheduled comms
|
||||
// to prevent buffering.
|
||||
allTracks_.shrink();
|
||||
mapDistributeBase::distribute
|
||||
(
|
||||
Pstream::scheduled,
|
||||
distMap.schedule(),
|
||||
distMap.constructSize(),
|
||||
distMap.subMap(),
|
||||
false,
|
||||
distMap.constructMap(),
|
||||
false,
|
||||
allTracks_,
|
||||
flipOp()
|
||||
);
|
||||
|
||||
// Distribute the scalars
|
||||
forAll(allScalars_, scalarI)
|
||||
{
|
||||
allScalars_[scalarI].shrink();
|
||||
mapDistributeBase::distribute
|
||||
(
|
||||
Pstream::scheduled,
|
||||
distMap.schedule(),
|
||||
distMap.constructSize(),
|
||||
distMap.subMap(),
|
||||
false,
|
||||
distMap.constructMap(),
|
||||
false,
|
||||
allScalars_[scalarI],
|
||||
flipOp()
|
||||
);
|
||||
allScalars_[scalarI].setCapacity(allScalars_[scalarI].size());
|
||||
}
|
||||
// Distribute the vectors
|
||||
forAll(allVectors_, vectorI)
|
||||
{
|
||||
allVectors_[vectorI].shrink();
|
||||
mapDistributeBase::distribute
|
||||
(
|
||||
Pstream::scheduled,
|
||||
distMap.schedule(),
|
||||
distMap.constructSize(),
|
||||
distMap.subMap(),
|
||||
false,
|
||||
distMap.constructMap(),
|
||||
false,
|
||||
allVectors_[vectorI],
|
||||
flipOp()
|
||||
);
|
||||
allVectors_[vectorI].setCapacity(allVectors_[vectorI].size());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
label n = 0;
|
||||
forAll(allTracks_, trackI)
|
||||
{
|
||||
n += allTracks_[trackI].size();
|
||||
}
|
||||
|
||||
Info<< " Tracks:" << allTracks_.size() << nl
|
||||
<< " Total samples:" << n << endl;
|
||||
|
||||
|
||||
// Massage into form suitable for writers
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
if (Pstream::master() && allTracks_.size())
|
||||
{
|
||||
// Make output directory
|
||||
|
||||
fileName vtkPath
|
||||
(
|
||||
Pstream::parRun()
|
||||
? runTime.path()/".."/"postProcessing"/"sets"/name()
|
||||
: runTime.path()/"postProcessing"/"sets"/name()
|
||||
);
|
||||
if (mesh.name() != fvMesh::defaultRegion)
|
||||
{
|
||||
vtkPath = vtkPath/mesh.name();
|
||||
}
|
||||
vtkPath = vtkPath/mesh.time().timeName();
|
||||
|
||||
mkDir(vtkPath);
|
||||
|
||||
// Convert track positions
|
||||
|
||||
PtrList<coordSet> tracks(allTracks_.size());
|
||||
forAll(allTracks_, trackI)
|
||||
{
|
||||
tracks.set
|
||||
(
|
||||
trackI,
|
||||
new coordSet
|
||||
(
|
||||
"track" + Foam::name(trackI),
|
||||
sampledSetAxis_ //"xyz"
|
||||
)
|
||||
);
|
||||
tracks[trackI].transfer(allTracks_[trackI]);
|
||||
}
|
||||
|
||||
// Convert scalar values
|
||||
|
||||
if (allScalars_.size() > 0)
|
||||
{
|
||||
List<List<scalarField> > scalarValues(allScalars_.size());
|
||||
|
||||
forAll(allScalars_, scalarI)
|
||||
{
|
||||
DynamicList<scalarList>& allTrackVals =
|
||||
allScalars_[scalarI];
|
||||
scalarValues[scalarI].setSize(allTrackVals.size());
|
||||
|
||||
forAll(allTrackVals, trackI)
|
||||
{
|
||||
scalarList& trackVals = allTrackVals[trackI];
|
||||
scalarValues[scalarI][trackI].transfer(trackVals);
|
||||
}
|
||||
}
|
||||
|
||||
fileName vtkFile
|
||||
(
|
||||
vtkPath
|
||||
/ scalarFormatterPtr_().getFileName
|
||||
(
|
||||
tracks[0],
|
||||
scalarNames_
|
||||
)
|
||||
);
|
||||
|
||||
Info<< "Writing data to " << vtkFile.path() << endl;
|
||||
|
||||
scalarFormatterPtr_().write
|
||||
(
|
||||
true, // writeTracks
|
||||
tracks,
|
||||
scalarNames_,
|
||||
scalarValues,
|
||||
OFstream(vtkFile)()
|
||||
);
|
||||
}
|
||||
|
||||
// Convert vector values
|
||||
|
||||
if (allVectors_.size() > 0)
|
||||
{
|
||||
List<List<vectorField> > vectorValues(allVectors_.size());
|
||||
|
||||
forAll(allVectors_, vectorI)
|
||||
{
|
||||
DynamicList<vectorList>& allTrackVals =
|
||||
allVectors_[vectorI];
|
||||
vectorValues[vectorI].setSize(allTrackVals.size());
|
||||
|
||||
forAll(allTrackVals, trackI)
|
||||
{
|
||||
vectorList& trackVals = allTrackVals[trackI];
|
||||
vectorValues[vectorI][trackI].transfer(trackVals);
|
||||
}
|
||||
}
|
||||
|
||||
fileName vtkFile
|
||||
(
|
||||
vtkPath
|
||||
/ vectorFormatterPtr_().getFileName
|
||||
(
|
||||
tracks[0],
|
||||
vectorNames_
|
||||
)
|
||||
);
|
||||
|
||||
//Info<< "Writing vector data to " << vtkFile << endl;
|
||||
|
||||
vectorFormatterPtr_().write
|
||||
(
|
||||
true, // writeTracks
|
||||
tracks,
|
||||
vectorNames_,
|
||||
vectorValues,
|
||||
OFstream(vtkFile)()
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::wallBoundedStreamLine::updateMesh(const mapPolyMesh&)
|
||||
{
|
||||
read(dict_);
|
||||
}
|
||||
|
||||
|
||||
void Foam::wallBoundedStreamLine::movePoints(const polyMesh&)
|
||||
{
|
||||
// Moving mesh affects the search tree
|
||||
read(dict_);
|
||||
}
|
||||
|
||||
|
||||
//void Foam::wallBoundedStreamLine::readUpdate
|
||||
//(const polyMesh::readUpdateState state)
|
||||
//{
|
||||
// if (state != UNCHANGED)
|
||||
// {
|
||||
// read(dict_);
|
||||
// }
|
||||
//}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -2,8 +2,8 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -49,7 +49,7 @@ Description
|
||||
);
|
||||
lifeTime 10000;
|
||||
trackLength 1e-3;
|
||||
nSubCycle 5;
|
||||
bounds (0.2 -10 -10)(0.22 10 10);
|
||||
cloudName particleTracks;
|
||||
seedSampleSet patchSeed;
|
||||
patchSeedCoeffs
|
||||
@ -71,8 +71,9 @@ Description
|
||||
fields | fields to sample | yes |
|
||||
lifetime | maximum number of particle tracking steps | yes |
|
||||
trackLength | tracking segment length | no |
|
||||
nSubCycle | number of tracking steps per cell | no|
|
||||
cloudName | cloud name to use | yes |
|
||||
log | Log to standard output | no | yes
|
||||
bounds | Bounding box to trim tracks | no | greatBox
|
||||
seedSampleSet| seeding method (see below)| yes |
|
||||
\endtable
|
||||
|
||||
@ -85,14 +86,11 @@ Description
|
||||
triSurfaceMeshPointSet | points according to a tri-surface mesh
|
||||
\endplaintable
|
||||
|
||||
Note
|
||||
When specifying the track resolution, the \c trackLength OR \c nSubCycle
|
||||
option should be used
|
||||
|
||||
SeeAlso
|
||||
Foam::functionObject
|
||||
Foam::OutputFilterFunctionObject
|
||||
Foam::sampledSet
|
||||
Foam::streamLineBase
|
||||
Foam::streamLine
|
||||
|
||||
SourceFiles
|
||||
@ -103,16 +101,7 @@ SourceFiles
|
||||
#ifndef wallBoundedStreamLine_H
|
||||
#define wallBoundedStreamLine_H
|
||||
|
||||
#include "volFieldsFwd.H"
|
||||
#include "pointFieldFwd.H"
|
||||
#include "Switch.H"
|
||||
#include "DynamicList.H"
|
||||
#include "scalarList.H"
|
||||
#include "vectorList.H"
|
||||
#include "polyMesh.H"
|
||||
#include "writer.H"
|
||||
#include "indirectPrimitivePatch.H"
|
||||
#include "tetIndices.H"
|
||||
#include "streamLineBase.H"
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -120,99 +109,15 @@ SourceFiles
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward declaration of classes
|
||||
class objectRegistry;
|
||||
class dictionary;
|
||||
class mapPolyMesh;
|
||||
class meshSearch;
|
||||
class sampledSet;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class wallBoundedStreamLine Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class wallBoundedStreamLine
|
||||
:
|
||||
public streamLineBase
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Input dictionary
|
||||
dictionary dict_;
|
||||
|
||||
//- Name of this set of field averages.
|
||||
word name_;
|
||||
|
||||
//- Database this class is registered to
|
||||
const objectRegistry& obr_;
|
||||
|
||||
//- Load fields from files (not from objectRegistry)
|
||||
bool loadFromFiles_;
|
||||
|
||||
//- On/off switch
|
||||
bool active_;
|
||||
|
||||
|
||||
//- List of fields to sample
|
||||
wordList fields_;
|
||||
|
||||
//- Field to transport particle with
|
||||
word UName_;
|
||||
|
||||
//- Interpolation scheme to use
|
||||
word interpolationScheme_;
|
||||
|
||||
//- Whether to use +u or -u
|
||||
bool trackForward_;
|
||||
|
||||
//- Maximum lifetime (= number of cells) of particle
|
||||
label lifeTime_;
|
||||
|
||||
//- Track length
|
||||
scalar trackLength_;
|
||||
|
||||
//- Optional specified name of particles
|
||||
word cloudName_;
|
||||
|
||||
//- Type of seed
|
||||
word seedSet_;
|
||||
|
||||
//- Names of scalar fields
|
||||
wordList scalarNames_;
|
||||
|
||||
//- Names of vector fields
|
||||
wordList vectorNames_;
|
||||
|
||||
|
||||
// Demand driven
|
||||
|
||||
//- Mesh searching enigne
|
||||
autoPtr<meshSearch> meshSearchPtr_;
|
||||
|
||||
//- Seed set engine
|
||||
autoPtr<sampledSet> sampledSetPtr_;
|
||||
|
||||
//- Axis of the sampled points to output
|
||||
word sampledSetAxis_;
|
||||
|
||||
//- File output writer
|
||||
autoPtr<writer<scalar> > scalarFormatterPtr_;
|
||||
|
||||
autoPtr<writer<vector> > vectorFormatterPtr_;
|
||||
|
||||
|
||||
// Generated data
|
||||
|
||||
//- All tracks. Per particle the points it passed through
|
||||
DynamicList<List<point> > allTracks_;
|
||||
|
||||
//- Per scalarField, per particle, the sampled value.
|
||||
List<DynamicList<scalarList> > allScalars_;
|
||||
|
||||
//- Per scalarField, per particle, the sampled value.
|
||||
List<DynamicList<vectorList> > allVectors_;
|
||||
|
||||
|
||||
//- Construct patch out of all wall patch faces
|
||||
autoPtr<indirectPrimitivePatch> wallPatch() const;
|
||||
// Private Member Functions
|
||||
|
||||
//- Find wall tet on cell
|
||||
tetIndices findNearestTet
|
||||
@ -222,9 +127,6 @@ class wallBoundedStreamLine
|
||||
const label cellI
|
||||
) const;
|
||||
|
||||
//- Do all seeding and tracking
|
||||
void track();
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
wallBoundedStreamLine(const wallBoundedStreamLine&);
|
||||
|
||||
@ -257,35 +159,11 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return name of the set of field averages
|
||||
virtual const word& name() const
|
||||
{
|
||||
return name_;
|
||||
}
|
||||
|
||||
//- Read the field average data
|
||||
//- Read settings
|
||||
virtual void read(const dictionary&);
|
||||
|
||||
//- Execute the averaging
|
||||
virtual void execute();
|
||||
|
||||
//- Execute the averaging at the final time-loop, currently does nothing
|
||||
virtual void end();
|
||||
|
||||
//- Called when time was set at the end of the Time::operator++
|
||||
virtual void timeSet();
|
||||
|
||||
//- Calculate the field average data and write
|
||||
virtual void write();
|
||||
|
||||
//- Update for changes of mesh
|
||||
virtual void updateMesh(const mapPolyMesh&);
|
||||
|
||||
//- Update for mesh point-motion
|
||||
virtual void movePoints(const polyMesh&);
|
||||
|
||||
////- Update for changes of mesh due to readUpdate
|
||||
//virtual void readUpdate(const polyMesh::readUpdateState state);
|
||||
//- Do the actual tracking to fill the track data
|
||||
virtual void track();
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -38,7 +38,7 @@ Foam::vector Foam::wallBoundedStreamLineParticle::interpolateFields
|
||||
{
|
||||
if (cellI == -1)
|
||||
{
|
||||
FatalErrorIn("wallBoundedStreamLineParticle::interpolateFields(..)")
|
||||
FatalErrorInFunction
|
||||
<< "Cell:" << cellI << abort(FatalError);
|
||||
}
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -343,25 +343,24 @@ void Foam::forceCoeffs::execute()
|
||||
scalar ClfTot = ClTot/2.0 + CmTot;
|
||||
scalar ClrTot = ClTot/2.0 - CmTot;
|
||||
|
||||
if (log_)
|
||||
{
|
||||
Info<< type() << " " << name_ << " output:" << nl
|
||||
<< " Coefficients" << nl;
|
||||
}
|
||||
if (log_) Info
|
||||
<< type() << " " << name_ << " output:" << nl
|
||||
<< " Coefficients" << nl;
|
||||
|
||||
writeIntegratedData("Cm", momentCoeffs);
|
||||
writeIntegratedData("Cd", dragCoeffs);
|
||||
writeIntegratedData("Cl", liftCoeffs);
|
||||
if (log_)
|
||||
{
|
||||
Info<< " Cl(f) : " << ClfTot << nl
|
||||
<< " Cl(r) : " << ClrTot << nl
|
||||
<< endl;
|
||||
}
|
||||
|
||||
if (log_) Info
|
||||
<< " Cl(f) : " << ClfTot << nl
|
||||
<< " Cl(r) : " << ClrTot << nl
|
||||
<< endl;
|
||||
|
||||
if (writeToFile())
|
||||
{
|
||||
writeTime(coeffFilePtr_());
|
||||
coeffFilePtr_()
|
||||
<< obr_.time().value() << tab << CmTot << tab << CdTot
|
||||
<< tab << CmTot << tab << CdTot
|
||||
<< tab << ClTot << tab << ClfTot << tab << ClrTot << endl;
|
||||
|
||||
|
||||
@ -426,10 +425,7 @@ void Foam::forceCoeffs::execute()
|
||||
|
||||
void Foam::forceCoeffs::end()
|
||||
{
|
||||
if (active_)
|
||||
{
|
||||
execute();
|
||||
}
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -84,6 +84,7 @@ Description
|
||||
magUInf | free stream velocity magnitude | yes |
|
||||
lRef | reference length scale for moment calculations | yes |
|
||||
Aref | reference area | yes |
|
||||
porosity | flag to include porosity contributions | no | no
|
||||
\endtable
|
||||
|
||||
Bin data is optional, but if the dictionary is present, the entries must
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -173,7 +173,7 @@ void Foam::forces::initialise()
|
||||
if (!obr_.foundObject<volVectorField>(fDName_))
|
||||
{
|
||||
active_ = false;
|
||||
WarningIn("void Foam::forces::initialise()")
|
||||
WarningInFunction
|
||||
<< "Could not find " << fDName_ << " in database." << nl
|
||||
<< " De-activating forces."
|
||||
<< endl;
|
||||
@ -193,7 +193,7 @@ void Foam::forces::initialise()
|
||||
{
|
||||
active_ = false;
|
||||
|
||||
WarningIn("void Foam::forces::initialise()")
|
||||
WarningInFunction
|
||||
<< "Could not find " << UName_ << ", " << pName_;
|
||||
|
||||
if (rhoName_ != "rhoInf")
|
||||
@ -370,7 +370,7 @@ Foam::tmp<Foam::volSymmTensorField> Foam::forces::devRhoReff() const
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorIn("forces::devRhoReff()")
|
||||
FatalErrorInFunction
|
||||
<< "No valid model for viscous stress calculation"
|
||||
<< exit(FatalError);
|
||||
|
||||
@ -409,7 +409,7 @@ Foam::tmp<Foam::volScalarField> Foam::forces::mu() const
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorIn("forces::mu()")
|
||||
FatalErrorInFunction
|
||||
<< "No valid model for dynamic viscosity calculation"
|
||||
<< exit(FatalError);
|
||||
|
||||
@ -456,7 +456,7 @@ Foam::scalar Foam::forces::rho(const volScalarField& p) const
|
||||
{
|
||||
if (rhoName_ != "rhoInf")
|
||||
{
|
||||
FatalErrorIn("forces::rho(const volScalarField& p)")
|
||||
FatalErrorInFunction
|
||||
<< "Dynamic pressure is expected but kinematic is provided."
|
||||
<< exit(FatalError);
|
||||
}
|
||||
@ -690,7 +690,7 @@ void Foam::forces::writeBinnedForceMoment
|
||||
|
||||
Ostream& os = osPtr();
|
||||
|
||||
os << obr_.time().value();
|
||||
writeTime(os);
|
||||
|
||||
forAll(f[0], i)
|
||||
{
|
||||
@ -923,10 +923,8 @@ void Foam::forces::read(const dictionary& dict)
|
||||
|
||||
if (nBin_ < 0)
|
||||
{
|
||||
FatalIOErrorIn
|
||||
(
|
||||
"void Foam::forces::read(const dictionary&)", dict
|
||||
) << "Number of bins (nBin) must be zero or greater"
|
||||
FatalIOErrorInFunction(dict)
|
||||
<< "Number of bins (nBin) must be zero or greater"
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
else if (nBin_ == 0)
|
||||
@ -1037,10 +1035,7 @@ void Foam::forces::execute()
|
||||
|
||||
void Foam::forces::end()
|
||||
{
|
||||
if (active_)
|
||||
{
|
||||
execute();
|
||||
}
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
|
||||
@ -1176,7 +1171,7 @@ void Foam::forces::calcForcesMoment()
|
||||
|
||||
if (models.empty())
|
||||
{
|
||||
WarningIn("void Foam::forces::calcForcesMoment()")
|
||||
WarningInFunction
|
||||
<< "Porosity effects requested, but no porosity models found "
|
||||
<< "in the database"
|
||||
<< endl;
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -79,6 +79,7 @@ Description
|
||||
UName | velocity field name | no | U
|
||||
rhoName | density field name (see below) | no | rho
|
||||
CofR | centre of rotation (see below) | no |
|
||||
porosity | flag to include porosity contributions | no | no
|
||||
directForceDensity | force density supplied directly (see below)|no|no
|
||||
fDName | name of force density field (see below) | no | fD
|
||||
\endtable
|
||||
|
||||
@ -2,8 +2,8 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2013-2014 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\ / A nd | Copyright (C) 2013-2015 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -32,7 +32,7 @@ License
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(calcFvcDiv, 0);
|
||||
defineTypeNameAndDebug(calcFvcDiv, 0);
|
||||
}
|
||||
|
||||
|
||||
@ -88,22 +88,15 @@ Foam::calcFvcDiv::calcFvcDiv
|
||||
obr_(obr),
|
||||
active_(true),
|
||||
fieldName_("undefined-fieldName"),
|
||||
resultName_("undefined-resultName")
|
||||
resultName_(word::null),
|
||||
log_(true)
|
||||
{
|
||||
// Check if the available mesh is an fvMesh, otherwise deactivate
|
||||
if (!isA<fvMesh>(obr_))
|
||||
{
|
||||
active_ = false;
|
||||
WarningIn
|
||||
(
|
||||
"calcFvcDiv::calcFvcDiv"
|
||||
"("
|
||||
"const word&, "
|
||||
"const objectRegistry&, "
|
||||
"const dictionary&, "
|
||||
"const bool"
|
||||
")"
|
||||
) << "No fvMesh available, deactivating." << nl
|
||||
WarningInFunction
|
||||
<< "No fvMesh available, deactivating." << nl
|
||||
<< endl;
|
||||
}
|
||||
|
||||
@ -123,10 +116,12 @@ void Foam::calcFvcDiv::read(const dictionary& dict)
|
||||
{
|
||||
if (active_)
|
||||
{
|
||||
dict.lookup("fieldName") >> fieldName_;
|
||||
dict.lookup("resultName") >> resultName_;
|
||||
log_.readIfPresent("log", dict);
|
||||
|
||||
if (resultName_ == "none")
|
||||
dict.lookup("fieldName") >> fieldName_;
|
||||
dict.readIfPresent("resultName", resultName_);
|
||||
|
||||
if (resultName_ == word::null)
|
||||
{
|
||||
resultName_ = "fvc::div(" + fieldName_ + ")";
|
||||
}
|
||||
@ -145,7 +140,7 @@ void Foam::calcFvcDiv::execute()
|
||||
|
||||
if (!processed)
|
||||
{
|
||||
WarningIn("void Foam::calcFvcDiv::write()")
|
||||
WarningInFunction
|
||||
<< "Unprocessed field " << fieldName_ << endl;
|
||||
}
|
||||
}
|
||||
@ -154,10 +149,7 @@ void Foam::calcFvcDiv::execute()
|
||||
|
||||
void Foam::calcFvcDiv::end()
|
||||
{
|
||||
if (active_)
|
||||
{
|
||||
execute();
|
||||
}
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
|
||||
@ -176,7 +168,8 @@ void Foam::calcFvcDiv::write()
|
||||
const regIOobject& field =
|
||||
obr_.lookupObject<regIOobject>(resultName_);
|
||||
|
||||
Info<< type() << " " << name_ << " output:" << nl
|
||||
if (log_) Info
|
||||
<< type() << " " << name_ << " output:" << nl
|
||||
<< " writing field " << field.name() << nl << endl;
|
||||
|
||||
field.write();
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012-2014 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -28,9 +28,29 @@ Group
|
||||
grpFVFunctionObjects
|
||||
|
||||
Description
|
||||
This function object calculates the divergence of a field. The operation is
|
||||
limited to surfaceScalarFields and volumeVector fields, and the output is a
|
||||
volume scalar field.
|
||||
This function object calculates the divergence of a field. The operation
|
||||
is limited to surfaceScalarFields and volumeVector fields, and the output
|
||||
is a volume scalar field.
|
||||
|
||||
Example of function object specification:
|
||||
\verbatim
|
||||
calcFvcDiv1
|
||||
{
|
||||
type calcFvcDiv;
|
||||
functionObjectLibs ("libFVFunctionObjects.so");
|
||||
...
|
||||
fieldName U;
|
||||
}
|
||||
\endverbatim
|
||||
|
||||
\heading Function object usage
|
||||
\table
|
||||
Property | Description | Required | Default value
|
||||
type | type name: calcFvcDiv | yes |
|
||||
fieldName | Name of field to process | yes |
|
||||
resultName | Name of divergence field | no | fvc::div(fieldName)
|
||||
log | Log to standard output | no | yes
|
||||
\endtable
|
||||
|
||||
SourceFiles
|
||||
calcFvcDiv.C
|
||||
@ -82,6 +102,9 @@ class calcFvcDiv
|
||||
//- Name of result field
|
||||
word resultName_;
|
||||
|
||||
//- Switch to send output to Info as well as to file
|
||||
Switch log_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
|
||||
@ -2,8 +2,8 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2013-2014 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\ / A nd | Copyright (C) 2013-2015 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -32,7 +32,7 @@ License
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(calcFvcGrad, 0);
|
||||
defineTypeNameAndDebug(calcFvcGrad, 0);
|
||||
}
|
||||
|
||||
|
||||
@ -50,22 +50,15 @@ Foam::calcFvcGrad::calcFvcGrad
|
||||
obr_(obr),
|
||||
active_(true),
|
||||
fieldName_("undefined-fieldName"),
|
||||
resultName_("undefined-resultName")
|
||||
resultName_(word::null),
|
||||
log_(true)
|
||||
{
|
||||
// Check if the available mesh is an fvMesh, otherwise deactivate
|
||||
if (!isA<fvMesh>(obr_))
|
||||
{
|
||||
active_ = false;
|
||||
WarningIn
|
||||
(
|
||||
"calcFvcGrad::calcFvcGrad"
|
||||
"("
|
||||
"const word&, "
|
||||
"const objectRegistry&, "
|
||||
"const dictionary&, "
|
||||
"const bool"
|
||||
")"
|
||||
) << "No fvMesh available, deactivating." << nl
|
||||
WarningInFunction
|
||||
<< "No fvMesh available, deactivating." << nl
|
||||
<< endl;
|
||||
}
|
||||
|
||||
@ -85,10 +78,12 @@ void Foam::calcFvcGrad::read(const dictionary& dict)
|
||||
{
|
||||
if (active_)
|
||||
{
|
||||
dict.lookup("fieldName") >> fieldName_;
|
||||
dict.lookup("resultName") >> resultName_;
|
||||
log_.readIfPresent("log", dict);
|
||||
|
||||
if (resultName_ == "none")
|
||||
dict.lookup("fieldName") >> fieldName_;
|
||||
dict.readIfPresent("resultName", resultName_);
|
||||
|
||||
if (resultName_ == word::null)
|
||||
{
|
||||
resultName_ = "fvc::grad(" + fieldName_ + ")";
|
||||
}
|
||||
@ -107,7 +102,7 @@ void Foam::calcFvcGrad::execute()
|
||||
|
||||
if (!processed)
|
||||
{
|
||||
WarningIn("void Foam::calcFvcGrad::write()")
|
||||
WarningInFunction
|
||||
<< "Unprocessed field " << fieldName_ << endl;
|
||||
}
|
||||
}
|
||||
@ -116,10 +111,7 @@ void Foam::calcFvcGrad::execute()
|
||||
|
||||
void Foam::calcFvcGrad::end()
|
||||
{
|
||||
if (active_)
|
||||
{
|
||||
execute();
|
||||
}
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
|
||||
@ -138,7 +130,8 @@ void Foam::calcFvcGrad::write()
|
||||
const regIOobject& field =
|
||||
obr_.lookupObject<regIOobject>(resultName_);
|
||||
|
||||
Info<< type() << " " << name_ << " output:" << nl
|
||||
if (log_) Info
|
||||
<< type() << " " << name_ << " output:" << nl
|
||||
<< " writing field " << field.name() << nl << endl;
|
||||
|
||||
field.write();
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012-2014 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -28,9 +28,29 @@ Group
|
||||
grpFVFunctionObjects
|
||||
|
||||
Description
|
||||
This function object calculates the gradient of a field. The operation is
|
||||
limited to scalar and vector volume or surface fields, and the output is a
|
||||
volume vector or tensor field.
|
||||
This function object calculates the gradient of a field. The operation
|
||||
is limited to scalar and vector volume or surface fields, and the output
|
||||
is a volume vector or tensor field.
|
||||
|
||||
Example of function object specification:
|
||||
\verbatim
|
||||
calcFvcGrad1
|
||||
{
|
||||
type calcFvcGrad;
|
||||
functionObjectLibs ("libFVFunctionObjects.so");
|
||||
...
|
||||
fieldName U;
|
||||
}
|
||||
\endverbatim
|
||||
|
||||
\heading Function object usage
|
||||
\table
|
||||
Property | Description | Required | Default value
|
||||
type | type name: calcFvcGrad | yes |
|
||||
fieldName | Name of field to process | yes |
|
||||
resultName | Name of gradient field | no | fvc::grad(fieldName)
|
||||
log | Log to standard output | no | yes
|
||||
\endtable
|
||||
|
||||
SourceFiles
|
||||
calcFvcGrad.C
|
||||
@ -82,6 +102,9 @@ class calcFvcGrad
|
||||
//- Name of result field
|
||||
word resultName_;
|
||||
|
||||
//- Switch to send output to Info as well as to file
|
||||
Switch log_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
|
||||
@ -2,8 +2,8 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2013-2014 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\ / A nd | Copyright (C) 2013-2015 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -32,7 +32,7 @@ License
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(calcMag, 0);
|
||||
defineTypeNameAndDebug(calcMag, 0);
|
||||
}
|
||||
|
||||
|
||||
@ -50,22 +50,15 @@ Foam::calcMag::calcMag
|
||||
obr_(obr),
|
||||
active_(true),
|
||||
fieldName_("undefined-fieldName"),
|
||||
resultName_("undefined-resultName")
|
||||
resultName_(word::null),
|
||||
log_(true)
|
||||
{
|
||||
// Check if the available mesh is an fvMesh, otherwise deactivate
|
||||
if (!isA<fvMesh>(obr_))
|
||||
{
|
||||
active_ = false;
|
||||
WarningIn
|
||||
(
|
||||
"calcMag::calcMag"
|
||||
"("
|
||||
"const word&, "
|
||||
"const objectRegistry&, "
|
||||
"const dictionary&, "
|
||||
"const bool"
|
||||
")"
|
||||
) << "No fvMesh available, deactivating." << nl
|
||||
WarningInFunction
|
||||
<< "No fvMesh available, deactivating." << nl
|
||||
<< endl;
|
||||
}
|
||||
|
||||
@ -85,10 +78,12 @@ void Foam::calcMag::read(const dictionary& dict)
|
||||
{
|
||||
if (active_)
|
||||
{
|
||||
dict.lookup("fieldName") >> fieldName_;
|
||||
dict.lookup("resultName") >> resultName_;
|
||||
log_.readIfPresent("log", dict);
|
||||
|
||||
if (resultName_ == "none")
|
||||
dict.lookup("fieldName") >> fieldName_;
|
||||
dict.readIfPresent("resultName", resultName_);
|
||||
|
||||
if (resultName_ == word::null)
|
||||
{
|
||||
resultName_ = "mag(" + fieldName_ + ")";
|
||||
}
|
||||
@ -110,7 +105,7 @@ void Foam::calcMag::execute()
|
||||
|
||||
if (!processed)
|
||||
{
|
||||
WarningIn("void Foam::calcMag::write()")
|
||||
WarningInFunction
|
||||
<< "Unprocessed field " << fieldName_ << endl;
|
||||
}
|
||||
}
|
||||
@ -119,10 +114,7 @@ void Foam::calcMag::execute()
|
||||
|
||||
void Foam::calcMag::end()
|
||||
{
|
||||
if (active_)
|
||||
{
|
||||
execute();
|
||||
}
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
|
||||
@ -141,7 +133,8 @@ void Foam::calcMag::write()
|
||||
const regIOobject& field =
|
||||
obr_.lookupObject<regIOobject>(resultName_);
|
||||
|
||||
Info<< type() << " " << name_ << " output:" << nl
|
||||
if (log_) Info
|
||||
<< type() << " " << name_ << " output:" << nl
|
||||
<< " writing field " << field.name() << nl << endl;
|
||||
|
||||
field.write();
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012-2014 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -32,6 +32,25 @@ Description
|
||||
can be applied to any volume or surface fieldsm and the output is a
|
||||
volume or surface scalar field.
|
||||
|
||||
Example of function object specification:
|
||||
\verbatim
|
||||
calcMag1
|
||||
{
|
||||
type calcMag;
|
||||
functionObjectLibs ("libFVFunctionObjects.so");
|
||||
...
|
||||
fieldName U;
|
||||
}
|
||||
\endverbatim
|
||||
|
||||
\heading Function object usage
|
||||
\table
|
||||
Property | Description | Required | Default value
|
||||
type | type name: calcMag | yes |
|
||||
fieldName | Name of field to process | yes |
|
||||
resultName | Name of magnitude field | no | mag(fieldName)
|
||||
log | Log to standard output | no | yes
|
||||
\endtable
|
||||
SourceFiles
|
||||
calcMag.C
|
||||
IOcalcMag.H
|
||||
@ -82,6 +101,9 @@ class calcMag
|
||||
//- Name of result field
|
||||
word resultName_;
|
||||
|
||||
//- Switch to send output to Info as well as to file
|
||||
Switch log_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
|
||||
@ -0,0 +1,30 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
\defgroup grpGraphicsFunctionObjects Graphics function objects
|
||||
@{
|
||||
\ingroup grpFunctionObjects
|
||||
This group contains graphics-based function objects
|
||||
@}
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
@ -2,22 +2,26 @@ cmake_minimum_required(VERSION 2.8)
|
||||
|
||||
project(runTimePostProcessing)
|
||||
|
||||
if (EXISTS $ENV{VTK_DIR})
|
||||
# Set policy for CMP0002 needed for cmake > 3
|
||||
cmake_policy(SET CMP0002 OLD)
|
||||
|
||||
if (EXISTS "$ENV{VTK_DIR}")
|
||||
message("Building with VTK from $ENV{VTK_DIR}")
|
||||
find_package(VTK REQUIRED HINTS $ENV{VTK_DIR})
|
||||
include(${VTK_USE_FILE})
|
||||
|
||||
else (EXISTS $ENV{ParaView_DIR})
|
||||
elseif (EXISTS "$ENV{ParaView_DIR}")
|
||||
message("Building with Paraview from $ENV{ParaView_DIR}")
|
||||
find_package(ParaView REQUIRED)
|
||||
include(${VTK_USE_FILE})
|
||||
|
||||
set(
|
||||
VTK_VERSION
|
||||
"${VTK_MAJOR_VERSION}.${VTK_MINOR_VERSION}.${VTK_BUILD_VERSION}"
|
||||
)
|
||||
endif (EXISTS $ENV{VTK_DIR})
|
||||
else ()
|
||||
message (FATAL_ERROR "VTK not found using VTK_DIR or ParaView_DIR")
|
||||
endif ()
|
||||
|
||||
include(CMakeLists-Common.txt)
|
||||
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -407,19 +407,7 @@ void Foam::fieldVisualisationBase::addGlyphs
|
||||
}
|
||||
else
|
||||
{
|
||||
WarningIn
|
||||
(
|
||||
"void Foam::fieldVisualisationBase::addGlyphs"
|
||||
"("
|
||||
"const scalar, "
|
||||
"const word&, "
|
||||
"const word&, "
|
||||
"const scalar, "
|
||||
"vtkPolyData*, "
|
||||
"vtkActor*, "
|
||||
"vtkRenderer*"
|
||||
") const"
|
||||
)
|
||||
WarningInFunction
|
||||
<< "Glyphs can only be added to " << pTraits<scalar>::typeName
|
||||
<< " and " << pTraits<vector>::typeName << " fields. "
|
||||
<< " Field " << scaleFieldName << " has " << nComponents
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -102,14 +102,7 @@ void Foam::functionObjectCloud::addGeometryToScene
|
||||
|
||||
if (fName.empty())
|
||||
{
|
||||
WarningIn
|
||||
(
|
||||
"void Foam::functionObjectCloud::addToScene"
|
||||
"("
|
||||
"const scalar, "
|
||||
"vtkRenderer*"
|
||||
")"
|
||||
)
|
||||
WarningInFunction
|
||||
<< "Unable to find function object " << functionObject_
|
||||
<< " output for field " << fieldName_
|
||||
<< ". Line will not be processed"
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -93,14 +93,7 @@ void Foam::functionObjectLine::addGeometryToScene
|
||||
fileName fName;
|
||||
if (!dict.readIfPresent("file", fName))
|
||||
{
|
||||
WarningIn
|
||||
(
|
||||
"void Foam::functionObjectLine::addToScene"
|
||||
"("
|
||||
"const scalar, "
|
||||
"vtkRenderer*"
|
||||
")"
|
||||
)
|
||||
WarningInFunction
|
||||
<< "Unable to find function object " << functionObject_
|
||||
<< " output for field " << fieldName_
|
||||
<< ". Line will not be processed"
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -95,14 +95,7 @@ void Foam::functionObjectSurface::addGeometryToScene
|
||||
fileName fName;
|
||||
if (!dict.readIfPresent("file", fName))
|
||||
{
|
||||
WarningIn
|
||||
(
|
||||
"void Foam::functionObjectSurface::addToScene"
|
||||
"("
|
||||
"const scalar, "
|
||||
"vtkRenderer*"
|
||||
")"
|
||||
)
|
||||
WarningInFunction
|
||||
<< "Unable to find function object " << functionObject_
|
||||
<< " output for field " << fieldName_
|
||||
<< ". Surface will not be processed"
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -64,15 +64,7 @@ void Foam::geometrySurface::addGeometryToScene
|
||||
{
|
||||
if (representation_ == rtGlyph)
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"void Foam::geometrySurface::addGeometryToScene"
|
||||
"("
|
||||
"const label, "
|
||||
"vtkRenderer*, "
|
||||
"const fileName&"
|
||||
") const"
|
||||
)
|
||||
FatalErrorInFunction
|
||||
<< "Glyph representation not available for " << typeName
|
||||
<< "object" << exit(FatalError);
|
||||
}
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -182,16 +182,8 @@ Foam::autoPtr<Foam::pathline> Foam::pathline::New
|
||||
|
||||
if (cstrIter == dictionaryConstructorTablePtr_->end())
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"Foam::autoPtr<Foam::pathline> Foam::pathline::New"
|
||||
"("
|
||||
"const runTimePostProcessing&, "
|
||||
"const dictionary&, "
|
||||
"const HashPtrTable<DataEntry<vector>, word>&, "
|
||||
"const word&"
|
||||
")"
|
||||
) << "Unknown pathline type "
|
||||
FatalErrorInFunction
|
||||
<< "Unknown pathline type "
|
||||
<< pathlineType << nl << nl
|
||||
<< "Valid pathline types are:" << endl
|
||||
<< dictionaryConstructorTablePtr_->sortedToc()
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -142,16 +142,8 @@ Foam::autoPtr<Foam::pointData> Foam::pointData::New
|
||||
|
||||
if (cstrIter == dictionaryConstructorTablePtr_->end())
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"Foam::autoPtr<Foam::pointData> Foam::pointData::New"
|
||||
"("
|
||||
"const runTimePostProcessing&, "
|
||||
"const dictionary&, "
|
||||
"const HashPtrTable<DataEntry<vector>, word>&, "
|
||||
"const word&"
|
||||
")"
|
||||
) << "Unknown pointData type "
|
||||
FatalErrorInFunction
|
||||
<< "Unknown pointData type "
|
||||
<< pointDataType << nl << nl
|
||||
<< "Valid pointData types are:" << endl
|
||||
<< dictionaryConstructorTablePtr_->sortedToc()
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -31,6 +31,7 @@ License
|
||||
#include "surface.H"
|
||||
#include "text.H"
|
||||
#include "Time.H"
|
||||
#include "sigFpe.H"
|
||||
|
||||
// VTK includes
|
||||
#include "vtkPolyDataMapper.h"
|
||||
@ -101,11 +102,7 @@ void Foam::runTimePostProcessing::read(const dictionary& dict)
|
||||
{
|
||||
if (!iter().isDict())
|
||||
{
|
||||
FatalIOErrorIn
|
||||
(
|
||||
"void Foam::runTimePostProcessing::read(const dictionary&)",
|
||||
textDict
|
||||
)
|
||||
FatalIOErrorInFunction(textDict)
|
||||
<< "text must be specified in dictionary format"
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
@ -143,6 +140,10 @@ void Foam::runTimePostProcessing::write()
|
||||
Info<< type() << " " << name_ << " output:" << nl
|
||||
<< " Constructing scene" << endl;
|
||||
|
||||
// Unset any floating point trapping (some low-level rendering functionality
|
||||
// does not like it)
|
||||
sigFpe::unset(false);
|
||||
|
||||
// Initialise render window
|
||||
vtkSmartPointer<vtkRenderWindow> renderWindow =
|
||||
vtkSmartPointer<vtkRenderWindow>::New();
|
||||
@ -204,6 +205,9 @@ void Foam::runTimePostProcessing::write()
|
||||
surfaces_[i].updateActors(position);
|
||||
}
|
||||
}
|
||||
|
||||
// Reset any floating point trapping
|
||||
sigFpe::set(false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -24,6 +24,9 @@ License
|
||||
Class
|
||||
Foam::runTimePostProcessing
|
||||
|
||||
Group
|
||||
grpGraphicsFunctionObjects
|
||||
|
||||
Description
|
||||
Function object to generate images during run-time.
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -37,15 +37,7 @@ void Foam::runTimePostProcessing::readObjects
|
||||
{
|
||||
if (!iter().isDict())
|
||||
{
|
||||
FatalIOErrorIn
|
||||
(
|
||||
"void Foam::runTimePostProcessing::readObjects"
|
||||
"("
|
||||
"const dictionary&, "
|
||||
"PtrList<Type>&"
|
||||
")",
|
||||
dict
|
||||
)
|
||||
FatalIOErrorInFunction(dict)
|
||||
<< dict.dictName()
|
||||
<< " objects must be specified in dictionary format"
|
||||
<< exit(FatalIOError);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user