| [19528] | 1 | #include "./SmbAnalysis.h"
 | 
|---|
 | 2 | #include "../toolkits/toolkits.h"
 | 
|---|
 | 3 | #include "../classes/classes.h"
 | 
|---|
 | 4 | #include "../shared/shared.h"
 | 
|---|
 | 5 | #include "../modules/modules.h"
 | 
|---|
 | 6 | 
 | 
|---|
| [23317] | 7 | // FIX
 | 
|---|
 | 8 | #include "./shared/io/Print/Print.h"
 | 
|---|
 | 9 | 
 | 
|---|
| [19528] | 10 | /*Model processing*/
 | 
|---|
 | 11 | void SmbAnalysis::CreateConstraints(Constraints* constraints,IoModel* iomodel){/*{{{*/
 | 
|---|
 | 12 |         /*No constraints*/
 | 
|---|
 | 13 | }/*}}}*/
 | 
|---|
 | 14 | void SmbAnalysis::CreateLoads(Loads* loads, IoModel* iomodel){/*{{{*/
 | 
|---|
 | 15 |         /*No loads*/
 | 
|---|
 | 16 | }/*}}}*/
 | 
|---|
| [23585] | 17 | void SmbAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel,bool isamr){/*{{{*/
 | 
|---|
| [19528] | 18 |         ::CreateNodes(nodes,iomodel,SmbAnalysisEnum,P1Enum);
 | 
|---|
 | 19 | }/*}}}*/
 | 
|---|
 | 20 | int  SmbAnalysis::DofsPerNode(int** doflist,int domaintype,int approximation){/*{{{*/
 | 
|---|
 | 21 |         return 1;
 | 
|---|
 | 22 | }/*}}}*/
 | 
