Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates from upstream including relative winds #270

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from

Conversation

TillRasmussen
Copy link
Collaborator

Added upstream changes and a few bugfixes
Changed epmass to integer. Check if NERSC error message is correct in blkdat.input (reviewers)

Added variable use of ocean current in (ocnscl) Default is 1.0 which will result in full relative wind (windx-ocnscl*Uocn). See mod_momtum. This should result in removal of negative wndflg and removal of amoflg as this no longer make sense. I will suggest that to the upstream. Note this is the only part which changes the md5sum (bit for bit check of restart after one day).

A conservative cfl flag criterion is added when cpp flag momtum_cfl is added. This is not tested and to not change result when false.
Added hybthk. Default to normal when set to 0.0. A way of avoiding to thin hybrid layers. There is a bug as the pressure p(kdm) sometimes is smaller than p(kdm+1), which is unphysical as it represents a layer with negative thickness at the bottom. This seems to be a numerical issue and it is only in the order of a few mm. Solved by requiring that the difference cannot be lower than 0. Another thing to raise to upstream. This is not related to this implementation.

I found a parenthesis missing in a cpp block that required STOKES added. This is located in mod_barotrop. I have not checked that it is correct as I dont run with this

@TillRasmussen TillRasmussen changed the title Develop Updates from upstream including relative winds Oct 13, 2024
@Jipingnersc
Copy link
Collaborator

Based on this current branch, the model was compiled on Betzy and the one-month run has been done.
However, during the parameter testing, for example, the ocnscl can not be equal to 0.0 because of a possible paradox in the code.
The amoflg is an indicated parameter by the ocnscl, which should be equal to 0 if the ocnscl is set to 0.0, but the code is not acceptable.
See the lines of 1889 and 1899 in blkdat.F90
if (ocnscl.ne.0.0 .and. wndflg.lt.4) then
if (mnproc.eq.1) then
write(lp,'(/ a /)') &
&'error - ocnscl must be 0.0 for absolute winds (wndflg<4)'
call flush(lp)
endif !1st tile
call xcstop('(blkdat)')
stop '(blkdat)'
endif
wndflg = abs(wndflg)
if (ocnscl.eq.0.0) then
amoflg = 0 !U10
else
amoflg = 1 !U10-Uocn
endif

In addition, the codes between lines of 498 and 514 in mod_momtum.F90 are possible to be shorten.
For example, only keeping the first part as following:
samo = sqrt( (wndx-ocnsclusur)**2 +&
(wndy-ocnscl
vsur)**2 )
cdw = 1.0e-3cd_coarep(samo,vpmx,airt,pair, &
temp(i,j,1,n))
surtx( i,j) = rair
cdwsamo(wndx-ocnsclusur)
surty( i,j) = rair
cdwsamo(wndy-ocnscl*vsur)
wndocn(i,j) = samo !save

Because when the ocnscl equals 0.0, the results both are same.

@TillRasmussen
Copy link
Collaborator Author

The reason that it is implemented like this is that it is taken from the upstream code.
I am happy to bring suggestion forward to Alex and Alan. It is much easier to keep the code aligned with the upstream code if they are the same (to the extend possible).

@Jipingnersc Just to be sure the code do not fail when ocnscl is 0.0?. It "just" exit due to statements.

blkdat.F90
The exit statements are there to avoid clashes in definitions between wndflg and ocnslc.

exit 1) ocnscl=0. (no influence of currents on wind) and wndflg>=4 (influence of currents on wind)
This has to do with the definition wndflg. The real solution is to remove the option of negative wndflg.
I need to check that nothing else happens.

exit 2) ocnscl>0. wndflg<4:
If wndflg > 0 then It uses stresses from atmospheric forcing or coupler. This could be a warning.
if wndflg<0 (no influence of currents on wind) ocnscl>0. (influence of currents on wind)

Comments mod_momtum.F90
I agree that it could be shortened.
There are other things that could be removed.
Amoflg is obsolete (use ocnscl)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants