On 1 Sep 2015, at 09:09, Justin Chang <jychang48@gmail.com> wrote:
try this out.
And thanks Andrew for your help. I ended up porting the undocumented SUPG advection-diffusion FEniCS example to Firedrake.
One more question:
4 I also want to work with a tensor diffusion coefficient. In FEniCS I could normally do something like
D = as_matrix([[1.0],[0,1]])
but i specifically want tensorial dispersion from velocity. E.g.,
D = alpha_t*norm(velocity)*Identity + (alpha_L-alpha_t)*outer(v,v)/norm(v)
Where alpha_t and alpha_L are the transverse and longitudinal dispersivity respectively (ignoring molecular diffusion for the moment). How would do I express this D matrix?
Assuming alpha_t and alpha_L are just scalars. I think you just do: Id = Identity(mesh.ufl_cell().geometric_dimension()) alpha_t = Constant(val_t) alpha_L = Constant(val_L) norm_v = inner(velocity, velocity) D = alpha_t * norm_v * Id + (alpha_L - alpha_t) * outer(v, v) / norm_v Then use D as normal in your variational form. A word of warning, D is not polynomial, so UFL try and guess a quadrature degree that will be quite high. You probably want to end up specifying the quad degree manually. For example: a = D[i, i] * trial * test*dx(degree=chosen_quad_degree) Cheers, Lawrence