|---|
| [25379] | 23 | void SmbAnalysis::UpdateElements(Elements* elements,Inputs* inputs,IoModel* iomodel,int analysis_counter,int analysis_type){/*{{{*/
 | 
|---|
| [23066] | 24 | 
 | 
|---|
| [19528] | 25 |         int    smb_model;
 | 
|---|
| [23317] | 26 |         bool   isdelta18o,ismungsm,isd18opd,issetpddfac,isprecipscaled,istemperaturescaled,isfirnwarming;
 | 
|---|
| [23066] | 27 | 
 | 
|---|
| [19528] | 28 |         /*Update elements: */
 | 
|---|
 | 29 |         int counter=0;
 | 
|---|
 | 30 |         for(int i=0;i<iomodel->numberofelements;i++){
 | 
|---|
 | 31 |                 if(iomodel->my_elements[i]){
 | 
|---|
 | 32 |                         Element* element=(Element*)elements->GetObjectByOffset(counter);
 | 
|---|
| [25379] | 33 |                         element->Update(inputs,i,iomodel,analysis_counter,analysis_type,P1Enum);
 | 
|---|
| [19528] | 34 |                         counter++;
 | 
|---|
 | 35 |                 }
 | 
|---|
 | 36 |         }
 | 
|---|
| [23066] | 37 | 
 | 
|---|
| [19554] | 38 |         /*Figure out smb model: */
 | 
|---|
| [20690] | 39 |         iomodel->FindConstant(&smb_model,"md.smb.model");
 | 
|---|
| [19528] | 40 |         switch(smb_model){
 | 
|---|
 | 41 |                 case SMBforcingEnum:
 | 
|---|
| [25379] | 42 |                         iomodel->FetchDataToInput(inputs,elements,"md.smb.mass_balance",SmbMassBalanceEnum,0.);
 | 
|---|
| [19528] | 43 |                         break;
 | 
|---|
| [19554] | 44 |                 case SMBgembEnum:
 | 
|---|
| [25379] | 45 |                         iomodel->FetchDataToInput(inputs,elements,"md.smb.Ta",SmbTaEnum);
 | 
|---|
 | 46 |                         iomodel->FetchDataToInput(inputs,elements,"md.smb.V",SmbVEnum);
 | 
|---|
 | 47 |                         iomodel->FetchDataToInput(inputs,elements,"md.smb.dswrf",SmbDswrfEnum);
 | 
|---|
| [25997] | 48 |                         iomodel->FetchDataToInput(inputs,elements,"md.smb.dswdiffrf",SmbDswdiffrfEnum);
 | 
|---|
| [25379] | 49 |                         iomodel->FetchDataToInput(inputs,elements,"md.smb.dlwrf",SmbDlwrfEnum);
 | 
|---|
 | 50 |                         iomodel->FetchDataToInput(inputs,elements,"md.smb.P",SmbPEnum);
 | 
|---|
 | 51 |                         iomodel->FetchDataToInput(inputs,elements,"md.smb.eAir",SmbEAirEnum);
 | 
|---|
 | 52 |                         iomodel->FetchDataToInput(inputs,elements,"md.smb.pAir",SmbPAirEnum);
 | 
|---|
 | 53 |                         iomodel->FetchDataToInput(inputs,elements,"md.smb.zTop",SmbZTopEnum);
 | 
|---|
 | 54 |                         iomodel->FetchDataToInput(inputs,elements,"md.smb.dzTop",SmbDzTopEnum);
 | 
|---|
 | 55 |                         iomodel->FetchDataToInput(inputs,elements,"md.smb.dzMin",SmbDzMinEnum);
 | 
|---|
 | 56 |                         iomodel->FetchDataToInput(inputs,elements,"md.smb.zY",SmbZYEnum);
 | 
|---|
 | 57 |                         iomodel->FetchDataToInput(inputs,elements,"md.smb.zMax",SmbZMaxEnum);
 | 
|---|
 | 58 |                         iomodel->FetchDataToInput(inputs,elements,"md.smb.zMin",SmbZMinEnum);
 | 
|---|
 | 59 |                         iomodel->FetchDataToInput(inputs,elements,"md.smb.Tmean",SmbTmeanEnum);
 | 
|---|
 | 60 |                         iomodel->FetchDataToInput(inputs,elements,"md.smb.Vmean",SmbVmeanEnum);
 | 
|---|
 | 61 |                         iomodel->FetchDataToInput(inputs,elements,"md.smb.C",SmbCEnum);
 | 
|---|
 | 62 |                         iomodel->FetchDataToInput(inputs,elements,"md.smb.Tz",SmbTzEnum);
 | 
|---|
 | 63 |                         iomodel->FetchDataToInput(inputs,elements,"md.smb.Vz",SmbVzEnum);
 | 
|---|
 | 64 |                         InputUpdateFromConstantx(inputs,elements,false,SmbIsInitializedEnum);
 | 
|---|
 | 65 |                         iomodel->FetchDataToInput(inputs,elements,"md.smb.Dzini",SmbDziniEnum);
 | 
|---|
 | 66 |                         iomodel->FetchDataToInput(inputs,elements,"md.smb.Dini",SmbDiniEnum);
 | 
|---|
 | 67 |                         iomodel->FetchDataToInput(inputs,elements,"md.smb.Reini",SmbReiniEnum);
 | 
|---|
 | 68 |                         iomodel->FetchDataToInput(inputs,elements,"md.smb.Gdnini",SmbGdniniEnum);
 | 
|---|
 | 69 |                         iomodel->FetchDataToInput(inputs,elements,"md.smb.Gspini",SmbGspiniEnum);
 | 
|---|
 | 70 |                         iomodel->FetchDataToInput(inputs,elements,"md.smb.ECini",SmbECiniEnum);
 | 
|---|
 | 71 |                         iomodel->FetchDataToInput(inputs,elements,"md.smb.Wini",SmbWiniEnum);
 | 
|---|
 | 72 |                         iomodel->FetchDataToInput(inputs,elements,"md.smb.Aini",SmbAiniEnum);
 | 
|---|
| [25997] | 73 |                         iomodel->FetchDataToInput(inputs,elements,"md.smb.Adiffini",SmbAdiffiniEnum);
 | 
|---|
| [25379] | 74 |                         iomodel->FetchDataToInput(inputs,elements,"md.smb.Tini",SmbTiniEnum);
 | 
|---|
 | 75 |                         iomodel->FetchDataToInput(inputs,elements,"md.smb.Sizeini",SmbSizeiniEnum);
 | 
|---|
 | 76 |                         iomodel->FetchDataToInput(inputs,elements,"md.smb.aValue",SmbAValueEnum);
 | 
|---|
 | 77 |                         iomodel->FetchDataToInput(inputs,elements,"md.smb.teValue",SmbTeValueEnum);
 | 
|---|
| [25997] | 78 |                         iomodel->FetchDataToInput(inputs,elements,"md.smb.szaValue",SmbSzaValueEnum);
 | 
|---|
 | 79 |                         iomodel->FetchDataToInput(inputs,elements,"md.smb.cotValue",SmbCotValueEnum);
 | 
|---|
 | 80 |                         iomodel->FetchDataToInput(inputs,elements,"md.smb.ccsnowValue",SmbCcsnowValueEnum);
 | 
|---|
 | 81 |                         iomodel->FetchDataToInput(inputs,elements,"md.smb.cciceValue",SmbCciceValueEnum);
 | 
|---|
| [19554] | 82 |                         break;
 | 
|---|
| [19528] | 83 |                 case SMBpddEnum:
 | 
|---|
| [20690] | 84 |                         iomodel->FindConstant(&isdelta18o,"md.smb.isdelta18o");
 | 
|---|
 | 85 |                         iomodel->FindConstant(&ismungsm,"md.smb.ismungsm");
 | 
|---|
| [25374] | 86 |                         iomodel->FindConstant(&issetpddfac,"md.smb.issetpddfac");
 | 
|---|
| [25379] | 87 |                         iomodel->FetchDataToInput(inputs,elements,"md.thermal.spctemperature",ThermalSpctemperatureEnum);
 | 
|---|
 | 88 |                         iomodel->FetchDataToInput(inputs,elements,"md.smb.s0p",SmbS0pEnum);
 | 
|---|
 | 89 |                         iomodel->FetchDataToInput(inputs,elements,"md.smb.s0t",SmbS0tEnum);
 | 
|---|
| [19528] | 90 |                         if(isdelta18o || ismungsm){
 | 
|---|
| [25379] | 91 |                                 iomodel->FetchDataToDatasetInput(inputs,elements,"md.smb.temperatures_lgm",SmbTemperaturesLgmEnum);
 | 
|---|
 | 92 |                                 iomodel->FetchDataToDatasetInput(inputs,elements,"md.smb.temperatures_presentday",SmbTemperaturesPresentdayEnum);
 | 
|---|
 | 93 |                                 iomodel->FetchDataToDatasetInput(inputs,elements,"md.smb.precipitations_presentday",SmbPrecipitationsPresentdayEnum);
 | 
|---|
 | 94 |                                 iomodel->FetchDataToDatasetInput(inputs,elements,"md.smb.precipitations_lgm",SmbPrecipitationsLgmEnum);
 | 
|---|
| [22852] | 95 |                         }else{
 | 
|---|
| [25379] | 96 |                                 iomodel->FetchDataToDatasetInput(inputs,elements,"md.smb.precipitation",SmbPrecipitationEnum);
 | 
|---|
 | 97 |                                 iomodel->FetchDataToDatasetInput(inputs,elements,"md.smb.monthlytemperatures",SmbMonthlytemperaturesEnum);
 | 
|---|
| [19528] | 98 |                         }
 | 
|---|
| [25374] | 99 |                         if(issetpddfac){
 | 
|---|
| [25379] | 100 |                                 iomodel->FetchDataToInput(inputs,elements,"md.smb.pddfac_snow",SmbPddfacSnowEnum,-1.);
 | 
|---|
 | 101 |                                 iomodel->FetchDataToInput(inputs,elements,"md.smb.pddfac_ice",SmbPddfacIceEnum,-1.);
 | 
|---|
| [25374] | 102 |                         }
 | 
|---|
| [19528] | 103 |                         break;
 | 
|---|
| [23317] | 104 |                 case SMBpddSicopolisEnum:
 | 
|---|
| [25379] | 105 |                         iomodel->FetchDataToInput(inputs,elements,"md.smb.s0p",SmbS0pEnum);
 | 
|---|
 | 106 |                         iomodel->FetchDataToInput(inputs,elements,"md.smb.s0t",SmbS0tEnum);
 | 
|---|
| [23317] | 107 |                         iomodel->FindConstant(&isfirnwarming,"md.smb.isfirnwarming");
 | 
|---|
| [25379] | 108 |                         iomodel->FetchDataToInput(inputs,elements,"md.smb.smb_corr",SmbSmbCorrEnum);
 | 
|---|
 | 109 |                         iomodel->FetchDataToInput(inputs,elements,"md.smb.precipitation_anomaly",SmbPrecipitationsAnomalyEnum);
 | 
|---|
 | 110 |                         iomodel->FetchDataToInput(inputs,elements,"md.smb.temperature_anomaly",SmbTemperaturesAnomalyEnum);
 | 
|---|
 | 111 |                         iomodel->FetchDataToDatasetInput(inputs,elements,"md.smb.monthlytemperatures",SmbMonthlytemperaturesEnum);
 | 
|---|
 | 112 |                         iomodel->FetchDataToDatasetInput(inputs,elements,"md.smb.precipitation",SmbPrecipitationEnum);
 | 
|---|
| [23317] | 113 |                         break;
 | 
|---|
| [19528] | 114 |                 case SMBd18opddEnum:
 | 
|---|
| [22852] | 115 |                         iomodel->FindConstant(&istemperaturescaled,"md.smb.istemperaturescaled");
 | 
|---|
 | 116 |                         iomodel->FindConstant(&isprecipscaled,"md.smb.isprecipscaled");
 | 
|---|
| [20690] | 117 |                         iomodel->FindConstant(&ismungsm,"md.smb.ismungsm");
 | 
|---|
 | 118 |                         iomodel->FindConstant(&isd18opd,"md.smb.isd18opd");
 | 
|---|
| [22448] | 119 |                         iomodel->FindConstant(&issetpddfac,"md.smb.issetpddfac");
 | 
|---|
| [25379] | 120 |                         iomodel->FetchDataToInput(inputs,elements,"md.thermal.spctemperature",ThermalSpctemperatureEnum);
 | 
|---|
 | 121 |                         iomodel->FetchDataToInput(inputs,elements,"md.smb.s0p",SmbS0pEnum);
 | 
|---|
 | 122 |                         iomodel->FetchDataToInput(inputs,elements,"md.smb.s0t",SmbS0tEnum);
 | 
|---|
| [20690] | 123 |                         if(isd18opd){
 | 
|---|
| [25379] | 124 |                                 iomodel->FetchDataToDatasetInput(inputs,elements,"md.smb.temperatures_presentday",SmbTemperaturesPresentdayEnum);
 | 
|---|
 | 125 |                                 iomodel->FetchDataToDatasetInput(inputs,elements,"md.smb.precipitations_presentday",SmbPrecipitationsPresentdayEnum);
 | 
|---|
| [22852] | 126 |                                 if(!istemperaturescaled){
 | 
|---|
| [24626] | 127 |                                         /*Fetch array*/
 | 
|---|
 | 128 |                                         IssmDouble* doublearray = NULL;
 | 
|---|
 | 129 |                                         int         M,N;
 | 
|---|
 | 130 |                                         iomodel->FetchData(&doublearray,&M,&N,"md.smb.temperatures_reconstructed");
 | 
|---|
 | 131 |                                         if(M!=iomodel->numberofvertices+1) _error_("md.smb.temperatures_reconstructed should have nbv+1 rows");
 | 
|---|
 | 132 |                                         if(N%12!=0) _error_("md.smb.temperatures_reconstructed should have a multiple of 12 columns (since it is monthly)");
 | 
|---|
 | 133 | 
 | 
|---|
 | 134 |                                         /*Build indices*/
 | 
|---|
 | 135 |                                         int* ids = xNew<int>(N); for(int i=0;i<N;i++) ids[i] = i;
 | 
|---|
 | 136 | 
 | 
|---|
| [25539] | 137 |                                         for(Object* & object : elements->objects){
 | 
|---|
 | 138 |                                                 Element* element=xDynamicCast<Element*>(object);
 | 
|---|
| [25379] | 139 |                                                 element->DatasetInputCreate(doublearray,M-1,N,ids,N,inputs,iomodel,SmbTemperaturesReconstructedEnum);
 | 
|---|
| [24626] | 140 |                                         }
 | 
|---|
 | 141 |                                         xDelete<int>(ids);
 | 
|---|
 | 142 |                                         iomodel->DeleteData(doublearray,"md.smb.temperatures_reconstructed");
 | 
|---|
| [22852] | 143 |                                 }
 | 
|---|
 | 144 |                                 if(!isprecipscaled){
 | 
|---|
| [24626] | 145 |                                         /*Fetch array*/
 | 
|---|
 | 146 |                                         IssmDouble* doublearray = NULL;
 | 
|---|
 | 147 |                                         int         M,N;
 | 
|---|
 | 148 |                                         iomodel->FetchData(&doublearray,&M,&N,"md.smb.precipitations_reconstructed");
 | 
|---|
 | 149 |                                         if(M!=iomodel->numberofvertices+1) _error_("md.smb.precipitations_reconstructed should have nbv+1 rows");
 | 
|---|
 | 150 |                                         if(N%12!=0) _error_("md.smb.precipitations_reconstructed should have a multiple of 12 columns (since it is monthly)");
 | 
|---|
 | 151 | 
 | 
|---|
 | 152 |                                         /*Build indices*/
 | 
|---|
 | 153 |                                         int* ids = xNew<int>(N); for(int i=0;i<N;i++) ids[i] = i;
 | 
|---|
 | 154 | 
 | 
|---|
| [25539] | 155 |                                         for(Object* & object : elements->objects){
 | 
|---|
 | 156 |                                                 Element* element=xDynamicCast<Element*>(object);
 | 
|---|
| [25379] | 157 |                                                 element->DatasetInputCreate(doublearray,M-1,N,ids,N,inputs,iomodel,SmbPrecipitationsReconstructedEnum);
 | 
|---|
| [24626] | 158 |                                         }
 | 
|---|
 | 159 |                                         xDelete<int>(ids);
 | 
|---|
 | 160 |                                         iomodel->DeleteData(doublearray,"md.smb.precipitations_reconstructed");
 | 
|---|
| [22852] | 161 |                                 }
 | 
|---|
| [19528] | 162 |                         }
 | 
|---|
| [22448] | 163 |                         if(issetpddfac){
 | 
|---|
| [25379] | 164 |                                 iomodel->FetchDataToInput(inputs,elements,"md.smb.pddfac_snow",SmbPddfacSnowEnum,-1.);
 | 
|---|
 | 165 |                                 iomodel->FetchDataToInput(inputs,elements,"md.smb.pddfac_ice",SmbPddfacIceEnum,-1.);
 | 
|---|
| [22448] | 166 |                         }
 | 
|---|
| [19528] | 167 |                         break;
 | 
|---|
 | 168 |                 case SMBgradientsEnum:
 | 
|---|
| [25379] | 169 |                         iomodel->FetchDataToInput(inputs,elements,"md.smb.href",SmbHrefEnum);
 | 
|---|
 | 170 |                         iomodel->FetchDataToInput(inputs,elements,"md.smb.smbref",SmbSmbrefEnum);
 | 
|---|
 | 171 |                         iomodel->FetchDataToInput(inputs,elements,"md.smb.b_pos",SmbBPosEnum);
 | 
|---|
 | 172 |                         iomodel->FetchDataToInput(inputs,elements,"md.smb.b_neg",SmbBNegEnum);
 | 
|---|
| [19528] | 173 |                         break;
 | 
|---|
| [21469] | 174 |                 case SMBgradientselaEnum:
 | 
|---|
| [25379] | 175 |                         iomodel->FetchDataToInput(inputs,elements,"md.smb.ela",SmbElaEnum);
 | 
|---|
 | 176 |                         iomodel->FetchDataToInput(inputs,elements,"md.smb.b_pos",SmbBPosEnum);
 | 
|---|
 | 177 |                         iomodel->FetchDataToInput(inputs,elements,"md.smb.b_neg",SmbBNegEnum);
 | 
|---|
 | 178 |                         iomodel->FetchDataToInput(inputs,elements,"md.smb.b_max",SmbBMaxEnum);
 | 
|---|
 | 179 |                         iomodel->FetchDataToInput(inputs,elements,"md.smb.b_min",SmbBMinEnum);
 | 
|---|
| [21469] | 180 |                         break;
 | 
|---|
| [19528] | 181 |                 case SMBhenningEnum:
 | 
|---|
| [25379] | 182 |                         iomodel->FetchDataToInput(inputs,elements,"md.smb.smbref",SmbSmbrefEnum,0.);
 | 
|---|
| [19528] | 183 |                         break;
 | 
|---|
 | 184 |                 case SMBcomponentsEnum:
 | 
|---|
| [25379] | 185 |                         iomodel->FetchDataToInput(inputs,elements,"md.smb.accumulation",SmbAccumulationEnum,0.);
 | 
|---|
 | 186 |                         iomodel->FetchDataToInput(inputs,elements,"md.smb.evaporation",SmbEvaporationEnum,0.);
 | 
|---|
 | 187 |                         iomodel->FetchDataToInput(inputs,elements,"md.smb.runoff",SmbRunoffEnum,0.);
 | 
|---|
| [19528] | 188 |                         break;
 | 
|---|
 | 189 |                 case SMBmeltcomponentsEnum:
 | 
|---|
| [25379] | 190 |                         iomodel->FetchDataToInput(inputs,elements,"md.smb.accumulation",SmbAccumulationEnum,0.);
 | 
|---|
 | 191 |                         iomodel->FetchDataToInput(inputs,elements,"md.smb.evaporation",SmbEvaporationEnum,0.);
 | 
|---|
 | 192 |                         iomodel->FetchDataToInput(inputs,elements,"md.smb.melt",SmbMeltEnum,0.);
 | 
|---|
 | 193 |                         iomodel->FetchDataToInput(inputs,elements,"md.smb.refreeze",SmbRefreezeEnum,0.);
 | 
|---|
| [19528] | 194 |                         break;
 | 
|---|
| [23366] | 195 |                 case SMBgradientscomponentsEnum:
 | 
|---|
| [24385] | 196 |                         /* Nothing to add to input */
 | 
|---|
| [23366] | 197 |                         break;
 | 
|---|
| [23540] | 198 |                 case SMBsemicEnum:
 | 
|---|
| [25379] | 199 |                         iomodel->FetchDataToInput(inputs,elements,"md.thermal.spctemperature",ThermalSpctemperatureEnum);
 | 
|---|
 | 200 |                         iomodel->FetchDataToInput(inputs,elements,"md.smb.s0gcm",SmbS0gcmEnum);
 | 
|---|
 | 201 |                         iomodel->FetchDataToInput(inputs,elements,"md.smb.dailysnowfall",SmbDailysnowfallEnum);
 | 
|---|
 | 202 |                         iomodel->FetchDataToInput(inputs,elements,"md.smb.dailyrainfall",SmbDailyrainfallEnum);
 | 
|---|
 | 203 |                         iomodel->FetchDataToInput(inputs,elements,"md.smb.dailydsradiation",SmbDailydsradiationEnum);
 | 
|---|
 | 204 |                         iomodel->FetchDataToInput(inputs,elements,"md.smb.dailydlradiation",SmbDailydlradiationEnum);
 | 
|---|
 | 205 |                         iomodel->FetchDataToInput(inputs,elements,"md.smb.dailywindspeed",SmbDailywindspeedEnum);
 | 
|---|
 | 206 |                         iomodel->FetchDataToInput(inputs,elements,"md.smb.dailypressure",SmbDailypressureEnum);
 | 
|---|
 | 207 |                         iomodel->FetchDataToInput(inputs,elements,"md.smb.dailyairdensity",SmbDailyairdensityEnum);
 | 
|---|
 | 208 |                         iomodel->FetchDataToInput(inputs,elements,"md.smb.dailyairhumidity",SmbDailyairhumidityEnum);
 | 
|---|
 | 209 |                         iomodel->FetchDataToInput(inputs,elements,"md.smb.dailytemperature",SmbDailytemperatureEnum);
 | 
|---|
| [23540] | 210 |                         break;
 | 
|---|
| [19528] | 211 |                 default:
 | 
|---|
 | 212 |                         _error_("Surface mass balance model "<<EnumToStringx(smb_model)<<" not supported yet");
 | 
|---|
 | 213 |         }
 | 
|---|
 | 214 | 
 | 
|---|
 | 215 | }/*}}}*/
 | 
