<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jul 2, 2018 at 3:04 PM, Smith, Barry F. <span dir="ltr"><<a href="mailto:bsmith@mcs.anl.gov" target="_blank">bsmith@mcs.anl.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
First make sure that getCenterInfo(daScalars, xstart, ystart, zstart, xend, yend, zend) returns what it should. <br></blockquote><div><br></div><div>It does, i am also working in one processor only for now.</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
remove the 99 business and print out the arrtemp() and TO() values. Are they correct?<br></blockquote><div><br></div><div>They are not, i'm using maximum and minimum as probes to print into, but the minimum of T0 is 1 and is 0 for arrtemp, </div><div> </div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
What is DimTemperature? Shouldn't it be LocTempature?<br></blockquote><div><br></div><div>Yes, sorry about that,</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Print out the values in tdim().<br></blockquote><div><br></div><div>Yes, the same as with arrtemp/T0</div><div><br></div><div>Sorry i didn't mention i was debugging by printing the extremas of the arrays,</div><div><br></div><div>From your answer you seem to think the problem is in my code's side and it may very well be, but from the DMGlobalToLocalBegin there is a warning saying INSERT_VALUES doesn't work with DMDAs, is this still an issue or have been fixed? i understand it looks like these are two different problems in my code,</div><div><br></div><div>Thanks,</div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<span class="HOEnZb"><font color="#888888"><br>
Barry<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
<br>
<br>
<br>
> On Jul 2, 2018, at 2:58 PM, Manuel Valera <<a href="mailto:mvalera-w@sdsu.edu">mvalera-w@sdsu.edu</a>> wrote:<br>
> <br>
> Hi guys,<br>
> <br>
> I've noticed a bug in my code that seems to happen right after a call to DMGlobalToLocalBegin/End and i can't seem to find a reason, it goes like this:<br>
> <br>
> I create the DMDA (daScalars) with the following: <br>
> <br>
> bx = DM_BOUNDARY_GHOSTED<br>
> by = DM_BOUNDARY_PERIODIC<br>
> bz = DM_BOUNDARY_GHOSTED<br>
> dof = 1<br>
> stw = 3<br>
> call DMDACreate3d(PETSC_COMM_WORLD,<wbr>bx,by,bz,DMDA_STENCIL_BOX,<wbr>gridx,gridy,gridz,PETSC_<wbr>DECIDE,PETSC_DECIDE,PETSC_<wbr>DECIDE, & dof,stw,PETSC_NULL_INTEGER,<wbr>PETSC_NULL_INTEGER,PETSC_NULL_<wbr>INTEGER,daScalars,ierr)<br>
> call DMSetFromOptions(daScalars,<wbr>ierr)<br>
> call DMSetUp(daScalars,ierr)<br>
> <br>
> Then i read from a file the temperature and salinity fields of my problems, those two are giving the trouble, i do it with this template:<br>
> <br>
> call DMCreateGlobalVector(<wbr>daScalars,gTemperature,ierr)<br>
> call DMDAVecGetArrayF90(daScalars,<wbr>gTemperature,arrtemp,ierr)<br>
> arrtemp = 99.0d0 !no idea why this fixes the problem -mv 62518<br>
> call getCenterInfo(daScalars, xstart, ystart, zstart, xend, yend, zend)<br>
> do k=zstart,zend-1<br>
> do j=ystart,yend-1<br>
> do i=xstart,xend-1<br>
> arrtemp(i,j,k) = T0(i+1,j+1,k+1)<br>
> enddo<br>
> enddo<br>
> enddo<br>
> call DMDAVecRestoreArrayF90(<wbr>daScalars,gTemperature,<wbr>arrtemp,ierr)<br>
> call DMCreateLocalVector(daScalars,<wbr>LocTemperature,ierr)<br>
> call DMGlobalToLocalBegin(<wbr>daScalars,gTemperature,INSERT_<wbr>VALUES,LocTemperature,ierr)<br>
> call DMGlobalToLocalEnd(daScalars,<wbr>gTemperature,INSERT_VALUES,<wbr>LocTemperature,ierr)<br>
> <br>
> <br>
> Now here is the first weirdness, if i assign a number to my array it does behave as it should for the global quantity, but it must be a greater number than the maximum of the field for this to happen, so i assign 99.0 arbitrarily, otherwise it doesn't read the array correctly, but it does as of now,<br>
> <br>
> Next, the last two lines communicate the array to the local counterparts, but when i read LocTemperature with:<br>
> <br>
> call DMDAVecGetArrayReadF90(<wbr>daScalars,DimTemperature,tdim,<wbr>ierr)<br>
> print*,'Copied MinT0: ', minval(tdim)<br>
> call DMDAVecRestoreArrayReadF90(<wbr>daScalars,DimTemperature,tdim,<wbr>ierr)<br>
> <br>
> That array minimum doesn't coincide with the global minimum, it should be 1.000 but it is just 0.000, the same happens with the Salinity following an identical approach,<br>
> <br>
> Any ideas on where to start looking? i have last month's PETSc build,<br>
> <br>
> I'm running in 1 processor for now,<br>
> <br>
> Thanks,<br>
> <br>
> Manuel<br>
> <br>
> <br>
> <br>
> <br>
> <br>
> <br>
> <br>
> <br>
> <br>
> <br>
<br>
</div></div></blockquote></div><br></div></div>