Pointwise calculations
Dear Firedrakers, One of our favourite testcases, the Galewsky jet, is annoying in that the initial conditions for one of the variables is expressed as a 1-dimensional integral which must be evaluated numerically. In our Fortran code, we used the Fluidity Python interface to evaluate this function pointwise at the node points of the coordinate field, and were thus able to use Numpy quadrature routines to evaluate the integral. What is the best way to do this in Firedrake? all the best --Colin
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 07/05/15 09:17, Colin Cotter wrote:
Dear Firedrakers, One of our favourite testcases, the Galewsky jet, is annoying in that the initial conditions for one of the variables is expressed as a 1-dimensional integral which must be evaluated numerically. In our Fortran code, we used the Fluidity Python interface to evaluate this function pointwise at the node points of the coordinate field, and were thus able to use Numpy quadrature routines to evaluate the integral.
What is the best way to do this in Firedrake?
You can use python Expressions when interpolating into a Function, as well as C-string Expressions, in a similar manner to Dolfin. class ICExpression(Expression): def eval(self, value, X): value[0] = one_d_function_of(X) ics = Function(V) ics.interpolate(ICExpression()) This is slooooow, sorry, but should work. Lawrence -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAEBAgAGBQJVSyO2AAoJECOc1kQ8PEYvpzAIAJ9LlsaPff5YUpN6Zwu3O0rk dqgjOSiQfzQmSR52TOXmK0rXGa/UJ4pR6jqAUYTSiH/j8neVcBzmiCxn66Shr9/C YD5jArhBTJUP05Nlow84CArqFsbYu2VN77mz1XkamcpEk4ZMxyn/MnW5sUhujF9I SRkFeEfYywggU6JgBsf8HZU9lE4b0/tuia1rGSrya9vJ61NLw8bZ5jNT6W5RIKdg R9c4q3VOZIOvvyTO8RE9Gyzv4zEj8V7+YEdGyxGFIiv0JxM7M7GgTd2xnHe7Db5N O0+176veYrgnytpw/lfG71Uqx/UGZTfSqWNUdRtLUQv3B23NYrZHBUyJnKP8TbA= =uniu -----END PGP SIGNATURE-----
participants (2)
- 
                
                Colin Cotter
- 
                
                Lawrence Mitchell