geometryPhasicFlow.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 
22 #include "systemControl.hpp"
23 #include "Wall.hpp"
24 #include "Vectors.hpp"
25 #include "multiTriSurface.hpp"
26 #include "geometryMotion.hpp"
27 #include "commandLine.hpp"
28 #include "readControlDict.hpp"
29 
30 using pFlow::output;
31 using pFlow::endl;
32 using pFlow::IOobject;
33 using pFlow::dictionary;
34 using pFlow::objectFile;
35 using pFlow::wordVector;
36 using pFlow::Wall;
37 using pFlow::geometry;
40 using pFlow::commandLine;
41 
42 int main( int argc, char* argv[] )
43 {
44 
45  commandLine cmds(
46  "geometryPhasicFlow",
47  "Converts the supplied informaiton for sufraces in"
48  " geometryDict into PhasicFlow geometry data structure");
49 
50 
51  bool isCoupling = false;
52  cmds.add_flag(
53  "-c,--coupling",
54  isCoupling,
55  "Is this a fluid-particle coupling simulation?");
56 
57  if(!cmds.parse(argc, argv)) return 0;
58 
59 // this should be palced in each main
60 #include "initialize_Control.hpp"
61 
62  #include "setProperty.hpp"
63 
64  REPORT(0)<<"\nReading "<<"createGeometryDict"<<" . . ."<<endREPORT;
65  auto objDict = IOobject::make<dictionary>
66  (
68  (
69  "geometryDict",
70  Control.settings().path(),
71  objectFile::READ_ALWAYS,
72  objectFile::WRITE_NEVER
73  ),
74  "geometryDict",
75  true
76  );
77 
78  auto& geometryDict = objDict().getObject<dictionary>();
79 
80  auto& surfacesDict = geometryDict.subDict("surfaces");
81 
82  auto wallsDictName = surfacesDict.dictionaryKeywords();
83 
84 
85 
86  multiTriSurface surface;
87  wordVector materials;
88  wordVector motion;
89 
90  for(auto& name:wallsDictName)
91  {
92  REPORT(1)<<"Creating wall "<<greenText(name)<<" from file dictionary . . . "<<endREPORT;
93  auto wallPtr = Wall::create( surfacesDict.subDict(name));
94  auto& wall = wallPtr();
95  REPORT(1)<<"wall type is "<<greenText(wall.typeName())<<'\n'<<endREPORT;
96 
97  realx3x3Vector trinalges(wall.name());
98  trinalges = wall.triangles();
99  surface.addTriSurface(wall.name(), trinalges);
100  materials.push_back(wall.materialName());
101  motion.push_back(wall.motionName());
102  }
103 
104  REPORT(1)<<"Selected wall materials are "<<cyanText(materials)<<'\n'<<endREPORT;
105 
106  REPORT(0)<< "\nCreating geometry . . ."<<endREPORT;
107  auto geomPtr = geometry::create(Control, proprties, geometryDict, surface, motion, materials);
108  REPORT(1)<< "geometry type is "<< greenText(geomPtr().typeName())<<endREPORT;
109 
110  REPORT(1)<< "Writing geometry to folder "<< geomPtr().path()<<endREPORT;
111  geomPtr().write();
112 
113  REPORT(0)<< greenText("\nFinished successfully.\n");
114 
115 // this should be palced in each main
116 #include "finalize.hpp"
117 
118  return 0;
119 }
initialize_Control.hpp
endREPORT
#define endREPORT
Definition: streams.hpp:41
setProperty.hpp
Wall.hpp
REPORT
#define REPORT(n)
Definition: streams.hpp:40
cyanText
#define cyanText(text)
Definition: streams.hpp:34
systemControl.hpp
Vectors.hpp
geometryMotion.hpp
pFlow::endl
iOstream & endl(iOstream &os)
Definition: iOstream.hpp:312
greenText
#define greenText(text)
Definition: streams.hpp:32
pFlow::multiTriSurface
Definition: multiTriSurface.hpp:33
pFlow::IOobject
Definition: IOobject.hpp:35
pFlow::dictionary::dictionaryKeywords
wordList dictionaryKeywords() const
Definition: dictionary.cpp:721
main
int main(int argc, char *argv[])
Definition: geometryPhasicFlow.cpp:42
multiTriSurface.hpp
pFlow::output
Ostream output
pFlow::realx3x3Vector
Vector< realx3x3 > realx3x3Vector
Definition: Vectors.hpp:62
proprties
auto proprties
Definition: setProperty.hpp:27
pFlow::objectFile
Definition: objectFile.hpp:33
pFlow::dictionary::subDict
dictionary & subDict(const word &keyword)
Definition: dictionary.cpp:547
pFlow::wordVector
Vector< word > wordVector
Definition: Vectors.hpp:64
pFlow::geometry
Definition: geometry.hpp:37
pFlow::multiTriSurface::addTriSurface
bool addTriSurface(const word &name, const triSurface &tSurf)
Definition: multiTriSurface.cpp:96
readControlDict.hpp
pFlow::Wall
Definition: Wall.hpp:41
pFlow::dictionary
Definition: dictionary.hpp:38
Control
auto & Control
Definition: initialize_Control.hpp:47
finalize.hpp