Changeset 5358
- Timestamp:
- 08/18/10 10:13:49 (15 years ago)
- Location:
- issm/trunk/src/c
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/c/EnumDefinitions/EnumDefinitions.h
r5286 r5358 221 221 ResetPenaltiesEnum, 222 222 RheologyBEnum, 223 RheologyB 2dEnum,223 RheologyBbarEnum, 224 224 RheologyNEnum, 225 225 SegmentOnIceShelfEnum, -
issm/trunk/src/c/EnumDefinitions/EnumToModelField.cpp
r5329 r5358 16 16 case DragCoefficientEnum : return "drag_coefficient"; 17 17 case RheologyBEnum : return "rheology_B"; 18 case RheologyB 2dEnum : return "rheology_B";18 case RheologyBbarEnum : return "rheology_B"; 19 19 default : ISSMERROR("No model field is associated to enum %s",EnumToString(en)); 20 20 } -
issm/trunk/src/c/EnumDefinitions/EnumToString.cpp
r5286 r5358 195 195 case ResetPenaltiesEnum : return "ResetPenalties"; 196 196 case RheologyBEnum : return "RheologyB"; 197 case RheologyB 2dEnum : return "RheologyB2d";197 case RheologyBbarEnum : return "RheologyBbar"; 198 198 case RheologyNEnum : return "RheologyN"; 199 199 case SegmentOnIceShelfEnum : return "SegmentOnIceShelf"; -
issm/trunk/src/c/EnumDefinitions/StringToEnum.cpp
r5286 r5358 193 193 else if (strcmp(name,"ResetPenalties")==0) return ResetPenaltiesEnum; 194 194 else if (strcmp(name,"RheologyB")==0) return RheologyBEnum; 195 else if (strcmp(name,"RheologyB 2d")==0) return RheologyB2dEnum;195 else if (strcmp(name,"RheologyBbar")==0) return RheologyBbarEnum; 196 196 else if (strcmp(name,"RheologyN")==0) return RheologyNEnum; 197 197 else if (strcmp(name,"SegmentOnIceShelf")==0) return SegmentOnIceShelfEnum; -
issm/trunk/src/c/modules/ModelProcessorx/Balancedthickness/UpdateElementsBalancedthickness.cpp
r5251 r5358 39 39 IoModelFetchData(&iomodel->thickness_obs,NULL,NULL,iomodel_handle,"thickness_obs"); 40 40 IoModelFetchData(&iomodel->weights,NULL,NULL,iomodel_handle,"weights"); 41 if( strcmp(iomodel->control_type,"dhdt")==0){42 IoModelFetchData(&iomodel->control_parameter,NULL,NULL,iomodel_handle, iomodel->control_type); //copy the control parameter in iomodel41 if(iomodel->control_type==DhDtEnum){ 42 IoModelFetchData(&iomodel->control_parameter,NULL,NULL,iomodel_handle,EnumToModelField(iomodel->control_type)); //copy the control parameter in iomodel 43 43 } 44 44 } -
issm/trunk/src/c/modules/ModelProcessorx/Control/CreateParametersControl.cpp
r5281 r5358 26 26 27 27 /*What control type?*/ 28 if (strcmp(iomodel->control_type,"drag_coefficient")==0){ 29 parameters->AddObject(new IntParam(ControlTypeEnum,DragCoefficientEnum)); 30 } 31 else if (strcmp(iomodel->control_type,"rheology_B")==0){ 32 parameters->AddObject(new IntParam(ControlTypeEnum,RheologyB2dEnum)); 33 } 34 else if (strcmp(iomodel->control_type,"dhdt")==0){ 35 parameters->AddObject(new IntParam(ControlTypeEnum,DhDtEnum)); 28 if (iomodel->control_type!=DragCoefficientEnum && iomodel->control_type!=RheologyBbarEnum && iomodel->control_type!=DhDtEnum){ 29 ISSMERROR("control_type %s not supported yet!",EnumToString(iomodel->control_type)); 36 30 } 37 31 else{ 38 ISSMERROR("control_type %s not supported yet!",iomodel->control_type);32 parameters->AddObject(new IntParam(ControlTypeEnum,iomodel->control_type)); 39 33 } 40 34 … … 75 69 xfree((void**)&iomodel->maxiter); 76 70 77 IoModelFetchData(&control_parameter,NULL,NULL,iomodel_handle, iomodel->control_type);71 IoModelFetchData(&control_parameter,NULL,NULL,iomodel_handle,EnumToModelField(iomodel->control_type)); 78 72 parameters->AddObject(new DoubleVecParam(ControlParameterEnum,control_parameter,iomodel->nsteps)); 79 73 xfree((void**)&control_parameter); -
issm/trunk/src/c/modules/ModelProcessorx/CreateElementsVerticesAndMaterials.cpp
r4967 r5358 40 40 IoModelFetchData(&iomodel->rheology_B,NULL,NULL,iomodel_handle,"rheology_B"); 41 41 IoModelFetchData(&iomodel->rheology_n,NULL,NULL,iomodel_handle,"rheology_n"); 42 if(iomodel->control_analysis && strcmp(iomodel->control_type,"rheology_B")==0){43 IoModelFetchData(&iomodel->control_parameter,NULL,NULL,iomodel_handle, iomodel->control_type); //copy the control parameter in iomodel42 if(iomodel->control_analysis && iomodel->control_type==RheologyBbarEnum){ 43 IoModelFetchData(&iomodel->control_parameter,NULL,NULL,iomodel_handle,EnumToModelField(iomodel->control_type)); //copy the control parameter in iomodel 44 44 } 45 45 -
issm/trunk/src/c/modules/ModelProcessorx/DiagnosticHoriz/UpdateElementsDiagnosticHoriz.cpp
r4967 r5358 47 47 IoModelFetchData(&iomodel->vy_obs,NULL,NULL,iomodel_handle,"vy_obs"); 48 48 IoModelFetchData(&iomodel->weights,NULL,NULL,iomodel_handle,"weights"); 49 if( strcmp(iomodel->control_type,"drag_coefficient")==0){50 IoModelFetchData(&iomodel->control_parameter,NULL,NULL,iomodel_handle, iomodel->control_type); //copy the control parameter in iomodel49 if(iomodel->control_type==DragCoefficientEnum){ 50 IoModelFetchData(&iomodel->control_parameter,NULL,NULL,iomodel_handle,EnumToModelField(iomodel->control_type)); //copy the control parameter in iomodel 51 51 } 52 52 } -
issm/trunk/src/c/modules/ModelProcessorx/DiagnosticStokes/UpdateElementsDiagnosticStokes.cpp
r4967 r5358 48 48 IoModelFetchData(&iomodel->vy_obs,NULL,NULL,iomodel_handle,"vy_obs"); 49 49 IoModelFetchData(&iomodel->weights,NULL,NULL,iomodel_handle,"weights"); 50 if( strcmp(iomodel->control_type,"drag_coefficient")==0){51 IoModelFetchData(&iomodel->control_parameter,NULL,NULL,iomodel_handle, iomodel->control_type); //copy the control parameter in iomodel50 if(iomodel->control_type==DragCoefficientEnum){ 51 IoModelFetchData(&iomodel->control_parameter,NULL,NULL,iomodel_handle,EnumToModelField(iomodel->control_type)); //copy the control parameter in iomodel 52 52 } 53 53 } -
issm/trunk/src/c/objects/Elements/Penta.cpp
r5322 r5358 716 716 717 717 /*Depth Average B*/ 718 this->InputDepthAverageAtBase(RheologyBEnum,RheologyB 2dEnum,MaterialsEnum);718 this->InputDepthAverageAtBase(RheologyBEnum,RheologyBbarEnum,MaterialsEnum); 719 719 720 720 tria=(Tria*)SpawnTria(0,1,2); //grids 0, 1 and 2 make the new tria (lower face). … … 723 723 724 724 /*delete B average*/ 725 this->matice->inputs->DeleteInput(RheologyB 2dEnum);725 this->matice->inputs->DeleteInput(RheologyBbarEnum); 726 726 727 727 return J; … … 731 731 /*Depth Average B and put it in inputs*/ 732 732 Penta* penta=GetBasalElement(); 733 penta->InputDepthAverageAtBase(RheologyBEnum,RheologyB 2dEnum,MaterialsEnum);734 Input* B_input=penta->matice->inputs->GetInput(RheologyB 2dEnum);733 penta->InputDepthAverageAtBase(RheologyBEnum,RheologyBbarEnum,MaterialsEnum); 734 Input* B_input=penta->matice->inputs->GetInput(RheologyBbarEnum); 735 735 Input* B_copy=(Input*)B_input->copy(); 736 736 this->matice->inputs->AddInput((Input*)B_copy); … … 741 741 742 742 /*delete B average*/ 743 this->matice->inputs->DeleteInput(RheologyB 2dEnum);744 penta->matice->inputs->DeleteInput(RheologyB 2dEnum);743 this->matice->inputs->DeleteInput(RheologyBbarEnum); 744 penta->matice->inputs->DeleteInput(RheologyBbarEnum); 745 745 746 746 return J; … … 1033 1033 GradjDrag(gradient); 1034 1034 } 1035 else if (control_type==RheologyB 2dEnum){1035 else if (control_type==RheologyBbarEnum){ 1036 1036 GradjB(gradient); 1037 1037 } … … 1087 1087 1088 1088 /*Rheology*/ 1089 if(control_type==RheologyB 2dEnum){1089 if(control_type==RheologyBbarEnum){ 1090 1090 1091 1091 /*The update is done by the element on bed only*/ … … 1097 1097 1098 1098 /*Now, update using the gradient new = old + scalar * gradient*/ 1099 //matice->inputs->AXPY(RheologyB 2dEnum,scalar,GradientEnum);1099 //matice->inputs->AXPY(RheologyBbarEnum,scalar,GradientEnum); 1100 1100 // For now: Gradient is in element (TO BE CHANGED) and parameter in matice 1101 1101 Input* input_B =(Input*)matice->inputs->GetInput(RheologyBEnum); ISSMASSERT(input_B); … … 1268 1268 1269 1269 /*Go through all the input objects, and find the one corresponding to enum_type, if it exists: */ 1270 if (enum_type==RheologyB 2dEnum){1270 if (enum_type==RheologyBbarEnum){ 1271 1271 input=this->matice->inputs->GetInput(RheologyBEnum); 1272 1272 } … … 2636 2636 2637 2637 /*Depth Averaging B*/ 2638 this->InputDepthAverageAtBase(RheologyBEnum,RheologyB 2dEnum,MaterialsEnum);2638 this->InputDepthAverageAtBase(RheologyBEnum,RheologyBbarEnum,MaterialsEnum); 2639 2639 2640 2640 /*Call Tria function*/ … … 2644 2644 2645 2645 /*Delete B averaged*/ 2646 this->matice->inputs->DeleteInput(RheologyB 2dEnum);2646 this->matice->inputs->DeleteInput(RheologyBbarEnum); 2647 2647 2648 2648 return; … … 5264 5264 5265 5265 /*Depth Average B*/ 5266 this->InputDepthAverageAtBase(RheologyBEnum,RheologyB 2dEnum,MaterialsEnum);5266 this->InputDepthAverageAtBase(RheologyBEnum,RheologyBbarEnum,MaterialsEnum); 5267 5267 5268 5268 tria=(Tria*)SpawnTria(0,1,2); //grids 0, 1 and 2 make the new tria (lower face). … … 5271 5271 5272 5272 /*delete B average*/ 5273 this->matice->inputs->DeleteInput(RheologyB 2dEnum);5273 this->matice->inputs->DeleteInput(RheologyBbarEnum); 5274 5274 } 5275 5275 else{ 5276 /*Gradient is computed on bed only (B 2d)*/5276 /*Gradient is computed on bed only (Bbar)*/ 5277 5277 if (!onbed) return; 5278 5278 5279 5279 /*Depth Average B*/ 5280 this->InputDepthAverageAtBase(RheologyBEnum,RheologyB 2dEnum,MaterialsEnum);5280 this->InputDepthAverageAtBase(RheologyBEnum,RheologyBbarEnum,MaterialsEnum); 5281 5281 5282 5282 /*B is a 2d field, use MacAyeal(2d) gradient even if it is Stokes or Pattyn*/ … … 5286 5286 5287 5287 /*delete B average*/ 5288 this->matice->inputs->DeleteInput(RheologyB 2dEnum);5288 this->matice->inputs->DeleteInput(RheologyBbarEnum); 5289 5289 } 5290 5290 -
issm/trunk/src/c/objects/Elements/Tria.cpp
r5327 r5358 419 419 420 420 /*update input*/ 421 if (name==RheologyB 2dEnum || name==RheologyBEnum){421 if (name==RheologyBbarEnum || name==RheologyBEnum){ 422 422 matice->inputs->AddInput(new TriaVertexInput(name,values)); 423 423 } … … 709 709 } 710 710 } 711 else if (control_type==RheologyB 2dEnum){712 matice->inputs->GetParameterDerivativeValue(&dB[0], &xyz_list[0][0], &gauss_l1l2l3[0],RheologyB 2dEnum);711 else if (control_type==RheologyBbarEnum){ 712 matice->inputs->GetParameterDerivativeValue(&dB[0], &xyz_list[0][0], &gauss_l1l2l3[0],RheologyBbarEnum); 713 713 Jelem+=cm_noisedmp*1/2*(pow(dB[0],2)+pow(dB[1],2))*Jdet*gauss_weight; 714 714 } … … 954 954 GradjDrag(gradient); 955 955 } 956 else if (control_type==RheologyB 2dEnum){956 else if (control_type==RheologyBbarEnum){ 957 957 GradjB(gradient); 958 958 } … … 1050 1050 adjointx_input=inputs->GetInput(AdjointxEnum); 1051 1051 adjointy_input=inputs->GetInput(AdjointyEnum); 1052 rheologyb_input=matice->inputs->GetInput(RheologyB 2dEnum);1052 rheologyb_input=matice->inputs->GetInput(RheologyBbarEnum); 1053 1053 1054 1054 /* Start looping on the number of gaussian points: */ … … 1392 1392 1393 1393 /*Rheology*/ 1394 if(control_type==RheologyB 2dEnum){1394 if(control_type==RheologyBbarEnum){ 1395 1395 1396 1396 /*First, get revert to previous parameter value (kept in ControlParameter input)*/ 1397 matice->inputs->DuplicateInput(ControlParameterEnum,RheologyB 2dEnum);1397 matice->inputs->DuplicateInput(ControlParameterEnum,RheologyBbarEnum); 1398 1398 1399 1399 /*Now, update using the gradient new = old + scalar * gradient*/ 1400 //matice->inputs->AXPY(RheologyB 2dEnum,scalar,GradientEnum);1400 //matice->inputs->AXPY(RheologyBbarEnum,scalar,GradientEnum); 1401 1401 // For now: Gradient is in element (TO BE CHANGED) and parameter in matice 1402 Input* input_B =(Input*)matice->inputs->GetInput(RheologyB 2dEnum); ISSMASSERT(input_B);1402 Input* input_B =(Input*)matice->inputs->GetInput(RheologyBbarEnum); ISSMASSERT(input_B); 1403 1403 Input* input_Grad=(Input*)this->inputs->GetInput(GradientEnum); ISSMASSERT(input_Grad); 1404 1404 input_B->AXPY(input_Grad,scalar); 1405 1405 1406 1406 /*Constrain constrain input*/ 1407 input=(Input*)matice->inputs->GetInput(RheologyB 2dEnum); ISSMASSERT(input);1407 input=(Input*)matice->inputs->GetInput(RheologyBbarEnum); ISSMASSERT(input); 1408 1408 input->Constrain(cm_min,cm_max); 1409 1409 1410 1410 /*Finally: save input if requested*/ 1411 if (save_parameter) matice->inputs->DuplicateInput(RheologyB 2dEnum,ControlParameterEnum);1411 if (save_parameter) matice->inputs->DuplicateInput(RheologyBbarEnum,ControlParameterEnum); 1412 1412 1413 1413 } … … 1542 1542 1543 1543 /*Go through all the input objects, and find the one corresponding to enum_type, if it exists: */ 1544 if (enum_type==RheologyB 2dEnum){1544 if (enum_type==RheologyBbarEnum){ 1545 1545 input=this->matice->inputs->GetInput(enum_type); 1546 1546 } … … 5533 5533 gravity=matpar->GetG(); 5534 5534 n=matice->GetN(); 5535 B=matice->GetB 2d();5535 B=matice->GetBbar(); 5536 5536 5537 5537 /* Get slopes and thickness */ -
issm/trunk/src/c/objects/IoModel.cpp
r5281 r5358 100 100 xfree((void**)&this->riftinfo); 101 101 xfree((void**)&this->penalties); 102 xfree((void**)&this->control_type);103 102 xfree((void**)&this->control_parameter); 104 103 … … 297 296 this->rheology_n=NULL; 298 297 this->rheology_B=NULL; 299 300 /*!control methods: */301 this->control_type=NULL;302 298 303 299 /*!solution parameters: */ -
issm/trunk/src/c/objects/IoModel.h
r5281 r5358 125 125 126 126 /*control methods: */ 127 char*control_type;127 int control_type; 128 128 double* control_parameter; 129 129 -
issm/trunk/src/c/objects/Materials/Matice.cpp
r5320 r5358 47 47 if (iomodel->rheology_B) { 48 48 for(i=0;i<num_vertices;i++) nodeinputs[i]=iomodel->rheology_B[int(iomodel->elements[num_vertices*index+i]-1)]; 49 this->inputs->AddInput(new TriaVertexInput(RheologyB 2dEnum,nodeinputs));49 this->inputs->AddInput(new TriaVertexInput(RheologyBbarEnum,nodeinputs)); 50 50 } 51 51 … … 257 257 } 258 258 /*}}}*/ 259 /*FUNCTION Matice::GetB 2d{{{1*/260 double Matice::GetB 2d(){259 /*FUNCTION Matice::GetBbar {{{1*/ 260 double Matice::GetBbar(){ 261 261 262 262 /*Output*/ 263 double B 2d;264 265 inputs->GetParameterAverage(&B 2d,RheologyB2dEnum);266 return B 2d;263 double Bbar; 264 265 inputs->GetParameterAverage(&Bbar,RheologyBbarEnum); 266 return Bbar; 267 267 } 268 268 /*}}}*/ … … 302 302 303 303 /*Get B and n*/ 304 B=GetB 2d();304 B=GetBbar(); 305 305 n=GetN(); 306 306 … … 507 507 508 508 /*Get B and n*/ 509 B=GetB 2d();509 B=GetBbar(); 510 510 n=GetN(); 511 511 … … 652 652 if ( 653 653 name==RheologyBEnum || 654 name==RheologyB 2dEnum ||654 name==RheologyBbarEnum || 655 655 name==RheologyNEnum || 656 656 name==ControlParameterEnum -
issm/trunk/src/c/objects/Materials/Matice.h
r5320 r5358 64 64 void GetViscosityComplement(double* pviscosity_complement, double* pepsilon); 65 65 double GetB(); 66 double GetB 2d();66 double GetBbar(); 67 67 double GetN(); 68 68 bool IsInput(int name);
Note:
See TracChangeset
for help on using the changeset viewer.