Changeset 27095
- Timestamp:
- 06/22/22 16:12:28 (3 years ago)
- Location:
- issm/branches/trunk-larour-SLPS2022/src/c
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified issm/branches/trunk-larour-SLPS2022/src/c/analyses/MmemasstransportAnalysis.cpp ¶
r27084 r27095 1 #include "./Mmemasstransport transportAnalysis.h"1 #include "./MmemasstransportAnalysis.h" 2 2 #include <math.h> 3 3 #include "../toolkits/toolkits.h" … … 8 8 9 9 /*Model processing*/ 10 void Mmemasstransport transportAnalysis::CreateConstraints(Constraints* constraints,IoModel* iomodel){/*{{{*/10 void MmemasstransportAnalysis::CreateConstraints(Constraints* constraints,IoModel* iomodel){/*{{{*/ 11 11 /*No constraints*/ 12 12 }/*}}}*/ 13 void Mmemasstransport transportAnalysis::CreateLoads(Loads* loads, IoModel* iomodel){/*{{{*/13 void MmemasstransportAnalysis::CreateLoads(Loads* loads, IoModel* iomodel){/*{{{*/ 14 14 /*No loads*/ 15 15 }/*}}}*/ 16 void Mmemasstransport transportAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel,bool isamr){/*{{{*/17 ::CreateNodes(nodes,iomodel,Mmemasstransport transportAnalysisEnum,P1Enum);16 void MmemasstransportAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel,bool isamr){/*{{{*/ 17 ::CreateNodes(nodes,iomodel,MmemasstransportAnalysisEnum,P1Enum); 18 18 }/*}}}*/ 19 int Mmemasstransport transportAnalysis::DofsPerNode(int** doflist,int domaintype,int approximation){/*{{{*/19 int MmemasstransportAnalysis::DofsPerNode(int** doflist,int domaintype,int approximation){/*{{{*/ 20 20 return 3; 21 21 }/*}}}*/ 22 void Mmemasstransport transportAnalysis::UpdateElements(Elements* elements,Inputs* inputs,IoModel* iomodel,int analysis_counter,int analysis_type){/*{{{*/22 void MmemasstransportAnalysis::UpdateElements(Elements* elements,Inputs* inputs,IoModel* iomodel,int analysis_counter,int analysis_type){/*{{{*/ 23 23 24 24 int nature=0; … … 36 36 37 37 /*Plug inputs into element:*/ 38 iomodel->FetchDataToInput(inputs,elements,"md.mmemasstransport.deltathickness", MmemasstransportDeltathicknessEnum); 38 iomodel->FetchDataToInput(inputs,elements,"md.geometry.thickness",ThicknessEnum); 39 iomodel->FetchDataToInput(inputs,elements,"md.geometry.surface",SurfaceEnum); 40 iomodel->FetchDataToInput(inputs,elements,"md.geometry.base",BaseEnum); 41 iomodel->FetchDataToInput(inputs,elements,"md.initialization.sealevel",SealevelEnum,0); 42 iomodel->FetchDataToInput(inputs,elements,"md.mask.ice_levelset",MaskIceLevelsetEnum); 43 iomodel->FetchDataToInput(inputs,elements,"md.mask.ocean_levelset",MaskOceanLevelsetEnum); 44 iomodel->FetchDataToInput(inputs,elements,"md.mmemasstransport.thickness", MmemasstransportThicknessEnum); 39 45 40 46 /*Initialize sea level cumulated sea level loads :*/ 41 iomodel->ConstantToInput(inputs,elements,0.,AccumulatedDelta ThicknessEnum,P0Enum);42 iomodel->ConstantToInput(inputs,elements,0.,OldAccumulatedDelta ThicknessEnum,P0Enum);47 iomodel->ConstantToInput(inputs,elements,0.,AccumulatedDeltaIceThicknessEnum,P1Enum); 48 iomodel->ConstantToInput(inputs,elements,0.,OldAccumulatedDeltaIceThicknessEnum,P1Enum); 43 49 44 50 }/*}}}*/ 45 void Mmemasstransport transportAnalysis::UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum){/*{{{*/51 void MmemasstransportAnalysis::UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum){/*{{{*/ 46 52 47 53 int numoutputs; 48 54 char** requestedoutputs = NULL; 49 55 50 /*Deal with multi-model ensembles: {{{*/51 52 56 int nids,npart,nel; 53 IssmDouble* modelids=NULL;57 IssmDouble* ids=NULL; 54 58 IssmDouble* partition = NULL; 55 59 56 60 iomodel->FetchData(&nel,"md.mesh.numberofelements"); 57 iomodel->FetchData(&modelids,&nids,NULL,"md.mmemasstransport.modelids"); 58 parameters->AddObject(new DoubleParam(MmemasstransportModelidsEnum,modelids,nids,1)); 61 iomodel->FetchData(&ids,&nids,NULL,"md.mmemasstransport.ids"); 62 //_printf_("nids: " << nids << "\n"); for(int i=0;i<nids;i++)_printf_(ids[i] << "|"); _printf_("\n"); 63 parameters->AddObject(new DoubleMatParam(MmemasstransportModelidsEnum,ids,nids,1)); 59 64 iomodel->FetchData(&partition,&npart,NULL,"md.mmemasstransport.partition"); 60 65 if (npart!=nel)_error_("MmemasstransportAnalysis:UpdateParameters: partition vector should be distributed over elements, not vertices!"); 61 parameters->AddObject(new Double Param(MmemasstransportPartitionEnum,partition,nel,1));66 parameters->AddObject(new DoubleMatParam(MmemasstransportPartitionEnum,partition,nel,1)); 62 67 63 xDelete<IssmDouble>( modelids);68 xDelete<IssmDouble>(ids); 64 69 xDelete<IssmDouble>(partition); 65 66 } /*}}}*/ 67 /*Requested outputs {{{*/ 68 iomodel->FindConstant(&requestedoutputs,&numoutputs,"md.solidearth.requested_outputs"); 69 if(numoutputs)parameters->AddObject(new StringArrayParam(SealevelchangeRequestedOutputsEnum,requestedoutputs,numoutputs)); 70 iomodel->DeleteData(&requestedoutputs,numoutputs,"md.solidearth.requested_outputs"); 71 /*}}}*/ 70 71 /*Requested outputs*/ 72 iomodel->FindConstant(&requestedoutputs,&numoutputs,"md.mmemasstransport.requested_outputs"); 73 parameters->AddObject(new IntParam(MmemasstransportNumRequestedOutputsEnum,numoutputs)); 74 if(numoutputs)parameters->AddObject(new StringArrayParam(MmemasstransportRequestedOutputsEnum,requestedoutputs,numoutputs)); 75 iomodel->DeleteData(&requestedoutputs,numoutputs,"md.mmemasstransport.requested_outputs"); 72 76 73 77 }/*}}}*/ 74 78 75 79 /*Finite Element Analysis*/ 76 void Mmemasstransport transportAnalysis::Core(FemModel* femmodel){/*{{{*/80 void MmemasstransportAnalysis::Core(FemModel* femmodel){/*{{{*/ 77 81 _error_("not implemented"); 78 82 }/*}}}*/ 79 void Mmemasstransport transportAnalysis::PreCore(FemModel* femmodel){/*{{{*/83 void MmemasstransportAnalysis::PreCore(FemModel* femmodel){/*{{{*/ 80 84 _error_("not implemented"); 81 85 }/*}}}*/ 82 ElementVector* Mmemasstransport transportAnalysis::CreateDVector(Element* element){/*{{{*/86 ElementVector* MmemasstransportAnalysis::CreateDVector(Element* element){/*{{{*/ 83 87 /*Default, return NULL*/ 84 88 return NULL; 85 89 }/*}}}*/ 86 ElementMatrix* Mmemasstransport transportAnalysis::CreateJacobianMatrix(Element* element){/*{{{*/90 ElementMatrix* MmemasstransportAnalysis::CreateJacobianMatrix(Element* element){/*{{{*/ 87 91 _error_("Not implemented"); 88 92 }/*}}}*/ 89 ElementMatrix* Mmemasstransport transportAnalysis::CreateKMatrix(Element* element){/*{{{*/93 ElementMatrix* MmemasstransportAnalysis::CreateKMatrix(Element* element){/*{{{*/ 90 94 _error_("not implemented yet"); 91 95 }/*}}}*/ 92 ElementVector* Mmemasstransport transportAnalysis::CreatePVector(Element* element){/*{{{*/96 ElementVector* MmemasstransportAnalysis::CreatePVector(Element* element){/*{{{*/ 93 97 _error_("not implemented yet"); 94 98 }/*}}}*/ 95 void Mmemasstransport transportAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/99 void MmemasstransportAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/ 96 100 97 /*retrieve thickness from Mmemasstransport transportAnalysis spcs in our element:*/101 /*retrieve thickness from MmemasstransportAnalysis spcs in our element:*/ 98 102 99 103 IssmDouble h; … … 107 111 /*Get dof list and inputs */ 108 112 element->GetDofList(&doflist,NoneApproximationEnum,GsetEnum); 109 Input* dh_input=element->GetInput(MmemasstransportDeltathicknessEnum); _assert_(h_input);113 Input* h_input=element->GetInput(MmemasstransportThicknessEnum); _assert_(h_input); 110 114 111 115 /*Ok, we have the thickness in inputs, fill in solution */ … … 113 117 for(int i=0;i<numnodes;i++){ 114 118 gauss->GaussVertex(i); 115 dh_input->GetInputValue(&dh,gauss);116 values[i+0]= dh;119 h_input->GetInputValue(&h,gauss); 120 values[i+0]=h; 117 121 } 118 122 … … 125 129 xDelete<IssmDouble>(values); 126 130 }/*}}}*/ 127 void Mmemasstransport transportAnalysis::GradientJ(Vector<IssmDouble>* gradient,Element* element,int control_type,int control_interp,int control_index){/*{{{*/131 void MmemasstransportAnalysis::GradientJ(Vector<IssmDouble>* gradient,Element* element,int control_type,int control_interp,int control_index){/*{{{*/ 128 132 _error_("Not implemented yet"); 129 133 }/*}}}*/ 130 void Mmemasstransport transportAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/134 void MmemasstransportAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/ 131 135 132 136 int i,domaintype; … … 154 158 } 155 159 156 /*Add bp, dsl and stras inputs to the tria element: */160 /*Add thickness as inputs to the tria element: */ 157 161 element->AddInput(ThicknessEnum,h,P1Enum); 158 162 … … 163 167 164 168 }/*}}}*/ 165 void Mmemasstransport transportAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/169 void MmemasstransportAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/ 166 170 /*Default, do nothing*/ 167 171 return; -
TabularUnified issm/branches/trunk-larour-SLPS2022/src/c/classes/Profiler.h ¶
r26469 r27095 22 22 #define MOVINGFRONTCORE 9 /*Profiling MOVINGFRONT */ 23 23 #define MASSTRANSPORTCORE 10 /*Profiling MASSTRANSPORT */ 24 #define OCEANTRANSPORTCORE 11 /*Profiling OCEANTRANSPORT */ 25 #define SMBCORE 12 /*Profiling SMB */ 26 #define GROUNDINGLINECORE 13 /*Profiling GROUDINGLINE MIGRATION */ 27 #define ESACORE 14 /*Profiling ESA */ 28 #define SLRCORE 15 /*Profiling SLR */ 29 #define SAMPLINGCORE 16 /*Profiling SAMPLING */ 30 #define MPISERIAL 17 /*Profiling MPISerial */ 31 #define SEDLOOP 18 /*Profiling MPISerial */ 32 #define SEDMatrix 19 /*Profiling MPISerial */ 33 #define SEDUpdate 20 /*Profiling MPISerial */ 34 #define EPLLOOP 21 /*Profiling MPISerial */ 35 #define EPLMasking 22 /*Profiling MPISerial */ 36 #define EPLMatrices 23 /*Profiling MPISerial */ 37 #define EPLUpdate 24 /*Profiling MPISerial */ 38 #define MAXPROFSIZE 25 /*Used to initialize static arrays*/ 24 #define MMEMASSTRANSPORTCORE 11 /*Profiling MMEMASSTRANSPORT */ 25 #define OCEANTRANSPORTCORE 12 /*Profiling OCEANTRANSPORT */ 26 #define SMBCORE 13 /*Profiling SMB */ 27 #define GROUNDINGLINECORE 14 /*Profiling GROUDINGLINE MIGRATION */ 28 #define ESACORE 15/*Profiling ESA */ 29 #define SLRCORE 16 /*Profiling SLR */ 30 #define SAMPLINGCORE 17 /*Profiling SAMPLING */ 31 #define MPISERIAL 18 /*Profiling MPISerial */ 32 #define SEDLOOP 19 /*Profiling MPISerial */ 33 #define SEDMatrix 20 /*Profiling MPISerial */ 34 #define SEDUpdate 21 /*Profiling MPISerial */ 35 #define EPLLOOP 22 /*Profiling MPISerial */ 36 #define EPLMasking 23 /*Profiling MPISerial */ 37 #define EPLMatrices 24 /*Profiling MPISerial */ 38 #define EPLUpdate 25 /*Profiling MPISerial */ 39 #define MAXPROFSIZE 26 /*Used to initialize static arrays*/ 39 40 40 41 class Profiler: public Object{ -
TabularUnified issm/branches/trunk-larour-SLPS2022/src/c/modules/InputUpdateFromDakotax/InputUpdateFromDakotax.cpp ¶
r27080 r27095 162 162 163 163 /*Here, we put all the code that cannot be handled any other place: */ 164 if (strncmp(root," SurfaceloadModelid",18)==0){ //surface load in solid earth class {{{164 if (strncmp(root,"MmemasstransportThickness",25)==0){ //surface load in solid earth class {{{ 165 165 166 166 if(VerboseQmu()){ 167 _printf0_(" SurfaceloadModelid MME,with ids: ");167 _printf0_(" Masstransport Thickness MME with ids: "); 168 168 for (int i=0;i<npart;i++)_printf0_((int)distributed_values[i] << " "); 169 169 _printf0_("\n"); 170 170 } 171 171 172 if (femmodel->inputs->GetInputObjectEnum(M asstransportSpcthicknessEnum)==DatasetInputEnum)173 MmeToInput (femmodel,distributed_values,variable_partition,npart,MasstransportSpcthicknessEnum, P0Enum);172 if (femmodel->inputs->GetInputObjectEnum(MmemasstransportThicknessEnum)==DatasetInputEnum) 173 MmeToInputx(femmodel,distributed_values,variable_partition,npart,MmemasstransportThicknessEnum, P0Enum); 174 174 175 175 if (femmodel->inputs->GetInputObjectEnum(MaskIceLevelsetEnum)==DatasetInputEnum) 176 MmeToInput (femmodel,distributed_values,variable_partition,npart,MaskIceLevelsetEnum, P1Enum);176 MmeToInputx(femmodel,distributed_values,variable_partition,npart,MaskIceLevelsetEnum, P1Enum); 177 177 178 178 if (femmodel->inputs->GetInputObjectEnum(MaskOceanLevelsetEnum)==DatasetInputEnum) 179 MmeToInput (femmodel,distributed_values,variable_partition,npart,MaskOceanLevelsetEnum, P1Enum);179 MmeToInputx(femmodel,distributed_values,variable_partition,npart,MaskOceanLevelsetEnum, P1Enum); 180 180 181 181 } /*}}}*/ … … 183 183 184 184 } //}}} 185 void MmeToInput (FemModel* femmodel,IssmDouble* distributed_values,IssmDouble* variable_partition,int npart,int rootenum, int interpolationenum){ /*{{{*/185 void MmeToInputx(FemModel* femmodel,IssmDouble* distributed_values,IssmDouble* variable_partition,int npart,int rootenum, int interpolationenum){ /*{{{*/ 186 186 187 187 TransientInput* transientinput = NULL; … … 201 201 transientinput->GetAllTimes(×,&N); 202 202 femmodel->inputs->SetTransientInput(DummyEnum,times,N); 203 transientinput2 = femmodel->inputs->GetTransientInput(DummyEnum); 203 transientinput2 = femmodel->inputs->GetTransientInput(DummyEnum); transientinput2->Configure(femmodel->parameters); 204 204 205 205 for(Object* & object : femmodel->elements->objects){ … … 239 239 femmodel->inputs->ChangeEnum(DummyEnum,rootenum); 240 240 241 //reconfigure:242 transientinput2->Configure(femmodel->parameters);243 241 } //}}} 244 242 void InputScaleFromDakotax(FemModel* femmodel,IssmDouble* distributed_values,IssmDouble* partition, int npart, int nt, int name){ /*{{{*/ -
TabularUnified issm/branches/trunk-larour-SLPS2022/src/c/modules/InputUpdateFromDakotax/InputUpdateFromDakotax.h ¶
r26469 r27095 10 10 void InputUpdateFromDakotax(FemModel* femmodel,double* variables,char* *variables_descriptors,int numvariables); 11 11 void InputUpdateSpecialtyCode(FemModel* femmodel,IssmDouble* distributed_values,IssmDouble* variable_partition,int npart,char* root); 12 void MmeToInput (FemModel* femmodel,IssmDouble* distributed_values,IssmDouble* variable_partition,int npart,int rootenum, int interpolationenum);12 void MmeToInputx(FemModel* femmodel,IssmDouble* distributed_values,IssmDouble* variable_partition,int npart,int rootenum, int interpolationenum); 13 13 void InputScaleFromDakotax(FemModel* femmodel,IssmDouble* distributed_values,IssmDouble* partition, int npart, int nt, int name); 14 14 -
TabularUnified issm/branches/trunk-larour-SLPS2022/src/c/modules/ModelProcessorx/CreateParameters.cpp ¶
r26947 r27095 78 78 parameters->AddObject(iomodel->CopyConstantObject("md.transient.isstressbalance",TransientIsstressbalanceEnum)); 79 79 parameters->AddObject(iomodel->CopyConstantObject("md.transient.ismasstransport",TransientIsmasstransportEnum)); 80 parameters->AddObject(iomodel->CopyConstantObject("md.transient.ismmemasstransport",TransientIsmmemasstransportEnum)); 80 81 parameters->AddObject(iomodel->CopyConstantObject("md.transient.isoceantransport",TransientIsoceantransportEnum)); 81 82 parameters->AddObject(iomodel->CopyConstantObject("md.transient.issmb",TransientIssmbEnum)); -
TabularUnified issm/branches/trunk-larour-SLPS2022/src/c/modules/UpdateMmesx/UpdateMmesx.cpp ¶
r27084 r27095 5 5 #include "./UpdateMmesx.h" 6 6 #include "../MmeToInputFromIdx/MmeToInputFromIdx.h" 7 #include "../InputUpdateFromDakotax/InputUpdateFromDakotax.h" 7 8 8 9 void UpdateMmesx(FemModel* femmodel){ … … 35 36 MmeToInputFromIdx(femmodel->inputs,femmodel->elements,femmodel->parameters,modelid-1,OceantransportSpcstrEnum, P0Enum); 36 37 } /*}}}*/ 37 if (femmodel->inputs->Exist(MmemasstransportThicknessEnum) && femmodel->inputs->GetInputObjectEnum(MmemasstransportThicknessEnum)==DatasetInputEnum){ /*{{{*/ 38 /*Deal with solid earth ice loads: {{{*/ 39 if (femmodel->inputs->Exist(MmemasstransportThicknessEnum) && femmodel->inputs->GetInputObjectEnum(MmemasstransportThicknessEnum)==DatasetInputEnum){ 38 40 39 /*Deal with solid earth ice loads: */40 41 41 42 int nids; … … 46 47 femmodel->parameters->FindParam(&modelids,&nids,NULL,MmemasstransportModelidsEnum); 47 48 femmodel->parameters->FindParam(&partition,NULL,NULL,MmemasstransportPartitionEnum); 49 //_printf_("modelids: " << nids << "|ids:" << modelids[0] << "|" << modelids[1] << "|" << modelids[2] << "|\n"); 48 50 49 MmeToInput (femmodel,modelids,partition,nids,MmemasstransportThicknessEnum, P0Enum);51 MmeToInputx(femmodel,modelids,partition,nids,MmemasstransportThicknessEnum, P0Enum); 50 52 51 53 if (femmodel->inputs->GetInputObjectEnum(MaskIceLevelsetEnum)==DatasetInputEnum) 52 MmeToInput (femmodel,modelids,partition,nids,MaskIceLevelsetEnum, P1Enum);54 MmeToInputx(femmodel,modelids,partition,nids,MaskIceLevelsetEnum, P1Enum); 53 55 54 56 if (femmodel->inputs->GetInputObjectEnum(MaskOceanLevelsetEnum)==DatasetInputEnum) 55 MmeToInput (femmodel,modelids,partition,nids,MaskOceanLevelsetEnum, P1Enum);57 MmeToInputx(femmodel,modelids,partition,nids,MaskOceanLevelsetEnum, P1Enum); 56 58 57 59 /*free ressources:*/
Note:
See TracChangeset
for help on using the changeset viewer.