Re: [firedrake] JacobianDeterminant
So you're using the 'bendy' branch in Firedrake as well? If so, JacobianDeterminant gets torn apart into components of grad(x) [x = coordinate field] within UFL. ufl/algorithms/change_to_reference.py: @memoized_handler def jacobian_determinant(self, o): domain = o.domain() J = self.jacobian(Jacobian(domain)) return determinant_expr(J) where determinant_expr is the obvious thing (use git grep determinant_expr from within a UFL subdirectory if you want to look at this) Note there's some magic that maps JacobianDeterminant to the handler jacobian_determinant. I think that pointing CellSize at JacobianDeterminant within Firedrake is something I'll revert in the future, since it's not backwards compatible for simplices (despite generalising well to other shapes). Will need to find another name, or just let people use the UFL object, like for FacetNormal. On 1 October 2015 at 21:01, Tuomas Karna <tuomas.karna@gmail.com> wrote:
Hi all,
We're trying to figure out what CellSize actually does. Does anyone know where JacobianDeterminant gets turn into code?
- Tuomas
_______________________________________________ firedrake mailing list firedrake@imperial.ac.uk https://mailman.ic.ac.uk/mailman/listinfo/firedrake
To give some background information, in FEniCS and in Firedrake master, CellSize gives the circumdiameter (twice the circumradius) of the cell. This is not implemented for quads and extruded meshes in Firedrake (I hope...), since the circumradius isn't defined in general. In the Firedrake bendy_changes branch, I tentatively changed CellSize to return (abs(JacobianDeterminant))**(1/dim) since this generalises better to non-simplicies, higher-order elements, etc. However, this is a poor idea since it changes the behaviour of existing [simplex] code that depends sensitively on CellSize giving the cell circumdiameter. On 1 October 2015 at 21:13, Andrew McRae <A.T.T.McRae@bath.ac.uk> wrote:
So you're using the 'bendy' branch in Firedrake as well?
If so, JacobianDeterminant gets torn apart into components of grad(x) [x = coordinate field] within UFL.
ufl/algorithms/change_to_reference.py:
@memoized_handler def jacobian_determinant(self, o): domain = o.domain() J = self.jacobian(Jacobian(domain)) return determinant_expr(J)
where determinant_expr is the obvious thing (use git grep determinant_expr from within a UFL subdirectory if you want to look at this)
Note there's some magic that maps JacobianDeterminant to the handler jacobian_determinant.
I think that pointing CellSize at JacobianDeterminant within Firedrake is something I'll revert in the future, since it's not backwards compatible for simplices (despite generalising well to other shapes). Will need to find another name, or just let people use the UFL object, like for FacetNormal.
On 1 October 2015 at 21:01, Tuomas Karna <tuomas.karna@gmail.com> wrote:
Hi all,
We're trying to figure out what CellSize actually does. Does anyone know where JacobianDeterminant gets turn into code?
- Tuomas
_______________________________________________ firedrake mailing list firedrake@imperial.ac.uk https://mailman.ic.ac.uk/mailman/listinfo/firedrake
Thanks Andrew, very helpful. We're trying to figure out if CellSize could be generalized for extruded meshes to return the horizontal/vertical size of the mesh. Presumably one could just use the same Jacobian formulation to do that (e.g. det of upper 2x2 corner for horizontal, lower left element for vertical size, assuming extrusion is along z axis)? On 10/01/2015 01:30 PM, Andrew McRae wrote:
To give some background information, in FEniCS and in Firedrake master, CellSize gives the circumdiameter (twice the circumradius) of the cell. This is not implemented for quads and extruded meshes in Firedrake (I hope...), since the circumradius isn't defined in general.
In the Firedrake bendy_changes branch, I tentatively changed CellSize to return (abs(JacobianDeterminant))**(1/dim) since this generalises better to non-simplicies, higher-order elements, etc. However, this is a poor idea since it changes the behaviour of existing [simplex] code that depends sensitively on CellSize giving the cell circumdiameter.
Perhaps one solution would be to rename that CellSize to something else to avoid the conflict? In that case we could then include the horizontal/vertical option in the same function. - Tuomas
On 1 October 2015 at 21:13, Andrew McRae <A.T.T.McRae@bath.ac.uk <mailto:A.T.T.McRae@bath.ac.uk>> wrote:
So you're using the 'bendy' branch in Firedrake as well?
If so, JacobianDeterminant gets torn apart into components of grad(x) [x = coordinate field] within UFL.
ufl/algorithms/change_to_reference.py:
@memoized_handler def jacobian_determinant(self, o): domain = o.domain() J = self.jacobian(Jacobian(domain)) return determinant_expr(J)
where determinant_expr is the obvious thing (use git grep determinant_expr from within a UFL subdirectory if you want to look at this)
Note there's some magic that maps JacobianDeterminant to the handler jacobian_determinant.
I think that pointing CellSize at JacobianDeterminant within Firedrake is something I'll revert in the future, since it's not backwards compatible for simplices (despite generalising well to other shapes). Will need to find another name, or just let people use the UFL object, like for FacetNormal.
On 1 October 2015 at 21:01, Tuomas Karna <tuomas.karna@gmail.com <mailto:tuomas.karna@gmail.com>> wrote:
Hi all,
We're trying to figure out what CellSize actually does. Does anyone know where JacobianDeterminant gets turn into code?
- Tuomas
_______________________________________________ firedrake mailing list firedrake@imperial.ac.uk <mailto:firedrake@imperial.ac.uk> https://mailman.ic.ac.uk/mailman/listinfo/firedrake
_______________________________________________ firedrake mailing list firedrake@imperial.ac.uk https://mailman.ic.ac.uk/mailman/listinfo/firedrake
FYI: abs(ufl.JacobianDeterminant(mesh.ufl_domain()))**(1.0/mesh.cell_dimension()) doesn't work on extruded mesh as mesh.cell_dimension() is a tuple. On 10/01/2015 04:34 PM, Tuomas Karna wrote:
Thanks Andrew, very helpful.
We're trying to figure out if CellSize could be generalized for extruded meshes to return the horizontal/vertical size of the mesh. Presumably one could just use the same Jacobian formulation to do that (e.g. det of upper 2x2 corner for horizontal, lower left element for vertical size, assuming extrusion is along z axis)?
On 10/01/2015 01:30 PM, Andrew McRae wrote:
To give some background information, in FEniCS and in Firedrake master, CellSize gives the circumdiameter (twice the circumradius) of the cell. This is not implemented for quads and extruded meshes in Firedrake (I hope...), since the circumradius isn't defined in general.
In the Firedrake bendy_changes branch, I tentatively changed CellSize to return (abs(JacobianDeterminant))**(1/dim) since this generalises better to non-simplicies, higher-order elements, etc. However, this is a poor idea since it changes the behaviour of existing [simplex] code that depends sensitively on CellSize giving the cell circumdiameter.
Perhaps one solution would be to rename that CellSize to something else to avoid the conflict? In that case we could then include the horizontal/vertical option in the same function.
- Tuomas
On 1 October 2015 at 21:13, Andrew McRae <A.T.T.McRae@bath.ac.uk <mailto:A.T.T.McRae@bath.ac.uk>> wrote:
So you're using the 'bendy' branch in Firedrake as well?
If so, JacobianDeterminant gets torn apart into components of grad(x) [x = coordinate field] within UFL.
ufl/algorithms/change_to_reference.py:
@memoized_handler def jacobian_determinant(self, o): domain = o.domain() J = self.jacobian(Jacobian(domain)) return determinant_expr(J)
where determinant_expr is the obvious thing (use git grep determinant_expr from within a UFL subdirectory if you want to look at this)
Note there's some magic that maps JacobianDeterminant to the handler jacobian_determinant.
I think that pointing CellSize at JacobianDeterminant within Firedrake is something I'll revert in the future, since it's not backwards compatible for simplices (despite generalising well to other shapes). Will need to find another name, or just let people use the UFL object, like for FacetNormal.
On 1 October 2015 at 21:01, Tuomas Karna <tuomas.karna@gmail.com> wrote:
Hi all,
We're trying to figure out what CellSize actually does. Does anyone know where JacobianDeterminant gets turn into code?
- Tuomas
_______________________________________________ firedrake mailing list firedrake@imperial.ac.uk <mailto:firedrake@imperial.ac.uk> https://mailman.ic.ac.uk/mailman/listinfo/firedrake
_______________________________________________ firedrake mailing list firedrake@imperial.ac.uk https://mailman.ic.ac.uk/mailman/listinfo/firedrake
participants (2)
- 
                
                Andrew McRae
- 
                
                Tuomas Karna