[petsc-users] advection-diffusion pointwise function for FEM
Matthew Knepley
knepley at gmail.com
Tue May 5 15:34:53 CDT 2015
On Sat, Apr 4, 2015 at 11:54 AM, Justin Chang <jchang27 at uh.edu> wrote:
> Hi everyone,
>
> I want to include advection into my diffusion FEM code (I am assuming a
> small Peclet number so stability isn't an issue ATM). That is I want to
> incorporate the second term as a pointwise function:
>
> du/dt + v * grad[c] - div[grad[c]] = f
>
> Where v is the velocity (obtained from the auxiliary term a_x[]). For the
> residual, would it be of the following form:
>
1) I would think you would use a[] instead. What is your velocity the
gradient of?
> f0_u(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 f0[]) {
>
> PetscInt d;
> f[0] = u_t[0];
> for (d = 0; d < spatialDim; ++d) f0[0] += a_x[d]*u_x[d];
>
> }
>
> What about the jacobian? My guess would be to use g1(...) but what would
> the inside of this function be?
>
Yes it would be g1. The indices for the output are f,g,dg. I am guessing
that c is a scalar, so f = {0}, g = {0}, dg = {0, 1}
for 2D, so g1 would have two terms,
g1[0] = a[0];
g1[1] = a[1];
Thanks,
Matt
> Thanks,
>
>
> --
> Justin Chang
> PhD Candidate, Civil Engineering - Computational Sciences
> University of Houston, Department of Civil and Environmental Engineering
> Houston, TX 77004
> (512) 963-3262
>
--
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/20150505/12090388/attachment.html>
More information about the petsc-users
mailing list