← Back to team overview

dolfin team mailing list archive

Re: Subfunctions

 

On Tue, Jun 06, 2006 at 12:05:10PM +0200, Kristian Oelgaard wrote:
> 
> 
> Hi,
> I have some difficulties with the subfunction facility in Dolfin. I'm interested
> in saving the normal and shear components of a stress function (in 3D) for post
> processing purposes.
> 
> the stress function is initialised in this way:
> 
> 	stress.init(mesh, a_strain.trial());
> 
> and the trial element 'a_strain.trial()' is defined as:
> 
> 	elementB = FiniteElement("Discontinuous vector Lagrange", "tetrahedron", 0, 3)
> 	elementC = FiniteElement("Discontinuous vector Lagrange", "tetrahedron", 0, 3)
> 
> 	strain_element = elementB + elementC
> 
> 	(wn,ws) = TrialFunctions(strain_element)
> 
> Now, when doing:
> 
> 	Function n_stress = stress[0];
> 	Function s_stress = stress[1];
> 
>  	File file_normal_stress("normal_stress.pvd");
>  	File file_shear_stress("shear_stress.pvd");
> 
> 	while( t < T)
> 	{
> 
>     nonlinear_solver.solve(nonlinear_problem, x);
> 
> 		n_stress = stress[0];
> 		s_stress = stress[1];
> 
> 	  file_normal_stress << n_stress;
> 	  file_shear_stress  << s_stress;
> 
>   }
> 
> the values of the two files are exactly the same as if only the first half of
> stress.vector() is used as a basis for both subfunctions.
> 
> Funny thing is that a similar approach works fine in the elasticity demo. Only
> difference is that in this case the strains are computed in FFC, where my
> stresses are computed in the non-linear problem, on element level, and then
> written into the stress.vector(). So, what am I doing wrong?
> 
> Regards,
> 
> Kristian
> 
> _______________________________________________
> DOLFIN-dev mailing list
> DOLFIN-dev@xxxxxxxxxx
> http://www.fenics.org/cgi-bin/mailman/listinfo/dolfin-dev

Which versions of DOLFIN and FFC are you using? We recently updated
the evaluation at vertices (that is called when saving to file), so we
might have broken something.

Check the code generated by FFC, what does the function(s) vertexeval
say?

You're using discontinuous Lagrange which I don't think is supported
correctly by vertexeval().

/Anders



Follow ups

References