[petsc-users] Gradient in DMProjectField

Maximilian Hartig imilian.hartig at gmail.com
Wed Sep 13 04:22:51 CDT 2017


> On 12. Sep 2017, at 21:26, Matthew Knepley <knepley at gmail.com> wrote:
> 
> On Tue, Sep 12, 2017 at 12:52 PM, Maximilian Hartig <imilian.hartig at gmail.com <mailto:imilian.hartig at gmail.com>> wrote:
> Hello,
> 
> in my attempt to use an incremental formulation for elastoplasticity I wanted to create an auxiliary field in which the stresses from the past tilmestep are stored. I managed to create an auxiliary DM on which I have a field for the displacement, one for the stress and one for the inner variables. I transfer the displacements to a global vector on the auxiliary field, then calculate the stresses and inner variables using the DMProjectField function. Transfer of the displacements works fine and they are correct. The problem is with the stresses. While on some gauss points I get the correct stress, others have random stresses. I construct the strain using the gradient of the displacements and I believe this is where the problem lies. However, I have not been able to pinpoint it.
> When I just transfer the displacements to the auxiliary fields and then use a_x in the residual function instead, the stresses are correct. Is there a trick with using u_x in the DMProjectField?
> 
> Its possible that there is a bug. Just so I understand, you are saying that DMProjectField() has the wrong gradient of the input Vec?
> It would really be great if you could demonstrate it with a standalone example.

That is correct, and I suspect it has something to do with the Dirichlet boundary conditions I impose.
If I comment out the following line, projected result and expected result are the same:

 ierr = DMAddBoundary(dm, PETSC_TRUE, "fixed", "Face Sets",0,Ncomp,restrictall,(void (*)()) zero_vector, Nfid,fid,NULL);CHKERRQ(ierr);

Please find attached the test example and the test mesh. I run it with:

 -disp_petscspace_order 2 -stress_petscspace_order 2

Thanks,
Max




> 
>   Thanks,
> 
>     Matt
>  
> Thanks,
> Max
> 
> 
> 
> -- 
> 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
> 
> http://www.caam.rice.edu/~mk51/ <http://www.caam.rice.edu/~mk51/>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20170913/779ea773/attachment-0003.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: projectfieldtest.c
Type: application/octet-stream
Size: 8596 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20170913/779ea773/attachment-0002.obj>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20170913/779ea773/attachment-0004.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: testcube.msh
Type: application/octet-stream
Size: 841 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20170913/779ea773/attachment-0003.obj>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20170913/779ea773/attachment-0005.html>


More information about the petsc-users mailing list