Dear All,<br>I have a code where the velocity (three components) and pressure are all stored in a distributed array with 4 degrees of freedom per node. I'd like to take one component of the velocity and multiply it by -1, but I am having trouble figuring out how to access that. I believe it must involve DAVecGetArrayDOF or DAVecGetArray, but I haven't managed to get either to work. I've attached a code fragment where it loads the velocity. Could someone suggest how to do this or point me to where I can find additional discussion of this? I've read the users manual on DA already.<br>
Sincerely,<br>Pearl Flath<br>ICES, UT Austin<br>
---------------------------------<br>DACreate3d(PETSC_COMM_WORLD,DA_NONPERIODIC,DA_STENCIL_BOX,m,n,p,<br> PETSC_DECIDE,PETSC_DECIDE,PETSC_DECIDE,<br> 4,1,PETSC_NULL,PETSC_NULL,PETSC_NULL,&daV);<br>
<br> DACreateGlobalVector(daV, &vel);<br>
<br> // Set the velocity file to read from<br> PetscTruth flg ;<br> PetscViewer view_u;<br> char velocityfile[1024] ;<br> PetscOptionsGetString(0,"-velocityfile",velocityfile,1023,&flg);<br><br> PetscViewerBinaryOpen(PETSC_COMM_WORLD, velocityfile,<br>
FILE_MODE_READ, &view_u);<br> VecLoadIntoVector(view_u, vel);<br> PetscViewerDestroy(view_u);<br><br><br>