<div dir="ltr">Good Afternoon Everyone,<div><br></div><div style>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 style><br></div><div style>-------------------------------------------------------------------------</div><div style><b>Assembling A:</b></div><div style><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 style><b>Defining KSP environment:</b></div><div style><div>KSPCreate(MPI_COMM_WORLD, &m_inksp);</div><div>KSPSetOperators(m_inksp,<span class="" style="white-space:pre"> </span>matLaplacian, matLaplacian, DIFFERENT_NONZERO_PATTERN);</div>
<div>KSPSetType(m_inksp, KSPGMRES);</div><div>KSPSetInitialGuessNonzero(m_inksp,PETSC_TRUE);<span class="" style="white-space:pre"> </span></div><div>KSPSetFromOptions(m_inksp);</div><div>KSPSetUp(m_inksp);</div><div><br>
</div><div style><b>Defining RHS vector:</b></div><div style>VecCreateMPI(MPI_COMM_WORLD, nLocalElements, nGlobalElements, &m_vecRHS);<br></div><div style><br></div><div style><b>Solving the linear system:</b></div><div style>
<div>VecAssemblyBegin(m_vecRHS);</div><div>VecAssemblyEnd(m_vecRHS);</div></div><div style>KSPSolve(m_inksp, m_vecRHS, m_vecPressure);<br></div><div style>-------------------------------------------------------------------------<br>
</div><div style><br></div><div style>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 style><br></div><div style>Are there ways for me to remove these errors? Should I be looking at the DM manual pages?</div><div style><br></div><div style>Thanks for any help and suggestions.</div><div style><br></div>
<div style>All the best,</div><div style>John</div><div style><br></div><div style><br></div></div></div></div>