Check_mask tools

Hello!

I’m trying to run MOM5/ butchered ACCESS-OM2, and came up with the same error as Christina here.

I was hoping to change the number of cpus inline with @micael 's suggestion, but I can’t figure out where to get/how to use the check_mask tool. I’m assuming that it works on MOM5 too? I started to follow the instructions here, then figured I should stop before I break something.

Also tagging @angus-g since the wiki has your edits too? Thanks in advance!

EDIT: wrong link to Christina’s post

So I solved the problem I had separately from the check_mask thing, but I though I’d just write what I did very explicitly.

The ocean_mask_table file input from ik11 says there are 24 masked domains (based on this). The current layout in &ocean_model_nml in input.nml is layout = 16, 15, so 16x15 - 24 masked = 216 cpus following this advice, and the model ran after changing that.

Not sure what to do with this so the people in charge can feel free to remove the post but since finding the number of masked domains was not obvious to me I thought I’d put this here anyways.

Yes, the format it generates is compatible with both MOM5 and MOM6 (it’s an FMS thing). The FRE-NCtools are provided by ACCESS-NRI, so it should be accessible without having to figure out how to compile it:

module use /g/data/vk83/modules
module load model-tools/fre-nctools

I would like for that wiki article to be actually useful, so if you have specific feedback I’m happy to expand on some things. I do agree that it’s silly that the file name format for the masks has the number of masked PEs rather than the number of active PEs

FWIW these were some old instructions @marshallward sent to me in 2014!

Creating the mask (non-mosaic)

  1. Copy check_mask and grid_spec.nc into a common directory
  2. To generate every possible (uniform) layout mask:

check_mask --grid_file grid_spec.nc

  1. To generate a specific layout (eg. 8, 8):

check_mask --grid_file grid_spec.nc --layout 8,8

NOTE: If there are no land cells, then it will report “success” but will not
generate a file!

e.g. try

    check_mask --grid_file grid_spec.nc --layout 8,5

Creating the mask (mosaic)

  1. Copy these files into a common directory:
check_mask
ocean_mosaic.nc
ocean_hgrid.nc
topog.nc
  1. Generate the mask
./check_mask --grid_file ocean_mosaic.nc --ocean_topog topog.nc --layout 32,30

Using the masks

  1. Copy the mask table into MOM’s INPUT directory, e.g.:
cp mask_table.199.32x30 /path/to/mom/INPUT/ocean_mask_table
cp mask_table.199.32x30 /path/to/mom/INPUT/ice_mask_table

In this case, both ocean and ice share the same grid, so I use the same mask
file.

These are the default file names. If a file with this name exists, then MOM
reads it and uses the mask.

You can set the filename explicitly in input.nml:

&ocean_model_nml
    #...
    mask_table='some_filename'
/

same for ice_model_nml

Additional info from me

check_mask tells you how many CPUS are masked (e.g. 199 in above example). You have to subtract that number of CPUs from the CPU count in your config.yaml.

Some gotchas: sometimes it will just complain about a bad domain decomposition, so in that case I just remove one of the masked cells in the file (one of the lines) and change the header and name to reflect that it is now one less masked cell. Usually it works by removing one, but in rare cases I had to remove 2 or 3.