<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<br>
On 10/6/2012 2:42 PM, Matthew Knepley wrote:
<blockquote
cite="mid:CAMYG4Gk17LdSjCW++KX6CqXGL1D80Cq7qWEXUZaju_1=Osh+WA@mail.gmail.com"
type="cite">On Sun, Jun 10, 2012 at 5:42 PM, TAY wee-beng <span
dir="ltr"><<a moz-do-not-send="true"
href="mailto:zonexo@gmail.com" target="_blank">zonexo@gmail.com</a>></span>
wrote:<br>
<div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000"> Hi,<br>
<br>
Currently, my matrix A changes its non zero position at each
time step. <br>
<br>
For e.g.: At a particular node, at time step = 1, I will
insert values into its east, west neighbours. At time step =
2, I will insert values into its east, north neighbours.
Hence, the non-zero positions at each row will be different
at each time step. However, the max values per row will
always be 5 or less.<br>
<br>
Currently, after MatSetValues and MatAssemblyBegin/End, I
call:<br>
<br>
<i>call
MatSetOption(A_mat,MAT_NEW_NONZERO_LOCATIONS,PETSC_TRUE,ierr)<br>
<br>
call
KSPSetOperators(ksp,A_mat,A_mat,DIFFERENT_NONZERO_PATTERN,ierr)<br>
<br>
call KSPGetPC(ksp,pc,ierr) <br>
<br>
ksptype=KSPBCGS<br>
<br>
call KSPSetType(ksp,ksptype,ierr)<br>
<br>
call KSPSetFromOptions(ksp,ierr)<br>
<br>
call KSPSolve(ksp,b_rhs,xx,ierr)</i><br>
<br>
Is this sufficient and correct? If so, apart from KSPSolve,
MatSetValues and MatAssemblyBegin/End, can I only call the
other subroutines once at the 1st time step?<br>
<br>
Or do I have to explicitly destroy the matrix and create a
new one? I think I ask this question a while ago but I can't
find the email now.</div>
</blockquote>
<div><br>
</div>
<div>After assembly the nonzero pattern is fixed. The right
thing to do is put in explicit zeros for the rest of the
stencil.</div>
<div><br>
</div>
<div> Matt</div>
<div> </div>
</div>
</blockquote>
Hi,<br>
<br>
Just to clarify, do you mean that I create a bigger stencil and put
in explicit zeros for those which I don't need at each time step?<br>
<br>
I realise that for my problem, instead of the original 5 non-zero
locations (east, west, north, south, center) for the stencil, I now
have 4 more (east-east, west-west etc). So now I call MATCREATEAIJ
with dnz + o_nz = 9 (instead of previously 5). Is that correct?<br>
<blockquote
cite="mid:CAMYG4Gk17LdSjCW++KX6CqXGL1D80Cq7qWEXUZaju_1=Osh+WA@mail.gmail.com"
type="cite">
<div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000"><span class="HOEnZb"><font
color="#888888"><br>
<pre cols="72">--
Yours sincerely,
TAY wee-beng</pre>
</font></span></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<br>
</blockquote>
</body>
</html>