Changeset 4931
- Timestamp:
- 08/02/10 14:55:29 (15 years ago)
- Location:
- issm/trunk/src/c
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/c/modules/InputDepthAveragex/InputDepthAveragex.cpp
r4573 r4931 19 19 for (i=0;i<elements->Size();i++){ 20 20 element=(Element*)elements->GetObjectByOffset(i); 21 element->InputDepthAverageAtBase(enum_type,average_enum_type );21 element->InputDepthAverageAtBase(enum_type,average_enum_type,ElementsEnum); 22 22 } 23 23 -
issm/trunk/src/c/objects/Elements/Element.h
r4880 r4931 43 43 virtual double CostFunction(void)=0; 44 44 virtual double SurfaceArea(void)=0; 45 virtual void InputDepthAverageAtBase(int enum_type,int average_enum_type )=0;45 virtual void InputDepthAverageAtBase(int enum_type,int average_enum_type,int object_enum)=0; 46 46 virtual void ComputeBasalStress(Vec sigma_b)=0; 47 47 virtual void ComputePressure(Vec p_g)=0; -
issm/trunk/src/c/objects/Elements/Penta.cpp
r4929 r4931 14 14 #include <string.h> 15 15 #include "../objects.h" 16 #include "../../EnumDefinitions/EnumDefinitions.h"17 16 #include "../../shared/shared.h" 18 17 #include "../../include/include.h" … … 1028 1027 /*}}}*/ 1029 1028 /*FUNCTION Penta::InputDepthAverageAtBase{{{1*/ 1030 void Penta::InputDepthAverageAtBase(int enum_type,int average_enum_type ){1029 void Penta::InputDepthAverageAtBase(int enum_type,int average_enum_type,int object_enum){ 1031 1030 1032 1031 /*Intermediaries*/ 1033 1032 const int numvertices=6; 1034 1033 bool onbed; 1035 int i;1034 int step,i; 1036 1035 1037 1036 Penta* penta=NULL; … … 1055 1054 /*OK, we are on bed. Initialize global inputs as 0*/ 1056 1055 total_thickness_input =new PentaVertexInput(ThicknessEnum,zeros_list); 1057 total_integrated_input=new PentaVertexInput(average_enum_type,zeros_list);1058 1056 1059 1057 /*Now follow all the upper element from the base to the surface to integrate the input*/ 1060 1058 penta=this; 1059 step =0; 1061 1060 for(;;){ 1062 1061 1063 1062 /*Step1: Get original input (to be depth avegaged): */ 1064 original_input=(Input*)penta->inputs->GetInput(enum_type); 1063 if (object_enum==ElementsEnum) 1064 original_input=(Input*)penta->inputs->GetInput(enum_type); 1065 else if (object_enum==MaterialsEnum) 1066 original_input=(Input*)penta->matice->inputs->GetInput(enum_type); 1067 else 1068 ISSMERROR("object %s not supported yet",EnumAsString(object_enum)); 1065 1069 if(!original_input) ISSMERROR("could not find input with enum %s",EnumAsString(enum_type)); 1070 1071 /*If first time, initialize total_integrated_input*/ 1072 if (step==0){ 1073 if (original_input->Enum()==PentaVertexInputEnum) 1074 total_integrated_input=new PentaVertexInput(average_enum_type,zeros_list); 1075 else if (original_input->Enum()==DoubleInputEnum) 1076 total_integrated_input=new DoubleInput(average_enum_type,0.0); 1077 else 1078 ISSMERROR("object %s not supported yet",EnumAsString(original_input->Enum())); 1079 } 1066 1080 1067 1081 /*Step2: Create element thickness input*/ … … 1086 1100 1087 1101 /*Stop if we have reached the surface, else, take upper penta*/ 1088 if (penta->IsOnSurface()) {1089 break; 1090 }1091 else{1092 /* get upper Penta*/1093 penta=penta->GetUpperElement(); 1094 ISSMASSERT(penta->Id()!=this->id);1095 }1102 if (penta->IsOnSurface()) break; 1103 1104 /* get upper Penta*/ 1105 penta=penta->GetUpperElement(); 1106 ISSMASSERT(penta->Id()!=this->id); 1107 1108 /*increase couter*/ 1109 step++; 1096 1110 } 1097 1111 … … 1105 1119 1106 1120 /*Finally, add to inputs*/ 1107 this->inputs->AddInput((Input*)depth_averaged_input); 1108 return; 1121 if (object_enum==ElementsEnum) 1122 this->inputs->AddInput((Input*)depth_averaged_input); 1123 else if (object_enum==MaterialsEnum) 1124 this->matice->inputs->AddInput((Input*)depth_averaged_input); 1125 else 1126 ISSMERROR("object %s not supported yet",EnumAsString(object_enum)); 1109 1127 } 1110 1128 /*}}}*/ … … 2130 2148 /*This element should be collapsed into a tria element at its base. Create this tria element, 2131 2149 *and use its CreateKMatrix functionality to fill the global stiffness matrix: */ 2150 2151 /*Depth Averaging B*/ 2152 this->InputDepthAverageAtBase(RheologyBEnum,RheologyB2dEnum,MaterialsEnum); 2153 2154 /*Call Tria function*/ 2132 2155 tria=(Tria*)SpawnTria(0,1,2); //grids 0, 1 and 2 make the new tria. 2133 2156 tria->CreateKMatrix(Kgg); 2134 2157 delete tria; 2158 2159 /*Delete B averaged*/ 2160 this->matice->inputs->DeleteInput(RheologyB2dEnum); 2161 2135 2162 return; 2136 2163 } … … 3941 3968 3942 3969 /*Delete Vx and Vy averaged*/ 3943 this- inputs->DeleteInput(VxAverageEnum);3944 this- inputs->DeleteInput(VyAverageEnum);3970 this->inputs->DeleteInput(VxAverageEnum); 3971 this->inputs->DeleteInput(VyAverageEnum); 3945 3972 3946 3973 return; … … 5228 5255 this->inputs->AddInput(new PentaVertexInput(TemperatureEnum,values)); 5229 5256 5230 /*Also update the rheology WARNING: ONLY FOR PATTYN and STOKES FOR NOW*/5257 /*Also update the rheology*/ 5231 5258 inputs->GetParameterValue(&collapse,CollapseEnum); 5232 if (!collapse)this->matice->inputs->AddInput(new PentaVertexInput(RheologyBEnum,B));5259 this->matice->inputs->AddInput(new PentaVertexInput(RheologyBEnum,B)); 5233 5260 5234 5261 } -
issm/trunk/src/c/objects/Elements/Penta.h
r4927 r4931 22 22 #include "../../include/include.h" 23 23 #include "../../shared/Exceptions/exceptions.h" 24 #include "../../EnumDefinitions/EnumDefinitions.h" 24 25 /*}}}*/ 25 26 … … 88 89 void InputControlConstrain(int control_type,double cm_min, double cm_max); 89 90 bool InputConvergence(double* eps, int* enums,int num_enums,int* criterionenums,double* criterionvalues,int num_criterionenums); 90 void InputDepthAverageAtBase(int enum_type,int average_enum_type );91 void InputDepthAverageAtBase(int enum_type,int average_enum_type,int object_enum=ElementsEnum); 91 92 void InputDuplicate(int original_enum,int new_enum); 92 93 void InputScale(int enum_type,double scale_factor); -
issm/trunk/src/c/objects/Elements/Tria.cpp
r4927 r4931 14 14 #include <string.h> 15 15 #include "../objects.h" 16 #include "../../EnumDefinitions/EnumDefinitions.h"17 16 #include "../../shared/shared.h" 18 17 #include "../../Container/Container.h" … … 629 628 } 630 629 else if (control_type==RheologyBEnum){ 631 inputs->GetParameterDerivativeValue(&dB[0], &xyz_list[0][0], &gauss_l1l2l3[0],RheologyB Enum);630 inputs->GetParameterDerivativeValue(&dB[0], &xyz_list[0][0], &gauss_l1l2l3[0],RheologyB2dEnum); 632 631 Jelem+=cm_noisedmp*1/2*(pow(dB[0],2)+pow(dB[1],2))*Jdet*gauss_weight; 633 632 } … … 870 869 GradjDrag(gradient); 871 870 } 872 else if (control_type==RheologyB Enum){871 else if (control_type==RheologyB2dEnum){ 873 872 GradjB(gradient); 874 873 } … … 966 965 adjointx_input=inputs->GetInput(AdjointxEnum); 967 966 adjointy_input=inputs->GetInput(AdjointyEnum); 968 rheologyb_input=inputs->GetInput(RheologyB Enum);967 rheologyb_input=inputs->GetInput(RheologyB2dEnum); 969 968 970 969 /* Start looping on the number of gaussian points: */ … … 1231 1230 1232 1231 /*Move input to Material if required (needed if control method) TO BE IMPROVED*/ 1233 if (YEnum==RheologyBEnum ){1232 if (YEnum==RheologyBEnum || YEnum==RheologyB2dEnum){ 1234 1233 this->matice->inputs->AddInput((Input*)yinput->copy()); 1235 1234 } … … 1287 1286 /*}}}*/ 1288 1287 /*FUNCTION Tria::InputDepthAverageAtBase {{{1*/ 1289 void Tria::InputDepthAverageAtBase(int enum_type,int average_enum_type ){1288 void Tria::InputDepthAverageAtBase(int enum_type,int average_enum_type,int object_enum){ 1290 1289 1291 1290 /*New input*/ … … 1294 1293 1295 1294 /*copy input of enum_type*/ 1296 oldinput=this->inputs->GetInput(enum_type); 1295 if (object_enum==ElementsEnum) 1296 oldinput=(Input*)this->inputs->GetInput(enum_type); 1297 else if (object_enum==MaterialsEnum) 1298 oldinput=(Input*)this->matice->inputs->GetInput(enum_type); 1299 else 1300 ISSMERROR("object %s not supported yet",EnumAsString(object_enum)); 1297 1301 if(!oldinput)ISSMERROR("%s%s"," could not find old input with enum: ",EnumAsString(enum_type)); 1298 1302 newinput=(Input*)oldinput->copy(); … … 1302 1306 1303 1307 /*Add new input to current element*/ 1304 this->inputs->AddInput(newinput); 1308 if (object_enum==ElementsEnum) 1309 this->inputs->AddInput((Input*)newinput); 1310 else if (object_enum==MaterialsEnum) 1311 this->matice->inputs->AddInput((Input*)newinput); 1312 else 1313 ISSMERROR("object %s not supported yet",EnumAsString(object_enum)); 1305 1314 1306 1315 } … … 2126 2135 if (iomodel->rheology_B) { 2127 2136 for(i=0;i<3;i++)nodeinputs[i]=iomodel->rheology_B[tria_vertex_ids[i]-1]; 2128 this->inputs->AddInput(new TriaVertexInput(RheologyB Enum,nodeinputs));2137 this->inputs->AddInput(new TriaVertexInput(RheologyB2dEnum,nodeinputs)); 2129 2138 } 2130 2139 if (iomodel->control_parameter) { … … 6048 6057 name==VyEnum || 6049 6058 name==RheologyBEnum || 6059 name==RheologyB2dEnum || 6050 6060 name==RheologyNEnum || 6051 6061 name==FitEnum || -
issm/trunk/src/c/objects/Elements/Tria.h
r4927 r4931 20 20 #include "../../include/include.h" 21 21 #include "../../shared/Exceptions/exceptions.h" 22 #include "../../EnumDefinitions/EnumDefinitions.h" 22 23 /*}}}*/ 23 24 … … 84 85 void InputControlConstrain(int control_type,double cm_min, double cm_max); 85 86 bool InputConvergence(double* eps, int* enums,int num_enums,int* criterionenums,double* criterionvalues,int num_criterionenums); 86 void InputDepthAverageAtBase(int enum_type,int average_enum_type );87 void InputDepthAverageAtBase(int enum_type,int average_enum_type,int object_enum=ElementsEnum); 87 88 void InputDuplicate(int original_enum,int new_enum); 88 89 void InputScale(int enum_type,double scale_factor); -
issm/trunk/src/c/objects/Inputs/DoubleInput.cpp
r4927 r4931 23 23 } 24 24 /*}}}*/ 25 /*FUNCTION DoubleInput::DoubleInput(double * values){{{1*/25 /*FUNCTION DoubleInput::DoubleInput(double value){{{1*/ 26 26 DoubleInput::DoubleInput(int in_enum_type,IssmDouble in_value){ 27 27 … … 253 253 } 254 254 /*}}}*/ 255 /*FUNCTION DoubleInput::VerticallyIntegrate{{{1*/ 256 void DoubleInput::VerticallyIntegrate(Input* thickness_input){ 257 258 /*Intermediaries*/ 259 double thickness_value; 260 261 /*Check that input provided is a thickness*/ 262 if (thickness_input->EnumType()!=ThicknessEnum) ISSMERROR("Input provided is not a Thickness (enum_type is %s)",EnumAsString(thickness_input->EnumType())); 263 264 /*vertically integrate depending on type:*/ 265 switch(thickness_input->Enum()){ 266 267 case PentaVertexInputEnum: 268 thickness_input->GetParameterAverage(&thickness_value); 269 this->value=this->value*thickness_value; 270 return; 271 272 default: 273 ISSMERROR("not implemented yet"); 274 } 275 } 276 /*}}}*/ 277 /*FUNCTION DoubleInput::PointwiseDivide{{{1*/ 278 Input* DoubleInput::PointwiseDivide(Input* inputB){ 279 280 /*Ouput*/ 281 DoubleInput* outinput=NULL; 282 283 /*Intermediaries*/ 284 double AdotBvalue; 285 double Bvalue; 286 287 /*Check that inputB is of the same type*/ 288 inputB->GetParameterAverage(&Bvalue); 289 290 /*Create new DoubleInput*/ 291 outinput=new DoubleInput(this->enum_type,this->value/Bvalue); 292 293 /*Return output pointer*/ 294 return outinput; 295 296 } 297 /*}}}*/ -
issm/trunk/src/c/objects/Inputs/DoubleInput.h
r4927 r4931 38 38 int EnumType(); 39 39 Input* SpawnTriaInput(int* indices); 40 Input* PointwiseDivide(Input* inputB) {ISSMERROR("not implemented yet");};40 Input* PointwiseDivide(Input* inputB); 41 41 ElementResult* SpawnResult(int step, double time); 42 42 /*}}}*/ … … 62 62 void Constrain(double cm_min, double cm_max); 63 63 void Extrude(void){ISSMERROR("not supported yet");}; 64 void VerticallyIntegrate(Input* thickness_input) {ISSMERROR("not supported yet");};64 void VerticallyIntegrate(Input* thickness_input); 65 65 void GetVectorFromInputs(Vec vector,int* doflist); 66 66 void GetValuesPtr(double** pvalues,int* pnum_values); -
issm/trunk/src/c/objects/Materials/Matice.cpp
r4920 r4931 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 Enum,nodeinputs));49 this->inputs->AddInput(new TriaVertexInput(RheologyB2dEnum,nodeinputs)); 50 50 } 51 51 … … 245 245 } 246 246 /*}}}*/ 247 /*FUNCTION Matice::GetB2d {{{1*/ 248 double Matice::GetB2d(){ 249 250 /*Output*/ 251 double B2d; 252 253 inputs->GetParameterAverage(&B2d,RheologyB2dEnum); 254 return B2d; 255 } 256 /*}}}*/ 247 257 /*FUNCTION Matice::GetN {{{1*/ 248 258 double Matice::GetN(){ … … 280 290 281 291 /*Get B and n*/ 282 B=GetB ();292 B=GetB2d(); 283 293 n=GetN(); 284 294 … … 488 498 489 499 /*Get B and n*/ 490 B=GetB ();500 B=GetB2d(); 491 501 n=GetN(); 492 502 -
issm/trunk/src/c/objects/Materials/Matice.h
r4920 r4931 58 58 void GetViscosityComplement(double* pviscosity_complement, double* pepsilon); 59 59 double GetB(); 60 double GetB2d(); 60 61 double GetN(); 61 62 /*}}}*/
Note:
See TracChangeset
for help on using the changeset viewer.