Changeset 16699
- Timestamp:
- 11/11/13 09:07:42 (11 years ago)
- Location:
- issm/trunk-jpl/src/c
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/analyses/ThermalAnalysis.cpp
r16684 r16699 116 116 }/*}}}*/ 117 117 void ThermalAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/ 118 _error_("not implemented yet"); 118 119 bool converged; 120 int i,rheology_law; 121 IssmDouble B_average,s_average,T_average=0.; 122 int *doflist = NULL; 123 IssmDouble *xyz_list = NULL; 124 bool hack = false; 125 126 /*Fetch number of nodes and dof for this finite element*/ 127 int numnodes = element->GetNumberOfNodes(); 128 129 /*Fetch dof list and allocate solution vector*/ 130 element->GetDofList(&doflist,NoneApproximationEnum,GsetEnum); 131 IssmDouble* values = xNew<IssmDouble>(numnodes); 132 133 /*Use the dof list to index into the solution vector: */ 134 for(i=0;i<numnodes;i++){ 135 values[i]=solution[doflist[i]]; 136 137 /*Check solution*/ 138 if(xIsNan<IssmDouble>(values[i])) _error_("NaN found in solution vector"); 139 //if(values[i]<0) _printf_("temperature < 0°K found in solution vector\n"); 140 //if(values[i]>275) _printf_("temperature > 275°K found in solution vector (Paterson's rheology associated is negative)\n"); 141 } 142 143 /*Force temperature between [Tpmp-50 Tpmp] to disable penalties*/ 144 if(hack){ 145 IssmDouble* pressure = xNew<IssmDouble>(numnodes); 146 element->GetInputListOnVertices(pressure,PressureEnum); 147 for(i=0;i<numnodes;i++){ 148 if(values[i]>element->TMeltingPoint(pressure[i])) values[i]=element->TMeltingPoint(pressure[i]); 149 if(values[i]<element->TMeltingPoint(pressure[i])-50.) values[i]=element->TMeltingPoint(pressure[i])-50.; 150 } 151 xDelete<IssmDouble>(pressure); 152 } 153 154 /*Get all inputs and parameters*/ 155 156 element->GetInputValue(&converged,ConvergedEnum); 157 if(converged){ 158 element->AddInput(TemperatureEnum,values,P1Enum); 159 160 /*Update Rheology only if converged (we must make sure that the temperature is below melting point 161 * otherwise the rheology could be negative*/ 162 element->FindParam(&rheology_law,MaterialsRheologyLawEnum); 163 switch(rheology_law){ 164 case NoneEnum: 165 /*Do nothing: B is not temperature dependent*/ 166 break; 167 case PatersonEnum: 168 for(i=0;i<numnodes;i++) T_average+=values[i]/reCast<IssmDouble>(numnodes); 169 B_average=Paterson(T_average); 170 element->AddMaterialInput(MaterialsRheologyBEnum,&B_average,P0Enum); 171 break; 172 case ArrheniusEnum:{ 173 Input* surface_input=element->GetInput(SurfaceEnum); _assert_(surface_input); 174 surface_input->GetInputAverage(&s_average); 175 element->GetVerticesCoordinates(&xyz_list); 176 for(i=0;i<numnodes;i++) T_average+=values[i]/reCast<IssmDouble>(numnodes); 177 //B_average=Arrhenius(T_average, 178 //s_average-((xyz_list[0][2]+xyz_list[1][2]+xyz_list[2][2]+xyz_list[3][2]+xyz_list[4][2]+xyz_list[5][2])/6.0), 179 //element->GetMaticeParameter(MaterialsRheologyNEnum)); 180 element->AddMaterialInput(MaterialsRheologyBEnum,&B_average,P0Enum); 181 break; 182 } 183 default: 184 _error_("Rheology law " << EnumToStringx(rheology_law) << " not supported yet"); 185 186 } 187 } 188 else{ 189 element->AddInput(TemperaturePicardEnum,values,P1Enum); 190 } 191 192 /*Free ressources:*/ 193 xDelete<IssmDouble>(values); 194 xDelete<IssmDouble>(xyz_list); 195 xDelete<int>(doflist); 119 196 }/*}}}*/ -
issm/trunk-jpl/src/c/classes/Elements/Element.h
r16698 r16699 40 40 virtual void SetwiseNodeConnectivity(int* d_nz,int* o_nz,Node* node,bool* flags,int* flagsindices,int set1_enum,int set2_enum)=0; 41 41 virtual void AddInput(int input_enum, IssmDouble* values, int interpolation_enum)=0; 42 virtual void AddMaterialInput(int input_enum, IssmDouble* values, int interpolation_enum)=0; 42 43 virtual void CreateKMatrix(Matrix<IssmDouble>* Kff, Matrix<IssmDouble>* Kfs)=0; 43 44 virtual void CreateDVector(Vector<IssmDouble>* df)=0; … … 95 96 virtual void Delta18oParameterization(void)=0; 96 97 virtual void SmbGradients()=0; 98 virtual IssmDouble TMeltingPoint(IssmDouble pressure)=0; 97 99 virtual void ResetCoordinateSystem()=0; 98 100 virtual int VelocityInterpolation()=0; -
issm/trunk-jpl/src/c/classes/Elements/Penta.cpp
r16698 r16699 124 124 void Penta::AddInput(int input_enum,IssmDouble* values, int interpolation_enum){ 125 125 126 /*Call inputs method*/126 _assert_(this->inputs); 127 127 this->inputs->AddInput(new PentaInput(input_enum,values,interpolation_enum)); 128 128 } 129 129 /*}}}*/ 130 /*FUNCTION Penta::AddMaterialInput{{{*/ 131 void Penta::AddMaterialInput(int input_enum,IssmDouble* values, int interpolation_enum){ 132 133 _assert_(this->material); 134 this->material->inputs->AddInput(new TriaInput(input_enum,values,interpolation_enum)); 135 } 136 /*}}}*/ 137 130 138 /*FUNCTION Penta::BedNormal {{{*/ 131 139 void Penta::BedNormal(IssmDouble* bed_normal, IssmDouble xyz_list[3][3]){ … … 3151 3159 /*Update inputs*/ 3152 3160 this->inputs->AddInput(new PentaInput(SurfaceforcingsMassBalanceEnum,&smb[0],P1Enum)); 3161 } 3162 /*}}}*/ 3163 /*FUNCTION Penta::TMeltingPoint{{{*/ 3164 IssmDouble Penta::TMeltingPoint(IssmDouble pressure){ 3165 3166 _assert_(matpar); 3167 return this->matpar->TMeltingPoint(pressure); 3168 3153 3169 } 3154 3170 /*}}}*/ -
issm/trunk-jpl/src/c/classes/Elements/Penta.h
r16698 r16699 112 112 void ResetCoordinateSystem(void); 113 113 void SmbGradients(); 114 IssmDouble TMeltingPoint(IssmDouble pressure); 114 115 IssmDouble SurfaceArea(void); 115 116 void Update(int index, IoModel* iomodel,int analysis_counter,int analysis_type,int finitelement); … … 182 183 /*Penta specific routines:{{{*/ 183 184 void AddInput(int input_enum, IssmDouble* values, int interpolation_enum); 185 void AddMaterialInput(int input_enum, IssmDouble* values, int interpolation_enum); 184 186 void BedNormal(IssmDouble* bed_normal, IssmDouble xyz_list[3][3]); 185 187 ElementMatrix* CreateBasalMassMatrix(void); -
issm/trunk-jpl/src/c/classes/Elements/Seg.h
r16698 r16699 67 67 /*Element virtual functions definitions: {{{*/ 68 68 void AddInput(int input_enum, IssmDouble* values, int interpolation_enum){_error_("not implemented yet");}; 69 void AddMaterialInput(int input_enum, IssmDouble* values, int interpolation_enum){_error_("not implemented yet");}; 69 70 void ComputeBasalStress(Vector<IssmDouble>* sigma_b){_error_("not implemented yet");}; 70 71 void ComputeStrainRate(Vector<IssmDouble>* eps){_error_("not implemented yet");}; … … 137 138 void ResetCoordinateSystem(void){_error_("not implemented yet");}; 138 139 void SmbGradients(){_error_("not implemented yet");}; 140 IssmDouble TMeltingPoint(IssmDouble pressure){_error_("not implemented yet");}; 139 141 IssmDouble SurfaceArea(void){_error_("not implemented yet");}; 140 142 void Update(int index, IoModel* iomodel,int analysis_counter,int analysis_type,int finitelement){_error_("not implemented yet");}; -
issm/trunk-jpl/src/c/classes/Elements/Tria.cpp
r16698 r16699 170 170 171 171 /*Call inputs method*/ 172 _assert_(this->inputs); 172 173 this->inputs->AddInput(new TriaInput(input_enum,values,interpolation_enum)); 174 } 175 /*}}}*/ 176 /*FUNCTION Tria::AddMaterialInput{{{*/ 177 void Tria::AddMaterialInput(int input_enum,IssmDouble* values, int interpolation_enum){ 178 179 _assert_(this->material); 180 this->material->inputs->AddInput(new TriaInput(input_enum,values,interpolation_enum)); 173 181 } 174 182 /*}}}*/ … … 2641 2649 /*Update inputs*/ 2642 2650 this->inputs->AddInput(new TriaInput(SurfaceforcingsMassBalanceEnum,&smb[0],P1Enum)); 2651 } 2652 /*}}}*/ 2653 /*FUNCTION Tria::TMeltingPoint{{{*/ 2654 IssmDouble Tria::TMeltingPoint(IssmDouble pressure){ 2655 2656 _assert_(matpar); 2657 return this->matpar->TMeltingPoint(pressure); 2658 2643 2659 } 2644 2660 /*}}}*/ -
issm/trunk-jpl/src/c/classes/Elements/Tria.h
r16698 r16699 118 118 void ResetCoordinateSystem(void); 119 119 void SmbGradients(); 120 IssmDouble TMeltingPoint(IssmDouble pressure); 120 121 int VelocityInterpolation(); 121 122 int PressureInterpolation(); … … 193 194 /*Tria specific routines:{{{*/ 194 195 void AddInput(int input_enum, IssmDouble* values, int interpolation_enum); 196 void AddMaterialInput(int input_enum, IssmDouble* values, int interpolation_enum); 195 197 ElementMatrix* CreateKMatrix(void); 196 198 ElementMatrix* CreateKMatrixBalancethickness(void);
Note:
See TracChangeset
for help on using the changeset viewer.