CFDEMcoupling  2.4
 All Classes
twoWayMPI.H
1 /*---------------------------------------------------------------------------*\
2  CFDEMcoupling - Open Source CFD-DEM coupling
3 
4  CFDEMcoupling is part of the CFDEMproject
5  www.cfdem.com
6  Christoph Goniva, christoph.goniva@cfdem.com
7  Copyright 2009-2012 JKU Linz
8  Copyright 2012- DCS Computing GmbH, Linz
9 -------------------------------------------------------------------------------
10 License
11  This file is part of CFDEMcoupling.
12 
13  CFDEMcoupling is free software; you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by the
15  Free Software Foundation; either version 3 of the License, or (at your
16  option) any later version.
17 
18  CFDEMcoupling is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with CFDEMcoupling; if not, write to the Free Software Foundation,
25  Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
26 
27 Description
28  This code is designed to realize coupled CFD-DEM simulations using LIGGGHTS
29  and OpenFOAM(R). Note: this code is not part of OpenFOAM(R) (see DISCLAIMER).
30 
31  two way DEM-CFD coupling via MPI
32 
33 Class
34  twoWayMPI
35 
36 SourceFiles
37  twoWayMPI.C
38 
39 \*---------------------------------------------------------------------------*/
40 
41 #ifndef twoWayMPI_H
42 #define twoWayMPI_H
43 
44 #include "dataExchangeModel.H"
45 #include "liggghtsCommandModel.H"
46 #include "OFstream.H"
47 #include "sys/stat.h"
48 #include "pair.h"
49 #include "force.h"
50 #include "forceModel.H"
51 
52 //=================================//
53 //LAMMPS/LIGGGHTS
54 #include <stdio.h>
55 #include <stdlib.h>
56 #include <string.h>
57 #include "mpi.h"
58 #include <lammps.h> // these are LAMMPS include files
59 #include <input.h>
60 #include <atom.h>
61 #include <library.h>
62 #include <error.h>
63 #include <library_cfd_coupling.h>
64 #include <update.h>
65 //=================================//
66 
67 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
68 
69 namespace Foam
70 {
71 
72 /*---------------------------------------------------------------------------*\
73  Class noDrag Declaration
74 \*---------------------------------------------------------------------------*/
75 
76 class twoWayMPI
77 :
78  public dataExchangeModel
79 {
80 private:
81 
82  // private data
83  dictionary propsDict_;
84 
85  // variables
86  int me;
87 
88  int nprocs;
89 
90  int liggghts;
91 
92  MPI_Comm comm_liggghts;
93 
94  // private member functions
95 
96  char* wordToChar(word&) const;
97 
98 protected:
99  LAMMPS_NS::LAMMPS *lmp;
100 
101 public:
102 
103  //- Runtime type information
104  TypeName("twoWayMPI");
105 
106 
107  // Constructors
108 
109  //- Construct from components
110  twoWayMPI
111  (
112  const dictionary& dict,
113  cfdemCloud& sm
114  );
115 
116  // Destructor
117 
118  ~twoWayMPI();
119 
120 
121  // Member Functions
122 
123  void getData
124  (
125  word name,
126  word type,
127  double ** const& field,
128  label step
129  ) const;
130 
131  void getData
132  (
133  word name,
134  word type,
135  int ** const& field,
136  label step
137  ) const;
138 
139  void giveData
140  (
141  word name,
142  word type,
143  double ** const& field,
144  const char* datatype
145  ) const;
146 
147  //============
148  // double **
149  void allocateArray(double**&, double, int, int) const;
150  void allocateArray(double**&, double, int,const char* ="nparticles") const;
151  void destroy(double**,int) const;
152  //============
153  // int **
154  void allocateArray(int**&, int, int, int) const;
155  void allocateArray(int**&, int, int,const char* ="nparticles") const;
156  void destroy(int**,int) const;
157  //==============
158  // double *
159  void destroy(double*) const;
160  //============
161  // int **
162  void destroy(int*) const;
163  //==============
164 
165  bool couple(int) const;
166 
167  int getNumberOfParticles() const;
168  int getNumberOfClumps() const;
169  int getNumberOfTypes() const;
170  double* getTypeVol() const;
171 
172  word myType() const{return typeName; };
173 
174  void setCG() const { particleCloud_.setCG(lmp->force->cg()); };
175 };
176 
177 
178 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
179 
180 } // End namespace Foam
181 
182 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
183 
184 #endif
185 
186 // ************************************************************************* //
Definition: dataExchangeModel.H:53
Definition: twoWayMPI.H:76
Definition: cfdemCloud.H:81