<div class="gmail_quote">On Sun, Nov 14, 2010 at 20:46, Edward Bueler <span dir="ltr"><<a href="mailto:elbueler@alaska.edu">elbueler@alaska.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Dear PETSc--<br><br>This is an actual user request. I am working on a typical PETSc task involving two nonlinear PDEs coupled together. I notice that there are several tools for Vecs which don't help much when I have a dof>1 Vec from my DA, for which the components have different scaling. Thus VecNorm and VecScale are not really what I want. Is there a plan for component-wise versions of those?<br>
<br>For example, is there a better/quicker way to scale one component of a dof>1 DA-derived Vec than writing my own, something like this:<br><br> typedef struct {<br> PetscReal H, u;<br> } Node;<br> ierr = DACreate1d(PETSC_COMM_WORLD,DA_NONPERIODIC,-M,2,1,PETSC_NULL,&da);CHKERRQ(ierr);<br>
ierr = DACreateGlobalVector(da,&v);CHKERRQ(ierr);<br> ...<br> Node *n;<br> ierr = DAVecGetArray(da,v,&n);CHKERRQ(ierr);<br> for (i = xs; i < xs + xm; i++) {<br> n[i].u *= alpha;<br> }<br> ierr = DAVecRestoreArray(da,v,&n);CHKERRQ(ierr);<br>
<br>I guess I would want the loop to be replaced by "DAVecScaleDOF(da,v,k,alpha)" for k=0,...,dof-1.<br></blockquote><div><br></div><div>It's spelled VecStrideScale().</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Same question for VecNorm: norm just an identified component?<br></blockquote><div><br></div><div>You guessed it, VecStrideNorm()</div><div><br></div><div><br></div><div>But, I actually recommend nondimensionalizing (in the sense of ex48, not in terms on nondimensional numbers which tend to have imprecise definitions for complex geometry or multi-physics) so that these component norms are not needed by the solvers, as the nondimensional system will generally produce a better conditioned algebraic system.</div>
<div><br></div><div>Jed</div></div>