Thank you for sharing the detailed calculation. I am trying to find out what is causing the discrepancy.
I have a few of questions:
1. Why did you multiply (mu_bar[2] * phi_2(x))?
2a. Does firedrake pick up that mu_bar is a function of x (the exact expression in file
parameters.py, line 88)?
parameters.py:88 interpolates the analytic expression into the P1 Function mu_bar. This means that the full form of the Function is:
mu_bar(x) = sum_i mu_bar[i] * phi_i(x)
Because mu_bar[3] and mu_bar[4] are 0, the only term in this sum which is non-zero for the [3, 3] entry is:
mu_bar[2] * phi_2(x)
Note that mu_bar is not the analytic expression itself, it is the P1 interpolant of the analytic expression.
2b. In my Matlab code I use a 2-point Gauss quadrature. What quadrature is Firedrake using?
Firedrake calculates the required quadrature degree to achieve complete quadrature and uses that. In this case, because the degree of the integrand is 3, a two point quadrature will be selected. Firedrake employs Gauss-Lobatto quadrature.
Regards,
David
It's a bit confusing that the results "almost" agree on the first nodes, but are quite different closer to the "waterline" point (where mu_bar becomes zero).
Thank you.
Regards,
Anna.
On 08/06/16 15:38, David Ham wrote:
OK. Let's look at entry 3,3 in the matrix (ie the last nonzero entry - what matlab would call the 4,4 entry).
Note that the last two entries in mu_bar are zero.
This means that the only nonzero integral in the calculation of this entry is:
Note that this is the same as the Firedrake result and not the same as the Matlab code. I therefore claim that the problem is in the Matlab code, and not a bug in Firedrake
You can see that even though mu_bar is the same as the one obtained from firedrake, the matrix entries are different. I don't understand why.. The rest of the matrices, i.e. M, A and C_lam, have the same entries as in firedrake.
Thanks,
Anna.
On 08/06/16 14:38, Fabio Luporini wrote:
Hello Anna,
under the Inequality constraint folder, I'm running "python buoy-swe.py" and, besides the TSFC/COFFEE prints, I'm obtaining:
mu_bar
------
[ 0.34693095 0.28326793 0.20030068 0. -0. ]
Matrix b_mu
-----------
[[ 1.37331778 0.6536432 0. 0. 0. ]
[ 0.6536432 2.33042494 0.50155807 0. 0.]
[ 0. 0.50155807 1.54031885 0.20775216 0.]
[ 0. 0. 0.20775216 0.20775216 0. ]
[ 0. 0. 0. 0. 0. ]]
What values do you expect for b_mu ? Am I running the right thing?
I tried switching off some optimisations but I still get the same output.
I have a simple question regarding a matrix assembly in Firedrake which I believe is not computed correctly.
The relevant code can be found
here and the issue is with the B_mu matrix in solvers.py, line 51. I compare the result with my own Matlab code and the two don't agree. Also, the rest of the matrices M, A, C_lam agree in both sets of code.