<div dir="ltr"><div><div><div><div><div>Hi everyone,<br><br></div>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:<br><br></div>du/dt + v * grad[c] - div[grad[c]] = f<br><br></div>Where v is the velocity (obtained from the auxiliary term a_x[]). For the residual, would it be of the following form:<br><br></div>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[]) {<br><br></div><div>  PetscInt d;<br></div><div>  f[0] = u_t[0];<br></div>  for (d = 0; d < spatialDim; ++d) f0[0] += a_x[d]*u_x[d];<br><div><br>}<br><br></div><div>What about the jacobian? My guess would be to use g1(...) but what would the inside of this function be?<br><br></div><div>Thanks,<br></div><br clear="all"><br>-- <br><div class="gmail_signature"><div dir="ltr"><div><div><div>Justin Chang<br></div>PhD Candidate, Civil Engineering - Computational Sciences<br></div>University of Houston, Department of Civil and Environmental Engineering<br></div>Houston, TX 77004<br>(512) 963-3262<br></div></div></div>