Hi Jacob!
I am not sure exactly what you are trying to do. This is the C++ code for SMB gradient method:
/*Recover parameters*/
IssmDouble time = this->FindParam(TimeEnum);
IssmDouble accualti = this->FindParam(SmbAccualtiEnum);
IssmDouble runoffalti = this->FindParam(SmbRunoffaltiEnum);
/*Recover reference values at current time*/
parameters->FindParam(&accugrad,SmbAccugradEnum,time);
parameters->FindParam(&runoffgrad,SmbRunoffgradEnum,time);
parameters->FindParam(&accuref,SmbAccurefEnum,time);
parameters->FindParam(&runoffref,SmbRunoffrefEnum,time);
/*Recover surface elevation*/
GetInputListOnVertices(&surf[0],SurfaceEnum);
/*Compute the temperature and precipitation*/
for(int iv=0;iv<NUM_VERTICES;iv++){
accu[iv] = max(0.,(accuref+(surf[iv]-accualti)*accugrad));
runoff[iv] = max(0.,(runoffref+(surf[iv]-runoffalti)*runoffgrad));
smb[iv] = (accu[iv]-runoff[iv])*rho_ice/rho_water;
}
this->AddInput(SmbMassBalanceSubstepEnum,&smb[0],P1Enum);
this->AddInput(SmbRunoffSubstepEnum,&runoff[0],P1Enum);
and the MATLAB class SMBgradients
has the following fields:
SMB gradients parameters:
href : N/A -- reference elevation from which deviation is used to calculate SMB adjustment in smb gradients method [m]
smbref : N/A -- reference smb from which deviation is calculated in smb gradients method [mm/yr water equiv]
b_pos : N/A -- slope of hs - smb regression line for accumulation regime required if smb gradients is activated
b_neg : N/A -- slope of hs - smb regression line for ablation regime required if smb gradients is activated
averaging : 0 -- averaging methods from short to long steps
It is this parameterization that was used in https://www.nature.com/articles/s43247-021-00092-z.
If that's not what you need I am affraid we may need to implement another one. Let me know if I can help!
All the best
Mathieu