|---|
 | 216 | void SmbAnalysis::UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum){/*{{{*/
 | 
|---|
 | 217 | 
 | 
|---|
 | 218 |         int     numoutputs;
 | 
|---|
 | 219 |         char**  requestedoutputs = NULL;
 | 
|---|
| [26196] | 220 |         bool    isdelta18o,ismungsm,isd18opd,issetpddfac,interp,cycle,isfirnwarming;
 | 
|---|
| [24791] | 221 |         int     smb_model, smbslices, averaging;
 | 
|---|
| [19528] | 222 |         IssmDouble *temp = NULL;
 | 
|---|
 | 223 |         int         N,M;
 | 
|---|
| [23066] | 224 | 
 | 
|---|
| [20690] | 225 |         parameters->AddObject(iomodel->CopyConstantObject("md.smb.model",SmbEnum));
 | 
|---|
| [23066] | 226 | 
 | 
|---|
| [20690] | 227 |         iomodel->FindConstant(&smb_model,"md.smb.model");
 | 
|---|
| [26208] | 228 |         iomodel->FindConstant(&interp,"md.timestepping.interp_forcing");
 | 
|---|
| [26196] | 229 |         iomodel->FindConstant(&cycle,"md.timestepping.cycle_forcing");
 | 
|---|
| [23066] | 230 | 
 | 
|---|
| [24791] | 231 |         iomodel->FindConstant(&smbslices,"md.smb.steps_per_step");
 | 
|---|
| [24240] | 232 |         parameters->AddObject(new IntParam(SmbStepsPerStepEnum,smbslices));
 | 
|---|
 | 233 | 
 | 
|---|
| [24791] | 234 |         parameters->AddObject(iomodel->CopyConstantObject("md.smb.averaging",SmbAveragingEnum));
 | 
|---|
 | 235 | 
 | 
|---|
| [19528] | 236 |         switch(smb_model){
 | 
|---|
 | 237 |                 case SMBforcingEnum:
 | 
|---|
 | 238 |                         break;
 | 
|---|
| [19554] | 239 |                 case SMBgembEnum:
 | 
|---|
| [20690] | 240 |                         parameters->AddObject(iomodel->CopyConstantObject("md.smb.aIdx",SmbAIdxEnum));
 | 
|---|
 | 241 |                         parameters->AddObject(iomodel->CopyConstantObject("md.smb.swIdx",SmbSwIdxEnum));
 | 
|---|
 | 242 |                         parameters->AddObject(iomodel->CopyConstantObject("md.smb.denIdx",SmbDenIdxEnum));
 | 
|---|
| [23468] | 243 |                         parameters->AddObject(iomodel->CopyConstantObject("md.smb.dsnowIdx",SmbDsnowIdxEnum));
 | 
|---|
| [20690] | 244 |                         parameters->AddObject(iomodel->CopyConstantObject("md.smb.cldFrac",SmbCldFracEnum));
 | 
|---|
 | 245 |                         parameters->AddObject(iomodel->CopyConstantObject("md.smb.t0wet",SmbT0wetEnum));
 | 
|---|
 | 246 |                         parameters->AddObject(iomodel->CopyConstantObject("md.smb.t0dry",SmbT0dryEnum));
 | 
|---|
 | 247 |                         parameters->AddObject(iomodel->CopyConstantObject("md.smb.K",SmbKEnum));
 | 
|---|
 | 248 |                         parameters->AddObject(iomodel->CopyConstantObject("md.smb.aSnow",SmbASnowEnum));
 | 
|---|
 | 249 |                         parameters->AddObject(iomodel->CopyConstantObject("md.smb.aIce",SmbAIceEnum));
 | 
|---|
 | 250 |                         parameters->AddObject(iomodel->CopyConstantObject("md.smb.dt",SmbDtEnum));
 | 
|---|
 | 251 |                         parameters->AddObject(iomodel->CopyConstantObject("md.smb.isgraingrowth",SmbIsgraingrowthEnum));
 | 
|---|
 | 252 |                         parameters->AddObject(iomodel->CopyConstantObject("md.smb.isalbedo",SmbIsalbedoEnum));
 | 
|---|
 | 253 |                         parameters->AddObject(iomodel->CopyConstantObject("md.smb.isshortwave",SmbIsshortwaveEnum));
 | 
|---|
 | 254 |                         parameters->AddObject(iomodel->CopyConstantObject("md.smb.isthermal",SmbIsthermalEnum));
 | 
|---|
 | 255 |                         parameters->AddObject(iomodel->CopyConstantObject("md.smb.isaccumulation",SmbIsaccumulationEnum));
 | 
|---|
 | 256 |                         parameters->AddObject(iomodel->CopyConstantObject("md.smb.ismelt",SmbIsmeltEnum));
 | 
|---|
 | 257 |                         parameters->AddObject(iomodel->CopyConstantObject("md.smb.isdensification",SmbIsdensificationEnum));
 | 
|---|
 | 258 |                         parameters->AddObject(iomodel->CopyConstantObject("md.smb.isturbulentflux",SmbIsturbulentfluxEnum));
 | 
|---|
| [24735] | 259 |                         parameters->AddObject(iomodel->CopyConstantObject("md.smb.isconstrainsurfaceT",SmbIsconstrainsurfaceTEnum));
 | 
|---|
| [20690] | 260 |                         parameters->AddObject(iomodel->CopyConstantObject("md.smb.InitDensityScaling",SmbInitDensityScalingEnum));
 | 
|---|
| [22475] | 261 |                         parameters->AddObject(iomodel->CopyConstantObject("md.smb.ThermoDeltaTScaling",SmbThermoDeltaTScalingEnum));
 | 
|---|
| [22482] | 262 |                         parameters->AddObject(iomodel->CopyConstantObject("md.smb.adThresh",SmbAdThreshEnum));
 | 
|---|
| [19554] | 263 |                         break;
 | 
|---|
| [19528] | 264 |                 case SMBpddEnum:
 | 
|---|
| [20690] | 265 |                         parameters->AddObject(iomodel->CopyConstantObject("md.smb.isdelta18o",SmbIsdelta18oEnum));
 | 
|---|
 | 266 |                         parameters->AddObject(iomodel->CopyConstantObject("md.smb.ismungsm",SmbIsmungsmEnum));
 | 
|---|
| [22448] | 267 |                         parameters->AddObject(iomodel->CopyConstantObject("md.smb.issetpddfac",SmbIssetpddfacEnum));
 | 
|---|
| [20690] | 268 |                         iomodel->FindConstant(&isdelta18o,"md.smb.isdelta18o");
 | 
|---|
 | 269 |                         iomodel->FindConstant(&ismungsm,"md.smb.ismungsm");
 | 
|---|
| [19528] | 270 | 
 | 
|---|
 | 271 |                         if(ismungsm){
 | 
|---|
| [20690] | 272 |                           iomodel->FetchData(&temp,&N,&M,"md.smb.Pfac"); _assert_(N==2);
 | 
|---|
| [26196] | 273 |                           parameters->AddObject(new TransientParam(SmbPfacEnum,&temp[0],&temp[M],interp,cycle,M));
 | 
|---|
| [20690] | 274 |                           iomodel->DeleteData(temp,"md.smb.Pfac");
 | 
|---|
| [23066] | 275 | 
 | 
|---|
| [20690] | 276 |                           iomodel->FetchData(&temp,&N,&M,"md.smb.Tdiff"); _assert_(N==2);
 | 
|---|
| [26196] | 277 |                           parameters->AddObject(new TransientParam(SmbTdiffEnum,&temp[0],&temp[M],interp,cycle,M));
 | 
|---|
| [20690] | 278 |                           iomodel->DeleteData(temp,"md.smb.Tdiff");
 | 
|---|
| [19528] | 279 | 
 | 
|---|
| [20690] | 280 |                           iomodel->FetchData(&temp,&N,&M,"md.smb.sealev"); _assert_(N==2);
 | 
|---|
| [26196] | 281 |                           parameters->AddObject(new TransientParam(SmbSealevEnum,&temp[0],&temp[M],interp,cycle,M));
 | 
|---|
| [20690] | 282 |                           iomodel->DeleteData(temp,"md.smb.sealev");
 | 
|---|
| [19528] | 283 |                         }
 | 
|---|
 | 284 |                         if(isdelta18o){
 | 
|---|
| [20690] | 285 |                                 iomodel->FetchData(&temp,&N,&M,"md.smb.delta18o"); _assert_(N==2);
 | 
|---|
| [26196] | 286 |                                 parameters->AddObject(new TransientParam(SmbDelta18oEnum,&temp[0],&temp[M],interp,cycle,M));
 | 
|---|
| [20690] | 287 |                                 iomodel->DeleteData(temp,"md.smb.delta18o");
 | 
|---|
| [19528] | 288 | 
 | 
|---|
| [20690] | 289 |                                 iomodel->FetchData(&temp,&N,&M,"md.smb.delta18o_surface"); _assert_(N==2);
 | 
|---|
| [26196] | 290 |                                 parameters->AddObject(new TransientParam(SmbDelta18oSurfaceEnum,&temp[0],&temp[M],interp,cycle,M));
 | 
|---|
| [20690] | 291 |                                 iomodel->DeleteData(temp,"md.smb.delta18o_surface");
 | 
|---|
| [19528] | 292 |                         }
 | 
|---|
| [24626] | 293 | 
 | 
|---|
| [19528] | 294 |                         break;
 | 
|---|
| [23317] | 295 |                 case SMBpddSicopolisEnum:
 | 
|---|
| [23328] | 296 |                         parameters->AddObject(iomodel->CopyConstantObject("md.smb.isfirnwarming",SmbIsfirnwarmingEnum));
 | 
|---|
| [23317] | 297 |                         break;
 | 
|---|
| [19528] | 298 |                 case SMBd18opddEnum:
 | 
|---|
| [20690] | 299 |                         parameters->AddObject(iomodel->CopyConstantObject("md.smb.ismungsm",SmbIsmungsmEnum));
 | 
|---|
 | 300 |                         parameters->AddObject(iomodel->CopyConstantObject("md.smb.isd18opd",SmbIsd18opdEnum));
 | 
|---|
| [22448] | 301 |                         parameters->AddObject(iomodel->CopyConstantObject("md.smb.issetpddfac",SmbIssetpddfacEnum));
 | 
|---|
| [20690] | 302 |                         iomodel->FindConstant(&ismungsm,"md.smb.ismungsm");
 | 
|---|
 | 303 |                         iomodel->FindConstant(&isd18opd,"md.smb.isd18opd");
 | 
|---|
| [22448] | 304 |                         iomodel->FindConstant(&issetpddfac,"md.smb.issetpddfac");
 | 
|---|
| [19528] | 305 |                         if(isd18opd){
 | 
|---|
| [22608] | 306 |                                 parameters->AddObject(iomodel->CopyConstantObject("md.smb.f",SmbFEnum));
 | 
|---|
| [22495] | 307 |                                 parameters->AddObject(iomodel->CopyConstantObject("md.smb.istemperaturescaled",SmbIstemperaturescaledEnum));
 | 
|---|
| [22852] | 308 |                                 parameters->AddObject(iomodel->CopyConstantObject("md.smb.isprecipscaled",SmbIsprecipscaledEnum));
 | 
|---|
| [20690] | 309 |                                 iomodel->FetchData(&temp,&N,&M,"md.smb.delta18o"); _assert_(N==2);
 | 
|---|
| [26196] | 310 |                                 parameters->AddObject(new TransientParam(SmbDelta18oEnum,&temp[0],&temp[M],interp,cycle,M));
 | 
|---|
| [20690] | 311 |                                 iomodel->DeleteData(temp,"md.smb.delta18o");
 | 
|---|
| [24626] | 312 | 
 | 
|---|
 | 313 |                                 IssmDouble yts;
 | 
|---|
 | 314 |                                 bool istemperaturescaled,isprecipscaled;
 | 
|---|
 | 315 |                                 iomodel->FindConstant(&yts,"md.constants.yts");
 | 
|---|
 | 316 |                                 iomodel->FindConstant(&istemperaturescaled,"md.smb.istemperaturescaled");
 | 
|---|
 | 317 |                                 iomodel->FindConstant(&isprecipscaled,"md.smb.isprecipscaled");
 | 
|---|
 | 318 |                                 if(!istemperaturescaled){
 | 
|---|
 | 319 |                                         /*Fetch array*/
 | 
|---|
 | 320 |                                         IssmDouble* doublearray = NULL;
 | 
|---|
 | 321 |                                         int         M,N;
 | 
|---|
 | 322 |                                         iomodel->FetchData(&doublearray,&M,&N,"md.smb.temperatures_reconstructed");
 | 
|---|
 | 323 |                                         if(M!=iomodel->numberofvertices+1) _error_("md.smb.temperatures_reconstructed should have nbv+1 rows");
 | 
|---|
 | 324 |                                         if(N%12!=0) _error_("md.smb.temperatures_reconstructed should have a multiple of 12 columns (since it is monthly)");
 | 
|---|
 | 325 |                                         int numyears = N/12; _assert_(numyears*12==N);
 | 
|---|
 | 326 | 
 | 
|---|
 | 327 |                                         /*Check times*/
 | 
|---|
 | 328 |                                         #ifdef _ISSM_DEBUG_
 | 
|---|
 | 329 |                                         for(int i=0;i<numyears;i++){
 | 
|---|
 | 330 |                                                 for(int j=1;j<12;j++){
 | 
|---|
 | 331 |                                                         //_assert_(floor(doublearray[(M-1)*N+i*12+j]/yts)==floor(doublearray[(M-1)*N+i*12]/yts));
 | 
|---|
 | 332 |                                                         _assert_(doublearray[(M-1)*N+i*12+j]>doublearray[(M-1)*N+i*12+j-1]);
 | 
|---|
 | 333 |                                                 }
 | 
|---|
 | 334 |                                         }
 | 
|---|
 | 335 |                                         #endif
 | 
|---|
 | 336 | 
 | 
|---|
 | 337 |                                         /*Build time*/
 | 
|---|
 | 338 |                                         IssmDouble* times = xNew<IssmDouble>(numyears); for(int i=0;i<numyears;i++) times[i] = doublearray[(M-1)*N+i*12];
 | 
|---|
 | 339 |                                         parameters->AddObject(new DoubleVecParam(SmbTemperaturesReconstructedYearsEnum,times,numyears));
 | 
|---|
 | 340 |                                         xDelete<IssmDouble>(times);
 | 
|---|
 | 341 |                                         iomodel->DeleteData(doublearray,"md.smb.temperatures_reconstructed");
 | 
|---|
 | 342 |                                 }
 | 
|---|
 | 343 |                                 if(!isprecipscaled){
 | 
|---|
 | 344 |                                         /*Fetch array*/
 | 
|---|
 | 345 |                                         IssmDouble* doublearray = NULL;
 | 
|---|
 | 346 |                                         int         M,N;
 | 
|---|
 | 347 |                                         iomodel->FetchData(&doublearray,&M,&N,"md.smb.precipitations_reconstructed");
 | 
|---|
 | 348 |                                         if(M!=iomodel->numberofvertices+1) _error_("md.smb.precipitations_reconstructed should have nbv+1 rows");
 | 
|---|
 | 349 |                                         if(N%12!=0) _error_("md.smb.precipitations_reconstructed should have a multiple of 12 columns (since it is monthly)");
 | 
|---|
 | 350 |                                         int numyears = N/12; _assert_(numyears*12==N);
 | 
|---|
 | 351 | 
 | 
|---|
 | 352 |                                         /*Check times*/
 | 
|---|
 | 353 |                                         #ifdef _ISSM_DEBUG_
 | 
|---|
 | 354 |                                         for(int i=0;i<numyears;i++){
 | 
|---|
 | 355 |                                                 for(int j=1;j<12;j++){
 | 
|---|
 | 356 |                                                         //_assert_(floor(doublearray[(M-1)*N+i*12+j]/yts)==floor(doublearray[(M-1)*N+i*12]/yts));
 | 
|---|
 | 357 |                                                         _assert_(doublearray[(M-1)*N+i*12+j]>doublearray[(M-1)*N+i*12+j-1]);
 | 
|---|
 | 358 |                                                 }
 | 
|---|
 | 359 |                                         }
 | 
|---|
 | 360 |                                         #endif
 | 
|---|
 | 361 | 
 | 
|---|
 | 362 |                                         /*Build time*/
 | 
|---|
 | 363 |                                         IssmDouble* times = xNew<IssmDouble>(numyears); for(int i=0;i<numyears;i++) times[i] = doublearray[(M-1)*N+i*12];
 | 
|---|
 | 364 |                                         parameters->AddObject(new DoubleVecParam(SmbPrecipitationsReconstructedYearsEnum,times,numyears));
 | 
|---|
 | 365 |                                         xDelete<IssmDouble>(times);
 | 
|---|
 | 366 |                                         iomodel->DeleteData(doublearray,"md.smb.precipitations_reconstructed");
 | 
|---|
 | 367 |                                 }
 | 
|---|
| [19528] | 368 |                         }
 | 
|---|
| [24626] | 369 | 
 | 
|---|
| [19528] | 370 |                         break;
 | 
|---|
 | 371 |                 case SMBgradientsEnum:
 | 
|---|
 | 372 |                         /*Nothing to add to parameters*/
 | 
|---|
 | 373 |                         break;
 | 
|---|
| [21469] | 374 |                 case SMBgradientselaEnum:
 | 
|---|
 | 375 |                         /*Nothing to add to parameters*/
 | 
|---|
 | 376 |                         break;
 | 
|---|
| [19528] | 377 |                 case SMBhenningEnum:
 | 
|---|
 | 378 |                         /*Nothing to add to parameters*/
 | 
|---|
 | 379 |                         break;
 | 
|---|
 | 380 |                 case SMBcomponentsEnum:
 | 
|---|
 | 381 |                         break;
 | 
|---|
 | 382 |                 case SMBmeltcomponentsEnum:
 | 
|---|
 | 383 |                         break;
 | 
|---|
| [23366] | 384 |                 case SMBgradientscomponentsEnum:
 | 
|---|
 | 385 |                                 parameters->AddObject(iomodel->CopyConstantObject("md.smb.accualti",SmbAccualtiEnum));
 | 
|---|
 | 386 |                                 parameters->AddObject(iomodel->CopyConstantObject("md.smb.runoffalti",SmbRunoffaltiEnum));
 | 
|---|
 | 387 | 
 | 
|---|
| [25209] | 388 |                                 iomodel->FetchData(&temp,&N,&M,"md.smb.accugrad"); _assert_(N==2);
 | 
|---|
| [26196] | 389 |                                 parameters->AddObject(new TransientParam(SmbAccugradEnum,&temp[0],&temp[M],interp,cycle,M));
 | 
|---|
| [25209] | 390 |                                 iomodel->DeleteData(temp,"md.smb.accugrad");
 | 
|---|
 | 391 |                                 iomodel->FetchData(&temp,&N,&M,"md.smb.runoffgrad"); _assert_(N==2);
 | 
|---|
| [26196] | 392 |                                 parameters->AddObject(new TransientParam(SmbRunoffgradEnum,&temp[0],&temp[M],interp,cycle,M));
 | 
|---|
| [25209] | 393 |                                 iomodel->DeleteData(temp,"md.smb.runoffgrad");
 | 
|---|
| [23366] | 394 | 
 | 
|---|
| [25209] | 395 |                                 iomodel->FetchData(&temp,&N,&M,"md.smb.accuref"); _assert_(N==2);
 | 
|---|
| [26196] | 396 |                                 parameters->AddObject(new TransientParam(SmbAccurefEnum,&temp[0],&temp[M],interp,cycle,M));
 | 
|---|
| [25209] | 397 |                                 iomodel->DeleteData(temp,"md.smb.accuref");
 | 
|---|
 | 398 |                                 iomodel->FetchData(&temp,&N,&M,"md.smb.runoffref"); _assert_(N==2);
 | 
|---|
| [26196] | 399 |                                 parameters->AddObject(new TransientParam(SmbRunoffrefEnum,&temp[0],&temp[M],interp,cycle,M));
 | 
|---|
| [25209] | 400 |                                 iomodel->DeleteData(temp,"md.smb.runoffref");
 | 
|---|
| [23366] | 401 |                         break;
 | 
|---|
| [23540] | 402 |                 case SMBsemicEnum:
 | 
|---|
 | 403 |                         /*Nothing to add to parameters*/
 | 
|---|
 | 404 |                         break;
 | 
|---|
| [19528] | 405 |                 default:
 | 
|---|
 | 406 |                         _error_("Surface mass balance model "<<EnumToStringx(smb_model)<<" not supported yet");
 | 
|---|
 | 407 |         }
 | 
|---|
 | 408 | 
 | 
|---|
| [20690] | 409 |         iomodel->FindConstant(&requestedoutputs,&numoutputs,"md.smb.requested_outputs");
 | 
|---|
| [19528] | 410 |         parameters->AddObject(new IntParam(SmbNumRequestedOutputsEnum,numoutputs));
 | 
|---|
 | 411 |         if(numoutputs)parameters->AddObject(new StringArrayParam(SmbRequestedOutputsEnum,requestedoutputs,numoutputs));
 | 
|---|
| [20690] | 412 |         iomodel->DeleteData(&requestedoutputs,numoutputs,"md.smb.requested_outputs");
 | 
|---|
| [19528] | 413 | 
 | 
|---|
 | 414 | }/*}}}*/
 | 
