www.cemf.ir
postprocessPhasicFlow.cpp
Go to the documentation of this file.
1 /*------------------------------- phasicFlow ---------------------------------
2  O C enter of
3  O O E ngineering and
4  O O M ultiscale modeling of
5  OOOOOOO F luid flow
6 ------------------------------------------------------------------------------
7  Copyright (C): www.cemf.ir
8  email: hamid.r.norouzi AT gmail.com
9 ------------------------------------------------------------------------------
10 Licence:
11  This file is part of phasicFlow code. It is a free software for simulating
12  granular and multiphase flows. You can redistribute it and/or modify it under
13  the terms of GNU General Public License v3 or any other later versions.
14 
15  phasicFlow is distributed to help others in their research in the field of
16  granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
17  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 
19 -----------------------------------------------------------------------------*/
20 
21 #include "KokkosUtilities.hpp"
22 #include "systemControl.hpp"
23 #include "timeFolder.hpp"
24 #include "commandLine.hpp"
25 #include "ranges.hpp"
26 #include "readControlDict.hpp"
27 
28 #include "postprocess.hpp"
29 
30 using pFlow::word;
31 using pFlow::wordVector;
32 using pFlow::wordList;
33 using pFlow::commandLine;
34 using pFlow::timeFolder;
35 using pFlow::output;
36 using pFlow::endl;
37 
38 
39 
40 
41 int main(int argc, char** argv )
42 {
43 
44  word outFolder = (pFlow::CWD()/word("VTK/postprocess")).wordPath();
45 
46  commandLine cmds(
47  "postprocessPhasicFlow",
48  "post-process fields in time folders based on the input file "
49  "settings/postprocessDict and convetes the results into vtk file format.");
50 
51  wordVector times;
52 
53  cmds.addOption("-o,--out-folder",
54  outFolder,
55  "path to output folder of VTK/postprocess",
56  "path");
57 
58  cmds.addOption(
59  "-t,--time",
60  times.vectorField(),
61  "a space separated lits of time folders, or a strided range begin:stride:end, or an interval begin:end",
62  " ");
63 
64  bool withZeroFolder = false;
65  cmds.addOption(
66  "-z, --zeroFolder",
67  withZeroFolder,
68  "Do NOT exclude zero folder from processing time folders");
69 
70  bool isCoupling = false;
71 
72  if(!cmds.parse(argc, argv)) return 0;
73 
74  #include "initialize_Control.hpp"
75 
76 
77 
78 
79  // time folders in case
80  timeFolder folders(Control);
81 
82  // time in command line
83  pFlow::realCombinedRange validRange;
84  if( cmds.count("--time") )
85  {
86  if(!validRange.addRanges(times)){
87  fatalExit; }
88  }
89  else
90  {
91  validRange.addIntervalRange(folders.startTime(), folders.endTime());
92  }
93 
94  pFlow::fileSystem destFolder = pFlow::fileSystem(outFolder);
95 
97 
98  do
99  {
100 
101  if( !validRange.isMember( folders.time() ) )
102  {
103  continue;
104  }
105 
106  if( !withZeroFolder && pFlow::equal(folders.time() , 0.0))continue;
107 
108  post.processTimeFolder(folders);
109 
110  if(!post.writeToVTK(destFolder, "processed"))
111  {
112  fatalExit;
113  }
114 
115 
116 
117  }while (folders++);
118 
119  #include "finalize.hpp"
120 
121  return true;
122 }
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:133
fatalExit
#define fatalExit
Fatal exit.
Definition: error.hpp:98
pFlow::postprocess::processTimeFolder
bool processTimeFolder(real time, const word &tName, const fileSystem &localFolder)
Definition: postprocess.cpp:58
KokkosUtilities.hpp
systemControl.hpp
pFlow::commandLine::addOption
Option * addOption(word optionName, word description, word opText="")
pFlow::equal
INLINE_FUNCTION_HD bool equal(const box &b1, const box &b2, real tol=smallValue)
Definition: box.hpp:135
pFlow::word
std::string word
Definition: builtinTypes.hpp:64
pFlow::commandLine
Definition: commandLine.hpp:36
pFlow::endl
iOstream & endl(iOstream &os)
Add newline and flush stream.
Definition: iOstream.hpp:341
pFlow::timeFolder::startTime
real startTime() const
Definition: timeFolder.hpp:105
pFlow::combinedRange
Definition: combinedRange.hpp:36
pFlow::fileSystem
Manages file pathes, manupulate and combines them.
Definition: fileSystem.hpp:71
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:52
postprocess.hpp
pFlow::CWD
fileSystem CWD()
Free function to reture current working directory.
Definition: fileSystem.hpp:221
pFlow::timeFolder::endTime
real endTime() const
Definition: timeFolder.hpp:111
readControlDict.hpp
commandLine.hpp
Control
auto & Control
Definition: initialize_Control.hpp:47
pFlow::wordList
List< word > wordList
Definition: List.hpp:230
timeFolder.hpp
pFlow::timeFolder
Definition: timeFolder.hpp:32
finalize.hpp