<div dir="ltr"><div><div><div><div><div><div>Hello Ryan,<br><br></div> I double checked this morning, and Richard Wunsch's BHTree gravity includes variables for storing the gravitation acceleration at each cell if you use his solver with the added option bhtreeAcc at setup like this (make sure you take out any references to other gravity solvers in the simulation Config file):<br><br></div>./setup DustCollapse +auto +3d --with-unit=physics/Gravity/GravityMain/Poisson/BHTree bhtreeAcc=1<br><br></div>If you check in the code in source/physics/Gravity/GravityMain/Poisson/BHTree/Gravity_accelOneRow.F90 you can see how the accelerations are calculated and stored exactly from both the grid and any sinks in the code. I've been using his potential solver for some time (in Flash 4.2.2, including getting the accelerations) and find it to be both robust and fast. Or perhaps you could use his implementation as an example of how to structure your own modifications to Gravity_accelOneRow.F90.<br><br></div>Note that if you do use his code it already includes the gravity accel variables in source/physics/Gravity/GravityMain/Poisson/BHTree/Config, which I encourage you to check out as it describes the other options for the code. The paper for this method is in prep still I believe.<br><br></div>Hope this helps!<br><br></div>Josh<br><div><div><div><div><div><div><div><br><div class="gmail_quote"><div dir="ltr">On Sat, Feb 25, 2017 at 10:03 PM Ryan Farber <<a href="mailto:rjfarber@umich.edu">rjfarber@umich.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr" class="gmail_msg">Dear FLASH users,<div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">I decided to look at the components of the gravitational acceleration for the supplied </div><div class="gmail_msg">DustCollapse problem (FLASH 4.3), and have noticed some weird artifacts on the block boundaries.</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">The issue seems somewhat similar to one Thomas Peters' <a href="http://flash.uchicago.edu/pipermail/flash-users/2014-May/001440.html" class="gmail_msg" target="_blank">refinement issue</a> (a plotting bug)</div><div class="gmail_msg">but I chatted with ngoldbaum on the yt IRC channel and the conclusion was the artifacts </div><div class="gmail_msg">are on the FLASH side of things.</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">The only edits I made to the DustCollapse problem supplied with FLASH 4.3 were:</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">* Config: added the following lines</div><div class="gmail_msg"><div class="gmail_msg">VARIABLE grac</div><div class="gmail_msg">VARIABLE poix</div><div class="gmail_msg">VARIABLE poiy</div><div class="gmail_msg">VARIABLE poiz</div></div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">* Driver_initFlash.F90: copied to problem directory and modified the original lines:</div><div class="gmail_msg"><div class="gmail_msg"> if(.not. dr_restart) then</div><div class="gmail_msg"> call Grid_getListOfBlocks(LEAF,blockList,blockCount)</div><div class="gmail_msg"> call Gravity_potentialListOfBlocks(blockCount,blockList)</div><div class="gmail_msg"> call Particles_initForces()</div><div class="gmail_msg"> end if<br class="gmail_msg"></div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg"> ! If we want to free any arrays created during simulation</div><div class="gmail_msg"> ! initialization that are no longer needed, do it here.</div><div class="gmail_msg"> call Simulation_freeUserArrays()</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg"> call IO_outputInitial( dr_nbegin, dr_initialSimTime)</div><div class="gmail_msg"> if(dr_globalMe==MASTER_PE)print*,'Initial plotfile written'</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg"> if(dr_globalMe==MASTER_PE)print*,'Driver init all done'</div></div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">**to**</div><div class="gmail_msg"><div class="gmail_msg"> if(.not. dr_restart) then</div><div class="gmail_msg"> call Grid_getListOfBlocks(LEAF,blockList,blockCount)</div><div class="gmail_msg"> call Gravity_potentialListOfBlocks(blockCount,blockList)</div><div class="gmail_msg"> call Particles_initForces()</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg"> call Gravity_accelListOfBlocks(blockCount, blockList, IAXIS, GRAC_VAR)</div><div class="gmail_msg"> call Gravity_accelListOfBlocks(blockCount, blockList, JAXIS, GRAC_VAR)</div><div class="gmail_msg"> call Gravity_accelListOfBlocks(blockCount, blockList, KAXIS, GRAC_VAR)</div><div class="gmail_msg"> end if</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg"> ! If we want to free any arrays created during simulation</div><div class="gmail_msg"> ! initialization that are no longer needed, do it here.</div><div class="gmail_msg"> call Simulation_freeUserArrays()</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg"> call IO_outputInitial( dr_nbegin, dr_initialSimTime)</div><div class="gmail_msg"> if(dr_globalMe==MASTER_PE)print*,'Initial plotfile written'</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg"> STOP(99)</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg"> if(dr_globalMe==MASTER_PE)print*,'Driver init all done'</div></div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">* Gravity_accelOneRow: modified the original lines:</div><div class="gmail_msg"><div class="gmail_msg"> do ii = iimin+1, iimax-1</div><div class="gmail_msg"> grav(ii) = grav(ii) + delxinv * (gpot(ii-1) - gpot(ii+1))</div><div class="gmail_msg"> enddo<br class="gmail_msg"></div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg"> grav(iimin) = grav(iimin+1) ! this is invalid data - must not be used</div><div class="gmail_msg"> grav(iimax) = grav(iimax-1)</div></div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">**to**</div><div class="gmail_msg"><div class="gmail_msg"> do ii = iimin+1, iimax-1</div><div class="gmail_msg"> grav(ii) = grav(ii) + delxinv * (gpot(ii-1) - gpot(ii+1))</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg"> if (sweepDir .eq. SWEEP_X) then</div><div class="gmail_msg"> solnVec(POIX_VAR, ii, pos(1), pos(2)) = grav(ii)</div><div class="gmail_msg"> end if</div><div class="gmail_msg"> if (sweepDir .eq. SWEEP_Y) then</div><div class="gmail_msg"> solnVec(POIY_VAR, pos(1), ii, pos(2)) = grav(ii)</div><div class="gmail_msg"> end if</div><div class="gmail_msg"> if (sweepDir .eq. SWEEP_Z) then</div><div class="gmail_msg"> solnVec(POIZ_VAR, pos(1), pos(2), ii) = grav(ii)</div><div class="gmail_msg"> end if</div><div class="gmail_msg"> enddo</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg"> grav(iimin) = grav(iimin+1) ! this is invalid data - must not be used</div><div class="gmail_msg"> grav(iimax) = grav(iimax-1)</div></div><div class="gmail_msg"><div class="gmail_msg"> if (sweepDir .eq. SWEEP_X) then</div><div class="gmail_msg"> solnVec(POIX_VAR, iimin, pos(1), pos(2)) = grav(iimin+1)</div><div class="gmail_msg"> solnVec(POIX_VAR, iimax, pos(1), pos(2)) = grav(iimax-1)</div><div class="gmail_msg"> end if</div><div class="gmail_msg"> if (sweepDir .eq. SWEEP_Y) then</div><div class="gmail_msg"> solnVec(POIY_VAR, pos(1), iimin, pos(2)) = grav(iimin+1)</div><div class="gmail_msg"> solnVec(POIY_VAR, pos(1), iimax, pos(2)) = grav(iimax-1)</div><div class="gmail_msg"> end if</div><div class="gmail_msg"> if (sweepDir .eq. SWEEP_Z) then</div><div class="gmail_msg"> solnVec(POIZ_VAR, pos(1), pos(2), iimin) = grav(iimin+1)</div><div class="gmail_msg"> solnVec(POIZ_VAR, pos(1), pos(2), iimax) = grav(iimax-1)</div><div class="gmail_msg"> end if</div></div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">Slices were taken along the x-axis.</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">Thanks for your help,<br class="gmail_msg" clear="all"><div class="gmail_msg"><div class="m_-4857368356063029674gmail_signature gmail_msg"><div dir="ltr" class="gmail_msg"><div dir="ltr" class="gmail_msg"><div dir="ltr" class="gmail_msg"><div class="gmail_msg">Ryan</div></div></div></div></div></div>
</div></div>
</blockquote></div></div></div></div></div></div></div></div></div><div dir="ltr">-- <br></div><div data-smartmail="gmail_signature"><div dir="ltr"><div><div><div><div><div>Joshua Wall<br></div>Doctoral Candidate<br></div>Department of Physics<br></div>Drexel University<br></div>3141 Chestnut Street<br></div>Philadelphia, PA 19104<br></div></div>