Merge lp:~jonmcc/esys-particle/remote-force-periodicity into lp:~llaniewski/esys-particle/remote-force
- remote-force-periodicity
- Merge into remote-force
Proposed by
Jon McCullough
Status: | Merged |
---|---|
Merged at revision: | 1190 |
Proposed branch: | lp:~jonmcc/esys-particle/remote-force-periodicity |
Merge into: | lp:~llaniewski/esys-particle/remote-force |
Diff against target: |
1351 lines (+450/-91) 35 files modified
Geometry/CircularNeighbourTable.h (+4/-0) Geometry/CircularNeighbourTable.hpp (+117/-34) Geometry/FaultedBlock2d.cpp (+4/-0) Geometry/GougeBlock3D.cpp (+4/-1) Geometry/GougeConfig.hpp (+4/-1) Geometry/SimpleNTable.cpp (+17/-0) Geometry/SimpleNTable3D.cpp (+32/-1) Geometry/SphAggGougeBlock.cpp (+4/-1) Geometry/SplitBlock3D.cpp (+4/-0) Model/Particle.cpp (+24/-8) Model/Particle.h (+8/-3) Model/RotParticle.cpp (+16/-7) Model/RotParticle.h (+12/-4) Model/RotParticleVi.cpp (+6/-4) Model/RotParticleVi.h (+3/-1) Model/RotThermParticle.cpp (+3/-2) Model/RotThermParticle.h (+2/-1) Parallel/ASubLattice.h (+1/-0) Parallel/LatticeMaster.cpp (+16/-0) Parallel/LatticeMaster.h (+1/-0) Parallel/SubLattice.h (+1/-0) Parallel/SubLattice.hpp (+28/-4) Parallel/SubLatticeControler.cpp (+1/-0) Parallel/sublattice_cmd.h (+1/-1) Python/esys/lsm/LsmMpiPy.cpp (+17/-0) Python/esys/lsm/LsmMpiPy.h (+1/-0) Python/esys/lsm/ParticlePy.cpp (+1/-1) Python/esys/lsm/RotParticlePy.cpp (+1/-1) Python/esys/lsm/RotParticleViPy.cpp (+1/-1) Python/esys/lsm/RotThermalParticlePy.cpp (+1/-1) Tools/dump2vtk/frame_vtk.cpp (+20/-0) ppa/src/pp_array.h (+1/-1) ppa/src/pp_array.hpp (+92/-11) tml/comm/cart_comm.hpp (+1/-1) tml/comm/comm.hpp (+1/-1) |
To merge this branch: | bzr merge lp:~jonmcc/esys-particle/remote-force-periodicity |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Łukasz Łaniewski-Wołłk | Pending | ||
Review via email: mp+359569@code.launchpad.net |
Commit message
Hopeful merge of Jon's and Lukasz's esys-particle codes for coupling with TCLB
Description of the change
- Introduction of full periodicity to esys in the remote force periodicity framework.
- should ensure it works when periodicity is not required. Anecdotally this works but I am skeptical.
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'Geometry/CircularNeighbourTable.h' |
2 | --- Geometry/CircularNeighbourTable.h 2017-01-04 08:26:43 +0000 |
3 | +++ Geometry/CircularNeighbourTable.h 2018-11-27 02:58:52 +0000 |
4 | @@ -109,6 +109,10 @@ |
5 | ParticleSet m_clonedParticleSet; |
6 | int m_circGridWidth; |
7 | int m_periodicDimIndex; |
8 | + |
9 | + //JM |
10 | + int m_periodicDimList[3];// = {-1,-1,-1}; |
11 | + int m_circGridList[3];// = {0,0,0}; |
12 | }; |
13 | } |
14 | } |
15 | |
16 | === modified file 'Geometry/CircularNeighbourTable.hpp' |
17 | --- Geometry/CircularNeighbourTable.hpp 2017-01-04 08:26:43 +0000 |
18 | +++ Geometry/CircularNeighbourTable.hpp 2018-11-27 02:58:52 +0000 |
19 | @@ -48,6 +48,21 @@ |
20 | circBorderWidth = this->getGridSpacing(); |
21 | } |
22 | setCircularBorderWidth(circBorderWidth, this->getGridSpacing()); |
23 | + |
24 | + //JM |
25 | + for (int i = 0; i < 3; i++) { |
26 | + double checkcircBorderWidth = |
27 | + min( |
28 | + (bBox.getSizes()[i]), |
29 | + circBorderWidth |
30 | + ); |
31 | + |
32 | + m_circGridList[i] = int(ceil(checkcircBorderWidth/gridSpacing)); |
33 | + //m_circGridList[i] = m_circGridWidth; |
34 | + } |
35 | + |
36 | + //JM |
37 | + cerr << "init1 circGridlist = " << m_circGridList[0] << "," << m_circGridList[1] << "," << m_circGridList[2] << endl; |
38 | } |
39 | |
40 | template <class TmplParticle> |
41 | @@ -70,6 +85,14 @@ |
42 | circBorderWidth = this->getGridSpacing(); |
43 | } |
44 | setCircularBorderWidth(circBorderWidth, this->getGridSpacing()); |
45 | + |
46 | + //JM |
47 | + for (int i = 0; i < 3; i++) { |
48 | + m_circGridList[i] = m_circGridWidth; |
49 | + } |
50 | + |
51 | + //JM |
52 | + cerr << "init2 circGridlist = " << m_circGridList[0] << "," << m_circGridList[1] << "," << m_circGridList[2] << endl; |
53 | } |
54 | |
55 | template <class TmplParticle> |
56 | @@ -86,20 +109,26 @@ |
57 | } |
58 | int numPeriodic = 0; |
59 | for (int i = 0; i < 3; i++) { |
60 | + m_periodicDimList[i] = -1; |
61 | if (m_periodicDimensions[i]) |
62 | { |
63 | - m_periodicDimIndex = i; |
64 | + m_periodicDimIndex = i; // JM need to select multiple indices here |
65 | numPeriodic++; |
66 | + |
67 | + //JM |
68 | + m_periodicDimList[i] = i; |
69 | } |
70 | } |
71 | - |
72 | + cerr << "dimlist = " << m_periodicDimList[0] << "," << m_periodicDimList[1] << "," << m_periodicDimList[2] << endl; |
73 | + |
74 | if (numPeriodic > 1) { |
75 | std::stringstream msg; |
76 | msg |
77 | << "CircularNeighbourTable::CircularNeighbourTable -" |
78 | << " only a single dimension may be periodic."; |
79 | - throw std::runtime_error(msg.str()); |
80 | - } |
81 | + //throw std::runtime_error(msg.str()); |
82 | + } |
83 | + |
84 | } |
85 | |
86 | template <class TmplParticle> |
87 | @@ -133,13 +162,30 @@ |
88 | { |
89 | if (havePeriodicDimensions()) |
90 | { |
91 | - circBorderWidth = |
92 | + //JM repeat for each periodic direction |
93 | + /* circBorderWidth = |
94 | min( |
95 | (bBox.getSizes()[m_periodicDimIndex])/2.0, |
96 | circBorderWidth |
97 | - ); |
98 | + ); */ |
99 | + // end loop |
100 | + |
101 | + for (int i = 0; i < 3; i++) { |
102 | + if (m_periodicDimList[i] != -1) { |
103 | + circBorderWidth = |
104 | + min( |
105 | + (bBox.getSizes()[m_periodicDimList[i]])/2.0, |
106 | + circBorderWidth |
107 | + ); |
108 | + |
109 | + m_circGridList[i] = int(ceil(circBorderWidth/gridSpacing)); //JM direct use of setCircularBorderWidth(circBorderWidth, gridSpacing); |
110 | + } |
111 | + } |
112 | + } |
113 | + else { //JM |
114 | + setCircularBorderWidth(circBorderWidth, gridSpacing); //JM now included in loop above when periodic in place. |
115 | } |
116 | - setCircularBorderWidth(circBorderWidth, gridSpacing); |
117 | + //JM setCircularBorderWidth(circBorderWidth, gridSpacing); |
118 | ParticleVector particles = getNonClonedParticles(); |
119 | clearClonedParticles(); |
120 | this->clearAndRecomputeGrid(bBox, gridSpacing); |
121 | @@ -151,6 +197,9 @@ |
122 | { |
123 | this->insert(*it); |
124 | } |
125 | + |
126 | + //JM |
127 | + cerr << "Resize circGridlist = " << m_circGridList[0] << "," << m_circGridList[1] << "," << m_circGridList[2] << endl; |
128 | } |
129 | |
130 | template <class TmplParticle> |
131 | @@ -189,33 +238,45 @@ |
132 | havePeriodicDimensions() |
133 | ) |
134 | { |
135 | - const int &dimIdx = m_periodicDimIndex; |
136 | - if ( |
137 | - (posn[dimIdx] < this->getBBox().getMinPt()[dimIdx]) |
138 | - || |
139 | - (posn[dimIdx] > this->getBBox().getMaxPt()[dimIdx]) |
140 | - ) |
141 | - { |
142 | - Vec3 moddedPosn = posn; |
143 | - const double dimSize = this->getBBox().getSizes()[dimIdx]; |
144 | - moddedPosn[dimIdx] -= this->getBBox().getMinPt()[dimIdx]; |
145 | - moddedPosn[dimIdx] = |
146 | - (moddedPosn[dimIdx] > 0.0) |
147 | - ? |
148 | - ( |
149 | - this->getBBox().getMinPt()[dimIdx] |
150 | - + |
151 | - moddedPosn[dimIdx] - (floor(moddedPosn[dimIdx]/dimSize)*dimSize) |
152 | - ) |
153 | - : |
154 | - ( |
155 | - this->getBBox().getMaxPt()[dimIdx] |
156 | - - |
157 | - (fabs(moddedPosn[dimIdx]) - (floor(fabs(moddedPosn[dimIdx])/dimSize)*dimSize)) |
158 | - ); |
159 | - |
160 | - return moddedPosn; |
161 | - } |
162 | + |
163 | + Vec3 moddedPosn = posn; |
164 | + |
165 | + for (int i = 0; i < 3; i++) { |
166 | + if (m_periodicDimList[i] != -1) { |
167 | + |
168 | + //JM repeat this loop over each periodic direction |
169 | + //const int &dimIdx = m_periodicDimIndex; |
170 | + const int &dimIdx = m_periodicDimList[i]; |
171 | + |
172 | + if ( |
173 | + (posn[dimIdx] < this->getBBox().getMinPt()[dimIdx]) |
174 | + || |
175 | + (posn[dimIdx] > this->getBBox().getMaxPt()[dimIdx]) |
176 | + ) |
177 | + { |
178 | + //Vec3 moddedPosn = posn; |
179 | + const double dimSize = this->getBBox().getSizes()[dimIdx]; |
180 | + moddedPosn[dimIdx] -= this->getBBox().getMinPt()[dimIdx]; |
181 | + moddedPosn[dimIdx] = |
182 | + (moddedPosn[dimIdx] > 0.0) |
183 | + ? |
184 | + ( |
185 | + this->getBBox().getMinPt()[dimIdx] |
186 | + + |
187 | + moddedPosn[dimIdx] - (floor(moddedPosn[dimIdx]/dimSize)*dimSize) |
188 | + ) |
189 | + : |
190 | + ( |
191 | + this->getBBox().getMaxPt()[dimIdx] |
192 | + - |
193 | + (fabs(moddedPosn[dimIdx]) - (floor(fabs(moddedPosn[dimIdx])/dimSize)*dimSize)) |
194 | + ); |
195 | + } |
196 | + } |
197 | + } |
198 | + //JM end periodic repeat here |
199 | + return moddedPosn; |
200 | + //} |
201 | } |
202 | return posn; |
203 | } |
204 | @@ -223,6 +284,9 @@ |
205 | template <class TmplParticle> |
206 | void CircularNeighbourTable<TmplParticle>::insert(Particle *pParticle) |
207 | { |
208 | + //JM |
209 | + //cerr << "insert circGridlist = " << m_circGridList[0] << "," << m_circGridList[1] << "," << m_circGridList[2] << endl; |
210 | + |
211 | pParticle->moveTo(getModdedPosn(pParticle->getPos())); |
212 | const Vec3L minIdx = this->getVecIndex(pParticle->getPos() - pParticle->getRad()); |
213 | const Vec3L maxIdx = this->getVecIndex(pParticle->getPos() + pParticle->getRad()); |
214 | @@ -230,6 +294,7 @@ |
215 | this->insertInTable(pParticle, minIdx, maxIdx); |
216 | this->addInserted(pParticle); |
217 | |
218 | + //original |
219 | if (havePeriodicDimensions()) |
220 | { |
221 | for (int dimIdx = 0; dimIdx < 3; dimIdx++) { |
222 | @@ -247,6 +312,24 @@ |
223 | } |
224 | } |
225 | } |
226 | + |
227 | + /* //modified |
228 | + if (havePeriodicDimensions()) |
229 | + { |
230 | + Vec3 shift = Vec3::ZERO; |
231 | + for (int dimIdx = 0; dimIdx < 3; dimIdx++) { |
232 | + if (m_periodicDimensions[dimIdx]) { |
233 | + if (minIdx[dimIdx] < (this->getMinVecIndex()[dimIdx] + m_circGridList[dimIdx])) { //JM |
234 | + shift[dimIdx] = this->getBBox().getSizes()[dimIdx]; |
235 | + } |
236 | + if (maxIdx[dimIdx] > (this->getMaxVecIndex()[dimIdx] - m_circGridList[dimIdx])) { //JM |
237 | + shift[dimIdx] = -1.0d*this->getBBox().getSizes()[dimIdx]; |
238 | + } |
239 | + } |
240 | + } |
241 | + this->insertClone(pParticle, pParticle->getPos() + shift); |
242 | + } |
243 | + */ |
244 | } |
245 | |
246 | template <class TmplParticle> |
247 | |
248 | === modified file 'Geometry/FaultedBlock2d.cpp' |
249 | --- Geometry/FaultedBlock2d.cpp 2017-01-04 08:26:43 +0000 |
250 | +++ Geometry/FaultedBlock2d.cpp 2018-11-27 02:58:52 +0000 |
251 | @@ -29,6 +29,10 @@ |
252 | \param rmax maximum particle radius |
253 | \param pad thickness of the padding region at each diving edge |
254 | \param circ_x circular boudary condition in x-direction |
255 | + |
256 | + JM |
257 | + \param circ_y circular or open boundary conditions in y-direction |
258 | + \param circ_z circular or open boundary conditions in z-direction |
259 | */ |
260 | FaultedBlock2D::FaultedBlock2D(double xmin,double xmax,double ymin,double ymax,double rmin,double rmax,double pad,bool circ_x) : |
261 | CRandomBlock2D(xmin,xmax,ymin,ymax,rmin,rmax,circ_x) |
262 | |
263 | === modified file 'Geometry/GougeBlock3D.cpp' |
264 | --- Geometry/GougeBlock3D.cpp 2017-01-04 08:26:43 +0000 |
265 | +++ Geometry/GougeBlock3D.cpp 2018-11-27 02:58:52 +0000 |
266 | @@ -454,7 +454,10 @@ |
267 | m_prms.getPeriodicDimensions()[2] ? 1 : 0 |
268 | )*m_prms.getMaxRadius(); |
269 | if (m_prms.getBBox().getSizes().Z() >= 4*m_prms.getMaxRadius()) { |
270 | - ntableAdjust += Vec3(m_prms.getMaxRadius(), 0, 0); |
271 | + //ntableAdjust += Vec3(m_prms.getMaxRadius(), 0, 0); |
272 | + |
273 | + //JM For y/z circular bounds |
274 | + ntableAdjust += Vec3(m_prms.getMaxRadius(), m_prms.getMaxRadius(), m_prms.getMaxRadius()); |
275 | } |
276 | const BoundingBox nTableBBox(bBox.getMinPt(), bBox.getMaxPt() - ntableAdjust); |
277 | m_nTablePtr = |
278 | |
279 | === modified file 'Geometry/GougeConfig.hpp' |
280 | --- Geometry/GougeConfig.hpp 2017-01-04 08:26:43 +0000 |
281 | +++ Geometry/GougeConfig.hpp 2018-11-27 02:58:52 +0000 |
282 | @@ -652,7 +652,10 @@ |
283 | m_prms.getPeriodicDimensions()[2] ? 1 : 0 |
284 | )*m_prms.getMaxRadius(); |
285 | if (m_prms.getBBox().getSizes().Z() >= 4*m_prms.getMaxRadius()) { |
286 | - ntableAdjust += Vec3(m_prms.getMaxRadius(), 0, 0); |
287 | + //ntableAdjust += Vec3(m_prms.getMaxRadius(), 0, 0); |
288 | + |
289 | + //JM For y/z circular bounds |
290 | + ntableAdjust += Vec3(m_prms.getMaxRadius(), m_prms.getMaxRadius(), m_prms.getMaxRadius()); |
291 | } |
292 | const BoundingBox nTableBBox(bBox.getMinPt(), bBox.getMaxPt() - ntableAdjust); |
293 | m_nTablePtr = |
294 | |
295 | === modified file 'Geometry/SimpleNTable.cpp' |
296 | --- Geometry/SimpleNTable.cpp 2017-01-04 08:26:43 +0000 |
297 | +++ Geometry/SimpleNTable.cpp 2018-11-27 02:58:52 +0000 |
298 | @@ -142,6 +142,23 @@ |
299 | } |
300 | } |
301 | } |
302 | + |
303 | + // JM Circular y bound addition |
304 | + if(m_ycirc){ |
305 | + if (int((cbp.getPos().Y()-m_p0.Y())/m_dim)==1) { |
306 | + cbp.moveTo(cbp.getPos()+m_yshift); |
307 | + const vector<int> idy=allidx(cbp.getPos()); |
308 | + for(vector<int>::const_iterator citer=idy.begin();citer!=idy.end();citer++){ |
309 | + m_data[*citer].push_back(cbp); |
310 | + } |
311 | + } else if (int((cbp.getPos().Y()-m_p0.Y())/m_dim)==m_ysize-2) { |
312 | + cbp.moveTo(cbp.getPos()-m_yshift); |
313 | + const vector<int> idy=allidx(cbp.getPos()); |
314 | + for(vector<int>::const_iterator citer=idy.begin();citer!=idy.end();citer++){ |
315 | + m_data[*citer].push_back(cbp); |
316 | + } |
317 | + } |
318 | + } |
319 | } |
320 | |
321 | /*! |
322 | |
323 | === modified file 'Geometry/SimpleNTable3D.cpp' |
324 | --- Geometry/SimpleNTable3D.cpp 2017-01-04 08:26:43 +0000 |
325 | +++ Geometry/SimpleNTable3D.cpp 2018-11-27 02:58:52 +0000 |
326 | @@ -152,6 +152,37 @@ |
327 | } |
328 | } |
329 | } |
330 | + // JM Circular y/z bound addition |
331 | + if(m_ycirc){ |
332 | + if (int((cbp.getPos().Y()-m_p0.Y())/m_dim)==1) { |
333 | + cbp.moveTo(cbp.getPos()+m_yshift); |
334 | + const vector<int> idy=allidx(cbp.getPos()); |
335 | + for(vector<int>::const_iterator citer=idy.begin();citer!=idy.end();citer++){ |
336 | + m_data[*citer].push_back(cbp); |
337 | + } |
338 | + } else if (int((cbp.getPos().Y()-m_p0.Y())/m_dim)==m_ysize-2) { |
339 | + cbp.moveTo(cbp.getPos()-m_yshift); |
340 | + const vector<int> idy=allidx(cbp.getPos()); |
341 | + for(vector<int>::const_iterator citer=idy.begin();citer!=idy.end();citer++){ |
342 | + m_data[*citer].push_back(cbp); |
343 | + } |
344 | + } |
345 | + } |
346 | + if(m_zcirc){ |
347 | + if (int((cbp.getPos().Z()-m_p0.Z())/m_dim)==1) { |
348 | + cbp.moveTo(cbp.getPos()+m_zshift); |
349 | + const vector<int> idz=allidx(cbp.getPos()); |
350 | + for(vector<int>::const_iterator citer=idz.begin();citer!=idz.end();citer++){ |
351 | + m_data[*citer].push_back(cbp); |
352 | + } |
353 | + } else if (int((cbp.getPos().Z()-m_p0.Z())/m_dim)==m_zsize-2) { |
354 | + cbp.moveTo(cbp.getPos()-m_zshift); |
355 | + const vector<int> idz=allidx(cbp.getPos()); |
356 | + for(vector<int>::const_iterator citer=idz.begin();citer!=idz.end();citer++){ |
357 | + m_data[*citer].push_back(cbp); |
358 | + } |
359 | + } |
360 | + } |
361 | } |
362 | |
363 | |
364 | @@ -187,7 +218,7 @@ |
365 | if (m_zcirc) { |
366 | m_zsize+=2; |
367 | m_p0-=Vec3(0.0,0.0,r); |
368 | - m_yshift=Vec3(0.0,0.0,dim.Z()); |
369 | + m_zshift=Vec3(0.0,0.0,dim.Z()); |
370 | } |
371 | //cout << "NT size : " << m_xsize << " , " << m_ysize << " , " << m_zsize << endl; |
372 | m_data=new vector<SimpleParticle>[m_xsize*m_ysize*m_zsize]; |
373 | |
374 | === modified file 'Geometry/SphAggGougeBlock.cpp' |
375 | --- Geometry/SphAggGougeBlock.cpp 2017-01-04 08:26:43 +0000 |
376 | +++ Geometry/SphAggGougeBlock.cpp 2018-11-27 02:58:52 +0000 |
377 | @@ -162,7 +162,10 @@ |
378 | const BoundingBox bBox = m_prms.getBBox(); |
379 | Vec3 ntableAdjust = Vec3(0.0,0.0,0.0); |
380 | if (m_prms.getBBox().getSizes().Z() >= 4*m_prms.getMaxRadius()) { |
381 | - ntableAdjust += Vec3(m_prms.getMaxRadius(), 0, 0); |
382 | + //ntableAdjust += Vec3(m_prms.getMaxRadius(), 0, 0); |
383 | + |
384 | + //JM For y/z circular bounds |
385 | + ntableAdjust += Vec3(m_prms.getMaxRadius(), m_prms.getMaxRadius(), m_prms.getMaxRadius()); |
386 | } |
387 | const BoundingBox nTableBBox(bBox.getMinPt(), bBox.getMaxPt() - ntableAdjust); |
388 | m_nTablePtr2 = |
389 | |
390 | === modified file 'Geometry/SplitBlock3D.cpp' |
391 | --- Geometry/SplitBlock3D.cpp 2017-01-04 08:26:43 +0000 |
392 | +++ Geometry/SplitBlock3D.cpp 2018-11-27 02:58:52 +0000 |
393 | @@ -27,6 +27,10 @@ |
394 | \param ysplit the position of the split plane |
395 | \param dir the direction of the split plane (2=y,3=z) |
396 | \param circ_x circular or open boundary conditions in x-direction |
397 | + |
398 | + JM |
399 | + \param circ_y circular or open boundary conditions in y-direction |
400 | + \param circ_z circular or open boundary conditions in z-direction |
401 | */ |
402 | CSplitBlock3D::CSplitBlock3D(double xmin,double xmax,double ymin,double ymax,double zmin,double zmax,double rmin,double rmax,double ysplit,int dir, bool circ_x,bool rough):CRandomBlock3D(xmin,xmax,ymin,ymax,zmin,zmax,rmin,rmax,1.05,circ_x) |
403 | { |
404 | |
405 | === modified file 'Model/Particle.cpp' |
406 | --- Model/Particle.cpp 2017-01-04 08:26:43 +0000 |
407 | +++ Model/Particle.cpp 2018-11-27 02:58:52 +0000 |
408 | @@ -34,7 +34,8 @@ |
409 | m_mass(0.0), |
410 | m_div_mass(0.0), |
411 | flag(false), |
412 | - m_is_dynamic(true) |
413 | + m_is_dynamic(true), |
414 | + m_is_acc(true) |
415 | { |
416 | } |
417 | |
418 | @@ -49,7 +50,8 @@ |
419 | m_mass(data.getMass()), |
420 | m_div_mass((data.getMass() != 0) ? 1.0/data.getMass() : 0.0), |
421 | flag(false), |
422 | - m_is_dynamic(true) //! SimpleParticleData has no is_dynamic info -> default to true |
423 | + m_is_dynamic(true), //! SimpleParticleData has no is_dynamic info -> default to true |
424 | + m_is_acc(true) //! SimpleParticleData has no is_dynamic info -> default to true |
425 | { |
426 | } |
427 | |
428 | @@ -63,7 +65,7 @@ |
429 | \param force currently applied force |
430 | \param id particle id |
431 | */ |
432 | -CParticle::CParticle(double rad,double mass,const Vec3& pos,const Vec3& vel,const Vec3& force,int id,bool is_dyn) : CBasicParticle(pos,rad) |
433 | +CParticle::CParticle(double rad,double mass,const Vec3& pos,const Vec3& vel,const Vec3& force,int id,bool is_dyn,bool is_acc) : CBasicParticle(pos,rad) |
434 | { |
435 | m_oldpos=pos; |
436 | m_initpos=pos; |
437 | @@ -79,9 +81,10 @@ |
438 | m_circular_shift = zeroVec3; |
439 | flag=false; |
440 | m_is_dynamic=is_dyn; |
441 | + m_is_acc=is_acc; |
442 | } |
443 | |
444 | -CParticle::CParticle(double rad,double mass,const Vec3& pos,const Vec3& oldpos,const Vec3& initpos,const Vec3& vel,const Vec3& force,int id,bool is_dyn) : CBasicParticle(pos,rad) |
445 | +CParticle::CParticle(double rad,double mass,const Vec3& pos,const Vec3& oldpos,const Vec3& initpos,const Vec3& vel,const Vec3& force,int id,bool is_dyn,bool is_acc) : CBasicParticle(pos,rad) |
446 | { |
447 | m_oldpos=oldpos; |
448 | m_initpos=initpos; |
449 | @@ -97,6 +100,7 @@ |
450 | m_circular_shift = zeroVec3; |
451 | flag=false; |
452 | m_is_dynamic=is_dyn; |
453 | + m_is_acc=is_acc; |
454 | } |
455 | |
456 | /*! |
457 | @@ -211,6 +215,7 @@ |
458 | append(p.m_rad); |
459 | append(p.m_mass); |
460 | append(p.m_is_dynamic); |
461 | + append(p.m_is_acc); |
462 | } |
463 | |
464 | /*! |
465 | @@ -240,6 +245,7 @@ |
466 | p.m_div_mass=0.0; |
467 | } |
468 | p.m_is_dynamic=pop_bool(); |
469 | + p.m_is_acc=pop_bool(); |
470 | } |
471 | |
472 | /*! |
473 | @@ -253,6 +259,9 @@ |
474 | if (getDo2dCalculations()) { |
475 | m_force = Vec3(m_force.X(), m_force.Y(), 0); |
476 | } |
477 | + if (!m_is_acc) { |
478 | + m_force = Vec3(0.0,0.0,0.0); |
479 | + } |
480 | #if 1 |
481 | // 1st order scheme, 13 Flops |
482 | m_vel+=m_force*m_div_mass*dt; // 7 Flops |
483 | @@ -303,7 +312,8 @@ |
484 | m_initpos - m_circular_shift, |
485 | m_oldpos - m_circular_shift, |
486 | m_vel, |
487 | - m_is_dynamic |
488 | + m_is_dynamic, |
489 | + m_is_acc |
490 | ); |
491 | } |
492 | |
493 | @@ -319,6 +329,7 @@ |
494 | m_oldpos = E.m_oldPos + m_circular_shift; |
495 | m_vel = E.m_vel; |
496 | m_is_dynamic = E.m_is_dynamic; |
497 | + m_is_acc = E.m_is_acc; |
498 | } |
499 | |
500 | /*! |
501 | @@ -355,6 +366,7 @@ |
502 | append(p.m_vel.Y()); |
503 | append(p.m_vel.Z()); |
504 | append(p.m_is_dynamic); |
505 | + append(p.m_is_acc); |
506 | } |
507 | |
508 | /*! |
509 | @@ -372,6 +384,7 @@ |
510 | p.m_oldPos = Vec3(db[6], db[7], db[8]); |
511 | p.m_vel = Vec3(db[9], db[10], db[11]); |
512 | p.m_is_dynamic=pop_bool(); |
513 | + p.m_is_acc=pop_bool(); |
514 | } |
515 | |
516 | |
517 | @@ -448,7 +461,8 @@ |
518 | << getVel() << delim // 13,14,15 |
519 | << getForce() << delim // 16,17,18 |
520 | << m_circular_shift << delim // 19,20,21 |
521 | - << m_is_dynamic; |
522 | + << m_is_dynamic << delim |
523 | + << m_is_acc; |
524 | } |
525 | |
526 | /*! |
527 | @@ -467,6 +481,7 @@ |
528 | int id; |
529 | int tag; |
530 | bool is_dyn; |
531 | + bool is_acc; |
532 | |
533 | iStream |
534 | >> pos |
535 | @@ -479,7 +494,8 @@ |
536 | >> vel |
537 | >> force |
538 | >> circular_shift |
539 | - >> is_dyn; |
540 | + >> is_dyn |
541 | + >> is_acc; |
542 | |
543 | CParticle |
544 | particle |
545 | @@ -491,7 +507,7 @@ |
546 | initpos + circular_shift, |
547 | vel, |
548 | force, |
549 | - id, is_dyn |
550 | + id, is_dyn, is_acc |
551 | ); |
552 | particle.setTag(tag); |
553 | |
554 | |
555 | === modified file 'Model/Particle.h' |
556 | --- Model/Particle.h 2017-01-04 08:26:43 +0000 |
557 | +++ Model/Particle.h 2018-11-27 02:58:52 +0000 |
558 | @@ -60,15 +60,17 @@ |
559 | m_vel() |
560 | { |
561 | m_is_dynamic=true; |
562 | + m_is_acc=true; |
563 | } |
564 | |
565 | - exchangeType(const Vec3 &pos, const Vec3 &initPos, const Vec3 &oldPos, const Vec3 &vel,bool is_dyn) |
566 | + exchangeType(const Vec3 &pos, const Vec3 &initPos, const Vec3 &oldPos, const Vec3 &vel,bool is_dyn,bool is_acc) |
567 | : m_pos(pos), |
568 | m_initPos(initPos), |
569 | m_oldPos(oldPos), |
570 | m_vel(vel) |
571 | { |
572 | m_is_dynamic=is_dyn; |
573 | + m_is_acc=is_acc; |
574 | } |
575 | |
576 | Vec3 m_pos; |
577 | @@ -76,6 +78,7 @@ |
578 | Vec3 m_oldPos; |
579 | Vec3 m_vel; |
580 | bool m_is_dynamic; |
581 | + bool m_is_acc; |
582 | }; |
583 | |
584 | typedef double (CParticle::* ScalarFieldFunction)() const; |
585 | @@ -92,13 +95,14 @@ |
586 | |
587 | bool flag; |
588 | bool m_is_dynamic; |
589 | + bool m_is_acc; |
590 | |
591 | void setForce(const Vec3 &force) {m_force = force;} |
592 | |
593 | public: |
594 | CParticle(); |
595 | - CParticle(double,double,const Vec3&,const Vec3&,const Vec3&,int,bool); |
596 | - CParticle(double,double,const Vec3&,const Vec3&,const Vec3&,const Vec3&,const Vec3&,int,bool); // including oldpos |
597 | + CParticle(double,double,const Vec3&,const Vec3&,const Vec3&,int,bool,bool); |
598 | + CParticle(double,double,const Vec3&,const Vec3&,const Vec3&,const Vec3&,const Vec3&,int,bool,bool); // including oldpos |
599 | CParticle(const esys::lsm::SimpleParticleData &particleData); |
600 | virtual ~CParticle(){}; |
601 | |
602 | @@ -136,6 +140,7 @@ |
603 | virtual void setNonDynamic() {m_is_dynamic=false;}; |
604 | virtual void setNonDynamicLinear() {m_is_dynamic=false;}; |
605 | virtual void setNonDynamicRot(){}; // do nothing |
606 | + virtual void setNonDynamicAcc(){m_is_dynamic=true; m_is_acc=false;}; // JM |
607 | |
608 | void setFlag(bool b=true){flag=b;}; |
609 | bool isFlagged() const {return flag;}; |
610 | |
611 | === modified file 'Model/RotParticle.cpp' |
612 | --- Model/RotParticle.cpp 2017-01-04 08:26:43 +0000 |
613 | +++ Model/RotParticle.cpp 2018-11-27 02:58:52 +0000 |
614 | @@ -66,8 +66,9 @@ |
615 | const Vec3& force, |
616 | int id, |
617 | bool is_dyn, |
618 | - bool is_rot |
619 | - ) : CParticle(rad, mass, pos, vel, force, id, is_dyn) |
620 | + bool is_rot, |
621 | + bool is_acc |
622 | + ) : CParticle(rad, mass, pos, vel, force, id, is_dyn, is_acc) |
623 | { |
624 | m_quat = Quaternion(1.0,Vec3(0.0,0.0,0.0)); |
625 | m_initquat = m_quat; |
626 | @@ -109,8 +110,9 @@ |
627 | const Vec3& moment, |
628 | const Vec3& angvel, |
629 | bool is_dyn, |
630 | - bool is_rot |
631 | - ) :CParticle(rad, mass,pos,vel,force,id,is_dyn) |
632 | + bool is_rot, |
633 | + bool is_acc |
634 | + ) :CParticle(rad, mass,pos,vel,force,id,is_dyn,is_acc) |
635 | { |
636 | m_circular_shift=Vec3(0.0,0.0,0.0); |
637 | flag=false; |
638 | @@ -139,8 +141,9 @@ |
639 | const Vec3& moment, |
640 | const Vec3& angvel, |
641 | bool is_dyn, |
642 | - bool is_rot |
643 | - ) :CParticle(rad, mass,pos,oldpos, initpos,vel,force,id,is_dyn) |
644 | + bool is_rot, |
645 | + bool is_acc |
646 | + ) :CParticle(rad, mass,pos,oldpos, initpos,vel,force,id,is_dyn,is_acc) |
647 | { |
648 | m_circular_shift=Vec3(0.0,0.0,0.0); |
649 | flag=false; |
650 | @@ -228,6 +231,7 @@ |
651 | |
652 | append(p.m_is_dynamic); |
653 | append(p.m_is_rot); |
654 | + append(p.m_is_acc); |
655 | } |
656 | |
657 | |
658 | @@ -265,6 +269,7 @@ |
659 | p.m_global_id=pop_int(); |
660 | p.m_is_dynamic=pop_bool(); |
661 | p.m_is_rot=pop_bool(); |
662 | + p.m_is_acc=pop_bool(); |
663 | } |
664 | |
665 | /*! |
666 | @@ -339,7 +344,8 @@ |
667 | m_angVel, |
668 | m_quat, |
669 | m_is_dynamic, |
670 | - m_is_rot |
671 | + m_is_rot, |
672 | + m_is_acc |
673 | ); |
674 | } |
675 | |
676 | @@ -357,6 +363,7 @@ |
677 | m_quat = E.m_quat; |
678 | m_is_dynamic = E.m_is_dynamic; |
679 | m_is_rot = E.m_is_rot; |
680 | + m_is_acc = E.m_is_acc; |
681 | } |
682 | |
683 | template<> |
684 | @@ -380,6 +387,7 @@ |
685 | append(p.m_quat.return_vec().Z()); |
686 | append(p.m_is_dynamic); |
687 | append(p.m_is_rot); |
688 | + append(p.m_is_acc); |
689 | } |
690 | |
691 | /*! |
692 | @@ -399,6 +407,7 @@ |
693 | p.m_quat = Quaternion(db[12],Vec3(db[13],db[14],db[15])); |
694 | p.m_is_dynamic = pop_bool(); |
695 | p.m_is_rot = pop_bool(); |
696 | + p.m_is_acc = pop_bool(); |
697 | } |
698 | |
699 | CRotParticle::ScalarFieldFunction CRotParticle::getScalarFieldFunction(const string& name) |
700 | |
701 | === modified file 'Model/RotParticle.h' |
702 | --- Model/RotParticle.h 2017-01-04 08:26:43 +0000 |
703 | +++ Model/RotParticle.h 2018-11-27 02:58:52 +0000 |
704 | @@ -66,6 +66,7 @@ |
705 | { |
706 | m_is_dynamic=true; |
707 | m_is_rot=true; |
708 | + m_is_acc=true; |
709 | } |
710 | |
711 | exchangeType( |
712 | @@ -75,7 +76,8 @@ |
713 | const Vec3 &currAngVel, |
714 | const Quaternion &quat, |
715 | const bool is_dyn, |
716 | - const bool is_rot |
717 | + const bool is_rot, |
718 | + const bool is_acc |
719 | ) |
720 | : m_pos(pos), |
721 | m_initPos(initPos), |
722 | @@ -85,6 +87,7 @@ |
723 | { |
724 | m_is_dynamic=is_dyn; |
725 | m_is_rot=is_rot; |
726 | + m_is_acc=is_acc; |
727 | } |
728 | public: |
729 | Vec3 m_pos; |
730 | @@ -94,6 +97,7 @@ |
731 | Quaternion m_quat; |
732 | bool m_is_dynamic; |
733 | bool m_is_rot; |
734 | + bool m_is_acc; |
735 | |
736 | friend class TML_PackedMessageInterface; |
737 | }; |
738 | @@ -124,7 +128,8 @@ |
739 | const Vec3& force, |
740 | int id, |
741 | bool is_dyn, |
742 | - bool is_rot |
743 | + bool is_rot, |
744 | + bool is_acc |
745 | ); |
746 | CRotParticle( |
747 | double rad, |
748 | @@ -138,7 +143,8 @@ |
749 | const Vec3& moment, |
750 | const Vec3& angvel, |
751 | bool is_dyn, |
752 | - bool is_rot |
753 | + bool is_rot, |
754 | + bool is_acc |
755 | ); |
756 | CRotParticle( |
757 | double rad, |
758 | @@ -155,7 +161,8 @@ |
759 | const Vec3& moment, |
760 | const Vec3& angvel, |
761 | bool is_dyn, |
762 | - bool is_rot |
763 | + bool is_rot, |
764 | + bool is_acc |
765 | ); |
766 | |
767 | virtual ~CRotParticle(){}; |
768 | @@ -200,6 +207,7 @@ |
769 | virtual void setNonDynamic() {m_is_dynamic=false;m_is_rot=false;}; |
770 | virtual void setNonDynamicLinear() {m_is_dynamic=false;}; |
771 | virtual void setNonDynamicRot() {m_is_rot=false;}; |
772 | + virtual void setNonDynamicAcc() {m_is_dynamic=true; m_is_acc=false;}; |
773 | |
774 | inline Quaternion getQuatFromRotVec(const Vec3 &vec) const |
775 | { |
776 | |
777 | === modified file 'Model/RotParticleVi.cpp' |
778 | --- Model/RotParticleVi.cpp 2017-01-04 08:26:43 +0000 |
779 | +++ Model/RotParticleVi.cpp 2018-11-27 02:58:52 +0000 |
780 | @@ -42,8 +42,9 @@ |
781 | const Vec3& vel, |
782 | const Vec3& force, |
783 | int id, |
784 | - bool is_dyn |
785 | -) : CParticle(rad, mass, pos, vel, force, id, is_dyn) |
786 | + bool is_dyn, |
787 | + bool is_acc |
788 | +) : CParticle(rad, mass, pos, vel, force, id, is_dyn,is_acc) |
789 | { |
790 | m_quat = Quaternion(1.0,Vec3(0.0,0.0,0.0)); |
791 | m_initquat = m_quat; |
792 | @@ -53,6 +54,7 @@ |
793 | m_angVel_t = Vec3(0.0,0.0,0.0) ; |
794 | m_moment = Vec3(0.0,0.0,0.0); |
795 | m_is_dynamic=is_dyn; |
796 | + m_is_acc=is_acc; |
797 | } |
798 | |
799 | CRotParticleVi::CRotParticleVi(const CParticle &particle) : CParticle(particle) |
800 | @@ -91,7 +93,7 @@ |
801 | const Vec3& moment, |
802 | const Vec3& angvel, |
803 | const Vec3& angvel_t |
804 | -) :CParticle(rad, mass,pos,vel,force,id,true) |
805 | +) :CParticle(rad, mass,pos,vel,force,id,true,true) |
806 | { |
807 | m_circular_shift=Vec3(0.0,0.0,0.0); |
808 | flag=false; |
809 | @@ -120,7 +122,7 @@ |
810 | const Vec3& moment, |
811 | const Vec3& angvel, |
812 | const Vec3& angvel_t |
813 | -) :CParticle(rad, mass,pos,oldpos, initpos,vel,force,id,true) |
814 | +) :CParticle(rad, mass,pos,oldpos, initpos,vel,force,id,true,true) |
815 | { |
816 | m_circular_shift=Vec3(0.0,0.0,0.0); |
817 | flag=false; |
818 | |
819 | === modified file 'Model/RotParticleVi.h' |
820 | --- Model/RotParticleVi.h 2017-01-04 08:26:43 +0000 |
821 | +++ Model/RotParticleVi.h 2018-11-27 02:58:52 +0000 |
822 | @@ -105,6 +105,7 @@ |
823 | double m_inertRot; |
824 | double m_div_inertRot; |
825 | bool m_is_dynamic; |
826 | + bool m_is_acc; |
827 | |
828 | public: |
829 | CRotParticleVi(); |
830 | @@ -116,7 +117,8 @@ |
831 | const Vec3& vel, |
832 | const Vec3& force, |
833 | int id, |
834 | - bool is_dyn |
835 | + bool is_dyn, |
836 | + bool is_acc |
837 | ); |
838 | CRotParticleVi( |
839 | double rad, |
840 | |
841 | === modified file 'Model/RotThermParticle.cpp' |
842 | --- Model/RotThermParticle.cpp 2017-01-04 08:26:43 +0000 |
843 | +++ Model/RotThermParticle.cpp 2018-11-27 02:58:52 +0000 |
844 | @@ -52,9 +52,10 @@ |
845 | const Vec3& vel, |
846 | const Vec3& force, |
847 | int id, |
848 | - bool is_dyn |
849 | + bool is_dyn, |
850 | + bool is_acc |
851 | ) : |
852 | - CRotParticleVi(rad, mass, pos, vel, force, id, is_dyn), |
853 | + CRotParticleVi(rad, mass, pos, vel, force, id, is_dyn, is_acc), |
854 | CThermParticle(rad) |
855 | { |
856 | } |
857 | |
858 | === modified file 'Model/RotThermParticle.h' |
859 | --- Model/RotThermParticle.h 2017-01-04 08:26:43 +0000 |
860 | +++ Model/RotThermParticle.h 2018-11-27 02:58:52 +0000 |
861 | @@ -136,7 +136,8 @@ |
862 | const Vec3& vel, |
863 | const Vec3& force, |
864 | int id, |
865 | - bool is_dyn |
866 | + bool is_dyn, |
867 | + bool is_acc |
868 | ); |
869 | |
870 | CRotThermParticle( |
871 | |
872 | === modified file 'Parallel/ASubLattice.h' |
873 | --- Parallel/ASubLattice.h 2017-09-07 08:07:19 +0000 |
874 | +++ Parallel/ASubLattice.h 2018-11-27 02:58:52 +0000 |
875 | @@ -131,6 +131,7 @@ |
876 | virtual void setParticleAngularVelocity(){}; |
877 | virtual void setParticleNonDynamic()=0; |
878 | virtual void setParticleNonRot()=0; |
879 | + virtual void setParticleNonAcc()=0; |
880 | virtual void tagParticleNearestTo()=0; |
881 | virtual void moveSingleNode()=0; |
882 | virtual void moveTaggedNodes()=0; |
883 | |
884 | === modified file 'Parallel/LatticeMaster.cpp' |
885 | --- Parallel/LatticeMaster.cpp 2017-12-11 00:23:07 +0000 |
886 | +++ Parallel/LatticeMaster.cpp 2018-11-27 02:58:52 +0000 |
887 | @@ -1091,6 +1091,22 @@ |
888 | } |
889 | |
890 | /*! |
891 | + Set all particles with a given tag to be linear non-dynamic, i.e. switch off velocity updates JM version |
892 | + |
893 | + \param tag the tag |
894 | +*/ |
895 | +void CLatticeMaster::setParticleNonAcc(int tag) |
896 | +{ |
897 | + CMPILCmdBuffer cmd_buffer(m_global_comm,m_global_rank); |
898 | + CVarMPIBuffer buffer(m_global_comm); |
899 | + CMPIBarrier barrier(m_global_comm); |
900 | + |
901 | + cmd_buffer.broadcast(CMD_PSETNA); |
902 | + buffer.append(tag); |
903 | + buffer.broadcast(m_global_rank); |
904 | + barrier.wait("setParticleNonAcc"); |
905 | +} |
906 | +/*! |
907 | Set all particles with a given tag to be linear non-dynamic, i.e. switch off velocity updates |
908 | |
909 | \param tag the tag |
910 | |
911 | === modified file 'Parallel/LatticeMaster.h' |
912 | --- Parallel/LatticeMaster.h 2017-12-11 00:23:07 +0000 |
913 | +++ Parallel/LatticeMaster.h 2018-11-27 02:58:52 +0000 |
914 | @@ -303,6 +303,7 @@ |
915 | void setParticleNonDynamic(int); |
916 | void setParticleNonRot(int); |
917 | void setParticleNonTrans(int); |
918 | + void setParticleNonAcc(int); |
919 | void setParticleVel(int,const Vec3&); |
920 | void setParticleAngVel(int,const Vec3&); |
921 | void setParticleDensity(int tag,int mask,double rho); |
922 | |
923 | === modified file 'Parallel/SubLattice.h' |
924 | --- Parallel/SubLattice.h 2017-09-07 08:07:19 +0000 |
925 | +++ Parallel/SubLattice.h 2018-11-27 02:58:52 +0000 |
926 | @@ -226,6 +226,7 @@ |
927 | virtual void setParticleNonDynamic(); |
928 | virtual void setParticleNonRot(); |
929 | virtual void setParticleNonTrans(); |
930 | + virtual void setParticleNonAcc(); |
931 | virtual void setParticleDensity(); |
932 | virtual void setTaggedParticleVel(); |
933 | virtual void tagParticleNearestTo(); |
934 | |
935 | === modified file 'Parallel/SubLattice.hpp' |
936 | --- Parallel/SubLattice.hpp 2017-12-11 00:23:07 +0000 |
937 | +++ Parallel/SubLattice.hpp 2018-11-27 02:58:52 +0000 |
938 | @@ -293,9 +293,13 @@ |
939 | ysize=max.Y()-min.Y(); |
940 | if(fabs(ysize/m_nrange-lrint(ysize/m_nrange))>1e-6) |
941 | { |
942 | - console.Critical() << "circular y-dimension doesn't fit range !\n"; |
943 | + //JM as per x-dim |
944 | + //console.Critical() << "circular y-dimension doesn't fit range !\n"; |
945 | + console.Info() << "Circular y-size incompatible with range, adjusting...\n"; |
946 | + m_nrange = ysize/floor(ysize/m_nrange); |
947 | + console.Info() << "New range = " << m_nrange << "\n"; |
948 | } |
949 | - ysize+=2.0*m_nrange; // padding on the circular ends |
950 | + //ysize+=2.0*m_nrange; // padding on the circular ends |
951 | } |
952 | else |
953 | { |
954 | @@ -308,9 +312,13 @@ |
955 | zsize=max.Z()-min.Z(); |
956 | if(fabs(zsize/m_nrange-lrint(zsize/m_nrange))>1e-6) |
957 | { |
958 | - console.Critical() << "circular z-dimension doesn't fit range !\n"; |
959 | + //JM as per x-dim |
960 | + //console.Critical() << "circular z-dimension doesn't fit range !\n"; |
961 | + console.Info() << "Circular z-size incompatible with range, adjusting...\n"; |
962 | + m_nrange = zsize/floor(zsize/m_nrange); |
963 | + console.Info() << "New range = " << m_nrange << "\n"; |
964 | } |
965 | - zsize+=2.0*m_nrange; // padding on the circular ends |
966 | + //zsize+=2.0*m_nrange; // padding on the circular ends |
967 | } |
968 | else |
969 | { |
970 | @@ -2537,6 +2545,22 @@ |
971 | } |
972 | |
973 | /*! |
974 | + Make tagged particles non-accelerating, i.e. don't change velocity based on forces JM |
975 | + Parameters (tag) are received from master. |
976 | +*/ |
977 | +template <class T> |
978 | +void TSubLattice<T>::setParticleNonAcc() |
979 | +{ |
980 | + console.Debug() << "TSubLattice<T>::setParticleNonAcc()\n"; |
981 | + CVarMPIBuffer buffer(m_comm); |
982 | + |
983 | + buffer.receiveBroadcast(0); // get data from master |
984 | + int tag=buffer.pop_int(); |
985 | + m_ppa->forParticleTag(tag,(void (T::*)())(&T::setNonDynamicAcc)); |
986 | + console.Debug() << "end TSubLattice<T>::setParticleNonAcc()\n"; |
987 | +} |
988 | + |
989 | +/*! |
990 | Make tagged particles lieanr non-dynamic, i.e. don't update linear velocity |
991 | Parameters (tag) are received from master. |
992 | */ |
993 | |
994 | === modified file 'Parallel/SubLatticeControler.cpp' |
995 | --- Parallel/SubLatticeControler.cpp 2017-12-11 00:23:07 +0000 |
996 | +++ Parallel/SubLatticeControler.cpp 2018-11-27 02:58:52 +0000 |
997 | @@ -551,6 +551,7 @@ |
998 | case CMD_PMOVETAGGEDBY : m_lattice->moveTaggedParticlesBy(); break; |
999 | case CMD_PSETND : m_lattice->setParticleNonDynamic(); break; |
1000 | case CMD_PSETNR : m_lattice->setParticleNonRot(); break; |
1001 | + case CMD_PSETNA : m_lattice->setParticleNonAcc(); break; |
1002 | case CMD_PVEL : m_lattice->setParticleVelocity(); break; |
1003 | case CMD_PANGVEL : m_lattice->setParticleAngularVelocity(); break; |
1004 | case CMD_PDENS : m_lattice->setParticleDensity(); break; |
1005 | |
1006 | === modified file 'Parallel/sublattice_cmd.h' |
1007 | --- Parallel/sublattice_cmd.h 2017-09-07 08:07:19 +0000 |
1008 | +++ Parallel/sublattice_cmd.h 2018-11-27 02:58:52 +0000 |
1009 | @@ -101,7 +101,7 @@ |
1010 | const int CMD_SETCONSOLEFNAME=1113; |
1011 | const int CMD_SETCONSOLEBUFF=1114; |
1012 | const int CMD_SETINTERACTIONPARAMS=1115; |
1013 | - |
1014 | +const int CMD_PSETNA = 1116; |
1015 | |
1016 | |
1017 | // --------------------------------- |
1018 | |
1019 | === modified file 'Python/esys/lsm/LsmMpiPy.cpp' |
1020 | --- Python/esys/lsm/LsmMpiPy.cpp 2017-12-11 00:49:38 +0000 |
1021 | +++ Python/esys/lsm/LsmMpiPy.cpp 2018-11-27 02:58:52 +0000 |
1022 | @@ -1134,6 +1134,12 @@ |
1023 | { |
1024 | getLatticeMaster().setParticleNonTrans(id); |
1025 | } |
1026 | + |
1027 | + //JM non-accelerative flag for fluid coupling |
1028 | + void LsmMpiPy::setParticleNonAcc(int id) |
1029 | + { |
1030 | + getLatticeMaster().setParticleNonAcc(id); |
1031 | + } |
1032 | |
1033 | // --- modifying interaction parameters --- |
1034 | void LsmMpiPy::setInteractionParameter(const std::string& igname,const std::string& pname,double val) |
1035 | @@ -2879,6 +2885,17 @@ |
1036 | "@type tag: int\n" |
1037 | "@kwarg tag: the tag of the particle." |
1038 | ) |
1039 | + //JM |
1040 | + .def( |
1041 | + "setParticleNonAccelerating", |
1042 | + &LsmMpiPy::setParticleNonAcc, |
1043 | + (arg("tag")), |
1044 | + "Set the particle with tag C{tag} to be non-accelerating," |
1045 | + " this is to allow for fluid coupled particles to mainain\n" |
1046 | + " a constant velocity e.g. for shear platen tests" |
1047 | + "@type tag: int\n" |
1048 | + "@kwarg tag: the tag of the particle." |
1049 | + ) |
1050 | .def( |
1051 | "addPreTimeStepRunnable", |
1052 | &LsmMpiPy::addPreTimeStepRunnable, |
1053 | |
1054 | === modified file 'Python/esys/lsm/LsmMpiPy.h' |
1055 | --- Python/esys/lsm/LsmMpiPy.h 2017-12-11 00:23:07 +0000 |
1056 | +++ Python/esys/lsm/LsmMpiPy.h 2018-11-27 02:58:52 +0000 |
1057 | @@ -205,6 +205,7 @@ |
1058 | void setParticleNonDynamic(int); |
1059 | void setParticleNonRot(int); |
1060 | void setParticleNonTrans(int); |
1061 | + void setParticleNonAcc(int); //JM non-accelerating to allow constant velocity in fluid |
1062 | |
1063 | // --- modifying interaction parameters --- |
1064 | void setInteractionParameter(const std::string&,const std::string&,double); |
1065 | |
1066 | === modified file 'Python/esys/lsm/ParticlePy.cpp' |
1067 | --- Python/esys/lsm/ParticlePy.cpp 2017-12-04 00:00:38 +0000 |
1068 | +++ Python/esys/lsm/ParticlePy.cpp 2018-11-27 02:58:52 +0000 |
1069 | @@ -23,7 +23,7 @@ |
1070 | } |
1071 | |
1072 | ParticlePy::ParticlePy(int id, const Vec3Py &posn, double radius, double mass) |
1073 | - : CParticle(radius, mass, posn, Vec3(), Vec3(), id, true) |
1074 | + : CParticle(radius, mass, posn, Vec3(), Vec3(), id, true,true) |
1075 | { |
1076 | } |
1077 | |
1078 | |
1079 | === modified file 'Python/esys/lsm/RotParticlePy.cpp' |
1080 | --- Python/esys/lsm/RotParticlePy.cpp 2017-01-04 08:26:43 +0000 |
1081 | +++ Python/esys/lsm/RotParticlePy.cpp 2018-11-27 02:58:52 +0000 |
1082 | @@ -34,7 +34,7 @@ |
1083 | |
1084 | // dynamic & rotational default to true |
1085 | RotParticlePy::RotParticlePy(int id, const Vec3Py &posn, double radius, double mass) |
1086 | - : CRotParticle(radius, mass, posn, Vec3(), Vec3(), id,true,true) |
1087 | + : CRotParticle(radius, mass, posn, Vec3(), Vec3(), id,true,true,true) |
1088 | { |
1089 | } |
1090 | |
1091 | |
1092 | === modified file 'Python/esys/lsm/RotParticleViPy.cpp' |
1093 | --- Python/esys/lsm/RotParticleViPy.cpp 2017-01-04 08:26:43 +0000 |
1094 | +++ Python/esys/lsm/RotParticleViPy.cpp 2018-11-27 02:58:52 +0000 |
1095 | @@ -24,7 +24,7 @@ |
1096 | } |
1097 | |
1098 | RotParticleViPy::RotParticleViPy(int id, const Vec3Py &posn, double radius, double mass) |
1099 | - : CRotParticleVi(radius, mass, posn, Vec3(), Vec3(), id, true) |
1100 | + : CRotParticleVi(radius, mass, posn, Vec3(), Vec3(), id, true,true) |
1101 | { |
1102 | } |
1103 | |
1104 | |
1105 | === modified file 'Python/esys/lsm/RotThermalParticlePy.cpp' |
1106 | --- Python/esys/lsm/RotThermalParticlePy.cpp 2017-01-04 08:26:43 +0000 |
1107 | +++ Python/esys/lsm/RotThermalParticlePy.cpp 2018-11-27 02:58:52 +0000 |
1108 | @@ -24,7 +24,7 @@ |
1109 | } |
1110 | |
1111 | RotThermalParticlePy::RotThermalParticlePy(int id, const Vec3Py &posn, double radius, double mass) |
1112 | - : CRotThermParticle(radius, mass, posn, Vec3(), Vec3(), id, true) |
1113 | + : CRotThermParticle(radius, mass, posn, Vec3(), Vec3(), id, true, true) |
1114 | { |
1115 | } |
1116 | |
1117 | |
1118 | === modified file 'Tools/dump2vtk/frame_vtk.cpp' |
1119 | --- Tools/dump2vtk/frame_vtk.cpp 2017-09-07 08:07:19 +0000 |
1120 | +++ Tools/dump2vtk/frame_vtk.cpp 2018-11-27 02:58:52 +0000 |
1121 | @@ -345,6 +345,16 @@ |
1122 | vtkfile << (iter->second).angvel << endl;; |
1123 | } |
1124 | vtkfile << "</DataArray>\n"; |
1125 | + |
1126 | + // force - JM addition |
1127 | + vtkfile << "<DataArray type=\"Float64\" Name=\"force\" NumberOfComponents=\"3\" format=\"ascii\">\n"; |
1128 | + for(map<int,r_part>::iterator iter=datamap.begin(); |
1129 | + iter!=datamap.end(); |
1130 | + iter++){ |
1131 | + vtkfile << (iter->second).force << endl;; |
1132 | + } |
1133 | + vtkfile << "</DataArray>\n"; |
1134 | + |
1135 | // displacement |
1136 | vtkfile << "<DataArray type=\"Float64\" Name=\"displacement\" NumberOfComponents=\"3\" format=\"ascii\">\n"; |
1137 | for(map<int,r_part>::iterator iter=datamap.begin(); |
1138 | @@ -440,6 +450,16 @@ |
1139 | vtkfile << (iter->second).vel << endl;; |
1140 | } |
1141 | vtkfile << "</DataArray>\n"; |
1142 | + |
1143 | + // force - JM addition |
1144 | + vtkfile << "<DataArray type=\"Float64\" Name=\"force\" NumberOfComponents=\"3\" format=\"ascii\">\n"; |
1145 | + for(map<int,nr_part>::iterator iter=datamap.begin(); |
1146 | + iter!=datamap.end(); |
1147 | + iter++){ |
1148 | + vtkfile << (iter->second).force << endl;; |
1149 | + } |
1150 | + vtkfile << "</DataArray>\n"; |
1151 | + |
1152 | // displacement |
1153 | vtkfile << "<DataArray type=\"Float64\" Name=\"displacement\" NumberOfComponents=\"3\" format=\"ascii\">\n"; |
1154 | for(map<int,nr_part>::iterator iter=datamap.begin(); |
1155 | |
1156 | === modified file 'ppa/src/pp_array.h' |
1157 | --- ppa/src/pp_array.h 2017-12-11 00:23:07 +0000 |
1158 | +++ ppa/src/pp_array.h 2018-11-27 02:58:52 +0000 |
1159 | @@ -84,7 +84,7 @@ |
1160 | NeighborTable<T>* m_nt; |
1161 | Vec3 m_minpos,m_maxpos; //!< local minimum and maximum positions |
1162 | double m_xshift,m_yshift,m_zshift; //!< circular shift values |
1163 | - bool m_circ_edge_x_up,m_circ_edge_x_down; //!< circular edge flags |
1164 | + bool m_circ_edge_x_up,m_circ_edge_x_down,m_circ_edge_y_up,m_circ_edge_y_down,m_circ_edge_z_up,m_circ_edge_z_down; //!< circular edge flags JM addition for y/z |
1165 | static const int m_exchg_tag; |
1166 | |
1167 | // helper fnc |
1168 | |
1169 | === modified file 'ppa/src/pp_array.hpp' |
1170 | --- ppa/src/pp_array.hpp 2017-01-04 08:26:43 +0000 |
1171 | +++ ppa/src/pp_array.hpp 2018-11-27 02:58:52 +0000 |
1172 | @@ -64,6 +64,12 @@ |
1173 | //- set x-edges to non-circular |
1174 | m_circ_edge_x_down=false; |
1175 | m_circ_edge_x_up=false; |
1176 | + //JM - set y-edges to non-circular |
1177 | + m_circ_edge_y_down=false; |
1178 | + m_circ_edge_y_up=false; |
1179 | + //JM - set z-edges to non-circular |
1180 | + m_circ_edge_z_down=false; |
1181 | + m_circ_edge_z_up=false; |
1182 | //- get own process coords |
1183 | vector<int> pcoords=m_comm.get_coords(); |
1184 | //- initialize ntable |
1185 | @@ -159,6 +165,12 @@ |
1186 | // setup circular edges |
1187 | m_circ_edge_x_down=(circ[0] && (pcoords[0]==0)) ? true : false ; |
1188 | m_circ_edge_x_up=(circ[0] && (pcoords[0]==m_comm.get_dim(0)-1)) ? true : false ; |
1189 | + //JM setup circular edges |
1190 | + m_circ_edge_y_down=(circ[1] && (pcoords[1]==0)) ? true : false ; |
1191 | + m_circ_edge_y_up=(circ[1] && (pcoords[1]==m_comm.get_dim(1)-1)) ? true : false ; |
1192 | + //JM setup circular edges |
1193 | + m_circ_edge_z_down=(circ[2] && (pcoords[2]==0)) ? true : false ; |
1194 | + m_circ_edge_z_up=(circ[2] && (pcoords[2]==m_comm.get_dim(2)-1)) ? true : false ; |
1195 | } |
1196 | // init time stamp |
1197 | m_timestamp=0; |
1198 | @@ -325,13 +337,46 @@ |
1199 | // define tranfer slabs |
1200 | up_slab=m_nt->xz_slab(m_nt->ysize()-2); |
1201 | down_slab=m_nt->xz_slab(1); |
1202 | - if(!circ_edge){ // normal boundary |
1203 | - // upstream |
1204 | + |
1205 | + // upstream |
1206 | + if(m_circ_edge_y_up){ // circ. bdry |
1207 | + // cout << "circular shift, node " << m_comm.rank() << " y-dim, up slab size " << up_slab.size() << endl; |
1208 | + // copy particles from transfer slab into buffer |
1209 | + vector<T> buffer; |
1210 | + for(typename NTSlab<T>::iterator iter=up_slab.begin(); |
1211 | + iter!=up_slab.end(); |
1212 | + iter++){ |
1213 | + buffer.push_back(*iter); |
1214 | + } |
1215 | + // shift particles in buffer by circular shift value |
1216 | + for(typename vector<T>::iterator iter=buffer.begin(); |
1217 | + iter!=buffer.end(); |
1218 | + iter++){ |
1219 | + iter->setCircular(Vec3(0.0,-1.0*m_yshift,0.0)); |
1220 | + } |
1221 | + m_comm.shift_cont_packed(buffer,*m_nt,1,1,m_exchg_tag); |
1222 | + } else { |
1223 | m_comm.shift_cont_packed(up_slab,*m_nt,1,1,m_exchg_tag); |
1224 | - // downstream |
1225 | + } |
1226 | + // downstream |
1227 | + if(m_circ_edge_y_down){// circ. bdry |
1228 | + // cout << "circular shift , node " << m_comm.rank() << " y-dim, down slab size " << down_slab.size() << endl; |
1229 | + // copy particles from transfer slab into buffer |
1230 | + vector<T> buffer; |
1231 | + for(typename NTSlab<T>::iterator iter=down_slab.begin(); |
1232 | + iter!=down_slab.end(); |
1233 | + iter++){ |
1234 | + buffer.push_back(*iter); |
1235 | + } |
1236 | + // shift particles in buffer by circular shift value |
1237 | + for(typename vector<T>::iterator iter=buffer.begin(); |
1238 | + iter!=buffer.end(); |
1239 | + iter++){ |
1240 | + iter->setCircular(Vec3(0.0,m_yshift,0.0)); |
1241 | + } |
1242 | + m_comm.shift_cont_packed(buffer,*m_nt,1,-1,m_exchg_tag); |
1243 | + } else { |
1244 | m_comm.shift_cont_packed(down_slab,*m_nt,1,-1,m_exchg_tag); |
1245 | - } else { // circular edge -> buffer & shift received particles |
1246 | - cout << "circular y shift not implemented" << endl; |
1247 | } |
1248 | } |
1249 | // z-dir |
1250 | @@ -346,13 +391,46 @@ |
1251 | // define tranfer slabs |
1252 | up_slab=m_nt->xy_slab(m_nt->zsize()-2); |
1253 | down_slab=m_nt->xy_slab(1); |
1254 | - if(!circ_edge){ // normal boundary |
1255 | - // upstream |
1256 | + |
1257 | + // upstream |
1258 | + if(m_circ_edge_z_up){ // circ. bdry |
1259 | + // cout << "circular shift, node " << m_comm.rank() << " z-dim, up slab size " << up_slab.size() << endl; |
1260 | + // copy particles from transfer slab into buffer |
1261 | + vector<T> buffer; |
1262 | + for(typename NTSlab<T>::iterator iter=up_slab.begin(); |
1263 | + iter!=up_slab.end(); |
1264 | + iter++){ |
1265 | + buffer.push_back(*iter); |
1266 | + } |
1267 | + // shift particles in buffer by circular shift value |
1268 | + for(typename vector<T>::iterator iter=buffer.begin(); |
1269 | + iter!=buffer.end(); |
1270 | + iter++){ |
1271 | + iter->setCircular(Vec3(0.0,0.0,-1.0*m_zshift)); |
1272 | + } |
1273 | + m_comm.shift_cont_packed(buffer,*m_nt,2,1,m_exchg_tag); |
1274 | + } else { |
1275 | m_comm.shift_cont_packed(up_slab,*m_nt,2,1,m_exchg_tag); |
1276 | - // downstream |
1277 | + } |
1278 | + // downstream |
1279 | + if(m_circ_edge_z_down){// circ. bdry |
1280 | + // cout << "circular shift , node " << m_comm.rank() << " z-dim, down slab size " << down_slab.size() << endl; |
1281 | + // copy particles from transfer slab into buffer |
1282 | + vector<T> buffer; |
1283 | + for(typename NTSlab<T>::iterator iter=down_slab.begin(); |
1284 | + iter!=down_slab.end(); |
1285 | + iter++){ |
1286 | + buffer.push_back(*iter); |
1287 | + } |
1288 | + // shift particles in buffer by circular shift value |
1289 | + for(typename vector<T>::iterator iter=buffer.begin(); |
1290 | + iter!=buffer.end(); |
1291 | + iter++){ |
1292 | + iter->setCircular(Vec3(0.0,0.0,m_zshift)); |
1293 | + } |
1294 | + m_comm.shift_cont_packed(buffer,*m_nt,2,-1,m_exchg_tag); |
1295 | + } else { |
1296 | m_comm.shift_cont_packed(down_slab,*m_nt,2,-1,m_exchg_tag); |
1297 | - } else { // circular edge -> buffer & shift received particles |
1298 | - cout << "circular x shift not implemented" << endl; |
1299 | } |
1300 | } |
1301 | // update timestamp |
1302 | @@ -424,12 +502,14 @@ |
1303 | send_data.push_back(((*iter).*rdf)()); |
1304 | // cout << "put exchange values from particle " << iter->getID() << " into buffer" << endl; |
1305 | } |
1306 | + |
1307 | // exchange |
1308 | m_comm.shift_cont_packed(send_data,recv_data,dir,dist,m_exchg_tag); |
1309 | - |
1310 | + |
1311 | // apply received data |
1312 | // check if sizes are correct |
1313 | if(recv_data.size()==recv_slab.size()){ |
1314 | + |
1315 | int count=0; |
1316 | for(typename NTSlab<T>::iterator iter=recv_slab.begin(); |
1317 | iter!=recv_slab.end(); |
1318 | @@ -438,6 +518,7 @@ |
1319 | // cout << "wrote exchange value to particle " << iter->getID() << endl; |
1320 | count++; |
1321 | } |
1322 | + |
1323 | }else{ |
1324 | cerr << "rank = " << m_comm.rank() << ":ParallelParticleArray<T>::exchange_single ERROR: size mismatch in received data, recv_data.size()!=recv_slab.size() - (" << recv_data.size() << "!=" << recv_slab.size() << "). dir = " << dir << ", dist = " << dist << endl; |
1325 | } |
1326 | |
1327 | === modified file 'tml/comm/cart_comm.hpp' |
1328 | --- tml/comm/cart_comm.hpp 2017-01-04 08:26:43 +0000 |
1329 | +++ tml/comm/cart_comm.hpp 2018-11-27 02:58:52 +0000 |
1330 | @@ -129,7 +129,7 @@ |
1331 | void TML_CartComm::shift_cont_packed(T send_data,P& recv_data,int dir,int dist,int tag) |
1332 | { |
1333 | int source,dest; |
1334 | - |
1335 | + |
1336 | if(dir<m_ndims){ |
1337 | MPI_Cart_shift(m_comm,dir,dist,&source,&dest); |
1338 | sendrecv_cont_packed(send_data,recv_data,dest,source,false,tag); |
1339 | |
1340 | === modified file 'tml/comm/comm.hpp' |
1341 | --- tml/comm/comm.hpp 2017-01-04 08:26:43 +0000 |
1342 | +++ tml/comm/comm.hpp 2018-11-27 02:58:52 +0000 |
1343 | @@ -389,7 +389,7 @@ |
1344 | |
1345 | //send/receive data |
1346 | sendrecv_array(send_msg->buffer(),send_msg_size,recv_msg->buffer(),recv_msg_size,dest,source,tag+1024); |
1347 | - |
1348 | + |
1349 | if(source!=MPI_PROC_NULL){ // if the source exists |
1350 | // extract nuber of items |
1351 | recv_nb_data=recv_msg->pop_int(); |