Changeset 26073
- Timestamp:
- 03/11/21 10:05:44 (4 years ago)
- Location:
- issm/trunk-jpl
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp
r26070 r26073 227 227 228 228 /*Initialize sea level cumulated sea level loads :*/ 229 InputUpdateFromConstantx(inputs,elements,0.,AccumulatedDeltaIceThicknessEnum);230 InputUpdateFromConstantx(inputs,elements,0.,OldAccumulatedDeltaIceThicknessEnum);229 iomodel->ConstantToInput(inputs,elements,0,AccumulatedDeltaIceThicknessEnum,P1Enum); 230 iomodel->ConstantToInput(inputs,elements,0,OldAccumulatedDeltaIceThicknessEnum,P1Enum); 231 231 232 232 /*for Ivins deformation model, initialize history of ice thickness changes:*/ … … 860 860 newthickness = xNew<IssmDouble>(numvertices); 861 861 IssmDouble* oldthickness = xNew<IssmDouble>(numvertices); 862 IssmDouble* cumdeltathickness = xNew<IssmDouble>(numvertices);863 IssmDouble* deltathickness = xNew<IssmDouble>(numvertices);864 862 IssmDouble* newbase = xNew<IssmDouble>(numvertices); 865 863 IssmDouble* bed = xNew<IssmDouble>(numvertices); … … 877 875 basalelement->GetInputListOnVertices(&phi[0],MaskOceanLevelsetEnum); 878 876 basalelement->GetInputListOnVertices(&sealevel[0],SealevelEnum); 879 if(isgrd)basalelement->GetInputListOnVertices(&cumdeltathickness[0],AccumulatedDeltaIceThicknessEnum);880 877 881 878 /*Do we do grounding line migration?*/ … … 883 880 element->FindParam(&isgroundingline,TransientIsgroundinglineEnum); 884 881 if(isgroundingline) basalelement->GetInputListOnVertices(&bed[0],BedEnum); 885 886 /*What is the delta thickness forcing the sea-level change core: cumulated over time, hence the +=:*/887 if(isgrd){888 for(int i=0;i<numvertices;i++){889 cumdeltathickness[i] += (newthickness[i]-oldthickness[i]);890 }891 }892 882 893 883 /*Find MasstransportHydrostaticAdjustment to figure out how to update the geometry:*/ … … 924 914 element->AddBasalInput(SurfaceEnum,newsurface,P1Enum); 925 915 element->AddBasalInput(BaseEnum,newbase,P1Enum); 926 if(isgrd){ 927 int grdmodel; 928 929 /*accumulate ice thickness changes: */ 930 element->AddBasalInput(AccumulatedDeltaIceThicknessEnum,cumdeltathickness,P1Enum); 931 932 /*for Ivins deformation model, keep history of ice thickness changes:*/ 933 element->FindParam(&grdmodel,GrdModelEnum); 934 if(grdmodel==IvinsEnum){ 935 int *vertexlids = NULL; 936 int *vertexsids= NULL; 937 IssmDouble time; 938 939 TransientInput* transientinput = basalelement->inputs->GetTransientInput(TransientAccumulatedDeltaIceThicknessEnum); 940 941 /*Get values and lid list and recover vertices ids needed to initialize inputs*/ 942 vertexlids = xNew<int>(numvertices); 943 vertexsids = xNew<int>(numvertices); 944 element->FindParam(&time,TimeEnum); 945 element->GetVerticesLidList(&vertexlids[0]); 946 element->GetVerticesSidList(&vertexsids[0]); 947 948 /*Add the current time cumdeltathickness to the existing time series: */ 949 switch(element->ObjectEnum()){ 950 case TriaEnum: transientinput->AddTriaTimeInput( time,numvertices,vertexlids,cumdeltathickness,P1Enum); break; 951 default: _error_("Not implemented yet"); 952 } 953 xDelete<int>(vertexlids); 954 xDelete<int>(vertexsids); 955 } 956 957 /*compute total ice thickness change between two sea-level solver time steps, ie. every frequency*dt:*/ 958 if(count==frequency){ 959 IssmDouble* oldcumdeltathickness = xNew<IssmDouble>(numvertices); 960 961 basalelement->GetInputListOnVertices(&oldcumdeltathickness[0],OldAccumulatedDeltaIceThicknessEnum); 962 element->AddBasalInput(OldAccumulatedDeltaIceThicknessEnum,cumdeltathickness,P1Enum); 963 for(int i=0;i<numvertices;i++)deltathickness[i]=cumdeltathickness[i]-oldcumdeltathickness[i]; 964 element->AddBasalInput(DeltaIceThicknessEnum,deltathickness,P1Enum); 965 966 xDelete<IssmDouble>(oldcumdeltathickness); 967 } 968 969 } 916 970 917 971 918 /*Free ressources:*/ 972 919 xDelete<IssmDouble>(newthickness); 973 xDelete<IssmDouble>(cumdeltathickness);974 xDelete<IssmDouble>(deltathickness);975 920 xDelete<IssmDouble>(newbase); 976 921 xDelete<IssmDouble>(newsurface); -
issm/trunk-jpl/src/c/classes/Elements/Element.cpp
r26058 r26073 1709 1709 } 1710 1710 /*}}}*/ 1711 void Element::InputCreateP1FromConstant(Inputs* inputs,IoModel* iomodel,IssmDouble value_in,int vector_enum){/*{{{*/ 1712 1713 const int NUM_VERTICES = this->GetNumberOfVertices(); 1714 1715 int vertexids[MAXVERTICES]; 1716 int vertexlids[MAXVERTICES]; 1717 IssmDouble values[MAXVERTICES]; 1718 1719 /*Recover vertices ids needed to initialize inputs*/ 1720 _assert_(iomodel->elements); 1721 for(int i=0;i<NUM_VERTICES;i++){ 1722 vertexids[i] =reCast<int>(iomodel->elements[NUM_VERTICES*this->Sid()+i]); //ids for vertices are in the elements array from Matlab 1723 vertexlids[i]=iomodel->my_vertices_lids[vertexids[i]-1]; 1724 } 1725 1726 for(int i=0;i<NUM_VERTICES;i++) values[i]=value_in; 1727 this->SetElementInput(inputs,NUM_VERTICES,vertexlids,values,vector_enum); 1728 1729 } 1730 /*}}}*/ 1711 1731 void Element::ControlInputCreate(IssmDouble* vector,IssmDouble* min_vector,IssmDouble* max_vector,Inputs* inputs,IoModel* iomodel,int M,int N,IssmDouble scale,int input_enum,int id){/*{{{*/ 1712 1732 … … 1946 1966 /*update input*/ 1947 1967 this->SetElementInput(name,constant); 1968 } 1969 /*}}}*/ 1970 void Element::InputUpdateFromConstant(IssmDouble constant, int name, int type){/*{{{*/ 1971 1972 /*Check that name is an element input*/ 1973 if(!IsInputEnum(name)) return; 1974 1975 /*update input*/ 1976 this->SetElementInput(name,constant,type); 1948 1977 } 1949 1978 /*}}}*/ -
issm/trunk-jpl/src/c/classes/Elements/Element.h
r26052 r26073 130 130 int Id(); 131 131 void InputCreate(IssmDouble* vector,Inputs* inputs,IoModel* iomodel,int M,int N,int vector_type,int vector_enum,int code); 132 void InputCreateP1FromConstant(Inputs* inputs,IoModel* iomodel,IssmDouble value,int vector_enum); 132 133 void ControlInputCreate(IssmDouble* doublearray,IssmDouble* independents_min,IssmDouble* independents_max,Inputs*inputs,IoModel* iomodel,int M,int N,IssmDouble scale,int input_enum,int id); 133 134 void DatasetInputAdd(int enum_type,IssmDouble* vector,Inputs* inputs,IoModel* iomodel,int M,int N,int vector_type,int vector_enum,int code,int input_enum); … … 135 136 void InputUpdateFromConstant(int constant, int name); 136 137 void InputUpdateFromConstant(bool constant, int name); 138 void InputUpdateFromConstant(IssmDouble constant, int name, int type); 137 139 138 140 bool IsFloating(); … … 331 333 virtual void ResetHooks()=0; 332 334 virtual void RignotMeltParameterization(void){_error_("not implemented yet");}; 333 virtual void SetElementInput(int enum_in,IssmDouble values){_error_("not implemented yet");}; 335 virtual void SetElementInput(int enum_in,IssmDouble value){_error_("not implemented yet");}; 336 virtual void SetElementInput(int enum_in,IssmDouble value, int type)=0; 334 337 virtual void SetElementInput(Inputs* inputs,int enum_in,IssmDouble values){_error_("not implemented yet");}; 335 338 virtual void SetElementInput(Inputs* inputs,int numindices,int* indices,IssmDouble* values,int enum_in){_error_("not implemented yet");}; -
issm/trunk-jpl/src/c/classes/Elements/Penta.h
r26052 r26073 165 165 void ResetHooks(); 166 166 void RignotMeltParameterization(); 167 void SetElementInput(int enum_in,IssmDouble values); 168 void SetElementInput(Inputs* inputs,int enum_in,IssmDouble values); 167 void SetElementInput(int enum_in,IssmDouble value); 168 void SetElementInput(int enum_in,IssmDouble value,int type){_error_("not implemented yet");}; 169 void SetElementInput(Inputs* inputs,int enum_in,IssmDouble value); 170 void SetElementInput(Inputs* inputs,int enum_in,IssmDouble value,int type){_error_("not implemented yet");}; 169 171 void SetElementInput(Inputs* inputs,int numindices,int* indices,IssmDouble* values,int enum_in); 170 172 void SetControlInputsFromVector(IssmDouble* vector,int control_enum,int control_index,int offset, int M,int N); -
issm/trunk-jpl/src/c/classes/Elements/Seg.h
r26052 r26073 139 139 Element* SpawnBasalElement(bool depthaverage_materials){_error_("not implemented yet");}; 140 140 Element* SpawnTopElement(void){_error_("not implemented yet");}; 141 void SetElementInput(int enum_in,IssmDouble value, int type){_error_("not implemented yet");}; 141 142 IssmDouble StabilizationParameter(IssmDouble u, IssmDouble v, IssmDouble w, IssmDouble diameter, IssmDouble kappa){_error_("not implemented yet");}; 142 143 void StabilizationParameterAnisotropic(IssmDouble* tau_parameter_anisotropic, IssmDouble u, IssmDouble v, IssmDouble w, IssmDouble hx, IssmDouble hy, IssmDouble hz, IssmDouble kappa){_error_("not implemented yet");}; -
issm/trunk-jpl/src/c/classes/Elements/Tetra.h
r26052 r26073 143 143 void SetCurrentConfiguration(Elements* elements,Loads* loads,Nodes* nodes,Materials* materials,Parameters* parameters); 144 144 void SetTemporaryElementType(int element_type_in){_error_("not implemented yet");}; 145 void SetElementInput(Inputs* inputs,int enum_in,IssmDouble value,int type){_error_("not implemented yet");}; 146 void SetElementInput(int enum_in, IssmDouble value, int type){_error_("not implemented yet");}; 145 147 Element* SpawnBasalElement(bool depthaverage_materials); 146 148 Element* SpawnTopElement(void); -
issm/trunk-jpl/src/c/classes/Elements/Tria.cpp
r26069 r26073 4177 4177 inputs->SetTriaInput(enum_in,P0Enum,this->lid,value); 4178 4178 4179 } 4180 /*}}}*/ 4181 void Tria::SetElementInput(int enum_in,IssmDouble value,int type){/*{{{*/ 4182 4183 if(type==P0Enum){ 4184 this->inputs->SetTriaInput(enum_in,P0Enum,this->lid,value); 4185 } 4186 else if(type==P1Enum){ 4187 IssmDouble values[3]; 4188 for(int i=0;i<3;i++)values[i]=value; 4189 int lidlist[3]; 4190 this->GetVerticesLidList(&lidlist[0]); 4191 this->inputs->SetTriaInput(enum_in,P1Enum,3,&lidlist[0],&values[0]); 4192 } 4193 else _error_("interpolation type not supported yet"); 4179 4194 } 4180 4195 /*}}}*/ -
issm/trunk-jpl/src/c/classes/Elements/Tria.h
r26052 r26073 126 126 void ResetLevelsetFromSegmentlist(IssmDouble* segments,int numsegments); 127 127 void RignotMeltParameterization(); 128 void SetElementInput(int enum_in,IssmDouble values); 129 void SetElementInput(Inputs* inputs,int enum_in,IssmDouble values); 128 void SetElementInput(int enum_in,IssmDouble value); 129 void SetElementInput(int enum_in,IssmDouble value,int type); 130 void SetElementInput(Inputs* inputs,int enum_in,IssmDouble value); 130 131 void SetElementInput(Inputs* inputs,int numindices,int* indices,IssmDouble* values,int enum_in); 131 132 void SetControlInputsFromVector(IssmDouble* vector,int control_enum,int control_index,int offset,int M,int N); -
issm/trunk-jpl/src/c/classes/IoModel.cpp
r26047 r26073 447 447 448 448 return NULL; 449 } 450 /*}}}*/ 451 void IoModel::ConstantToInput(Inputs* inputs,Elements* elements,IssmDouble value, int vector_enum,int type){/*{{{*/ 452 453 if (type==P1Enum){ 454 for(Object* & object : elements->objects){ 455 Element* element=xDynamicCast<Element*>(object); 456 element->InputCreateP1FromConstant(inputs,this,value,vector_enum); 457 } 458 } 459 else _error_("not supported yet!"); 460 return; 449 461 } 450 462 /*}}}*/ -
issm/trunk-jpl/src/c/classes/IoModel.h
r25425 r26073 123 123 void CheckFile(void); 124 124 Param *CopyConstantObject(const char* constant_name,int param_enum); 125 void ConstantToInput(Inputs* inputs,Elements* elements,IssmDouble value, int vector_enum,int type); 125 126 IssmDouble *Data(const char* data_name); 126 127 void DeclareIndependents(bool trace,IssmPDouble* X); -
issm/trunk-jpl/src/c/cores/masstransport_core.cpp
r26047 r26073 9 9 #include "../modules/modules.h" 10 10 #include "../solutionsequences/solutionsequences.h" 11 #include "../classes/Inputs/TransientInput.h" 12 void SolidEarthUpdates(FemModel* femmodel); 11 13 12 void masstransport_core(FemModel* femmodel){ 14 void masstransport_core(FemModel* femmodel){ /*{{{*/ 13 15 14 16 /*Start profiler*/ … … 75 77 //} 76 78 } 79 SolidEarthUpdates(femmodel); 80 77 81 femmodel->parameters->SetParam(ThicknessEnum,InputToExtrudeEnum); 78 82 extrudefrombase_core(femmodel); … … 81 85 femmodel->parameters->SetParam(SurfaceEnum,InputToExtrudeEnum); 82 86 extrudefrombase_core(femmodel); 87 83 88 } 84 89 … … 94 99 /*profiler*/ 95 100 femmodel->profiler->Stop(MASSTRANSPORTCORE); 96 } 101 } /*}}}*/ 102 void SolidEarthUpdates(FemModel* femmodel){ /*{{{*/ 103 104 int isgrd; 105 int grdmodel; 106 IssmDouble time; 107 int frequency,count; 108 109 /*retrieve parameters:*/ 110 femmodel->parameters->FindParam(&isgrd,SolidearthSettingsGRDEnum); 111 femmodel->parameters->FindParam(&grdmodel,GrdModelEnum); 112 femmodel->parameters->FindParam(&time,TimeEnum); 113 femmodel->parameters->FindParam(&frequency,SolidearthSettingsRunFrequencyEnum); 114 femmodel->parameters->FindParam(&count,SealevelchangeRunCountEnum); 115 116 /*early return?:*/ 117 if(!isgrd)return; 118 119 /*From old and new thickness, create delta thickness and accumulate:*/ 120 femmodel->inputs->AXPY(-1, ThicknessOldEnum,ThicknessEnum,DeltaIceThicknessEnum); 121 femmodel->inputs->AXPY(+1, DeltaIceThicknessEnum,AccumulatedDeltaIceThicknessEnum,DummyEnum); 122 femmodel->inputs->DuplicateInput(DummyEnum,AccumulatedDeltaIceThicknessEnum); 123 124 /*for Ivins deformation model, keep history of ice thickness changes inside TransientAccumulatedDeltaIceThicknessEnum:*/ 125 if(grdmodel==IvinsEnum){ 126 127 TransientInput* transientinput = femmodel->inputs->GetTransientInput(TransientAccumulatedDeltaIceThicknessEnum); 128 129 for(Object* & object : femmodel->elements->objects){ 130 int *vertexlids = NULL; 131 int *vertexsids= NULL; 132 Element* element=xDynamicCast<Element*>(object); 133 const int numvertices = element->GetNumberOfVertices(); 134 IssmDouble* cumdeltathickness=NULL; 135 136 /*Get values and lid list and recover vertices ids needed to initialize inputs*/ 137 vertexlids = xNew<int>(numvertices); 138 vertexsids = xNew<int>(numvertices); 139 cumdeltathickness=xNew<IssmDouble>(numvertices); 140 element->GetVerticesLidList(&vertexlids[0]); 141 element->GetVerticesSidList(&vertexsids[0]); 142 element->GetInputListOnVertices(&cumdeltathickness[0],AccumulatedDeltaIceThicknessEnum); 143 144 /*Add the current time cumdeltathickness to the existing time series: */ 145 switch(element->ObjectEnum()){ 146 case TriaEnum: transientinput->AddTriaTimeInput( time,numvertices,vertexlids,cumdeltathickness,P1Enum); break; 147 default: _error_("Not implemented yet"); 148 } 149 xDelete<int>(vertexlids); 150 xDelete<int>(vertexsids); 151 xDelete<IssmDouble>(cumdeltathickness); 152 } 153 } 154 155 /*compute total ice thickness change between two sea-level solver time steps, ie. every frequency*dt:*/ 156 if(count==frequency){ 157 femmodel->inputs->AXPY(-1, OldAccumulatedDeltaIceThicknessEnum,AccumulatedDeltaIceThicknessEnum,DeltaIceThicknessEnum); 158 femmodel->inputs->DuplicateInput(AccumulatedDeltaIceThicknessEnum,OldAccumulatedDeltaIceThicknessEnum); 159 } 160 return; 161 }/*}}}*/ -
issm/trunk-jpl/src/c/modules/InputUpdateFromConstantx/InputUpdateFromConstantx.cpp
r25539 r26073 27 27 } 28 28 } 29 30 31 29 32 void InputUpdateFromConstantx(FemModel* femmodel,IssmDouble constant, int name){ 30 33 … … 60 63 } 61 64 } 65 66 void InputUpdateFromConstantx(Inputs* inputs,Elements* elements,IssmDouble constant, int name,int type){ 67 68 if(type==P0Enum) InputUpdateFromConstantx(inputs, elements, constant,name); 69 else if(type==P1Enum){ 70 71 if(VerboseModule()) _printf0_(" Input updates from constant (P1 version)\n"); 72 73 /*Elements and loads drive the update: */ 74 if(IsInputEnum(name)){ 75 for(Object* & object : elements->objects){ 76 Element* element = xDynamicCast<Element*>(object); 77 element->InputUpdateFromConstant(constant,name,P1Enum); 78 } 79 } 80 else{ 81 _error_("not supported yet"); 82 } 83 } 84 else _error_("InputUpdateFromConstantx error message: type not supported yet!"); 85 86 87 } 62 88 void InputUpdateFromConstantx(Inputs* inputs,Elements* elements,bool constant, int name){ 63 89 -
issm/trunk-jpl/src/c/modules/InputUpdateFromConstantx/InputUpdateFromConstantx.h
r25379 r26073 17 17 #endif 18 18 void InputUpdateFromConstantx(Inputs* inputs,Elements* elements,IssmDouble constant,int name); 19 void InputUpdateFromConstantx(Inputs* inputs,Elements* elements,IssmDouble constant,int name, int type); 19 20 void InputUpdateFromConstantx(Inputs* inputs,Elements* elements,bool constant,int name); 20 21 -
issm/trunk-jpl/test/NightlyRun/test2001.m
r26059 r26073 7 7 %GIA Ivins, 2 layer model. 8 8 md.solidearth.settings.grdmodel=2; 9 md.solidearth.settings.isgrd=1; 9 10 10 11 md.materials=materials('litho','ice'); … … 22 23 md.timestepping.start_time=-2400000; %4,800 kyr :: EVALUATION TIME 23 24 md.timestepping.time_step= 2400000; %2,400 kyr :: EVALUATION TIME 24 % to get rid of default final_time , make sure final_time >start_time25 md.timestepping.final_time=2400000; %2, 400 kyr25 % to get rid of default final_time: make sure final_time>start_time 26 md.timestepping.final_time=2400000; %2,500 kyr 26 27 md.masstransport.spcthickness=[... 27 28 [md.geometry.thickness; 0],... … … 49 50 50 51 %Fields and tolerances to track changes 51 field_names ={'UG rd'};52 field_tolerances={1e-13 };52 field_names ={'UGia','UGiaRate'}; 53 field_tolerances={1e-13,1e-13}; 53 54 field_values={... 54 (md.results.TransientSolution(1).SealevelUGrd) 55 (md.results.TransientSolution(2).SealevelUGrd), 56 (md.results.TransientSolution(2).SealevelUGrd) 55 57 };
Note:
See TracChangeset
for help on using the changeset viewer.