[petsc-users] Using DMPlex for Darcys law

Justin Chang jychang48 at gmail.com
Wed Aug 6 22:47:36 CDT 2014


Thank you for the answer, i have a few more questions:

1) In ex62 regarding the functions f0/f1, what's the difference between
them? Do f0 correspond with test functions and f1 with the derivatives of
the test functions?

2) For darcy's law, the velocity boundary conditions for each surface is
simply the normal. i.e. u dot n over Gamma_u = <some value>. In
DMPlexAddBoundary it seems to me that it constraints every dof
corresponding to the mesh point (and field), but is there a way where given
a field (say in this case velocity) I only want to prescribe the x velocity
on the left and right faces and y velocity on the top and bottom?

3) Is there a way/function for DMPlex to output multiple fields to VTK
files? Or would the field solutions have to be manually separated out from
the original global solution?

Thanks,
Justin


On Wed, Aug 6, 2014 at 6:27 PM, Matthew Knepley <knepley at gmail.com> wrote:

> On Wed, Aug 6, 2014 at 5:55 PM, Justin Chang <jychang48 at gmail.com> wrote:
>
>> Hi,
>>
>> So in ex62 of SNES it solves the stokes equation with P2-P1 elements. I
>> want to solve the darcy equation with P2-P1 elements in a similar fashion.
>>
>> The difference between stokes and darcy is that in the weak form of
>> darcy, the velocity-velocity term is v*u whereas in stokes it's
>> grad[v]*grad[u]
>>
>> In ex62, the function g3_uu (lines 172-183) formulates the
>> grad[v]*grad[u] term but how would I do it for Darcy's equation where its
>> simply v*u (assuming drag coefficient is scalar quantity of 1.0)?
>>
>
> So you would want to define g0 instead of g3, since its the u-u term:
>
> void g0_uu(const PetscScalar u[], const PetscScalar u_t[], const
> PetscScalar u_x[], const PetscScalar a[], const PetscScalar a_t[], const
> PetscScalar a_x[], const PetscReal x[], PetscScalar g3[])
> {
>   const PetscInt Ncomp = spatialDim;
>   PetscInt       compI;
>
>   for (compI = 0; compI < Ncomp; ++compI) g0[compI] = u[compI];
> }
>
> and then register it in SetupProblem:
>
>   ierr = PetscDSSetJacobian(prob, 0, 0, g0_uu, NULL,  NULL,
>  NULL);CHKERRQ(ierr);
>
> and do not forget to change the residual definition in f0/f1.
>
>   Thanks,
>
>      Matt
>
>
>>  Thanks,
>> Justin
>>
>
>
>
> --
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20140806/0d1391dd/attachment.html>


More information about the petsc-users mailing list