# PhasicFlow: utilities/postprocessPhasicFlow/postprocessPhasicFlow.cpp Source File

postprocessPhasicFlow.cpp
Go to the documentation of this file.
/*------------------------------- phasicFlow ---------------------------------
O C enter of
O O E ngineering and
O O M ultiscale modeling of
OOOOOOO F luid flow
------------------------------------------------------------------------------
Copyright (C): www.cemf.ir
email: hamid.r.norouzi AT gmail.com
------------------------------------------------------------------------------
Licence:
This file is part of phasicFlow code. It is a free software for simulating
granular and multiphase flows. You can redistribute it and/or modify it under
the terms of GNU General Public License v3 or any other later versions.
phasicFlow is distributed to help others in their research in the field of
granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-----------------------------------------------------------------------------*/
#include "KokkosUtilities.hpp"
#include "systemControl.hpp"
#include "timeFolder.hpp"
#include "commandLine.hpp"
#include "ranges.hpp"
#include "readControlDict.hpp"
#include "postprocess.hpp"
using pFlow::word;
using pFlow::wordVector;
using pFlow::wordList;
using pFlow::commandLine;
using pFlow::timeFolder;
using pFlow::output;
using pFlow::endl;
int main(int argc, char** argv )
{
word outFolder = (pFlow::CWD()/word("VTK/postprocess")).wordPath();
commandLine cmds(
"postprocessPhasicFlow",
"post-process fields in time folders based on the input file "
"settings/postprocessDict and convetes the results into vtk file format.");
wordVector times;
cmds.addOption("-o,--out-folder",
outFolder,
"path to output folder of VTK/postprocess",
"path");
cmds.addOption(
"-t,--time",
times.vectorField(),
"a space separated lits of time folders, or a strided range begin:stride:end, or an interval begin:end",
" ");
bool withZeroFolder = false;
cmds.addOption(
"-z, --zeroFolder",
withZeroFolder,
"Do NOT exclude zero folder from processing time folders");
bool isCoupling = false;
if(!cmds.parse(argc, argv)) return 0;
#include "initialize_Control.hpp"
pFlow::postprocess post(Control);
// time folders in case
timeFolder folders(Control);
// time in command line
pFlow::realCombinedRange validRange;
if( cmds.count("--time") )
{
if(!validRange.addRanges(times)){
fatalExit; }
}
else
{
validRange.addIntervalRange(folders.startTime(), folders.endTime());
}
pFlow::fileSystem destFolder = pFlow::fileSystem(outFolder);
do
{
if( !validRange.isMember( folders.time() ) )continue;
if( !withZeroFolder && pFlow::equal(folders.time() , 0.0))continue;
post.processTimeFolder(folders);
if(!post.writeToVTK(destFolder, "processed"))
{
fatalExit;
}
}while (folders++);
#include "finalize.hpp"
return true;
}
initialize_Control.hpp
pFlow::timeFolder::time
real time() const
Definition: timeFolder.hpp:57
pFlow::postprocess::writeToVTK
bool writeToVTK(fileSystem path, word bName) const
Definition: postprocess.cpp:122
fatalExit
#define fatalExit
Definition: error.hpp:57
pFlow::postprocess::processTimeFolder
bool processTimeFolder(real time, const word &tName, const fileSystem &localFolder)
Definition: postprocess.cpp:53
KokkosUtilities.hpp
systemControl.hpp
pFlow::commandLine::addOption
Option * addOption(word optionName, word description, word opText="")
pFlow::word
std::string word
Definition: builtinTypes.hpp:63
pFlow::commandLine
Definition: commandLine.hpp:36
pFlow::endl
iOstream & endl(iOstream &os)
Definition: iOstream.hpp:312
pFlow::timeFolder::startTime
real startTime() const
Definition: timeFolder.hpp:105
pFlow::combinedRange
Definition: combinedRange.hpp:36
pFlow::fileSystem
Definition: fileSystem.hpp:63
pFlow::combinedRange::addIntervalRange
bool addIntervalRange(const word &strRange)
Definition: combinedRange.hpp:97
pFlow::commandLine::parse
bool parse(int argc, char **argv)
Definition: commandLine.cpp:50
main
int main(int argc, char **argv)
Definition: postprocessPhasicFlow.cpp:41
pFlow::output
Ostream output
pFlow::combinedRange::addRanges
bool addRanges(const std::vector< word > &strRanges)
Definition: combinedRange.hpp:64
ranges.hpp
pFlow::combinedRange::isMember
bool isMember(T val) const
Definition: combinedRange.hpp:131
pFlow::postprocess
Definition: postprocess.hpp:37
pFlow::wordVector
Vector< word > wordVector
Definition: Vectors.hpp:64
postprocess.hpp
pFlow::CWD
fileSystem CWD()
Definition: fileSystem.hpp:186
pFlow::timeFolder::endTime
real endTime() const
Definition: timeFolder.hpp:111
readControlDict.hpp
commandLine.hpp
pFlow::equal
INLINE_FUNCTION_HD bool equal(const real &s1, const real &s2)
Definition: bTypesFunctions.hpp:188
Control
auto & Control
Definition: initialize_Control.hpp:47
pFlow::wordList
List< word > wordList
Definition: List.hpp:241
timeFolder.hpp
pFlow::timeFolder
Definition: timeFolder.hpp:32
finalize.hpp