How to convert tuple of C string expressions to UFL?
Hi, firedrake-bench/elasticity (from 'experiments' branch) uses C string expressions which are no longer supported. I read some tips for conversion here, however, the help doesn't cover the case where there is a tuple of C string expressions: https://www.firedrakeproject.org/interpolation.html#c-string-expressions How to convert this? f = Function(V) f.interpolate(Expression( ("cos(2*pi*x[0])*cos(2*pi*x[1])*cos(2*pi*x[2])", "cos(2*pi*x[0])*cos(2*pi*x[1])*cos(2*pi*x[2])", "cos(2*pi*x[0])*cos(2*pi*x[1])*cos(2*pi*x[2])"))) Please forgive if this is obvious, I have no knowledge in this domain at all, just trying to blindly run this code. Thank you.
Just wrap the scalar expressions in an `as_vector`. x = SpatialCoordinate(V.mesh()) f.interpolate(as_vector( cos(2*pi*x[0])*cos(2*pi*x[1])*cos(2*pi*x[2]), cos(2*pi*x[0])*cos(2*pi*x[1])*cos(2*pi*x[2]), cos(2*pi*x[0])*cos(2*pi*x[1])*cos(2*pi*x[2]) )) From: firedrake-bounces@imperial.ac.uk <firedrake-bounces@imperial.ac.uk> on behalf of Alexei Colin <acolin@isi.edu> Date: Monday, 5 April 2021 at 17:48 To: firedrake <firedrake@imperial.ac.uk> Subject: [firedrake] How to convert tuple of C string expressions to UFL? Hi, firedrake-bench/elasticity (from 'experiments' branch) uses C string expressions which are no longer supported. I read some tips for conversion here, however, the help doesn't cover the case where there is a tuple of C string expressions: https://www.firedrakeproject.org/interpolation.html#c-string-expressions How to convert this? f = Function(V) f.interpolate(Expression( ("cos(2*pi*x[0])*cos(2*pi*x[1])*cos(2*pi*x[2])", "cos(2*pi*x[0])*cos(2*pi*x[1])*cos(2*pi*x[2])", "cos(2*pi*x[0])*cos(2*pi*x[1])*cos(2*pi*x[2])"))) Please forgive if this is obvious, I have no knowledge in this domain at all, just trying to blindly run this code. Thank you. _______________________________________________ firedrake mailing list firedrake@imperial.ac.uk https://mailman.ic.ac.uk/mailman/listinfo/firedrake
participants (2)
- 
                
                Alexei Colin
- 
                
                Ham, David A