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 
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 
96  do
97  {
98 
99 
100  if( !validRange.isMember( folders.time() ) )continue;
101 
102  if( !withZeroFolder && pFlow::equal(folders.time() , 0.0))continue;
103 
104  post.processTimeFolder(folders);
105 
106  if(!post.writeToVTK(destFolder, "processed"))
107  {
108  fatalExit;
109  }
110 
111 
112  }while (folders++);
113 
114  #include "finalize.hpp"
115 
116  return true;
117 }
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::word
std::string word
Definition: builtinTypes.hpp:63
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
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
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