Open BrodiePearson opened 3 years ago
@amrapallig @vanroekel @qingli411
@BrodiePearson thanks for continuing to dig through. I'll take a shot at your equation
1) you're right on that extra half, that shouldn't be there. Previously I had defined the KE (L498-499) without the 0.5 but when I put it in I missed making that correction
2) Again right on. The second derivative is wrong. We never use this but would be important to fix. It is something CLUBB developers have suggested a need for. Testing by @amrapallig suggests it doesn't run with this, likely because of the incorrect derivative.
3) beta5 and c2 are identical 0.5, only b/c as you say c2 = 1-beta5
. It would be good to unify that, it's just poorly mixed notation.
Here is my branch of the code. I have changed the variable names so that the coefficients should be consistent with the Overleaf file. However, this branch was based on an earlier version of the code so a lot of the recent changes have not been merged in. So many of the issues we saw earlier haven't been fixed in this branch. But I just wanted to put it here for reference. It would be good to unify these branches as we move forward.
@qingli411 Thanks for the link to your code and for adding the new constant names, I also like the commenting that you have added for budget terms etc. I agree that unifying these branches would be a good idea, especially as it will only get harder the longer we wait. I hope that it is not too challenging to do so now.
@vanroekel Thanks for your responses, I'm glad the comments were sensible. It looks like Qing's code has actually fixed the bugs in points (1) and (3), although it looks like the viscous terms in (2) are removed in @qingli411's code - that's good to know as we merge the codes.
I've been going through the budget equations to match them with the Langmuir closure Overleaf document and had three of questions/comments:
[x] It looks like the first part of the pressure closure in the u'w' and v'w' budgets is multiplied by an extra factor of a half, as the KE is defined with the factor of half already built in (see below). The factor of half outside makes sense to me, but I'm not sure where the second 0.5 or 0.5_RKIND comes from https://github.com/vanroekel/MPAS-Model/blob/4923b0e69f45bd72e7ee460abdf031669b003fc6/src/core_ocean/shared/mpas_ocn_adcReconstruct.F#L572-L573 https://github.com/vanroekel/MPAS-Model/blob/4923b0e69f45bd72e7ee460abdf031669b003fc6/src/core_ocean/shared/mpas_ocn_adcReconstruct.F#L587-L588 https://github.com/vanroekel/MPAS-Model/blob/4923b0e69f45bd72e7ee460abdf031669b003fc6/src/core_ocean/shared/mpas_ocn_adcReconstruct.F#L498-L499
[ ] I don't follow the flux dissipation terms in the u'v', v'w', u'w', w't', w's'. (which contain
kappa_FL
orkappa_VAR
; I'm also not sure why the latter is defined separate tokappa_FL
). I assume these represent the viscous/diffusive terms that have the form $\partial^2(\overline{u'w'})/\partial z^2$, but the numerator looks like a first-order numerical derivative instead of second-order. In the u'w' budget these terms are: https://github.com/vanroekel/MPAS-Model/blob/4923b0e69f45bd72e7ee460abdf031669b003fc6/src/core_ocean/shared/mpas_ocn_adcReconstruct.F#L580-L581 But I think the simplest second-order derivative (assuming that vertical grid spacing is constant) would bekappa_FL*(uw(i1,k-1,iCell) - 2.0_RKIND*uw(i1,k,iCell) + uw(i1,k+1,iCell)) / ( 0.5_RKIND*(ze(k-1,iCell) - ze(k+1,iCell))**2.0_RKIND)
[ ] The coefficients for the buoyancy pressure closure change between the different budgets (w'w' contains
C2
while all the other budgets containbeta5
). Are these connected in your parameter definitions (C2=1-beta5
for energy conservation?), and if so could they be combined for simplicity in the code? It also looks likeB
could be used to replace the buoyancy flux in the w'w' budget as in the other budgets. https://github.com/vanroekel/MPAS-Model/blob/4923b0e69f45bd72e7ee460abdf031669b003fc6/src/core_ocean/shared/mpas_ocn_adcReconstruct.F#L512-L513 https://github.com/vanroekel/MPAS-Model/blob/4923b0e69f45bd72e7ee460abdf031669b003fc6/src/core_ocean/shared/mpas_ocn_adcReconstruct.F#L605