MPAS-Dev / MPAS-Tools

MPAS Tools Repository
Other
37 stars 63 forks source link

Fix flux files processing when no threshold calving cells are boundary cells #494

Closed trhille closed 1 year ago

trhille commented 1 year ago

If none of the threshold calving cells in a given time step are boundary cells, then bdyIndices is empty and will cause an error. In this case, just skip to the next time step.

trhille commented 1 year ago

I have confirmed that 18bfe97 gets rid of the divide-by-zero warning without changes results. setting debug_face_melt_flux = True, I got these results that are the same as those reported in https://github.com/MPAS-Dev/MPAS-Tools/pull/493:

(Pdb) np.sum(calvingThickness * areaCell / deltat_array, axis=1)
array([49228.153451  , 48798.73392818, 49032.44329166, 49214.95196977,
       49139.30843669, 49108.95946778, 48821.79868413, 48846.31918012,
       49401.00119255, 48382.79642358, 47904.21284329, 48979.80998666,
       48583.38359388, 49540.65512782, 49088.7300805 , 49470.88866793,
       48316.82709034, 48878.77000334, 47424.93068525])
(Pdb) np.sum(calvingThicknessFromThreshold * areaCell / deltat_array, axis=1)
array([0.00000000e+00, 4.09425274e+02, 1.09914030e+02, 3.29482481e+04,
       5.12006266e+00, 3.97218190e+02, 2.92056028e+01, 1.45844674e+04,
       1.30159305e+01, 1.34037910e+02, 3.19408344e+02, 7.81719872e+01,
       8.04076717e+02, 6.34640333e+01, 9.16943069e+03, 1.38164811e+01,
       6.53044849e+02, 2.30591706e+02, 7.53014640e+02])
(Pdb) np.sum(faceMeltingThicknessCleaned * areaCell / deltat_array, axis=1)
array([1944.01822659, 1873.30731363, 1887.97714191, 1920.20367756,
       1967.18496115, 1961.2663264 , 1918.65576488, 1927.41338517,
       1970.79965386, 1922.56628164, 1970.3633663 , 1973.88229605,
       1961.96986461, 2025.76840017, 1988.95688489, 1962.31699737,
       1950.14811708, 1964.74881235, 1958.0574656 ])