|---|
 | 415 | 
 | 
|---|
 | 416 | /*Finite Element Analysis*/
 | 
|---|
 | 417 | void           SmbAnalysis::Core(FemModel* femmodel){/*{{{*/
 | 
|---|
 | 418 | 
 | 
|---|
 | 419 |         int    smb_model;
 | 
|---|
 | 420 | 
 | 
|---|
 | 421 |         /*Figure out smb model: */
 | 
|---|
 | 422 |         femmodel->parameters->FindParam(&smb_model,SmbEnum);
 | 
|---|
| [23066] | 423 | 
 | 
|---|
| [19528] | 424 |         /*branch to correct module*/
 | 
|---|
 | 425 |         switch(smb_model){
 | 
|---|
 | 426 |                 case SMBforcingEnum:
 | 
|---|
| [23814] | 427 |                         SmbForcingx(femmodel);
 | 
|---|
| [19528] | 428 |                         break;
 | 
|---|
| [19554] | 429 |                 case SMBgembEnum:
 | 
|---|
 | 430 |                         Gembx(femmodel);
 | 
|---|
 | 431 |                         break;
 | 
|---|
| [19528] | 432 |                 case SMBpddEnum:
 | 
|---|
 | 433 |                         bool isdelta18o,ismungsm;
 | 
|---|
 | 434 |                         femmodel->parameters->FindParam(&isdelta18o,SmbIsdelta18oEnum);
 | 
|---|
 | 435 |                         femmodel->parameters->FindParam(&ismungsm,SmbIsmungsmEnum);
 | 
|---|
 | 436 |                         if(isdelta18o){
 | 
|---|
 | 437 |                                 if(VerboseSolution()) _printf0_("   call Delta18oParameterization module\n");
 | 
|---|
 | 438 |                                 Delta18oParameterizationx(femmodel);
 | 
|---|
| [23366] | 439 |                         }
 | 
|---|
| [19528] | 440 |                         if(ismungsm){
 | 
|---|
 | 441 |                                 if(VerboseSolution()) _printf0_("   call MungsmtpParameterization module\n");
 | 
|---|
 | 442 |                                 MungsmtpParameterizationx(femmodel);
 | 
|---|
| [23366] | 443 |                         }
 | 
|---|
| [19528] | 444 |                         if(VerboseSolution()) _printf0_("   call positive degree day module\n");
 | 
|---|
 | 445 |                         PositiveDegreeDayx(femmodel);
 | 
|---|
 | 446 |                         break;
 | 
|---|
| [23317] | 447 |                 case SMBpddSicopolisEnum:
 | 
|---|
 | 448 |                         if(VerboseSolution()) _printf0_("   call SICOPOLIS positive degree day module\n");
 | 
|---|
 | 449 |                         PositiveDegreeDaySicopolisx(femmodel);
 | 
|---|
 | 450 |                         break;
 | 
|---|
| [19528] | 451 |                 case SMBd18opddEnum:
 | 
|---|
 | 452 |                         bool isd18opd;
 | 
|---|
 | 453 |                         femmodel->parameters->FindParam(&isd18opd,SmbIsd18opdEnum);
 | 
|---|
 | 454 |                         if(isd18opd){
 | 
|---|
 | 455 |                                 if(VerboseSolution()) _printf0_("   call Delta18opdParameterization module\n");
 | 
|---|
 | 456 |                                 Delta18opdParameterizationx(femmodel);
 | 
|---|
 | 457 |                                 if(VerboseSolution()) _printf0_("   call positive degree day module\n");
 | 
|---|
 | 458 |                                 PositiveDegreeDayx(femmodel);
 | 
|---|
| [23317] | 459 |                         }
 | 
|---|
| [19528] | 460 |                         break;
 | 
|---|
 | 461 |                 case SMBgradientsEnum:
 | 
|---|
 | 462 |                         if(VerboseSolution())_printf0_("        call smb gradients module\n");
 | 
|---|
 | 463 |                         SmbGradientsx(femmodel);
 | 
|---|
 | 464 |                         break;
 | 
|---|
| [21469] | 465 |                 case SMBgradientselaEnum:
 | 
|---|
 | 466 |                         if(VerboseSolution())_printf0_("        call smb gradients ela module\n");
 | 
|---|
 | 467 |                         SmbGradientsElax(femmodel);
 | 
|---|
 | 468 |                         break;
 | 
|---|
| [19528] | 469 |                 case SMBhenningEnum:
 | 
|---|
 | 470 |                         if(VerboseSolution())_printf0_("  call smb Henning module\n");
 | 
|---|
 | 471 |                         SmbHenningx(femmodel);
 | 
|---|
 | 472 |                         break;
 | 
|---|
 | 473 |                 case SMBcomponentsEnum:
 | 
|---|
 | 474 |                         if(VerboseSolution())_printf0_("  call smb Components module\n");
 | 
|---|
 | 475 |                         SmbComponentsx(femmodel);
 | 
|---|
 | 476 |                         break;
 | 
|---|
 | 477 |                 case SMBmeltcomponentsEnum:
 | 
|---|
 | 478 |                         if(VerboseSolution())_printf0_("  call smb Melt Components module\n");
 | 
|---|
 | 479 |                         SmbMeltComponentsx(femmodel);
 | 
|---|
 | 480 |                         break;
 | 
|---|
 | 481 |                 case SMBgcmEnum:
 | 
|---|
 | 482 |                         /*Nothing to be done*/
 | 
|---|
 | 483 |                         break;
 | 
|---|
| [23366] | 484 |                 case SMBgradientscomponentsEnum:
 | 
|---|
 | 485 |                         if(VerboseSolution())_printf0_("        call smb gradients components module\n");
 | 
|---|
 | 486 |                         SmbGradientsComponentsx(femmodel);
 | 
|---|
 | 487 |                         break;
 | 
|---|
| [23540] | 488 |                 case SMBsemicEnum:
 | 
|---|
 | 489 |                         #ifdef _HAVE_SEMIC_
 | 
|---|
 | 490 |                         if(VerboseSolution())_printf0_("  call smb SEMIC module\n");
 | 
|---|
 | 491 |                         SmbSemicx(femmodel);
 | 
|---|
 | 492 |                         #else
 | 
|---|
 | 493 |                         _error_("SEMIC not installed");
 | 
|---|
 | 494 |                         #endif //_HAVE_SEMIC_
 | 
|---|
 | 495 |                         break;
 | 
|---|
| [19528] | 496 |                 default:
 | 
|---|
 | 497 |                         _error_("Surface mass balance model "<<EnumToStringx(smb_model)<<" not supported yet");
 | 
|---|
 | 498 |         }
 | 
|---|
 | 499 | 
 | 
|---|
 | 500 | }/*}}}*/
 | 
