00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #ifndef dataExchangeModel_H
00033 #define dataExchangeModel_H
00034
00035 #include "fvCFD.H"
00036 #include "cfdemCloud.H"
00037
00038
00039 namespace Foam
00040 {
00041
00042
00043
00044
00045
00046 class dataExchangeModel
00047 {
00048
00049 protected:
00050
00051
00052 const dictionary& dict_;
00053
00054 cfdemCloud& particleCloud_;
00055
00056 int maxNumberOfParticles_;
00057
00058 int nClumpTypes_;
00059
00060 mutable int couplingStep_;
00061
00062 scalar DEMts_;
00063
00064 int couplingInterval_;
00065
00066
00067 void setNumberOfParticles(int) const;
00068
00069 public:
00070
00071
00072 TypeName("dataExchangeModel");
00073
00074
00075
00076 declareRunTimeSelectionTable
00077 (
00078 autoPtr,
00079 dataExchangeModel,
00080 dictionary,
00081 (
00082 const dictionary& dict,
00083 cfdemCloud& sm
00084 ),
00085 (dict,sm)
00086 );
00087
00088
00089
00090
00091
00092 dataExchangeModel
00093 (
00094 const dictionary& dict,
00095 cfdemCloud& sm
00096 );
00097
00098
00099
00100
00101 virtual ~dataExchangeModel();
00102
00103
00104
00105
00106 static autoPtr<dataExchangeModel> New
00107 (
00108 const dictionary& dict,
00109 cfdemCloud& sm
00110 );
00111
00112
00113
00114 inline const int& maxNumberOfParticles() const {return maxNumberOfParticles_;};
00115
00116 inline int nClumpTypes() const {return nClumpTypes_;};
00117
00118 template <typename T>
00119 void getData
00120 (
00121 word name,
00122 word type,
00123 T ** const& field
00124 ) const { getData(name,type,field,couplingStep_-1); }
00125
00126 virtual void getData
00127 (
00128 word name,
00129 word type,
00130 double ** const& field,
00131 label step
00132 ) const = 0;
00133
00134 virtual void getData
00135 (
00136 word name,
00137 word type,
00138 int ** const& field,
00139 label step
00140 ) const=0;
00141
00142 virtual void giveData
00143 (
00144 word name,
00145 word type,
00146 double ** const& field,
00147 const char* datatype="double"
00148 ) const = 0;
00149
00150
00151
00152 virtual void allocateArray(double**&, double, int, int) const;
00153
00154 virtual void allocateArray(double**&, double, int, const char* ="nparticles") const;
00155
00156
00157
00158 virtual void allocateArray(int**&, int, int, int) const;
00159
00160 virtual void allocateArray(int**&, int, int, const char* ="nparticles") const;
00161
00162
00163 virtual bool couple() const;
00164
00165 virtual scalar timeStepFraction() const;
00166
00167 inline int couplingStep() const {return couplingStep_;};
00168
00169 inline const scalar& DEMts() const {return DEMts_;};
00170
00171 inline int couplingInterval() const {return couplingInterval_;};
00172
00173 inline void checkTSsize() const
00174 {
00175 if(particleCloud_.mesh().time().deltaT().value() > couplingInterval_ * DEMts_ + SMALL)
00176 {
00177 Info << "particleCloud_.mesh().time().deltaT().value() = " << particleCloud_.mesh().time().deltaT().value() << endl;
00178 Info << "couplingInterval_ = " << couplingInterval_ << endl;
00179 Info << "DEMts_ = " << DEMts_ << endl;
00180 FatalError<<"\nError - TS bigger than coupling interval!\n"<< abort(FatalError);
00181 }
00182 }
00183
00184
00185
00186 inline void readDEMtsfromDict(dictionary& propsDict)
00187 {
00188 DEMts_ = readScalar(propsDict.lookup("DEMts"));
00189 checkTSsize();
00190 }
00191
00192 inline bool doCoupleNow() const
00193 {
00194 if (particleCloud_.mesh().time().value()-(couplingStep_*(DEMts_*couplingInterval_))
00195 > particleCloud_.mesh().time().deltaT().value()/2)
00196 {
00197 return true;
00198 }
00199 else
00200 {
00201 return false;
00202 }
00203 }
00204
00205 virtual int getNumberOfClumps() const;
00206 };
00207
00208
00209
00210
00211 }
00212
00213
00214
00215 #endif
00216
00217