MPAS-Dev / MPAS-Tools

MPAS Tools Repository
Other
37 stars 63 forks source link

Add 'muFriction' and 'eigencalvingParameter' to MPAS I/O field names #455

Closed hollyhan closed 2 years ago

hollyhan commented 2 years ago

This PR adds 1) new fields muFriction and eigencalvingParameter to the MPAS I/O field names in interpolate_mpasli_to_grid.py 2) a new optional field 'eigencalvingParameter' in 'create_landice_grid_from_generic_MPAS_grid.py'

hollyhan commented 2 years ago

@trhille, thanks for reviewing the PR so quickly! I have one more update, which is also adding eigencalvingParameter in create_landice_grid_from_generic_MPAS_grid.py. Could you also review this and see if your approval still stands? Thanks a lot!

trhille commented 2 years ago

@hollyhan That looks fine as well. Have you tested it to confirm it works? One question is whether we think we actually need to bring eigencalvingParameter into every mesh we create. We don't do that for other analogous fields like calvingVelocityData, but I don't see any harm in doing it.

hollyhan commented 2 years ago

One question is whether we think we actually need to bring eigencalvingParameter into every mesh we create. We don't do that for other analogous fields like calvingVelocityData, but I don't see any harm in doing it.

@matthewhoffman - would you have any input on this? I can delete eigencalvingParameter if this addition is unnecessary.

hollyhan commented 2 years ago

Thanks for the review and helpful explanation/suggestion, @matthewhoffman!

I've added a new optional argument --eigencalving in create_landice_grid_from_generic_MPAS_grid.py following your preferred solution and tested that both changes (commits) work:

  1. Adding the field variable eigencalvingParameter with an optional flag eigencalving in create_landice_grid_from_generic_MPAS_grid.py:
(base) pn2034311:mesh_tools_li hollyhan$ ./create_landice_grid_from_generic_MPAS_grid.py -i ~/Downloads/Antarctic_8to80km.nc -o ~/Downloads/Antarctic_8to80km_testOutputEigencalvingParam.nc --eigencalving  
** Gathering information.  (Invoke with --help for more details. All arguments are optional)
Input file is: /Users/hollyhan/Downloads/Antarctic_8to80km.nc

---- Copying global attributes from input file to output file ----
Copied global attribute  on_a_sphere = NO
Copied global attribute  sphere_radius = 0.0
Copied global attribute  is_periodic = NO
Copied global attribute  parent_id = zmu1qxl0rn
3lw6h7sv5n
ypbxag9uu6
6nf99h4k3n
ppwqquuiak
Copied global attribute  mesh_spec = 1.0
Copied global attribute  Conventions = MPAS
Copied global attribute  source = MpasMeshConverter.x
Copied global attribute  file_id = p0lmfdxe6n

---- Copying dimensions from input file to output file ----
Using nVertLevels from the intput file: 5
Added new dimension nVertInterfaces to output file with value of 6.
Finished creating dimensions in output file.

Beginning to copy mesh variables to output file.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
Finished copying mesh variables to output file.

Setting layerThicknessFractions to: [0.40740741 0.24565382 0.15943878 0.1093107  0.0781893 ]
Added default variables: thickness, temperature, bedTopography, sfcMassBal, floatingBasalMassBal
Added variable: beta
Added variable: muFriction
Added variable: effectivePressure
Added optional eigencalving variable: eigencalvingParameter
Completed creating land ice variables in new file. Now syncing to file.

** Successfully created /Users/hollyhan/Downloads/Antarctic_8to80km_testOutputEigencalvingParam.nc.**
  1. Adding the variables 'eigencalvingParameter' and 'muFriction' in interpolate_to_mpasli_grid.py:
(base) pn2034311:mesh_tools_li hollyhan$ ./interpolate_to_mpasli_grid.py  -s ~/Downloads/ais20km_newBetaStiffness_RignotBmb_SteveFixedSmb_initial_eigenParam_lowBetaExtrap.nc -d ~/Downloads/Antarctic_8to80km_testOutputEigencalvingParam.nc -m d -v eigencalvingParameter 
== Gathering information.  (Invoke with --help for more details. All arguments are optional)

  Source file:  /Users/hollyhan/Downloads/ais20km_newBetaStiffness_RignotBmb_SteveFixedSmb_initial_eigenParam_lowBetaExtrap.nc
  Destination MPASLI file to be modified:  /Users/hollyhan/Downloads/Antarctic_8to80km_testOutputEigencalvingParam.nc
  Interpolation method to be used:  d
    (b=bilinear, d=barycentric, e=esmf)

==================
Gathering coordinate information from input and output files.
  Using MPAS layer centers at sigma levels: [0.2037037  0.53023432 0.73278061 0.86715535 0.96090535]
  Using MPAS layer interfaces at sigma levels: [0.         0.40740741 0.65306122 0.8125     0.9218107  1.        ]
==================

Source file appears to be in MPAS format.
==================
Input MPAS File extents:
  xCell min, max:    -2745000.0 2845000.0
  yCell min, max:    -2225685.2877260074 2312287.828104451
Output MPAS File extents:
  xCell min, max: -2579104.3263391815 2812394.711808656
  yCell min, max: -2216798.803958245 2309080.616926154
==================
Building interpolation weights: MPAS in -> MPAS out
    Delaunay triangulation complete.
    find_simplex complete.
    identified vertices.
    np.take complete.
    calculating bary complete.
done in 0.936055128

## eigencalvingParameter ##
    ---- Interpolating time level 0 ----
  Input field  eigencalvingParameter min/max: 3000000000000000.0 1e+17
  ...Interpolating to eigencalvingParameter using barycentric method...
  interpolated MPAS eigencalvingParameter min/max: 2999999999999999.5 1.0000000000000002e+17
  interpolation done in 0.0023619089999999954

Fields successfully interpolated: eigencalvingParameter

*Note that the same test is also done for muFriction, and the test passed.