[petsc-users] Question about ordering of the gradient in DS
Matthew Knepley
knepley at gmail.com
Mon Dec 9 05:39:31 CST 2024
On Mon, Dec 9, 2024 at 6:34 AM Gong Yujie <yc17470 at connect.um.edu.mo> wrote:
> Dear PETSc group,
>
> I would like to inquire about the storage of the gradient in function
> PetscDSSetResidual:
>
> PetscErrorCode PetscDSSetResidual(PetscDS ds, PetscInt f, void
> (*f0)(PetscInt dim, PetscInt Nf, PetscInt NfAux, const PetscInt uOff[],
> const PetscInt uOff_x[], const PetscScalar u[], const PetscScalar u_t[],
> const PetscScalar u_x[], const PetscInt aOff[], const PetscInt aOff_x[],
> const PetscScalar a[], const PetscScalar a_t[], const PetscScalar a_x[],
> PetscReal t, const PetscReal x[], PetscInt numConstants, const PetscScalar
> constants[], PetscScalar f0[]), void (*f1)(PetscInt, PetscInt, PetscInt,
> const PetscInt[], const PetscInt[], const PetscScalar[], const
> PetscScalar[], const PetscScalar[], const PetscInt[], const PetscInt[],
> const PetscScalar[], const PetscScalar[], const PetscScalar[], PetscReal,
> const PetscReal[], PetscInt, const PetscScalar[], PetscScalar[]))
>
> Assume u = (u1, u2, u3)^T, the gradient of u is
>
> In PetscDSSetResidual, it is stored in an array. Is it ordered as
> (u1x,u2x, u3x, u1y, u2y, u3y, u1z, u2z,u3z)?
>
It is a C array grad[Nc][dE], so that the spatial dimension is fastest
ux, uy, ux, vx, vy, vz, wx, wy, wz
Thanks,
Matt
> Thanks in advance!
>
> Best Regards,
> Yujie
>
--
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener
https://urldefense.us/v3/__https://www.cse.buffalo.edu/*knepley/__;fg!!G_uCfscf7eWS!eb8ID0j7ucY5S-5H6K_Ig6DMc1VVC246S03W0vRWPw0ovJcnweTr4TvjN-SNwxLXHzOGC0c1gXcXEn6q0qfy$ <https://urldefense.us/v3/__http://www.cse.buffalo.edu/*knepley/__;fg!!G_uCfscf7eWS!eb8ID0j7ucY5S-5H6K_Ig6DMc1VVC246S03W0vRWPw0ovJcnweTr4TvjN-SNwxLXHzOGC0c1gXcXEmEjyQ8J$ >
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20241209/62598aa9/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 12296 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20241209/62598aa9/attachment-0001.png>
More information about the petsc-users
mailing list