Skip to content

Hollyhan/slm/add option to write zero ice thickness#1

Open
hollyhan wants to merge 56 commits into
GomezGroup:mainfrom
MALI-Dev:hollyhan/slm/add_option_to_write_zero_ice_thickness
Open

Hollyhan/slm/add option to write zero ice thickness#1
hollyhan wants to merge 56 commits into
GomezGroup:mainfrom
MALI-Dev:hollyhan/slm/add_option_to_write_zero_ice_thickness

Conversation

@hollyhan
Copy link
Copy Markdown
Collaborator

Previously, running the SLM coupled with an ice-sheet model always required reading in the ice thickness outside the ISM domain from external files. This caused inconvenience in cases where users wanted to consider zero-ice thickness outside the ISM domain - they still had to create files containing fields of zeros in the preprocess step. This PR resolves the issue by reading ice files from external files optional. That is when the namelist option 'patch_ice' is turned on, zere field ice thickness is assigned to the memory from the SLM directly.

hollyhan and others added 30 commits February 18, 2022 10:42
New module files:
init_slm_mod.f90 and user_specs_mod.f90
New files:

	new file:   Makefile
	new file:   sl_model_driver.f90
	new file:   sl_model_mod.f90

Removed file:

	deleted:    SL_MODEL_FWTW.f90
Wrappers included are:
  subroutines 'read_sl' and 'write_sl' in init_slm_mod.f90
new subroutines in sl_model_mod.f90 are:
   'sl_timewindow', 'set_planet', 'sl_solver_checkpoint',
   'sl_solver_init', 'sl_solver'.

These subroutines are called from 'sl_model_driver.f90'
…ENCHMARKED

Fully benchmarked against Han et al. (GMD Time window paper))
Subroutine set_planet is called within slmodel_checkpoint in
sl_model_mod.f90 script rather than in sl_model_driver.f90.
Included a subroutine called 'sl_set_unit_num()' in sl_model_mod.f90
that sets a unit number for Fortran write(*,*) statement.

changed the unit numbers used by SLM to read and write data (1 and 2)
to 201 since MALI uses unit numbers up to 200.
sl_model_mod.f90:

1. Subroutine 'sl_solver_init' takes in optional
input arguments 'mali_iceload' and 'mali_bedrock' provided by MALI.

2. Subroutine 'sl_solver' takes in optional input argument
'mali_iceload' and output arbument 'slchange' to exchange
outputs between MALI and SLM

sl_model_driver.f90:
Subroutine 'sl_set_unit_num' is replaced to Subroutine
'sl_solver_checkpoint' in sl_model_mod.f90.
It now correctly detects when .f90 files have been modified.
…hickness and bedTopo)

1. Take in ISM grid mask from the ice sheet model and merge with global data such that

(Merged_data_GaussianGrid) = (mali_data_in_GaussianGrid) + (Global_data)(1 - mali_mask_in_GaussianGrid)

2. Clean up the code a bit
Also, renaming routines and modules and editing Makefile to reflect the name changes.
        modified:   Makefile
	new file:   namelist.sealevel => created a text namelist file based on the user_specs_mod.f90
	new file:   sl_init_mod.f90 => changed the name of the file 'init_slm_mod.f90', include subroutines that read in the namelist
	modified:   sl_model_driver.f90 => call the subroutines 'sl_drive_readnl' and 'sl_call_readnl'
        modified:   sl_model_mod.f90 => included a wrapper subroutine that calls the subroutine 'sl_readnl'
Remove 'config_' from the variable names
This commit creates a str_len parameter of 200 characters and uses it to
define the length of all string variables used for filename or path
names.  This avoids filename truncation and associated read errors when
long filenames are used.  It also fixes the fact that the 'times' output
file had been shortened to 'time'.  Those truncation issues were
introduced in the switch to using a namelist, such that the associated
string variables could not be defined with unspecified length (*).
This allows a user/developer to look at the code to see which i/o call
actually failed.  Note that this will only produce useful results if the
model is compiled in debug mode.
* Add debug symbols (-g) to help with debugging.  (May want to remove
that eventually)
* Add gnu option to suppress underflow floating point exceptions, which
are a nuisance but not problematic
* Add build path to include path
This commit replaces fType with fType_in and fType_out, so that the
input and output file types can differ (e.g. text files for input and
netcdf for output).  A few other details:
* The .nc extension is added to NetCDF output files
* unit_num is moved to user_specs_mod so it can be accessed from
  sl_init_mod
* To get both kinds of output files, use 'both' instead of ''
Allow input and output file types to differ
Note the fix is hardcoded assuming the SLM is run with
resolution where nlon is twice nlat.  I think that will always be the
case, but if not, a more general but complicated solution could be used.
Note I had to comment out the gnu-specific 'backtrace' command.  It
could be manually uncommented as needed.
matthewhoffman and others added 26 commits June 29, 2022 13:44
This is for debugging and should eventually be reverted or pared down.
Uninitialized arrays is what was causing erratic behavior (code hanging,
floating point exceptions) on large, complex problems.  Initializing all
arrays after allocating them made those problems go away.
This reverts commit fdc2101.

Remove debugging write statements now that the code is working.
This reverts commit 1a6f63d.
Remove rest of debugging statements.
Fix random occurrences of code hanging and floating point exceptions
patch zero ice thickness everywhere
outside of the ice-model domain when coupled
These variables got carried over from the older version of the SLM
when it was coupled to the PSU model to run over the Northern Hemispheric Ice Sheet
during the Last glacial cycle. These variables are no longer used in
the MALI-SLM coupling framework.
Make constants consistent with mali and others
Write TPW variables into a new file every timestep
One calculation where ocean is defined to be anywhere below sea level
and one for where ocean is defined to be anywhere below sea level AND
there is no marine-based ice.
with and without considering marine-based areas
Previously, the variables `norder` and `nglv` were parameters that
were used in declaring the dimension of many variables. This has raised
two issues in our recent efforts to run a suite of sensitivity coupled MALI-SLM
simulations that sweeps across various values of MALI mesh resolution
and the number of Gauss-Legendre nodes in latitude (represented by variable `nglv`)
in the SLM. The first issue (or more like an inconvenience) was the need to code compilation needs to be done
everytime `nglv` parameter was changed, and the second was the failure
of compilation when the `nglv` value was set higher than 2000 because of limited memory imposed to
variables that are declared with defined a dimension size.
This PR addresses the two issues by 1) no longer assigning the variables `norder` and `nglv` as
model parameters, and 2) making the variables that use these variables to declare their dimension as allocatable.
…list_options

Change model res parameters `nglv` and `norder` as namelist options
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