CICE-Consortium / CICE

Development repository for the CICE sea-ice model
Other
53 stars 128 forks source link

Arguments in update_state need if present. #923

Closed dabail10 closed 3 months ago

dabail10 commented 7 months ago

I was adding a dvsdtd variable to the update_state call and found this code:

     daidt(i,j,iblk) = (aice(i,j,iblk) - daidt(i,j,iblk)) / dt
     dvidt(i,j,iblk) = (vice(i,j,iblk) - dvidt(i,j,iblk)) / dt
     dvsdt(i,j,iblk) = (vsno(i,j,iblk) - dvsdt(i,j,iblk)) / dt

These are wrapped in an if present(offset), but in my case I only want dvsdtd (dynamic) I don't want the dvsdtt (thermodynamic). It still seems dangerous to rely on offset only here. I would recommend an if present in front of these three.

apcraig commented 4 months ago

I assume, based on the current implementation, that either all the optional arguments are passed or none are. It would be good to have a check at the top of the subroutine to ensure that.

But it sounds like what you're proposing is that the code works with any number of the optional arguments present? offset seems to affect only dagedt, so if dagedt is present, does offset have to be present too?

apcraig commented 3 months ago

940 addressed this issue. Will close.