Changeset 23906
- Timestamp:
- 05/03/19 11:10:58 (6 years ago)
- Location:
- issm/trunk-jpl
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/classes/Elements/Tria.cpp
r23904 r23906 2726 2726 IssmDouble tf,gamma0,base,delta_t_basin,mean_tf_basin,absval; 2727 2727 IssmDouble basalmeltrate[NUMVERTICES]; 2728 bool islocal; 2728 2729 IssmDouble* delta_t = NULL; 2729 2730 IssmDouble* mean_tf = NULL; … … 2744 2745 this->parameters->FindParam(&gamma0,BasalforcingsIsmp6Gamma0Enum); 2745 2746 this->parameters->FindParam(&delta_t,&M,BasalforcingsIsmp6DeltaTEnum); _assert_(M==num_basins); 2746 this->parameters->FindParam(&mean_tf,&N,BasalforcingsIsmp6AverageTfEnum); _assert_(N==num_basins); 2747 this->parameters->FindParam(&islocal,BasalforcingsIsmp6IsLocalEnum); 2748 if(!islocal) { 2749 this->parameters->FindParam(&mean_tf,&N,BasalforcingsIsmp6AverageTfEnum); _assert_(N==num_basins); 2750 } 2747 2751 Input* tf_input=this->GetInput(BasalforcingsIsmp6TfShelfEnum); _assert_(tf_input); 2748 delta_t_basin = delta_t[basinid]; mean_tf_basin = mean_tf[basinid]; 2752 delta_t_basin = delta_t[basinid]; 2753 if(!islocal) mean_tf_basin = mean_tf[basinid]; 2749 2754 2750 2755 /* Compute melt rate */ … … 2753 2758 gauss->GaussVertex(i); 2754 2759 tf_input->GetInputValue(&tf,gauss); 2755 absval = mean_tf_basin+delta_t_basin; 2756 if (absval<0) {absval = -1.*absval;} 2757 basalmeltrate[i] = gamma0*pow((rhow*cp)/(rhoi*lf),2)*(tf+delta_t_basin)*absval; 2760 if(!islocal) { 2761 absval = mean_tf_basin+delta_t_basin; 2762 if (absval<0) {absval = -1.*absval;} 2763 basalmeltrate[i] = gamma0*pow((rhow*cp)/(rhoi*lf),2)*(tf+delta_t_basin)*absval;} 2764 else {basalmeltrate[i] = gamma0*pow((rhow*cp)/(rhoi*lf),2)*pow(max(tf+delta_t_basin,0.),2);} 2758 2765 } 2759 2766 … … 3489 3496 3490 3497 /*Compute ice shelf base slope (radians)*/ 3491 3498 alpha = atan(sqrt(slopex*slopex + slopey*slopey)); 3492 3499 if(alpha>=M_PI) alpha = M_PI - 0.001; //ensure sin(alpha) > 0 for meltrate calculations 3493 3500 -
issm/trunk-jpl/src/c/modules/FloatingiceMeltingRatex/FloatingiceMeltingRatex.cpp
r23799 r23906 75 75 int num_basins, basinid,num_depths; 76 76 IssmDouble area, tf, base, time; 77 bool islocal; 77 78 IssmDouble* tf_depths = NULL; 78 79 79 80 femmodel->parameters->FindParam(&num_basins,BasalforcingsIsmp6NumBasinsEnum); 80 81 femmodel->parameters->FindParam(&tf_depths,&num_depths,BasalforcingsIsmp6TfDepthsEnum); _assert_(tf_depths); 82 femmodel->parameters->FindParam(&islocal,BasalforcingsIsmp6IsLocalEnum); 81 83 82 84 /*Binary search works for vectors that are sorted in increasing order only, make depths positive*/ … … 148 150 } 149 151 150 /*Compute sums of tf*area and shelf-area per cpu*/ 151 for(int i=0;i<femmodel->elements->Size();i++){ 152 Element* element=xDynamicCast<Element*>(femmodel->elements->GetObjectByOffset(i)); 153 if(!element->IsIceInElement() || !element->IsFloating()) continue; 154 Input* tf_input=element->GetInput(BasalforcingsIsmp6TfShelfEnum); _assert_(tf_input); 155 element->inputs->GetInputValue(&basinid,BasalforcingsIsmp6BasinIdEnum); 156 Gauss* gauss=element->NewGauss(1); gauss->GaussPoint(0); 157 tf_input->GetInputValue(&tf,gauss); 158 delete gauss; 159 area=element->GetHorizontalSurfaceArea(); 160 tf_weighted_avg[basinid]+=tf*area; 161 areas_summed[basinid] +=area; 152 if(!islocal) { 153 /*Compute sums of tf*area and shelf-area per cpu*/ 154 for(int i=0;i<femmodel->elements->Size();i++){ 155 Element* element=xDynamicCast<Element*>(femmodel->elements->GetObjectByOffset(i)); 156 if(!element->IsIceInElement() || !element->IsFloating()) continue; 157 Input* tf_input=element->GetInput(BasalforcingsIsmp6TfShelfEnum); _assert_(tf_input); 158 element->inputs->GetInputValue(&basinid,BasalforcingsIsmp6BasinIdEnum); 159 Gauss* gauss=element->NewGauss(1); gauss->GaussPoint(0); 160 tf_input->GetInputValue(&tf,gauss); 161 delete gauss; 162 area=element->GetHorizontalSurfaceArea(); 163 tf_weighted_avg[basinid]+=tf*area; 164 areas_summed[basinid] +=area; 165 } 166 167 /*Syncronize across cpus*/ 168 ISSM_MPI_Allreduce(tf_weighted_avg,tf_weighted_avg_cpu,num_basins,ISSM_MPI_DOUBLE,ISSM_MPI_SUM,IssmComm::GetComm()); 169 ISSM_MPI_Allreduce(areas_summed,areas_summed_cpu,num_basins,ISSM_MPI_DOUBLE,ISSM_MPI_SUM,IssmComm::GetComm()); 170 171 /*Compute weighted means and save*/ 172 for(int k=0;k<num_basins;k++){tf_weighted_avg_cpu[k] = tf_weighted_avg_cpu[k]/areas_summed_cpu[k];} 173 femmodel->parameters->AddObject(new DoubleVecParam(BasalforcingsIsmp6AverageTfEnum,tf_weighted_avg_cpu,num_basins)); 162 174 } 163 164 /*Syncronize across cpus*/165 ISSM_MPI_Allreduce(tf_weighted_avg,tf_weighted_avg_cpu,num_basins,ISSM_MPI_DOUBLE,ISSM_MPI_SUM,IssmComm::GetComm());166 ISSM_MPI_Allreduce(areas_summed,areas_summed_cpu,num_basins,ISSM_MPI_DOUBLE,ISSM_MPI_SUM,IssmComm::GetComm());167 168 /*Compute weighted means and save*/169 for(int k=0;k<num_basins;k++){tf_weighted_avg_cpu[k] = tf_weighted_avg_cpu[k]/areas_summed_cpu[k];}170 femmodel->parameters->AddObject(new DoubleVecParam(BasalforcingsIsmp6AverageTfEnum,tf_weighted_avg_cpu,num_basins));171 175 172 176 /*Cleanup and return */ -
issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateParameters.cpp
r23843 r23906 238 238 parameters->AddObject(iomodel->CopyConstantObject("md.basalforcings.num_basins",BasalforcingsIsmp6NumBasinsEnum)); 239 239 parameters->AddObject(iomodel->CopyConstantObject("md.basalforcings.gamma_0",BasalforcingsIsmp6Gamma0Enum)); 240 parameters->AddObject(iomodel->CopyConstantObject("md.basalforcings.islocal",BasalforcingsIsmp6IsLocalEnum)); 240 241 iomodel->FetchData(&transparam,&M,&N,"md.basalforcings.delta_t"); 241 242 parameters->AddObject(new DoubleVecParam(BasalforcingsIsmp6DeltaTEnum,transparam,N)); -
issm/trunk-jpl/src/c/shared/Enum/EnumDefinitions.h
r23900 r23906 67 67 BasalforcingsIsmp6DeltaTEnum, 68 68 BasalforcingsIsmp6Gamma0Enum, 69 BasalforcingsIsmp6IsLocalEnum, 69 70 BasalforcingsIsmp6NumBasinsEnum, 70 71 BasalforcingsIsmp6TfDepthsEnum, -
issm/trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp
r23900 r23906 75 75 case BasalforcingsIsmp6DeltaTEnum : return "BasalforcingsIsmp6DeltaT"; 76 76 case BasalforcingsIsmp6Gamma0Enum : return "BasalforcingsIsmp6Gamma0"; 77 case BasalforcingsIsmp6IsLocalEnum : return "BasalforcingsIsmp6IsLocal"; 77 78 case BasalforcingsIsmp6NumBasinsEnum : return "BasalforcingsIsmp6NumBasins"; 78 79 case BasalforcingsIsmp6TfDepthsEnum : return "BasalforcingsIsmp6TfDepths"; -
issm/trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp
r23900 r23906 75 75 else if (strcmp(name,"BasalforcingsIsmp6DeltaT")==0) return BasalforcingsIsmp6DeltaTEnum; 76 76 else if (strcmp(name,"BasalforcingsIsmp6Gamma0")==0) return BasalforcingsIsmp6Gamma0Enum; 77 else if (strcmp(name,"BasalforcingsIsmp6IsLocal")==0) return BasalforcingsIsmp6IsLocalEnum; 77 78 else if (strcmp(name,"BasalforcingsIsmp6NumBasins")==0) return BasalforcingsIsmp6NumBasinsEnum; 78 79 else if (strcmp(name,"BasalforcingsIsmp6TfDepths")==0) return BasalforcingsIsmp6TfDepthsEnum; … … 136 137 else if (strcmp(name,"FemModelComm")==0) return FemModelCommEnum; 137 138 else if (strcmp(name,"FlowequationFeFS")==0) return FlowequationFeFSEnum; 138 else if (strcmp(name,"FlowequationIsFS")==0) return FlowequationIsFSEnum;139 139 else stage=2; 140 140 } 141 141 if(stage==2){ 142 if (strcmp(name,"FlowequationIsHO")==0) return FlowequationIsHOEnum; 142 if (strcmp(name,"FlowequationIsFS")==0) return FlowequationIsFSEnum; 143 else if (strcmp(name,"FlowequationIsHO")==0) return FlowequationIsHOEnum; 143 144 else if (strcmp(name,"FlowequationIsL1L2")==0) return FlowequationIsL1L2Enum; 144 145 else if (strcmp(name,"FlowequationIsSIA")==0) return FlowequationIsSIAEnum; … … 259 260 else if (strcmp(name,"MaterialsTemperateiceconductivity")==0) return MaterialsTemperateiceconductivityEnum; 260 261 else if (strcmp(name,"MaterialsEffectiveconductivityAveraging")==0) return MaterialsEffectiveconductivityAveragingEnum; 261 else if (strcmp(name,"MaterialsThermalconductivity")==0) return MaterialsThermalconductivityEnum;262 262 else stage=3; 263 263 } 264 264 if(stage==3){ 265 if (strcmp(name,"MaterialsThermalExchangeVelocity")==0) return MaterialsThermalExchangeVelocityEnum; 265 if (strcmp(name,"MaterialsThermalconductivity")==0) return MaterialsThermalconductivityEnum; 266 else if (strcmp(name,"MaterialsThermalExchangeVelocity")==0) return MaterialsThermalExchangeVelocityEnum; 266 267 else if (strcmp(name,"MeltingOffset")==0) return MeltingOffsetEnum; 267 268 else if (strcmp(name,"MeshAverageVertexConnectivity")==0) return MeshAverageVertexConnectivityEnum; … … 382 383 else if (strcmp(name,"SteadystateNumRequestedOutputs")==0) return SteadystateNumRequestedOutputsEnum; 383 384 else if (strcmp(name,"SteadystateReltol")==0) return SteadystateReltolEnum; 384 else if (strcmp(name,"SteadystateRequestedOutputs")==0) return SteadystateRequestedOutputsEnum;385 385 else stage=4; 386 386 } 387 387 if(stage==4){ 388 if (strcmp(name,"Step")==0) return StepEnum; 388 if (strcmp(name,"SteadystateRequestedOutputs")==0) return SteadystateRequestedOutputsEnum; 389 else if (strcmp(name,"Step")==0) return StepEnum; 389 390 else if (strcmp(name,"StressbalanceAbstol")==0) return StressbalanceAbstolEnum; 390 391 else if (strcmp(name,"StressbalanceFSreconditioning")==0) return StressbalanceFSreconditioningEnum; … … 505 506 else if (strcmp(name,"EffectivePressureHydrostep")==0) return EffectivePressureHydrostepEnum; 506 507 else if (strcmp(name,"EffectivePressureStacked")==0) return EffectivePressureStackedEnum; 507 else if (strcmp(name,"EffectivePressure")==0) return EffectivePressureEnum;508 508 else stage=5; 509 509 } 510 510 if(stage==5){ 511 if (strcmp(name,"Enthalpy")==0) return EnthalpyEnum; 511 if (strcmp(name,"EffectivePressure")==0) return EffectivePressureEnum; 512 else if (strcmp(name,"Enthalpy")==0) return EnthalpyEnum; 512 513 else if (strcmp(name,"EnthalpyPicard")==0) return EnthalpyPicardEnum; 513 514 else if (strcmp(name,"EplHeadStacked")==0) return EplHeadStackedEnum; … … 628 629 else if (strcmp(name,"SealevelRSLRate")==0) return SealevelRSLRateEnum; 629 630 else if (strcmp(name,"SealevelUEsa")==0) return SealevelUEsaEnum; 630 else if (strcmp(name,"SealevelRSLEustaticRate")==0) return SealevelRSLEustaticRateEnum;631 631 else stage=6; 632 632 } 633 633 if(stage==6){ 634 if (strcmp(name,"SealevelriseSpcthickness")==0) return SealevelriseSpcthicknessEnum; 634 if (strcmp(name,"SealevelRSLEustaticRate")==0) return SealevelRSLEustaticRateEnum; 635 else if (strcmp(name,"SealevelriseSpcthickness")==0) return SealevelriseSpcthicknessEnum; 635 636 else if (strcmp(name,"SealevelriseStericRate")==0) return SealevelriseStericRateEnum; 636 637 else if (strcmp(name,"SealevelNEsa")==0) return SealevelNEsaEnum; … … 751 752 else if (strcmp(name,"StressTensorxy")==0) return StressTensorxyEnum; 752 753 else if (strcmp(name,"StressTensorxz")==0) return StressTensorxzEnum; 753 else if (strcmp(name,"StressTensoryy")==0) return StressTensoryyEnum;754 754 else stage=7; 755 755 } 756 756 if(stage==7){ 757 if (strcmp(name,"StressTensoryz")==0) return StressTensoryzEnum; 757 if (strcmp(name,"StressTensoryy")==0) return StressTensoryyEnum; 758 else if (strcmp(name,"StressTensoryz")==0) return StressTensoryzEnum; 758 759 else if (strcmp(name,"StressTensorzz")==0) return StressTensorzzEnum; 759 760 else if (strcmp(name,"SurfaceAbsMisfit")==0) return SurfaceAbsMisfitEnum; … … 874 875 else if (strcmp(name,"Outputdefinition75")==0) return Outputdefinition75Enum; 875 876 else if (strcmp(name,"Outputdefinition76")==0) return Outputdefinition76Enum; 876 else if (strcmp(name,"Outputdefinition77")==0) return Outputdefinition77Enum;877 877 else stage=8; 878 878 } 879 879 if(stage==8){ 880 if (strcmp(name,"Outputdefinition78")==0) return Outputdefinition78Enum; 880 if (strcmp(name,"Outputdefinition77")==0) return Outputdefinition77Enum; 881 else if (strcmp(name,"Outputdefinition78")==0) return Outputdefinition78Enum; 881 882 else if (strcmp(name,"Outputdefinition79")==0) return Outputdefinition79Enum; 882 883 else if (strcmp(name,"Outputdefinition7")==0) return Outputdefinition7Enum; … … 997 998 else if (strcmp(name,"FreeSurfaceTopAnalysis")==0) return FreeSurfaceTopAnalysisEnum; 998 999 else if (strcmp(name,"FrontalForcingsDefault")==0) return FrontalForcingsDefaultEnum; 999 else if (strcmp(name,"FrontalForcingsRignot")==0) return FrontalForcingsRignotEnum;1000 1000 else stage=9; 1001 1001 } 1002 1002 if(stage==9){ 1003 if (strcmp(name,"FSApproximation")==0) return FSApproximationEnum; 1003 if (strcmp(name,"FrontalForcingsRignot")==0) return FrontalForcingsRignotEnum; 1004 else if (strcmp(name,"FSApproximation")==0) return FSApproximationEnum; 1004 1005 else if (strcmp(name,"Fset")==0) return FsetEnum; 1005 1006 else if (strcmp(name,"FSpressure")==0) return FSpressureEnum; … … 1120 1121 else if (strcmp(name,"Mumps")==0) return MumpsEnum; 1121 1122 else if (strcmp(name,"Nodal")==0) return NodalEnum; 1122 else if (strcmp(name,"Nodalvalue")==0) return NodalvalueEnum;1123 1123 else stage=10; 1124 1124 } 1125 1125 if(stage==10){ 1126 if (strcmp(name,"NodeSId")==0) return NodeSIdEnum; 1126 if (strcmp(name,"Nodalvalue")==0) return NodalvalueEnum; 1127 else if (strcmp(name,"NodeSId")==0) return NodeSIdEnum; 1127 1128 else if (strcmp(name,"NoFrictionOnPartiallyFloating")==0) return NoFrictionOnPartiallyFloatingEnum; 1128 1129 else if (strcmp(name,"NoMeltOnPartiallyFloating")==0) return NoMeltOnPartiallyFloatingEnum; … … 1243 1244 else if (strcmp(name,"VertexLId")==0) return VertexLIdEnum; 1244 1245 else if (strcmp(name,"Vertices")==0) return VerticesEnum; 1245 else if (strcmp(name,"ViscousHeating")==0) return ViscousHeatingEnum;1246 1246 else stage=11; 1247 1247 } 1248 1248 if(stage==11){ 1249 if (strcmp(name,"Water")==0) return WaterEnum; 1249 if (strcmp(name,"ViscousHeating")==0) return ViscousHeatingEnum; 1250 else if (strcmp(name,"Water")==0) return WaterEnum; 1250 1251 else if (strcmp(name,"XTaylorHood")==0) return XTaylorHoodEnum; 1251 1252 else if (strcmp(name,"XY")==0) return XYEnum; -
issm/trunk-jpl/src/m/classes/basalforcingsismip6.m
r23799 r23906 12 12 tf_depths = NaN; 13 13 delta_t = NaN; 14 islocal = 0; 14 15 geothermalflux = NaN; 15 16 groundedice_melting_rate = NaN; … … 47 48 function self = setdefaultparameters(self) % {{{ 48 49 self.gamma_0 = 14477; %m/yr 50 self.islocal = false; 49 51 end % }}} 50 52 function md = checkconsistency(self,md,solution,analyses) % {{{ … … 55 57 md = checkfield(md,'fieldname','basalforcings.tf_depths','NaN',1,'Inf',1); 56 58 md = checkfield(md,'fieldname','basalforcings.delta_t','NaN',1,'Inf',1,'numel',md.basalforcings.num_basins); 59 md = checkfield(md,'fieldname','basalforcings.islocal','values',[0 1]); 57 60 md = checkfield(md,'fieldname','basalforcings.geothermalflux','NaN',1,'Inf',1,'>=',0,'timeseries',1); 58 61 md = checkfield(md,'fieldname','basalforcings.groundedice_melting_rate','NaN',1,'Inf',1,'timeseries',1); … … 72 75 fielddisplay(self,'tf','thermal forcing (ocean temperature minus freezing point) (degrees C)'); 73 76 fielddisplay(self,'delta_t','Ocean temperature correction per basin (degrees C)'); 77 fielddisplay(self,'islocal','boolean to use the local version of the ISMIP6 melt rate parameterization (default false)'); 74 78 fielddisplay(self,'geothermalflux','geothermal heat flux (W/m^2)'); 75 79 fielddisplay(self,'groundedice_melting_rate','basal melting rate (positive if melting) (m/yr)'); … … 87 91 WriteData(fid,prefix,'object',self,'fieldname','tf','format','MatArray','name','md.basalforcings.tf','timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts); 88 92 WriteData(fid,prefix,'object',self,'fieldname','delta_t','format','DoubleMat','name','md.basalforcings.delta_t','timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts); 93 WriteData(fid,prefix,'object',self,'fieldname','islocal','format','Boolean'); 89 94 WriteData(fid,prefix,'object',self,'fieldname','geothermalflux','format','DoubleMat','name','md.basalforcings.geothermalflux','mattype',1,'timeserieslength',md.mesh.numberofelements+1,'yts',md.constants.yts); 90 95 WriteData(fid,prefix,'object',self,'fieldname','groundedice_melting_rate','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts); -
issm/trunk-jpl/test/NightlyRun/test472.m
r23799 r23906 24 24 md.basalforcings.tf_depths = [0 -1000 -2000]; 25 25 md.basalforcings.gamma_0 = 14477; 26 md.basalforcings.islocal = 0; 26 27 27 28 %Build an artificial tf field (for times 0 and 1, 3 depth layers)
Note:
See TracChangeset
for help on using the changeset viewer.