mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: extend command-line options for particleTracks
- can specify format, stride without modifying a dictionary (increases flexibility, eases testing)
This commit is contained in:
@ -0,0 +1,30 @@
|
||||
// Read particleTrackProperties dictionary and extract values from it
|
||||
|
||||
const word dictName("particleTrackProperties");
|
||||
|
||||
#include "setConstantMeshDictionaryIO.H"
|
||||
|
||||
IOdictionary propsDict(dictIO);
|
||||
|
||||
const word cloudName(propsDict.get<word>("cloud"));
|
||||
|
||||
label sampleFrequency(propsDict.get<label>("sampleFrequency"));
|
||||
|
||||
label maxPositions(propsDict.get<label>("maxPositions"));
|
||||
|
||||
label maxTracks(propsDict.getOrDefault<label>("maxTracks", -1));
|
||||
|
||||
word setFormat(propsDict.getOrDefault<word>("setFormat", "vtk"));
|
||||
|
||||
// Optional - if empty, select all
|
||||
const wordRes fieldNames(propsDict.getOrDefault<wordRes>("fields", wordRes()));
|
||||
|
||||
const word UName(propsDict.getOrDefault<word>("U", "U"));
|
||||
|
||||
const dictionary formatOptions
|
||||
(
|
||||
propsDict.subOrEmptyDict("formatOptions", keyType::LITERAL)
|
||||
);
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,26 +0,0 @@
|
||||
IOdictionary propsDict
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"particleTrackProperties",
|
||||
runTime.constant(),
|
||||
mesh,
|
||||
IOobject::MUST_READ_IF_MODIFIED
|
||||
)
|
||||
);
|
||||
|
||||
const word cloudName(propsDict.get<word>("cloud"));
|
||||
|
||||
const label sampleFrequency(propsDict.get<label>("sampleFrequency"));
|
||||
|
||||
const label maxPositions(propsDict.get<label>("maxPositions"));
|
||||
|
||||
const label maxTracks(propsDict.getOrDefault<label>("maxTracks", -1));
|
||||
|
||||
const word setFormat(propsDict.getOrDefault<word>("setFormat", "vtk"));
|
||||
|
||||
const wordRes fieldNames(propsDict.getOrDefault<wordRes>("fields", wordRes()));
|
||||
|
||||
const word UName(propsDict.getOrDefault<word>("U", "U"));
|
||||
|
||||
const dictionary formatOptions = propsDict.subOrEmptyDict("formatOptions");
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2021 OpenCFD Ltd.
|
||||
Copyright (C) 2021-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -247,16 +247,48 @@ int main(int argc, char *argv[])
|
||||
"Generate a file of particle tracks for cases that were"
|
||||
" computed using a tracked-parcel-type cloud"
|
||||
);
|
||||
|
||||
timeSelector::addOptions();
|
||||
#include "addRegionOption.H"
|
||||
|
||||
#include "setRootCase.H"
|
||||
// Less frequently used - reduce some clutter
|
||||
argList::setAdvanced("decomposeParDict");
|
||||
argList::setAdvanced("noFunctionObjects");
|
||||
|
||||
argList::addOption
|
||||
(
|
||||
"dict",
|
||||
"file",
|
||||
"Alternative particleTracksProperties dictionary"
|
||||
);
|
||||
argList::addOption
|
||||
(
|
||||
"stride",
|
||||
"int",
|
||||
"Override the sample-frequency"
|
||||
);
|
||||
argList::addOption
|
||||
(
|
||||
"format",
|
||||
"name",
|
||||
"The writer format "
|
||||
"(default: vtk or 'setFormat' from dictionary)"
|
||||
);
|
||||
argList::addVerboseOption("Additional verbosity");
|
||||
|
||||
#include "setRootCase.H"
|
||||
#include "createTime.H"
|
||||
instantList timeDirs = timeSelector::select0(runTime, args);
|
||||
#include "createNamedMesh.H"
|
||||
#include "createFields.H"
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Control properties
|
||||
|
||||
#include "createControls.H"
|
||||
|
||||
args.readIfPresent("format", setFormat);
|
||||
|
||||
args.readIfPresent("stride", sampleFrequency);
|
||||
sampleFrequency = max(1, sampleFrequency); // sanity
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
@ -0,0 +1,19 @@
|
||||
// Read particleTrackDict dictionary and extract values from it
|
||||
|
||||
const word dictName("particleTrackDict");
|
||||
|
||||
#include "setConstantMeshDictionaryIO.H"
|
||||
|
||||
IOdictionary propsDict(dictIO);
|
||||
|
||||
const word cloudName(propsDict.get<word>("cloud"));
|
||||
|
||||
List<word> userFields(propsDict.lookup("fields"));
|
||||
|
||||
const dictionary formatOptions
|
||||
(
|
||||
propsDict.subOrEmptyDict("formatOptions", keyType::LITERAL)
|
||||
);
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,9 +0,0 @@
|
||||
const word dictName("particleTrackDict");
|
||||
|
||||
#include "setConstantMeshDictionaryIO.H"
|
||||
|
||||
IOdictionary propsDict(dictIO);
|
||||
|
||||
word cloudName(propsDict.get<word>("cloud"));
|
||||
|
||||
List<word> userFields(propsDict.lookup("fields"));
|
||||
@ -132,12 +132,13 @@ int main(int argc, char *argv[])
|
||||
"file",
|
||||
"Alternative particleTrackDict dictionary"
|
||||
);
|
||||
argList::addVerboseOption("Additional verbosity");
|
||||
|
||||
#include "setRootCase.H"
|
||||
#include "createTime.H"
|
||||
instantList timeDirs = timeSelector::select0(runTime, args);
|
||||
#include "createNamedMesh.H"
|
||||
#include "createFields.H"
|
||||
#include "createControls.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
Reference in New Issue
Block a user