[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 | }/*}}}*/
|
---|
[24335] | 23 | void SmbAnalysis::UpdateElements(Elements* elements,Inputs2* inputs2,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);
|
---|
[24335] | 33 | element->Update(inputs2,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:
|
---|
[24335] | 42 | iomodel->FetchDataToInput(inputs2,elements,"md.smb.mass_balance",SmbMassBalanceEnum,0.);
|
---|
[19528] | 43 | break;
|
---|
[19554] | 44 | case SMBgembEnum:
|
---|
[24335] | 45 | iomodel->FetchDataToInput(inputs2,elements,"md.smb.Ta",SmbTaEnum);
|
---|
| 46 | iomodel->FetchDataToInput(inputs2,elements,"md.smb.V",SmbVEnum);
|
---|
| 47 | iomodel->FetchDataToInput(inputs2,elements,"md.smb.dswrf",SmbDswrfEnum);
|
---|
| 48 | iomodel->FetchDataToInput(inputs2,elements,"md.smb.dlwrf",SmbDlwrfEnum);
|
---|
| 49 | iomodel->FetchDataToInput(inputs2,elements,"md.smb.P",SmbPEnum);
|
---|
| 50 | iomodel->FetchDataToInput(inputs2,elements,"md.smb.eAir",SmbEAirEnum);
|
---|
| 51 | iomodel->FetchDataToInput(inputs2,elements,"md.smb.pAir",SmbPAirEnum);
|
---|
| 52 | iomodel->FetchDataToInput(inputs2,elements,"md.smb.zTop",SmbZTopEnum);
|
---|
| 53 | iomodel->FetchDataToInput(inputs2,elements,"md.smb.dzTop",SmbDzTopEnum);
|
---|
| 54 | iomodel->FetchDataToInput(inputs2,elements,"md.smb.dzMin",SmbDzMinEnum);
|
---|
| 55 | iomodel->FetchDataToInput(inputs2,elements,"md.smb.zY",SmbZYEnum);
|
---|
| 56 | iomodel->FetchDataToInput(inputs2,elements,"md.smb.zMax",SmbZMaxEnum);
|
---|
| 57 | iomodel->FetchDataToInput(inputs2,elements,"md.smb.zMin",SmbZMinEnum);
|
---|
| 58 | iomodel->FetchDataToInput(inputs2,elements,"md.smb.Tmean",SmbTmeanEnum);
|
---|
| 59 | iomodel->FetchDataToInput(inputs2,elements,"md.smb.Vmean",SmbVmeanEnum);
|
---|
| 60 | iomodel->FetchDataToInput(inputs2,elements,"md.smb.C",SmbCEnum);
|
---|
| 61 | iomodel->FetchDataToInput(inputs2,elements,"md.smb.Tz",SmbTzEnum);
|
---|
| 62 | iomodel->FetchDataToInput(inputs2,elements,"md.smb.Vz",SmbVzEnum);
|
---|
[24360] | 63 | InputUpdateFromConstantx(inputs2,elements,false,SmbIsInitializedEnum);
|
---|
[24335] | 64 | iomodel->FetchDataToInput(inputs2,elements,"md.smb.Dzini",SmbDziniEnum);
|
---|
| 65 | iomodel->FetchDataToInput(inputs2,elements,"md.smb.Dini",SmbDiniEnum);
|
---|
| 66 | iomodel->FetchDataToInput(inputs2,elements,"md.smb.Reini",SmbReiniEnum);
|
---|
| 67 | iomodel->FetchDataToInput(inputs2,elements,"md.smb.Gdnini",SmbGdniniEnum);
|
---|
| 68 | iomodel->FetchDataToInput(inputs2,elements,"md.smb.Gspini",SmbGspiniEnum);
|
---|
| 69 | iomodel->FetchDataToInput(inputs2,elements,"md.smb.ECini",SmbECiniEnum);
|
---|
| 70 | iomodel->FetchDataToInput(inputs2,elements,"md.smb.Wini",SmbWiniEnum);
|
---|
| 71 | iomodel->FetchDataToInput(inputs2,elements,"md.smb.Aini",SmbAiniEnum);
|
---|
| 72 | iomodel->FetchDataToInput(inputs2,elements,"md.smb.Tini",SmbTiniEnum);
|
---|
| 73 | iomodel->FetchDataToInput(inputs2,elements,"md.smb.Sizeini",SmbSizeiniEnum);
|
---|
| 74 | iomodel->FetchDataToInput(inputs2,elements,"md.smb.aValue",SmbAValueEnum);
|
---|
| 75 | iomodel->FetchDataToInput(inputs2,elements,"md.smb.teValue",SmbTeValueEnum);
|
---|
[19554] | 76 | break;
|
---|
[19528] | 77 | case SMBpddEnum:
|
---|
[20690] | 78 | iomodel->FindConstant(&isdelta18o,"md.smb.isdelta18o");
|
---|
| 79 | iomodel->FindConstant(&ismungsm,"md.smb.ismungsm");
|
---|
[24335] | 80 | iomodel->FetchDataToInput(inputs2,elements,"md.thermal.spctemperature",ThermalSpctemperatureEnum);
|
---|
| 81 | iomodel->FetchDataToInput(inputs2,elements,"md.smb.s0p",SmbS0pEnum);
|
---|
| 82 | iomodel->FetchDataToInput(inputs2,elements,"md.smb.s0t",SmbS0tEnum);
|
---|
[19528] | 83 | if(isdelta18o || ismungsm){
|
---|
[24335] | 84 | iomodel->FetchDataToInput(inputs2,elements,"md.smb.temperatures_lgm",SmbTemperaturesLgmEnum);
|
---|
| 85 | iomodel->FetchDataToInput(inputs2,elements,"md.smb.temperatures_presentday",SmbTemperaturesPresentdayEnum);
|
---|
| 86 | iomodel->FetchDataToInput(inputs2,elements,"md.smb.precipitations_presentday",SmbPrecipitationsPresentdayEnum);
|
---|
| 87 | iomodel->FetchDataToInput(inputs2,elements,"md.smb.precipitations_lgm",SmbPrecipitationsLgmEnum);
|
---|
[22852] | 88 | }else{
|
---|
[24335] | 89 | iomodel->FetchDataToInput(inputs2,elements,"md.smb.precipitation",SmbPrecipitationEnum);
|
---|
| 90 | iomodel->FetchDataToInput(inputs2,elements,"md.smb.monthlytemperatures",SmbMonthlytemperaturesEnum);
|
---|
[19528] | 91 | }
|
---|
| 92 | break;
|
---|
[23317] | 93 | case SMBpddSicopolisEnum:
|
---|
[24335] | 94 | iomodel->FetchDataToInput(inputs2,elements,"md.smb.s0p",SmbS0pEnum);
|
---|
| 95 | iomodel->FetchDataToInput(inputs2,elements,"md.smb.s0t",SmbS0tEnum);
|
---|
[23317] | 96 | iomodel->FindConstant(&isfirnwarming,"md.smb.isfirnwarming");
|
---|
[24335] | 97 | iomodel->FetchDataToInput(inputs2,elements,"md.smb.smb_corr",SmbSmbCorrEnum);
|
---|
| 98 | iomodel->FetchDataToInput(inputs2,elements,"md.smb.precipitation_anomaly",SmbPrecipitationsAnomalyEnum);
|
---|
| 99 | iomodel->FetchDataToInput(inputs2,elements,"md.smb.temperature_anomaly",SmbTemperaturesAnomalyEnum);
|
---|
[24579] | 100 | iomodel->FetchDataToDatasetInput(inputs2,elements,"md.smb.monthlytemperatures",SmbMonthlytemperaturesEnum);
|
---|
| 101 | iomodel->FetchDataToDatasetInput(inputs2,elements,"md.smb.precipitation",SmbPrecipitationEnum);
|
---|
[23317] | 102 | break;
|
---|
[19528] | 103 | case SMBd18opddEnum:
|
---|
[22852] | 104 | iomodel->FindConstant(&istemperaturescaled,"md.smb.istemperaturescaled");
|
---|
| 105 | iomodel->FindConstant(&isprecipscaled,"md.smb.isprecipscaled");
|
---|
[20690] | 106 | iomodel->FindConstant(&ismungsm,"md.smb.ismungsm");
|
---|
| 107 | iomodel->FindConstant(&isd18opd,"md.smb.isd18opd");
|
---|
[22448] | 108 | iomodel->FindConstant(&issetpddfac,"md.smb.issetpddfac");
|
---|
[24335] | 109 | iomodel->FetchDataToInput(inputs2,elements,"md.thermal.spctemperature",ThermalSpctemperatureEnum);
|
---|
| 110 | iomodel->FetchDataToInput(inputs2,elements,"md.smb.s0p",SmbS0pEnum);
|
---|
| 111 | iomodel->FetchDataToInput(inputs2,elements,"md.smb.s0t",SmbS0tEnum);
|
---|
[20690] | 112 | if(isd18opd){
|
---|
[24335] | 113 | iomodel->FetchDataToInput(inputs2,elements,"md.smb.temperatures_presentday",SmbTemperaturesPresentdayEnum);
|
---|
| 114 | iomodel->FetchDataToInput(inputs2,elements,"md.smb.precipitations_presentday",SmbPrecipitationsPresentdayEnum);
|
---|
[22852] | 115 | if(!istemperaturescaled){
|
---|
[24335] | 116 | iomodel->FetchDataToInput(inputs2,elements,"md.smb.temperatures_reconstructed",SmbTemperaturesReconstructedEnum);
|
---|
[22852] | 117 | }
|
---|
| 118 | if(!isprecipscaled){
|
---|
[24335] | 119 | iomodel->FetchDataToInput(inputs2,elements,"md.smb.precipitations_reconstructed",SmbPrecipitationsReconstructedEnum);
|
---|
[22852] | 120 | }
|
---|
[19528] | 121 | }
|
---|
[22448] | 122 | if(issetpddfac){
|
---|
[24335] | 123 | iomodel->FetchDataToInput(inputs2,elements,"md.smb.pddfac_snow",SmbPddfacSnowEnum,-1.);
|
---|
| 124 | iomodel->FetchDataToInput(inputs2,elements,"md.smb.pddfac_ice",SmbPddfacIceEnum,-1.);
|
---|
[22448] | 125 | }
|
---|
[19528] | 126 | break;
|
---|
| 127 | case SMBgradientsEnum:
|
---|
[24335] | 128 | iomodel->FetchDataToInput(inputs2,elements,"md.smb.href",SmbHrefEnum);
|
---|
| 129 | iomodel->FetchDataToInput(inputs2,elements,"md.smb.smbref",SmbSmbrefEnum);
|
---|
| 130 | iomodel->FetchDataToInput(inputs2,elements,"md.smb.b_pos",SmbBPosEnum);
|
---|
| 131 | iomodel->FetchDataToInput(inputs2,elements,"md.smb.b_neg",SmbBNegEnum);
|
---|
[19528] | 132 | break;
|
---|
[21469] | 133 | case SMBgradientselaEnum:
|
---|
[24335] | 134 | iomodel->FetchDataToInput(inputs2,elements,"md.smb.ela",SmbElaEnum);
|
---|
| 135 | iomodel->FetchDataToInput(inputs2,elements,"md.smb.b_pos",SmbBPosEnum);
|
---|
| 136 | iomodel->FetchDataToInput(inputs2,elements,"md.smb.b_neg",SmbBNegEnum);
|
---|
| 137 | iomodel->FetchDataToInput(inputs2,elements,"md.smb.b_max",SmbBMaxEnum);
|
---|
| 138 | iomodel->FetchDataToInput(inputs2,elements,"md.smb.b_min",SmbBMinEnum);
|
---|
[21469] | 139 | break;
|
---|
[19528] | 140 | case SMBhenningEnum:
|
---|
[24335] | 141 | iomodel->FetchDataToInput(inputs2,elements,"md.smb.smbref",SmbSmbrefEnum,0.);
|
---|
[19528] | 142 | break;
|
---|
| 143 | case SMBcomponentsEnum:
|
---|
[24335] | 144 | iomodel->FetchDataToInput(inputs2,elements,"md.smb.accumulation",SmbAccumulationEnum,0.);
|
---|
| 145 | iomodel->FetchDataToInput(inputs2,elements,"md.smb.evaporation",SmbEvaporationEnum,0.);
|
---|
| 146 | iomodel->FetchDataToInput(inputs2,elements,"md.smb.runoff",SmbRunoffEnum,0.);
|
---|
[19528] | 147 | break;
|
---|
| 148 | case SMBmeltcomponentsEnum:
|
---|
[24335] | 149 | iomodel->FetchDataToInput(inputs2,elements,"md.smb.accumulation",SmbAccumulationEnum,0.);
|
---|
| 150 | iomodel->FetchDataToInput(inputs2,elements,"md.smb.evaporation",SmbEvaporationEnum,0.);
|
---|
| 151 | iomodel->FetchDataToInput(inputs2,elements,"md.smb.melt",SmbMeltEnum,0.);
|
---|
| 152 | iomodel->FetchDataToInput(inputs2,elements,"md.smb.refreeze",SmbRefreezeEnum,0.);
|
---|
[19528] | 153 | break;
|
---|
[23366] | 154 | case SMBgradientscomponentsEnum:
|
---|
[24385] | 155 | /* Nothing to add to input */
|
---|
[23366] | 156 | break;
|
---|
[23540] | 157 | case SMBsemicEnum:
|
---|
[24335] | 158 | iomodel->FetchDataToInput(inputs2,elements,"md.thermal.spctemperature",ThermalSpctemperatureEnum);
|
---|
| 159 | iomodel->FetchDataToInput(inputs2,elements,"md.smb.s0gcm",SmbS0gcmEnum);
|
---|
| 160 | iomodel->FetchDataToInput(inputs2,elements,"md.smb.dailysnowfall",SmbDailysnowfallEnum);
|
---|
| 161 | iomodel->FetchDataToInput(inputs2,elements,"md.smb.dailyrainfall",SmbDailyrainfallEnum);
|
---|
| 162 | iomodel->FetchDataToInput(inputs2,elements,"md.smb.dailydsradiation",SmbDailydsradiationEnum);
|
---|
| 163 | iomodel->FetchDataToInput(inputs2,elements,"md.smb.dailydlradiation",SmbDailydlradiationEnum);
|
---|
| 164 | iomodel->FetchDataToInput(inputs2,elements,"md.smb.dailywindspeed",SmbDailywindspeedEnum);
|
---|
| 165 | iomodel->FetchDataToInput(inputs2,elements,"md.smb.dailypressure",SmbDailypressureEnum);
|
---|
| 166 | iomodel->FetchDataToInput(inputs2,elements,"md.smb.dailyairdensity",SmbDailyairdensityEnum);
|
---|
| 167 | iomodel->FetchDataToInput(inputs2,elements,"md.smb.dailyairhumidity",SmbDailyairhumidityEnum);
|
---|
| 168 | iomodel->FetchDataToInput(inputs2,elements,"md.smb.dailytemperature",SmbDailytemperatureEnum);
|
---|
[23540] | 169 | break;
|
---|
[19528] | 170 | default:
|
---|
| 171 | _error_("Surface mass balance model "<<EnumToStringx(smb_model)<<" not supported yet");
|
---|
| 172 | }
|
---|
| 173 |
|
---|
| 174 | }/*}}}*/
|
---|
| 175 | void SmbAnalysis::UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum){/*{{{*/
|
---|
| 176 |
|
---|
| 177 | int numoutputs;
|
---|
| 178 | char** requestedoutputs = NULL;
|
---|
[23317] | 179 | bool isdelta18o,ismungsm,isd18opd,issetpddfac,interp,isfirnwarming;
|
---|
[24240] | 180 | int smb_model, smbslices;
|
---|
[19528] | 181 | IssmDouble *temp = NULL;
|
---|
| 182 | int N,M;
|
---|
[23066] | 183 |
|
---|
[20690] | 184 | parameters->AddObject(iomodel->CopyConstantObject("md.smb.model",SmbEnum));
|
---|
[23066] | 185 |
|
---|
[20690] | 186 | iomodel->FindConstant(&smb_model,"md.smb.model");
|
---|
| 187 | iomodel->FindConstant(&interp,"md.timestepping.interp_forcings");
|
---|
[23066] | 188 |
|
---|
[24240] | 189 | iomodel->FetchData(&smbslices,"md.smb.steps_per_step");
|
---|
| 190 | parameters->AddObject(new IntParam(SmbStepsPerStepEnum,smbslices));
|
---|
| 191 |
|
---|
[19528] | 192 | switch(smb_model){
|
---|
| 193 | case SMBforcingEnum:
|
---|
[23814] | 194 | parameters->AddObject(iomodel->CopyConstantObject("md.smb.isclimatology",SmbIsclimatologyEnum));
|
---|
[19528] | 195 | break;
|
---|
[19554] | 196 | case SMBgembEnum:
|
---|
[20690] | 197 | parameters->AddObject(iomodel->CopyConstantObject("md.smb.aIdx",SmbAIdxEnum));
|
---|
| 198 | parameters->AddObject(iomodel->CopyConstantObject("md.smb.swIdx",SmbSwIdxEnum));
|
---|
| 199 | parameters->AddObject(iomodel->CopyConstantObject("md.smb.denIdx",SmbDenIdxEnum));
|
---|
[23468] | 200 | parameters->AddObject(iomodel->CopyConstantObject("md.smb.dsnowIdx",SmbDsnowIdxEnum));
|
---|
[20690] | 201 | parameters->AddObject(iomodel->CopyConstantObject("md.smb.cldFrac",SmbCldFracEnum));
|
---|
| 202 | parameters->AddObject(iomodel->CopyConstantObject("md.smb.t0wet",SmbT0wetEnum));
|
---|
| 203 | parameters->AddObject(iomodel->CopyConstantObject("md.smb.t0dry",SmbT0dryEnum));
|
---|
| 204 | parameters->AddObject(iomodel->CopyConstantObject("md.smb.K",SmbKEnum));
|
---|
| 205 | parameters->AddObject(iomodel->CopyConstantObject("md.smb.aSnow",SmbASnowEnum));
|
---|
| 206 | parameters->AddObject(iomodel->CopyConstantObject("md.smb.aIce",SmbAIceEnum));
|
---|
| 207 | parameters->AddObject(iomodel->CopyConstantObject("md.smb.dt",SmbDtEnum));
|
---|
| 208 | parameters->AddObject(iomodel->CopyConstantObject("md.smb.isgraingrowth",SmbIsgraingrowthEnum));
|
---|
| 209 | parameters->AddObject(iomodel->CopyConstantObject("md.smb.isalbedo",SmbIsalbedoEnum));
|
---|
| 210 | parameters->AddObject(iomodel->CopyConstantObject("md.smb.isshortwave",SmbIsshortwaveEnum));
|
---|
| 211 | parameters->AddObject(iomodel->CopyConstantObject("md.smb.isthermal",SmbIsthermalEnum));
|
---|
| 212 | parameters->AddObject(iomodel->CopyConstantObject("md.smb.isaccumulation",SmbIsaccumulationEnum));
|
---|
| 213 | parameters->AddObject(iomodel->CopyConstantObject("md.smb.ismelt",SmbIsmeltEnum));
|
---|
| 214 | parameters->AddObject(iomodel->CopyConstantObject("md.smb.isdensification",SmbIsdensificationEnum));
|
---|
| 215 | parameters->AddObject(iomodel->CopyConstantObject("md.smb.isturbulentflux",SmbIsturbulentfluxEnum));
|
---|
[23808] | 216 | parameters->AddObject(iomodel->CopyConstantObject("md.smb.isclimatology",SmbIsclimatologyEnum));
|
---|
[20690] | 217 | parameters->AddObject(iomodel->CopyConstantObject("md.smb.InitDensityScaling",SmbInitDensityScalingEnum));
|
---|
[22475] | 218 | parameters->AddObject(iomodel->CopyConstantObject("md.smb.ThermoDeltaTScaling",SmbThermoDeltaTScalingEnum));
|
---|
[22482] | 219 | parameters->AddObject(iomodel->CopyConstantObject("md.smb.adThresh",SmbAdThreshEnum));
|
---|
[19554] | 220 | break;
|
---|
[19528] | 221 | case SMBpddEnum:
|
---|
[20690] | 222 | parameters->AddObject(iomodel->CopyConstantObject("md.smb.isdelta18o",SmbIsdelta18oEnum));
|
---|
| 223 | parameters->AddObject(iomodel->CopyConstantObject("md.smb.ismungsm",SmbIsmungsmEnum));
|
---|
[22448] | 224 | parameters->AddObject(iomodel->CopyConstantObject("md.smb.issetpddfac",SmbIssetpddfacEnum));
|
---|
[20690] | 225 | iomodel->FindConstant(&isdelta18o,"md.smb.isdelta18o");
|
---|
| 226 | iomodel->FindConstant(&ismungsm,"md.smb.ismungsm");
|
---|
[19528] | 227 |
|
---|
| 228 | if(ismungsm){
|
---|
[20690] | 229 | iomodel->FetchData(&temp,&N,&M,"md.smb.Pfac"); _assert_(N==2);
|
---|
[19528] | 230 | parameters->AddObject(new TransientParam(SmbPfacEnum,&temp[0],&temp[M],interp,M));
|
---|
[20690] | 231 | iomodel->DeleteData(temp,"md.smb.Pfac");
|
---|
[23066] | 232 |
|
---|
[20690] | 233 | iomodel->FetchData(&temp,&N,&M,"md.smb.Tdiff"); _assert_(N==2);
|
---|
[19528] | 234 | parameters->AddObject(new TransientParam(SmbTdiffEnum,&temp[0],&temp[M],interp,M));
|
---|
[20690] | 235 | iomodel->DeleteData(temp,"md.smb.Tdiff");
|
---|
[19528] | 236 |
|
---|
[20690] | 237 | iomodel->FetchData(&temp,&N,&M,"md.smb.sealev"); _assert_(N==2);
|
---|
[19528] | 238 | parameters->AddObject(new TransientParam(SmbSealevEnum,&temp[0],&temp[M],interp,M));
|
---|
[20690] | 239 | iomodel->DeleteData(temp,"md.smb.sealev");
|
---|
[19528] | 240 | }
|
---|
| 241 | if(isdelta18o){
|
---|
[20690] | 242 | iomodel->FetchData(&temp,&N,&M,"md.smb.delta18o"); _assert_(N==2);
|
---|
[19528] | 243 | parameters->AddObject(new TransientParam(SmbDelta18oEnum,&temp[0],&temp[M],interp,M));
|
---|
[20690] | 244 | iomodel->DeleteData(temp,"md.smb.delta18o");
|
---|
[19528] | 245 |
|
---|
[20690] | 246 | iomodel->FetchData(&temp,&N,&M,"md.smb.delta18o_surface"); _assert_(N==2);
|
---|
[19528] | 247 | parameters->AddObject(new TransientParam(SmbDelta18oSurfaceEnum,&temp[0],&temp[M],interp,M));
|
---|
[20690] | 248 | iomodel->DeleteData(temp,"md.smb.delta18o_surface");
|
---|
[19528] | 249 | }
|
---|
| 250 | break;
|
---|
[23317] | 251 | case SMBpddSicopolisEnum:
|
---|
[23328] | 252 | parameters->AddObject(iomodel->CopyConstantObject("md.smb.isfirnwarming",SmbIsfirnwarmingEnum));
|
---|
[23317] | 253 | break;
|
---|
[19528] | 254 | case SMBd18opddEnum:
|
---|
[20690] | 255 | parameters->AddObject(iomodel->CopyConstantObject("md.smb.ismungsm",SmbIsmungsmEnum));
|
---|
| 256 | parameters->AddObject(iomodel->CopyConstantObject("md.smb.isd18opd",SmbIsd18opdEnum));
|
---|
[22448] | 257 | parameters->AddObject(iomodel->CopyConstantObject("md.smb.issetpddfac",SmbIssetpddfacEnum));
|
---|
[20690] | 258 | iomodel->FindConstant(&ismungsm,"md.smb.ismungsm");
|
---|
| 259 | iomodel->FindConstant(&isd18opd,"md.smb.isd18opd");
|
---|
[22448] | 260 | iomodel->FindConstant(&issetpddfac,"md.smb.issetpddfac");
|
---|
[19528] | 261 | if(isd18opd){
|
---|
[22608] | 262 | parameters->AddObject(iomodel->CopyConstantObject("md.smb.f",SmbFEnum));
|
---|
[22495] | 263 | parameters->AddObject(iomodel->CopyConstantObject("md.smb.istemperaturescaled",SmbIstemperaturescaledEnum));
|
---|
[22852] | 264 | parameters->AddObject(iomodel->CopyConstantObject("md.smb.isprecipscaled",SmbIsprecipscaledEnum));
|
---|
[20690] | 265 | iomodel->FetchData(&temp,&N,&M,"md.smb.delta18o"); _assert_(N==2);
|
---|
[19528] | 266 | parameters->AddObject(new TransientParam(SmbDelta18oEnum,&temp[0],&temp[M],interp,M));
|
---|
[20690] | 267 | iomodel->DeleteData(temp,"md.smb.delta18o");
|
---|
[19528] | 268 | }
|
---|
| 269 | break;
|
---|
| 270 | case SMBgradientsEnum:
|
---|
| 271 | /*Nothing to add to parameters*/
|
---|
| 272 | break;
|
---|
[21469] | 273 | case SMBgradientselaEnum:
|
---|
| 274 | /*Nothing to add to parameters*/
|
---|
| 275 | break;
|
---|
[19528] | 276 | case SMBhenningEnum:
|
---|
| 277 | /*Nothing to add to parameters*/
|
---|
| 278 | break;
|
---|
| 279 | case SMBcomponentsEnum:
|
---|
[23814] | 280 | parameters->AddObject(iomodel->CopyConstantObject("md.smb.isclimatology",SmbIsclimatologyEnum));
|
---|
[19528] | 281 | break;
|
---|
| 282 | case SMBmeltcomponentsEnum:
|
---|
[23814] | 283 | parameters->AddObject(iomodel->CopyConstantObject("md.smb.isclimatology",SmbIsclimatologyEnum));
|
---|
[19528] | 284 | break;
|
---|
[23366] | 285 | case SMBgradientscomponentsEnum:
|
---|
| 286 | parameters->AddObject(iomodel->CopyConstantObject("md.smb.accualti",SmbAccualtiEnum));
|
---|
| 287 | parameters->AddObject(iomodel->CopyConstantObject("md.smb.accugrad",SmbAccugradEnum));
|
---|
| 288 | parameters->AddObject(iomodel->CopyConstantObject("md.smb.runoffalti",SmbRunoffaltiEnum));
|
---|
| 289 | parameters->AddObject(iomodel->CopyConstantObject("md.smb.runoffgrad",SmbRunoffgradEnum));
|
---|
| 290 |
|
---|
| 291 | iomodel->FetchData(&temp,&N,&M,"md.smb.accuref"); _assert_(N==2);
|
---|
| 292 | parameters->AddObject(new TransientParam(SmbAccurefEnum,&temp[0],&temp[M],interp,M));
|
---|
| 293 | iomodel->DeleteData(temp,"md.smb.accuref");
|
---|
| 294 |
|
---|
| 295 | iomodel->FetchData(&temp,&N,&M,"md.smb.runoffref"); _assert_(N==2);
|
---|
| 296 | parameters->AddObject(new TransientParam(SmbRunoffrefEnum,&temp[0],&temp[M],interp,M));
|
---|
| 297 | iomodel->DeleteData(temp,"md.smb.runoffref");
|
---|
| 298 | break;
|
---|
[23540] | 299 | case SMBsemicEnum:
|
---|
| 300 | /*Nothing to add to parameters*/
|
---|
| 301 | break;
|
---|
[19528] | 302 | default:
|
---|
| 303 | _error_("Surface mass balance model "<<EnumToStringx(smb_model)<<" not supported yet");
|
---|
| 304 | }
|
---|
| 305 |
|
---|
[20690] | 306 | iomodel->FindConstant(&requestedoutputs,&numoutputs,"md.smb.requested_outputs");
|
---|
[19528] | 307 | parameters->AddObject(new IntParam(SmbNumRequestedOutputsEnum,numoutputs));
|
---|
| 308 | if(numoutputs)parameters->AddObject(new StringArrayParam(SmbRequestedOutputsEnum,requestedoutputs,numoutputs));
|
---|
[20690] | 309 | iomodel->DeleteData(&requestedoutputs,numoutputs,"md.smb.requested_outputs");
|
---|
[19528] | 310 |
|
---|
| 311 | }/*}}}*/
|
---|
| 312 |
|
---|
| 313 | /*Finite Element Analysis*/
|
---|
| 314 | void SmbAnalysis::Core(FemModel* femmodel){/*{{{*/
|
---|
| 315 |
|
---|
| 316 | int smb_model;
|
---|
| 317 |
|
---|
| 318 | /*Figure out smb model: */
|
---|
| 319 | femmodel->parameters->FindParam(&smb_model,SmbEnum);
|
---|
[23066] | 320 |
|
---|
[19528] | 321 | /*branch to correct module*/
|
---|
| 322 | switch(smb_model){
|
---|
| 323 | case SMBforcingEnum:
|
---|
[23814] | 324 | SmbForcingx(femmodel);
|
---|
[19528] | 325 | break;
|
---|
[19554] | 326 | case SMBgembEnum:
|
---|
| 327 | Gembx(femmodel);
|
---|
| 328 | break;
|
---|
[19528] | 329 | case SMBpddEnum:
|
---|
| 330 | bool isdelta18o,ismungsm;
|
---|
| 331 | femmodel->parameters->FindParam(&isdelta18o,SmbIsdelta18oEnum);
|
---|
| 332 | femmodel->parameters->FindParam(&ismungsm,SmbIsmungsmEnum);
|
---|
| 333 | if(isdelta18o){
|
---|
| 334 | if(VerboseSolution()) _printf0_(" call Delta18oParameterization module\n");
|
---|
| 335 | Delta18oParameterizationx(femmodel);
|
---|
[23366] | 336 | }
|
---|
[19528] | 337 | if(ismungsm){
|
---|
| 338 | if(VerboseSolution()) _printf0_(" call MungsmtpParameterization module\n");
|
---|
| 339 | MungsmtpParameterizationx(femmodel);
|
---|
[23366] | 340 | }
|
---|
[19528] | 341 | if(VerboseSolution()) _printf0_(" call positive degree day module\n");
|
---|
| 342 | PositiveDegreeDayx(femmodel);
|
---|
| 343 | break;
|
---|
[23317] | 344 | case SMBpddSicopolisEnum:
|
---|
| 345 | if(VerboseSolution()) _printf0_(" call SICOPOLIS positive degree day module\n");
|
---|
| 346 | PositiveDegreeDaySicopolisx(femmodel);
|
---|
| 347 | break;
|
---|
[19528] | 348 | case SMBd18opddEnum:
|
---|
| 349 | bool isd18opd;
|
---|
| 350 | femmodel->parameters->FindParam(&isd18opd,SmbIsd18opdEnum);
|
---|
| 351 | if(isd18opd){
|
---|
| 352 | if(VerboseSolution()) _printf0_(" call Delta18opdParameterization module\n");
|
---|
| 353 | Delta18opdParameterizationx(femmodel);
|
---|
| 354 | if(VerboseSolution()) _printf0_(" call positive degree day module\n");
|
---|
| 355 | PositiveDegreeDayx(femmodel);
|
---|
[23317] | 356 | }
|
---|
[19528] | 357 | break;
|
---|
| 358 | case SMBgradientsEnum:
|
---|
| 359 | if(VerboseSolution())_printf0_(" call smb gradients module\n");
|
---|
| 360 | SmbGradientsx(femmodel);
|
---|
| 361 | break;
|
---|
[21469] | 362 | case SMBgradientselaEnum:
|
---|
| 363 | if(VerboseSolution())_printf0_(" call smb gradients ela module\n");
|
---|
| 364 | SmbGradientsElax(femmodel);
|
---|
| 365 | break;
|
---|
[19528] | 366 | case SMBhenningEnum:
|
---|
| 367 | if(VerboseSolution())_printf0_(" call smb Henning module\n");
|
---|
| 368 | SmbHenningx(femmodel);
|
---|
| 369 | break;
|
---|
| 370 | case SMBcomponentsEnum:
|
---|
| 371 | if(VerboseSolution())_printf0_(" call smb Components module\n");
|
---|
| 372 | SmbComponentsx(femmodel);
|
---|
| 373 | break;
|
---|
| 374 | case SMBmeltcomponentsEnum:
|
---|
| 375 | if(VerboseSolution())_printf0_(" call smb Melt Components module\n");
|
---|
| 376 | SmbMeltComponentsx(femmodel);
|
---|
| 377 | break;
|
---|
| 378 | case SMBgcmEnum:
|
---|
| 379 | /*Nothing to be done*/
|
---|
| 380 | break;
|
---|
[23366] | 381 | case SMBgradientscomponentsEnum:
|
---|
| 382 | if(VerboseSolution())_printf0_(" call smb gradients components module\n");
|
---|
| 383 | SmbGradientsComponentsx(femmodel);
|
---|
| 384 | break;
|
---|
[23540] | 385 | case SMBsemicEnum:
|
---|
| 386 | #ifdef _HAVE_SEMIC_
|
---|
| 387 | if(VerboseSolution())_printf0_(" call smb SEMIC module\n");
|
---|
| 388 | SmbSemicx(femmodel);
|
---|
| 389 | #else
|
---|
| 390 | _error_("SEMIC not installed");
|
---|
| 391 | #endif //_HAVE_SEMIC_
|
---|
| 392 | break;
|
---|
[19528] | 393 | default:
|
---|
| 394 | _error_("Surface mass balance model "<<EnumToStringx(smb_model)<<" not supported yet");
|
---|
| 395 | }
|
---|
| 396 |
|
---|
| 397 | }/*}}}*/
|
---|
| 398 | ElementVector* SmbAnalysis::CreateDVector(Element* element){/*{{{*/
|
---|
| 399 | _error_("not implemented");
|
---|
| 400 | }/*}}}*/
|
---|
| 401 | ElementMatrix* SmbAnalysis::CreateJacobianMatrix(Element* element){/*{{{*/
|
---|
| 402 | _error_("Not implemented");
|
---|
| 403 | }/*}}}*/
|
---|
| 404 | ElementMatrix* SmbAnalysis::CreateKMatrix(Element* element){/*{{{*/
|
---|
| 405 | _error_("not implemented yet");
|
---|
| 406 | }/*}}}*/
|
---|
| 407 | ElementVector* SmbAnalysis::CreatePVector(Element* element){/*{{{*/
|
---|
| 408 | _error_("not implemented yet");
|
---|
| 409 | }/*}}}*/
|
---|
| 410 | void SmbAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
|
---|
| 411 | _error_("not implemented yet");
|
---|
| 412 | }/*}}}*/
|
---|
| 413 | void SmbAnalysis::GradientJ(Vector<IssmDouble>* gradient,Element* element,int control_type,int control_index){/*{{{*/
|
---|
| 414 | _error_("Not implemented yet");
|
---|
| 415 | }/*}}}*/
|
---|
| 416 | void SmbAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
|
---|
| 417 | _error_("not implemented yet");
|
---|
| 418 | }/*}}}*/
|
---|
| 419 | void SmbAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/
|
---|
| 420 | /*Default, do nothing*/
|
---|
| 421 | return;
|
---|
| 422 | }/*}}}*/
|
---|