<div dir="ltr">On Sat, Aug 3, 2013 at 1:27 AM, John Yawney <span dir="ltr"><<a href="mailto:jyawney123@gmail.com" target="_blank">jyawney123@gmail.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Good Afternoon Everyone,<div><br></div><div>I'm using PETSc to solve some linear systems in my ocean model. Currently I'm using the KSPSolve environment with 4 MPI processors. I've established the matrix A and the RHS b and confirmed that everything looks correct using VecView and MatView. Here are some code snippets that show the basic steps I took.</div>

<div><br></div><div>-------------------------------------------------------------------------</div><div><b>Assembling A:</b></div><div><div>MatConvert(matLaplacianX, MATSAME, MAT_INITIAL_MATRIX, &matLaplacian);</div>

<div>MatAssemblyBegin(matLaplacian, MAT_FINAL_ASSEMBLY);</div><div>MatAssemblyEnd(matLaplacian, MAT_FINAL_ASSEMBLY);</div><div><br></div><div>MatAXPY(matLaplacian, 1.0, matLaplacianY, DIFFERENT_NONZERO_PATTERN);</div><div>

MatAssemblyBegin(matLaplacian, MAT_FINAL_ASSEMBLY);</div><div>MatAssemblyEnd(matLaplacian, MAT_FINAL_ASSEMBLY);</div><div><br></div><div>MatAXPY(matLaplacian, 1.0, matLaplacianZ, DIFFERENT_NONZERO_PATTERN);</div><div>MatAssemblyBegin(matLaplacian, MAT_FINAL_ASSEMBLY);</div>

<div>MatAssemblyEnd(matLaplacian, MAT_FINAL_ASSEMBLY);</div><div><br></div><div><b>Defining KSP environment:</b></div><div><div>KSPCreate(MPI_COMM_WORLD, &m_inksp);</div><div>KSPSetOperators(m_inksp,<span style="white-space:pre-wrap">    </span>matLaplacian, matLaplacian, DIFFERENT_NONZERO_PATTERN);</div>

<div>KSPSetType(m_inksp, KSPGMRES);</div><div>KSPSetInitialGuessNonzero(m_inksp,PETSC_TRUE);<span style="white-space:pre-wrap">       </span></div><div>KSPSetFromOptions(m_inksp);</div><div>KSPSetUp(m_inksp);</div><div><br>
</div><div><b>Defining RHS vector:</b></div><div>VecCreateMPI(MPI_COMM_WORLD, nLocalElements, nGlobalElements, &m_vecRHS);<br></div><div><br></div><div><b>Solving the linear system:</b></div><div>
<div>VecAssemblyBegin(m_vecRHS);</div><div>VecAssemblyEnd(m_vecRHS);</div></div><div>KSPSolve(m_inksp, m_vecRHS, m_vecPressure);<br></div><div>-------------------------------------------------------------------------<br>

</div><div><br></div><div>If I modify my problem to consider a 2D (x-z) domain with flat bottom topography and I set the initial velocity fields to 0 and a constant density of 1025 throughout, then if I compute a number of time steps I get computational artifacts at the beginning and end locations of each block. I should also mention I'm only splitting up the domain into sub-blocks in the x direction currently. After about 10 time steps, the min density is off by about 1E-8 but only at these locations. I've attached a figure to demonstrate the errors.</div>

<div><br></div><div>Are there ways for me to remove these errors? Should I be looking at the DM manual pages?</div></div></div></div></blockquote><div><br></div><div>The above looks correct, so I assume there is a problem with the definition of the system. I would try putting</div>
<div>in an exact solution, or comparing a serial and parallel run.</div><div><br></div><div>  Thanks,</div><div><br></div><div>     Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr"><div><div><div>Thanks for any help and suggestions.</div><div><br></div>
<div>All the best,</div><div>John</div><div><br></div><div><br></div></div></div></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>
-- Norbert Wiener
</div></div>