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