[ENH] add eta to rbcs for nonlinear free surface#797
[ENH] add eta to rbcs for nonlinear free surface#797jklymak wants to merge 11 commits intoMITgcm:masterfrom
Conversation
|
One thing I'm not clear on - for obcs they have a calculation for |
acec722 to
5d57196
Compare
5d57196 to
b162bd3
Compare
mjlosch
left a comment
There was a problem hiding this comment.
docs compile (html), code compiles in the two verification experiments that use rbcs, but I get this (without the -devel option):
Y Y Y Y>16<16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 . . . . pass exp4
Y Y Y Y>--< 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 . . . . N/O exp4.nlfs
Y Y Y Y>16<16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 . . . . . . . . pass exp4.stevens
Y Y Y Y>12<16 16 16 16 16 16 16 16 16 16 16 16 16 16 14 16 . . . . . . . . pass tutorial_reentrant_channel
because results are NaNs already in timestep 0:
(PID.TID 0000.0001) %MON surfExpan_theta_mean = NaN
(PID.TID 0000.0001) %MON surfExpan_salt_mean = NaN
with the -devel option, the model does not run exp4.nlfs. I am guessing that there's a problem in the initialisation phase.
pkg/rbcs/rbcs_apply_eta.F
Outdated
| WRITE(msgBuf,'(A,1PE13.6,1PE13.6)') | ||
| & ' RBCS_APPLY_ETA: finished!', RBC_Etamask(sNx-10,1,bi,bj), | ||
| & RBCeta(sNx-10,1, bi,bj) | ||
| CALL PRINT_MESSAGE(msgBuf, standardMessageUnit, | ||
| & SQUEEZE_RIGHT , 1) |
There was a problem hiding this comment.
Maybe only print if the debug level is larger than default, like in e.g. model/src/external_fields_load.F?
pkg/rbcs/rbcs_readparms.F
Outdated
| WRITE(msgBuf,'(2A)') 'RBCS_READPARMS: ', | ||
| & 'tauRelaxS cannot be zero with useRBCsalt' | ||
| CALL PRINT_ERROR( msgBuf, myThid ) | ||
| STOP 'ABNORMAL END: S/R RBCS_READPARMS' | ||
| ENDIF |
There was a problem hiding this comment.
something went wrong with the indentation.
Since there are so many stops in this file, maybe we could import the "errCount=errCount+1" method here, too? (see, e.g., model/src/config_check.F)
|
Thanks @mjlosch for taking a look. For my testing, did you run |
|
I just checked out the branch and ran |
|
Thanks - I can have a look in a few days. |
|
Here's the problem: in |
|
Thanks @mjlosch this passes that test report. I added an if statement to Happy to write a test for this setup. |
mjlosch
left a comment
There was a problem hiding this comment.
LGTM, thanks for adding some documenation. See my comment there.
I changed the error handling to print all errors before stopping; this has nothing to do with this PR.
doc/phys_pkgs/rbcs.rst
Outdated
| | :varlink:`relaxUFile`, | | | otherwise there must be a separate file for each period with a 10-digit iteration number appended | | ||
| | :varlink:`relaxVFile` | | | to the file name (see :numref:`tab_phys_pkg_rbcs_timing` and examples below) | | ||
| +------------------------------------+--------+------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ||
| | :varlink:`relaxEtaFile`, | PARM01 | :kbd:`' '` | name of file with 2-D relaxation for Eta. Note shape is `(nt, ny, nx)` | |
There was a problem hiding this comment.
I am afraid, that mentioning the shape may be confusing. I don't even know what our convention is. For python-generated fields it is clear, i.e. (nt,ny,nx), but with all gendata.m-Matlab codes, it's the other way around (nx,ny,nt), isn't it?
There was a problem hiding this comment.
Our convention is math notation :) and/or fortran, not python (nor explicitly matlab per se either).
But I would agree with Martin here you don't need to mention the shape here.
There was a problem hiding this comment.
I find it pretty confusing to know what dimension gets the time index, and have to look it up in one of the examples or my own past setups. Where would I find this elsewhere in the docs? I think it's a gap in the docs that dimensions are not specified for most i/o files, though nz, ny, nx are a more natural order. Given the number of folks who mess up their input fields in the mailing lists, I don't think I am alone in getting this wrong sometimes
There was a problem hiding this comment.
see section 3.9 in the doc
We've purposely tried to keep the doc from catering to either matlab or python (or netcdf). In the code, the order would be (nx, ny, nz) so that would be the natural order, as it were.
There was a problem hiding this comment.
If explicitly the placement of the time index is the confusion, we could add this case in the 3.9 doc section.
There was a problem hiding this comment.
OK, removed this, and slightly rephrased the relax*File entry to include relaxEtaFile, and added a link back to sec 3.9 (that is very clear, thanks!).
I'll submit a follow-up PR for section 3.9 based on this discussion.
|
@jklymak thanks for sharing your code. I was supposed to look at this PR a long time ago but a little busy these days. There are several things that I would need to check (including how this fit into time-stepping with various options) as it affects the continuity equation and might affect tracer conservation. The other thing is that we are considering an alternative implementation of Open-Boundary Conditions that would allow naturally to prescribe the SSH at the OB and account for the pressure gradient across the OB. So I would suggest we keep this PR open and keep it up-to-date (will merge latest master branch in) and decide later which direction to take. |
|
Thanks @jm-c - I use this in an a-physical sponge part of the domain where I would also sponge active and passive tracers, so I don't consider tracer conservation important in my use cases. I'm not sure use cases where a-physically forcing eta could conserve anything (definitely not mass!) but perhaps there are such use cases... |
What changes does this PR introduce?
Draft for comment:
obcsallows settingetaH, but I wanted an rbcs-type sponge, so I added this to rbcs.This is potentially valuable for fjords and other embayments where we want to force the tide via sea surface height in a large receiving basin. I do this by adjusting the sponge in the receiving basin so that the surface wave is free in the fjord itself.
Does this PR introduce a breaking change?
No
Other information:
I have a simple version of a toy model that works with this at https://github.com/jklymak/FjordForce. That example could be simplified, its just a simulation I had that had a reasonable fjord with large receiving basin set up.