<meta http-equiv="Content-Type" content="text/html; charset=utf-8"><div dir="ltr">Hi Tony,<div><br></div><div>I'm not sure if you can retrieve all the box values in a stencil-wise manner from gr_hypreMatA the way you're thinking. If my understanding is correct, the SetBoxValues routine uses the stencil and the offsets like a guide so that it knows which entries in gr_hypreMatA to set or add to. So when you use GetBoxValues this way, you're assigning "combined" matrix entries from gr_hypreMatA to test and you'll have repeated values based on the stencil and offsets.</div><div><br></div><div>In other words, let's say you're in 2D and your stencil is 5 points in this order: (i,j), (i-1,j), (i+1,j), (i,j-1), (i,j+1). The GetBoxValues routine will set test from matrix A as follows:</div><div>test(1) = A(i,j)</div><div>test(2) = A(i-1,j)</div><div>test(3) = A(i+1,j)</div><div>test(4) = A(i,j-1)</div><div>test(5) = A(i,j+1)</div><div>test(6) = A(i,j+1)</div><div>test(7) = A(i-1,j+1)</div><div>test(8) = A(i+1,j+1)</div><div>test(9) = A(i,j)</div><div>test(10) = A(i,j+2)</div><div>etc., etc.</div><div><br></div><div>I've dealt with the HYPRE setup routines in FLASH a lot since I'm the one primarily in charge of implementing new implicit diffusion solvers. However, much of HYPRE itself is still a mystery to me, so I could still be wrong about how the SetBoxValues and GetBoxValues routines are operating.</div><div><br></div><div>Alternatively, if you're just interested in looking at gr_hypreMatA, you can use the subroutine HYPRE_SStructMatrixPrint(). There should be some lines in Grid_advanceDiffusion.F90 that you can uncomment to do this. Then you can use matlab or whatever program you prefer to look at the matrix.</div><div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Feb 25, 2021 at 9:09 PM Akash Dhruv <<a href="mailto:akashdhruv@email.gwu.edu" target="_blank">akashdhruv@email.gwu.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div>Hi Tony,<div><br></div><div>Can you share a snippet of the output? Also, can you try getting the BoxValues after HYPRE_SStructMatrixAssemble is called?</div><div><br><div>
<div>Akash</div><div><br></div><br>
</div>
<div><br><blockquote type="cite"><div>On Feb 25, 2021, at 9:48 PM, Alberti, Anthony L <<a href="mailto:anthony.alberti@oregonstate.edu" target="_blank">anthony.alberti@oregonstate.edu</a>> wrote:</div><br><div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none"><div style="margin:0in;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:10.5pt;font-family:Arial,sans-serif">Hi folks,<u></u><u></u></span></div><div style="margin:0in;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:10.5pt;font-family:Arial,sans-serif"><u></u> <u></u></span></div><div style="margin:0in;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:10.5pt;font-family:Arial,sans-serif">I’m interested in retrieving the values written to the matrix for the system of equations built in source/Grid/GridSolvers/HYPRE/UG/gr_hypreCreateMatrix.F90. After<span> </span></span><span style="font-size:10.5pt;font-family:Menlo">BoxVal</span><span style="font-size:10.5pt;font-family:Arial,sans-serif"><span> </span>is filled and then assigned to<span> </span></span><span style="font-size:10.5pt;font-family:Menlo">gr_hypreMatA</span><span style="font-size:10.5pt;font-family:Arial,sans-serif">(via the call to<span> </span></span><span style="font-size:10.5pt;font-family:Menlo">HYPRE_SStructMatrixSetBoxValues</span><span style="font-size:10.5pt;font-family:Arial,sans-serif">) I’ve added a snippet of code that attempts to retrieve the values just written to<span> </span></span><span style="font-size:10.5pt;font-family:Menlo">gr_hypreMatA</span><span style="font-size:10.5pt;font-family:Arial,sans-serif"><span> </span>and writes to the screen a comparison of<span> </span></span><span style="font-size:10.5pt;font-family:Menlo">BoxVal</span><span style="font-size:10.5pt;font-family:Arial,sans-serif"><span> </span>and an array of reals called<span> </span></span><span style="font-size:10.5pt;font-family:Menlo">test</span><span style="font-size:10.5pt;font-family:Arial,sans-serif"><span> </span>– see the snippet below. However, when I run this the values for<span> </span></span><span style="font-size:10.5pt;font-family:Menlo">BoxVal</span><span style="font-size:10.5pt;font-family:Arial,sans-serif"><span> </span>and<span> </span></span><span style="font-size:10.5pt;font-family:Menlo">test</span><span style="font-size:10.5pt;font-family:Arial,sans-serif"><span> </span>are not even close. Does anyone have an idea on how to alter this snippet so<span> </span></span><span style="font-size:10.5pt;font-family:Menlo">test</span><span style="font-size:10.5pt;font-family:Arial,sans-serif"><span> </span>and<span> </span></span><span style="font-size:10.5pt;font-family:Menlo">BoxVal</span><span style="font-size:10.5pt;font-family:Arial,sans-serif"><span> </span>are the same?<u></u><u></u></span></div><div style="margin:0in;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:10.5pt;font-family:Arial,sans-serif"><u></u> <u></u></span></div><div style="margin:0in;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:10.5pt;font-family:Menlo">allocate(test(nentries*product(datasize(1:NDIM)))) !nentries * total number of grid cells per block )<u></u><u></u></span></div><div style="margin:0in;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:10.5pt;font-family:Menlo">call HYPRE_SStructMatrixGetBoxValues(gr_hypreMatA, mypart, gr_hypreLower(lb,1:NDIM), &<u></u><u></u></span></div><div style="margin:0in;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:10.5pt;font-family:Menlo"> gr_hypreUpper(lb,1:NDIM), var, nentries, stencil_indices(1:nentries), test(:), ierr)<u></u><u></u></span></div><div style="margin:0in;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:10.5pt;font-family:Menlo">do i=1,nentries*product(datasize(1:NDIM))<u></u><u></u></span></div><div style="margin:0in;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:10.5pt;font-family:Menlo"> WRITE(*,fmt='(I4.0, 6X, E15.9, 6X, E15.9)') i, BoxVal(i), test(i)<u></u><u></u></span></div><div style="margin:0in;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:10.5pt;font-family:Menlo">end do<u></u><u></u></span></div><div style="margin:0in;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:10.5pt;font-family:Menlo">call exit(0)<u></u><u></u></span></div><div style="margin:0in;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:10.5pt;font-family:Arial,sans-serif"><u></u> <u></u></span></div><div style="margin:0in;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:10.5pt;font-family:Arial,sans-serif">Thanks in advance,<u></u><u></u></span></div><div><div><div style="margin:0in;font-size:11pt;font-family:Calibri,sans-serif">Tony<u></u><u></u></div><div style="margin:0in;font-size:11pt;font-family:Calibri,sans-serif"><u></u> <u></u></div><div style="margin:0in;font-size:11pt;font-family:Calibri,sans-serif"><u></u> <u></u></div><div style="margin:0in;font-size:11pt;font-family:Calibri,sans-serif"><u></u> <u></u></div><div style="margin:0in;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:10.5pt;font-family:Arial,sans-serif">-----------------------------------------------------------<u></u><u></u></span></div><div style="margin:0in;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:10.5pt;font-family:Arial,sans-serif;background-color:white">Tony Alberti</span><span style="font-size:10.5pt;font-family:Arial,sans-serif"><br><span style="background-color:white">Postdoctoral Scholar</span><br><span style="background-color:white">School of Nuclear Science and Engineering</span><br></span><span style="font-size:10.5pt;font-family:Arial,sans-serif"><a href="https://urldefense.proofpoint.com/v2/url?u=https-3A__ne.oregonstate.edu_tony-2Dalberti&d=DwMFaQ&c=kbmfwr1Yojg42sGEpaQh5ofMHBeTl9EI2eaqQZhHbOU&r=6F-TMED_bsUqKfX7XKE7kRK41M2Ogti8WJdx1GwNjkQ&m=viEEdaFV01zo9zrxAe3CDWtm6Kozcf5kb-Yoh2znXIA&s=aObgG-RLEKrNZ5hGr5VKNmbiTxeqGRkOBnGgU1QNERw&e=" target="_blank"><span style="color:rgb(17,85,204);background-color:white">https://ne.oregonstate.edu/tony-alberti</span></a></span></div></div></div></div></div></blockquote></div><br></div></div></blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr"><div dir="ltr"><div>Eddie Hansen, PhD<br>Postdoctoral Associate</div><div>University of Rochester</div><div>607-341-6126 | Flash Center</div></div></div>