|---|
| [26047] | 501 | void           SmbAnalysis::PreCore(FemModel* femmodel){/*{{{*/
 | 
|---|
 | 502 |         _error_("not implemented");
 | 
|---|
 | 503 | }/*}}}*/
 | 
|---|
| [19528] | 504 | ElementVector* SmbAnalysis::CreateDVector(Element* element){/*{{{*/
 | 
|---|
 | 505 |         _error_("not implemented");
 | 
|---|
 | 506 | }/*}}}*/
 | 
|---|
 | 507 | ElementMatrix* SmbAnalysis::CreateJacobianMatrix(Element* element){/*{{{*/
 | 
|---|
 | 508 | _error_("Not implemented");
 | 
|---|
 | 509 | }/*}}}*/
 | 
|---|
 | 510 | ElementMatrix* SmbAnalysis::CreateKMatrix(Element* element){/*{{{*/
 | 
|---|
 | 511 |         _error_("not implemented yet");
 | 
|---|
 | 512 | }/*}}}*/
 | 
|---|
 | 513 | ElementVector* SmbAnalysis::CreatePVector(Element* element){/*{{{*/
 | 
|---|
 | 514 | _error_("not implemented yet");
 | 
|---|
 | 515 | }/*}}}*/
 | 
|---|
 | 516 | void           SmbAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
 | 
|---|
 | 517 |            _error_("not implemented yet");
 | 
|---|
 | 518 | }/*}}}*/
 | 
|---|
| [25317] | 519 | void           SmbAnalysis::GradientJ(Vector<IssmDouble>* gradient,Element*  element,int control_type,int control_interp,int control_index){/*{{{*/
 | 
|---|
| [19528] | 520 |         _error_("Not implemented yet");
 | 
|---|
 | 521 | }/*}}}*/
 | 
|---|
 | 522 | void           SmbAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
 | 
|---|
 | 523 |         _error_("not implemented yet");
 | 
|---|
 | 524 | }/*}}}*/
 | 
|---|
 | 525 | void           SmbAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/
 | 
|---|
 | 526 |         /*Default, do nothing*/
 | 
|---|
 | 527 |         return;
 | 
|---|
 | 528 | }/*}}}*/
 | 
|---|