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

Update how grid location of MARBL error is reported to GCM #99

Closed
mnlevy1981 opened this issue Oct 28, 2016 · 4 comments
Closed

Update how grid location of MARBL error is reported to GCM #99

mnlevy1981 opened this issue Oct 28, 2016 · 4 comments

Comments

@mnlevy1981
Copy link
Collaborator

Currently marbl_set_surface_forcing is called for multiple grid cells ("elements") simultaneously, and if MARBL errors out it reports which grid cell in the error log... but there is no way for the driver to turn this value into a global latitude & longitude (or global indices). @klindsay28 pointed out an issue in the POP driver that we were not checking for errors after set_interior_forcing() returns; ideally the solution to this issue would be an update to marbl_logging_type in a fashion that could be used by both the surface and interior forcing routines (especially if we settle #81 by deciding to pass multiple elements to set_interior_forcing)

@mnlevy1981
Copy link
Collaborator Author

On the MARBL side, we should set ElementID to -1 by default, and then POP can automatically append lat / lon information given a positive ID. (Perhaps element_ind would be a better variable name.)

Also on the MARBL side, lall_tasks is a confusing variable name. Instead we should flip the meaning of it and use lonly_master_writes. By "flip the meaning" I mean that

lonly_master_writes = .not. lall_tasks

So we need to add (or remove) .not. from all uses.

@mnlevy1981
Copy link
Collaborator Author

Note that we also need POP's print_marbl_log() function to be aware of when it's being called -- after set_surface_forcing the element index corresponds to a specific column in the block, but after set_interior_forcing it refers to a specific level of a column. In the latter case, we will need to provide print_marbl_log with either the lat / lon of the column or the (i,j,bid) triplet. bid is already required, but one possibility is to make i and j optional arguments that are only passed after the interior call.

@mnlevy1981 mnlevy1981 self-assigned this Apr 6, 2017
@mnlevy1981
Copy link
Collaborator Author

I have a MARBL branch that takes care of the issues in my second comment ('lall_tasks' => 'lonly_master_writes' and setting 'ElementInd = -1'); working on the POP modifications following a conversation with @klindsay28

We are going to store marbl_col_cnt as well as mappings between index_marbl and (i,j) so we can map between surface elements and POP columns; for the latter, I realized that we can use marbl_col_cnt as gcm_num_elements_surface_forcing if we initialize things in the right order (i.e. determine marbl_col_cnt before initializing MARBL).

@mnlevy1981
Copy link
Collaborator Author

I have a first pass at improved logging; changing the width of the bounding bracket to force a failure in drtsafe leads to messages like

Message from (lon, lat) ( 316.100, -77.981), which is global (i,j) (99, 2)
(marbl_co2calc_mod:drtsafe) , c = 64, it = 1
Message from (lon, lat) ( 316.100, -77.981), which is global (i,j) (99, 2)
(marbl_co2calc_mod:drtsafe)    x1,f =  0.7563469E-008 0.5412834E-006
Message from (lon, lat) ( 316.100, -77.981), which is global (i,j) (99, 2)
(marbl_co2calc_mod:drtsafe)    x2,f =  0.7564165E-008 0.5255250E-006
Message from (lon, lat) ( 319.700, -77.981), which is global (i,j) (100, 2)
(marbl_co2calc_mod:drtsafe) , c = 65, it = 1
Message from (lon, lat) ( 319.700, -77.981), which is global (i,j) (100, 2)
(marbl_co2calc_mod:drtsafe)    x1,f =  0.7575660E-008 0.5382302E-006
Message from (lon, lat) ( 319.700, -77.981), which is global (i,j) (100, 2)
(marbl_co2calc_mod:drtsafe)    x2,f =  0.7576358E-008 0.5225090E-006

From the first iteration and

Message from (lon, lat) ( 316.100, -77.981), which is global (i,j) (99, 2)
(marbl_co2calc_mod:drtsafe) , c = 64, it = 4
Message from (lon, lat) ( 316.100, -77.981), which is global (i,j) (99, 2)
(marbl_co2calc_mod:drtsafe)    x1,f =  0.7561031E-008 0.5964447E-006
Message from (lon, lat) ( 316.100, -77.981), which is global (i,j) (99, 2)
(marbl_co2calc_mod:drtsafe)    x2,f =  0.7566604E-008 0.4703778E-006
Message from (lon, lat) ( 316.100, -77.981), which is global (i,j) (99, 2)
MARBL ERROR (marbl_co2calc_mod:drtsafe): bounding bracket for pH solution not found
Message from (lon, lat) ( 319.700, -77.981), which is global (i,j) (100, 2)
(marbl_co2calc_mod:drtsafe) , c = 65, it = 4
Message from (lon, lat) ( 319.700, -77.981), which is global (i,j) (100, 2)
(marbl_co2calc_mod:drtsafe)    x1,f =  0.7573219E-008 0.5932615E-006
Message from (lon, lat) ( 319.700, -77.981), which is global (i,j) (100, 2)
(marbl_co2calc_mod:drtsafe)    x2,f =  0.7578801E-008 0.4674918E-006
Message from (lon, lat) ( 319.700, -77.981), which is global (i,j) (100, 2)
MARBL ERROR (marbl_co2calc_mod:drtsafe): bounding bracket for pH solution not found

After exceeding max iterations. The log also contains the trace, pointing out that this was in surface computations (otherwise k would have been included in the message):

MARBL ERROR (marbl_co2calc_mod:marbl_comp_htotal): Error reported from drtsafe
MARBL ERROR (marbl_co2calc_mod:marbl_co2calc_surf): Error reported from comp_htotal()
MARBL ERROR (marbl_mod:marbl_set_surface_forcing): Error reported from co2calc_surf() with flux_co2
MARBL ERROR (marbl_interface:set_surface_forcing): Error reported from marbl_set_surface_forcing()
MARBL ERROR (ecosys_driver:ecosys_driver_set_sflux): Error reported from marbl_instances(1)%set_surface_forcing()
     (ecosys_driver:print_marbl_log) ERROR reported from MARBL library

I updated the algorithm so that if multiple points fail to converge they all get logged (previously, the model aborted after the first failure was detected). Thoughts on this formatting? I'm tempted to remove some of the

Message from (lon, lat) ( 316.100, -77.981), which is global (i,j) (99, 2)

lines for easier reading. So maybe something like

Message from (lon, lat) ( 316.100, -77.981), which is global (i,j) (99, 2)
(marbl_co2calc_mod:drtsafe) , c = 64, it = 4
(marbl_co2calc_mod:drtsafe)    x1,f =  0.7561031E-008 0.5964447E-006
(marbl_co2calc_mod:drtsafe)    x2,f =  0.7566604E-008 0.4703778E-006
MARBL ERROR (marbl_co2calc_mod:drtsafe): bounding bracket for pH solution not found
Message from (lon, lat) ( 319.700, -77.981), which is global (i,j) (100, 2)
(marbl_co2calc_mod:drtsafe) , c = 65, it = 4
(marbl_co2calc_mod:drtsafe)    x1,f =  0.7573219E-008 0.5932615E-006
(marbl_co2calc_mod:drtsafe)    x2,f =  0.7578801E-008 0.4674918E-006
MARBL ERROR (marbl_co2calc_mod:drtsafe): bounding bracket for pH solution not found

instead of the second block? And while I'm in this block of code, changing the c and it line to be more like x and f?

(marbl_co2calc_mod:drtsafe)    c, it = 64 4

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

No branches or pull requests

1 participant