← Back to team overview

dolfin team mailing list archive

Re: Gradient Reconstruction

 

If you'd like to compute the gradient for post-processing purposes, you
need to set up a separate variational problem which would return the
gradient. Dealing with the gradient of a vector is a little tricky since
FFC and DOLFIN are not yet equipped to deal with tensor functions. Below
is an example FFC input file which would be useful for post-processing.
I'll add it to src/demo/pde/elasticity shortly. If you want to compute a
stress tensor from the strain, you'd probably want to make the elementE
"Discontinuous vector Lagrange".

Garth

# Compute normal strain components
#
elementE = FiniteElement("Vector Lagrange", "triangle", 1, 3)
elementU = FiniteElement("Vector Lagrange", "triangle", 2)

v = BasisFunction(elementE)  # test function
e = BasisFunction(elementE)  # strain (to be computed)
u = Function(elementU)       # displacement 

def normal_strain(u): # eps_xx    eps_yy             gam_xy
	return [u[0].dx(0), u[1].dx(1), (u[0].dx(1) + u[1].dx(0))]

a = dot(v, e)*dx
L = dot(v, normal_strain(u))*dx


On Fri, 2006-02-17 at 10:03 +0000, Alexander Jarosch wrote:
> Hello everybody,
> 
> I am new to this mailing list and also new to the dolfin project. I 
> started to play around with the Stokes solver and have to say dolfin is 
> really neat to use, great job.
> I have a question, is there already a function to calculate the gradient 
> of the velocity field?
> 
> regards,
> Alex.





Follow ups

References