Trying to print discrete divergence
Dear all, I'm trying to assert that my projection in my incompressible case leaves my initial velocity to be discrete divergence free. I've tried print an L2 norm but must be writing it wrong as it causes causes the compiler to break. The relevant lines solve(DIVU_perp == DIVU, u_perp, solver_parameters={'ksp_rtol': 1e-14, 'pc_type' : 'none', 'ksp_type': 'lsqr'} ) u0 += u_perp # Print statement to verify initial velocity is divergence free u_div = assemble( div_u( u0 , dFdPproject ) ) u_div_norm = norm (u_div, norm_type="L2") print "l2 norm of discrete divergence on initial velocity is " % u_div_norm How would I go about getting the script to print that the velocity is verified as divergence free? Regards, Will
Dear Will, On 11/05/16 12:55, William Booker wrote:
Dear all,
I'm trying to assert that my projection in my incompressible case leaves my initial velocity to be discrete divergence free.
I've tried print an L2 norm but must be writing it wrong as it causes causes the compiler to break.
The relevant lines
solve(DIVU_perp == DIVU, u_perp, solver_parameters={'ksp_rtol': 1e-14, 'pc_type' : 'none', 'ksp_type': 'lsqr'} )
u0 += u_perp
# Print statement to verify initial velocity is divergence free
u_div = assemble( div_u( u0 , dFdPproject ) )
u_div_norm = norm (u_div, norm_type="L2")
print "l2 norm of discrete divergence on initial velocity is " % u_div_norm
How would I go about getting the script to print that the velocity is verified as divergence free?
We believe that this is a bug in COFFEE, but it was fixed yesterday afternoon. Can you please run firedrake-update followed by firedrake-clean and then try again. At least for me, your script runs. Cheers, Lawrence
Updated and ran firedrake -clean but I'm still getting an error TypeError: not all arguments converted during string formatting. Which I take to mean I'm doing something wrong in creating the number that is my measure of divergence free on my initial velocity Regards, Will ________________________________________ From: firedrake-bounces@imperial.ac.uk <firedrake-bounces@imperial.ac.uk> on behalf of Lawrence Mitchell <lawrence.mitchell@imperial.ac.uk> Sent: 11 May 2016 13:21:06 To: firedrake@imperial.ac.uk Subject: Re: [firedrake] Trying to print discrete divergence Dear Will, On 11/05/16 12:55, William Booker wrote:
Dear all,
I'm trying to assert that my projection in my incompressible case leaves my initial velocity to be discrete divergence free.
I've tried print an L2 norm but must be writing it wrong as it causes causes the compiler to break.
The relevant lines
solve(DIVU_perp == DIVU, u_perp, solver_parameters={'ksp_rtol': 1e-14, 'pc_type' : 'none', 'ksp_type': 'lsqr'} )
u0 += u_perp
# Print statement to verify initial velocity is divergence free
u_div = assemble( div_u( u0 , dFdPproject ) )
u_div_norm = norm (u_div, norm_type="L2")
print "l2 norm of discrete divergence on initial velocity is " % u_div_norm
How would I go about getting the script to print that the velocity is verified as divergence free?
We believe that this is a bug in COFFEE, but it was fixed yesterday afternoon. Can you please run firedrake-update followed by firedrake-clean and then try again. At least for me, your script runs. Cheers, Lawrence
On 11 May 2016, at 14:40, William Booker <scwb@leeds.ac.uk> wrote:
Updated and ran firedrake -clean but I'm still getting an error
TypeError: not all arguments converted during string formatting.
Which I take to mean I'm doing something wrong in creating the number that is my measure of divergence free on my initial velocity
Your code has: print "l2 norm of discrete divergence on initial velocity is " % u_div_norm But you haven't supplied a format string to paste in u_div_norm Lawrence
That solved it. Thanks, Will ________________________________________ From: firedrake-bounces@imperial.ac.uk <firedrake-bounces@imperial.ac.uk> on behalf of Lawrence Mitchell <lawrence.mitchell@imperial.ac.uk> Sent: 11 May 2016 14:42:46 To: firedrake@imperial.ac.uk Subject: Re: [firedrake] Trying to print discrete divergence
On 11 May 2016, at 14:40, William Booker <scwb@leeds.ac.uk> wrote:
Updated and ran firedrake -clean but I'm still getting an error
TypeError: not all arguments converted during string formatting.
Which I take to mean I'm doing something wrong in creating the number that is my measure of divergence free on my initial velocity
Your code has: print "l2 norm of discrete divergence on initial velocity is " % u_div_norm But you haven't supplied a format string to paste in u_div_norm Lawrence
participants (2)
-
Lawrence Mitchell
-
William Booker