Changeset 3479 for issm/trunk
- Timestamp:
- 04/08/10 16:49:03 (15 years ago)
- Location:
- issm/trunk/src
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/c/objects/ElementProperties.cpp
r3446 r3479 34 34 this->geothermalflux=NULL; 35 35 36 this->friction_type= 0;37 this->p= 0;38 this->q= 0;39 this->shelf= 0;40 this->onbed= 0;41 this->onwater= 0;42 this->onsurface= 0;43 this->collapse= 0;44 this->thermal_steadystate= 0;36 this->friction_type=UNDEF; 37 this->p=UNDEF; 38 this->q=UNDEF; 39 this->shelf=UNDEF; 40 this->onbed=UNDEF; 41 this->onwater=UNDEF; 42 this->onsurface=UNDEF; 43 this->collapse=UNDEF; 44 this->thermal_steadystate=UNDEF; 45 45 return; 46 46 } … … 145 145 this->numnodes=elementproperties_numnodes; 146 146 147 if(elementproperties_h)this->h=(double*)xmalloc(this->numnodes*sizeof(double)); 148 else this->h=NULL; 149 if(elementproperties_s)this->s=(double*)xmalloc(this->numnodes*sizeof(double)); 150 else this->s=NULL; 151 if(elementproperties_b)this->b=(double*)xmalloc(this->numnodes*sizeof(double)); 152 else this->b=NULL; 153 if(elementproperties_k)this->k=(double*)xmalloc(this->numnodes*sizeof(double)); 154 else this->k=NULL; 155 if(elementproperties_melting)this->melting=(double*)xmalloc(this->numnodes*sizeof(double)); 156 else this->melting=NULL; 157 if(elementproperties_accumulation)this->accumulation=(double*)xmalloc(this->numnodes*sizeof(double)); 158 else this->accumulation=NULL; 159 if(elementproperties_geothermalflux)this->geothermalflux=(double*)xmalloc(this->numnodes*sizeof(double)); 160 else this->geothermalflux=NULL; 147 this->h=(double*)xmalloc(this->numnodes*sizeof(double)); 148 this->s=(double*)xmalloc(this->numnodes*sizeof(double)); 149 this->b=(double*)xmalloc(this->numnodes*sizeof(double)); 150 this->k=(double*)xmalloc(this->numnodes*sizeof(double)); 151 this->melting=(double*)xmalloc(this->numnodes*sizeof(double)); 152 this->accumulation=(double*)xmalloc(this->numnodes*sizeof(double)); 153 this->geothermalflux=(double*)xmalloc(this->numnodes*sizeof(double)); 161 154 162 155 for(i=0;i<this->numnodes;i++){ 163 if(elementproperties_h)this->h[i]=elementproperties_h[i]; 164 if(elementproperties_s)this->s[i]=elementproperties_s[i]; 165 if(elementproperties_b)this->b[i]=elementproperties_b[i]; 166 if(elementproperties_k)this->k[i]=elementproperties_k[i]; 167 if(elementproperties_melting)this->melting[i]=elementproperties_melting[i]; 168 if(elementproperties_accumulation)this->accumulation[i]=elementproperties_accumulation[i]; 156 if(elementproperties_h) this->h[i]=elementproperties_h[i]; 157 else this->h[i]=UNDEF; 158 if(elementproperties_s) this->s[i]=elementproperties_s[i]; 159 else this->s[i]=UNDEF; 160 if(elementproperties_b) this->b[i]=elementproperties_b[i]; 161 else this->b[i]=UNDEF; 162 if(elementproperties_k) this->k[i]=elementproperties_k[i]; 163 else this->k[i]=UNDEF; 164 if(elementproperties_melting) this->melting[i]=elementproperties_melting[i]; 165 else this->melting[i]=UNDEF; 166 if(elementproperties_accumulation) this->accumulation[i]=elementproperties_accumulation[i]; 167 else this->accumulation[i]=UNDEF; 169 168 if(elementproperties_geothermalflux)this->geothermalflux[i]=elementproperties_geothermalflux[i]; 169 else this->geothermalflux[i]=UNDEF; 170 170 } 171 171 … … 179 179 this->collapse=elementproperties_collapse; 180 180 this->thermal_steadystate=elementproperties_thermal_steadystate; 181 182 return; 183 } 184 /*}}}*/ 185 /*FUNCTION ElementProperties Init propreties from iomodel{{{1*/ 186 void ElementProperties::Init(int numberofnodes, int* vertex_ids, int element_id, IoModel* iomodel){ //i is the node index 187 188 int i,k; 189 190 /*Initialize number of nodes*/ 191 this->numnodes=numberofnodes; 192 193 /*Allocate node properties*/ 194 if (iomodel->thickness) this->h=(double*)xmalloc(this->numnodes*sizeof(double)); 195 if (iomodel->surface) this->s=(double*)xmalloc(this->numnodes*sizeof(double)); 196 if (iomodel->bed) this->b=(double*)xmalloc(this->numnodes*sizeof(double)); 197 if (iomodel->drag) this->k=(double*)xmalloc(this->numnodes*sizeof(double)); 198 if (iomodel->melting) this->melting=(double*)xmalloc(this->numnodes*sizeof(double)); 199 if (iomodel->accumulation) this->accumulation=(double*)xmalloc(this->numnodes*sizeof(double)); 200 if (iomodel->geothermalflux)this->geothermalflux=(double*)xmalloc(this->numnodes*sizeof(double)); 201 202 /*Get node properties*/ 203 for(i=0;i<this->numnodes;i++){ 204 205 //get index of the vertex in C indexing 206 k=vertex_ids[i]-1; 207 208 //Get properties from iomodel 209 if(iomodel->thickness) this->h[i]=iomodel->thickness[k]; 210 if(iomodel->surface) this->s[i]=iomodel->surface[k]; 211 if(iomodel->bed) this->b[i]=iomodel->bed[k]; 212 if(iomodel->drag) this->k[i]=iomodel->drag[k]; 213 if(iomodel->melting) this->melting[i]=iomodel->melting[k]; 214 if(iomodel->accumulation) this->accumulation[i]=iomodel->accumulation[k]; 215 if(iomodel->geothermalflux)this->geothermalflux[i]=iomodel->geothermalflux[k]; 216 } 217 218 /*Get element properties from iomodel*/ 219 if (iomodel->p) this->p=iomodel->p[element_id-1]; 220 if (iomodel->q) this->q=iomodel->q[element_id-1]; 221 if (iomodel->elementoniceshelf)this->shelf=(int)iomodel->elementoniceshelf[element_id-1]; 222 if (iomodel->elementonbed) this->onbed=(int)iomodel->elementonbed[element_id-1]; 223 if (iomodel->elementonwater) this->onwater=(bool)iomodel->elementonwater[element_id-1]; 224 if (iomodel->elementonsurface) this->onsurface=(int)iomodel->elementonsurface[element_id-1]; 225 226 /*Get other properties from iomodel*/ 227 this->friction_type=iomodel->drag_type; 228 229 /*WARNING: collapse and thermal_steadystate are left undefined*/ 181 230 182 231 return; -
issm/trunk/src/c/objects/ElementProperties.h
r3420 r3479 5 5 #ifndef _ELEMENTPROPERTIES_H_ 6 6 #define _ELEMENTPROPERTIES_H_ 7 8 /*indefinitions: */ 9 struct IoModel; 7 10 8 11 class ElementProperties{ … … 33 36 ElementProperties(); 34 37 ElementProperties(int numnodes, double* h, double* s, double* b, double* k, double* melting, double* accumulation, double* geothermalflux, int friction_type, double p, double q, int shelf, int onbed, bool onwater, int onsurface, int collapse, int thermal_steadystate); 35 void Init(int numnodes, double* h, double* s, double* b, double* k, double* melting, double* accumulation, double* geothermalflux, int friction_type, double p, double q, int shelf, int onbed, bool onwater, int onsurface, int collapse, int thermal_steadystate);36 38 ElementProperties(ElementProperties* properties); 37 39 ~ElementProperties(); 40 41 void Init(int numnodes, int* vertex_ids, int element_id, IoModel* iomodel); 42 void Init(int numnodes, double* h, double* s, double* b, double* k, double* melting, double* accumulation, double* geothermalflux, int friction_type, double p, double q, int shelf, int onbed, bool onwater, int onsurface, int collapse, int thermal_steadystate); 38 43 39 44 void Marshall(char** pmarshalled_dataset); -
issm/trunk/src/c/objects/Matice.cpp
r3463 r3479 12 12 #include "./Matice.h" 13 13 #include <string.h> 14 #include "../EnumDefinitions/EnumDefinitions.h" 14 15 #include "../shared/shared.h" 15 16 #include "../include/macros.h" 16 #include "../EnumDefinitions/EnumDefinitions.h" 17 17 #include "../include/typedefs.h" 18 18 19 19 /*Object constructors and destructor*/ … … 51 51 matice_mid=i+1; //same as element it is created for 52 52 53 /*B and n: */ 54 B_avg=0; 55 for(j=0;j<num_vertices;j++){ 56 B_avg+=*(iomodel->B+((int)*(iomodel->elements+num_vertices*i+j)-1)); 57 } 58 B_avg=B_avg/num_vertices; 59 60 matice_B=B_avg; 61 matice_n=(double)*(iomodel->n+i); 53 /*Compute B on the element if provided*/ 54 if (iomodel->B){ 55 B_avg=0; 56 for(j=0;j<num_vertices;j++){ 57 B_avg+=*(iomodel->B+((int)*(iomodel->elements+num_vertices*i+j)-1)); 58 } 59 B_avg=B_avg/num_vertices; 60 } 61 62 if (iomodel->B) matice_B=B_avg; 63 else matice_B=UNDEF; 64 if (iomodel->n) matice_n=(double)*(iomodel->n+i); 65 else matice_n=UNDEF; 62 66 63 67 this->Init(matice_mid,matice_B,matice_n); -
issm/trunk/src/c/objects/Node.cpp
r3470 r3479 803 803 /*FUNCTION Node::UpdateFromInputs {{{2*/ 804 804 void Node::UpdateFromInputs(void* vinputs){ 805 806 ISSMERROR("not used yet!");807 805 806 /*nothing updated for now*/ 807 808 808 } 809 809 /*}}}*/ -
issm/trunk/src/c/objects/Tria.cpp
r3470 r3479 67 67 68 68 int j; 69 int offset;70 69 int tria_node_ids[3]; 71 70 int tria_matice_id; 72 71 int tria_matpar_id; 73 72 int tria_numpar_id; 74 double tria_h[3];75 double tria_s[3];76 double tria_b[3];77 double tria_k[3];78 double tria_melting[3];79 double tria_accumulation[3];80 int tria_friction_type;81 double tria_p,tria_q;82 int tria_shelf;83 int tria_onwater;84 85 73 86 74 /*id: */ … … 99 87 this->hmatpar.Init(&tria_matpar_id,1); 100 88 this->hnumpar.Init(&tria_numpar_id,1); 101 102 /*properties: */ 103 for(j=0;j<3;j++){ 104 105 offset=(int)*(iomodel->elements+3*i+j)-1; //get index of this vertex, in C numbering. 106 tria_h[j]= *(iomodel->thickness+offset); 107 tria_s[j]= *(iomodel->surface+offset); 108 tria_b[j]=*(iomodel->bed+offset); 109 tria_k[j]=*(iomodel->drag+offset); 110 tria_melting[j]=*(iomodel->melting+offset); 111 tria_accumulation[j]=*(iomodel->accumulation+offset); 112 } 113 tria_friction_type=(int)iomodel->drag_type; 114 tria_p=iomodel->p[i]; 115 tria_q=iomodel->q[i]; 116 tria_shelf=(int)*(iomodel->elementoniceshelf+i); 117 tria_onwater=(bool)*(iomodel->elementonwater+i); 118 119 this->properties.Init(3,tria_h, tria_s, tria_b, tria_k, tria_melting, tria_accumulation, NULL, 120 tria_friction_type, tria_p, tria_q, tria_shelf, UNDEF,tria_onwater, UNDEF,UNDEF,UNDEF); 121 89 this->properties.Init(3,tria_node_ids,this->id,iomodel); 122 90 123 91 } -
issm/trunk/src/c/objects/Vertex.cpp
r3469 r3479 188 188 Vertex* vertex=NULL; 189 189 int dof[1]={0}; 190 double coord[3];191 190 192 191 vertex=this; 193 194 coord[0]=this->x; coord[1]=this->y; coord[2]=this->z;195 192 196 193 /*Recover parameter inputs: */ … … 198 195 199 196 /*Update internal data if inputs holds new values: */ 200 inputs->Recover("x",&coord[0],1,dof,1,(void**)&vertex); 201 inputs->Recover("y",&coord[1],1,dof,1,(void**)&vertex); 202 inputs->Recover("z",&coord[2],1,dof,1,(void**)&vertex); 203 204 ISSMERROR("not supported yet!"); 197 inputs->Recover("x",&x,1,dof,1,(void**)&vertex); 198 inputs->Recover("y",&y,1,dof,1,(void**)&vertex); 199 inputs->Recover("z",&z,1,dof,1,(void**)&vertex); 205 200 206 201 } -
issm/trunk/src/m/solutions/jpl/control_core.m
r2761 r3479 45 45 46 46 %Update inputs in datasets 47 [model.elements,model.nodes,model. loads,model.materials,model.parameters]=UpdateFromInputs(model.elements,model.nodes,model.loads,model.materials,model.parameters,inputs);47 [model.elements,model.nodes,model.vertices,model.loads,model.materials,model.parameters]=UpdateFromInputs(model.elements,model.nodes,model.vertices,model.loads,model.materials,model.parameters,inputs); 48 48 49 49 displaystring(verbose,'\n%s',[' computing gradJ...']); -
issm/trunk/src/m/solutions/jpl/diagnostic_core_linear.m
r2333 r3479 9 9 10 10 %Update inputs in datasets 11 [m.elements,m.nodes, m.loads,m.materials,m.parameters]=UpdateFromInputs(m.elements,m.nodes,m.loads,m.materials,m.parameters,inputs);11 [m.elements,m.nodes,m.vertices,m.loads,m.materials,m.parameters]=UpdateFromInputs(m.elements,m.nodes,m.vertices,m.loads,m.materials,m.parameters,inputs); 12 12 13 13 %system matrices 14 [K_gg, p_g]=SystemMatrices(m.elements,m.nodes,m. loads,m.materials,m.parameters,inputs,analysis_type,sub_analysis_type);15 [K_gg, p_g,kmax]=PenaltySystemMatrices(K_gg,p_g,m.elements,m.nodes,m. loads,m.materials,m.parameters,inputs,analysis_type,sub_analysis_type);14 [K_gg, p_g]=SystemMatrices(m.elements,m.nodes,m.vertices,m.loads,m.materials,m.parameters,inputs,analysis_type,sub_analysis_type); 15 [K_gg, p_g,kmax]=PenaltySystemMatrices(K_gg,p_g,m.elements,m.nodes,m.vertices,m.loads,m.materials,m.parameters,inputs,analysis_type,sub_analysis_type); 16 16 17 17 %Reduce tangent matrix from g size to f size -
issm/trunk/src/m/solutions/jpl/diagnostic_core_nonlinear.m
r2547 r3479 31 31 32 32 %Update inputs in datasets 33 [m.elements,m.nodes, loads,m.materials,m.parameters]=UpdateFromInputs(m.elements,m.nodes, loads,m.materials,m.parameters,inputs);33 [m.elements,m.nodes,m.vertices, loads,m.materials,m.parameters]=UpdateFromInputs(m.elements,m.nodes,m.vertices, loads,m.materials,m.parameters,inputs); 34 34 35 35 %system matrices 36 [K_gg_nopenalty , p_g_nopenalty]=SystemMatrices(m.elements,m.nodes, loads,m.materials,m.parameters,inputs,analysis_type,sub_analysis_type);36 [K_gg_nopenalty , p_g_nopenalty]=SystemMatrices(m.elements,m.nodes,m.vertices,loads,m.materials,m.parameters,inputs,analysis_type,sub_analysis_type); 37 37 38 38 %penalties 39 [K_gg , p_g, kmax]=PenaltySystemMatrices(K_gg_nopenalty,p_g_nopenalty,m.elements,m.nodes, loads,m.materials,m.parameters,inputs,analysis_type,sub_analysis_type);39 [K_gg , p_g, kmax]=PenaltySystemMatrices(K_gg_nopenalty,p_g_nopenalty,m.elements,m.nodes,m.vertices,loads,m.materials,m.parameters,inputs,analysis_type,sub_analysis_type); 40 40 41 41 %Reduce tangent matrix from g size to f size … … 84 84 inputs=add(inputs,'velocity',u_g,'doublevec',m.parameters.numberofdofspernode,m.parameters.numberofnodes); 85 85 m.parameters.kflag=1; m.parameters.pflag=0; 86 [K_gg, p_g]=SystemMatrices(m.elements,m.nodes, loads,m.materials,m.parameters,inputs,analysis_type,sub_analysis_type);86 [K_gg, p_g]=SystemMatrices(m.elements,m.nodes,m.vertices,loads,m.materials,m.parameters,inputs,analysis_type,sub_analysis_type); 87 87 [K_ff, K_fs] = Reducematrixfromgtof( K_gg, m.Gmn, m.nodesets); 88 88 varargout(1)={K_ff}; -
issm/trunk/src/m/solutions/jpl/thermal_core_nonlinear.m
r2333 r3479 23 23 24 24 %Update inputs in datasets 25 [m.elements,m.nodes, loads,m.materials,m.parameters]=UpdateFromInputs(m.elements,m.nodes, loads,m.materials,m.parameters,inputs);25 [m.elements,m.nodes,m.vertices,loads,m.materials,m.parameters]=UpdateFromInputs(m.elements,m.nodes,m.vertices, loads,m.materials,m.parameters,inputs); 26 26 27 27 %system matrices … … 29 29 if count==1 30 30 displaystring(m.parameters.verbose,'%s',[' system matrices']); 31 [K_gg_nopenalty, p_g_nopenalty]=SystemMatrices(m.elements,m.nodes, loads,m.materials,m.parameters,inputs,analysis_type,sub_analysis_type);31 [K_gg_nopenalty, p_g_nopenalty]=SystemMatrices(m.elements,m.nodes,m.vertices,loads,m.materials,m.parameters,inputs,analysis_type,sub_analysis_type); 32 32 end 33 33 displaystring(m.parameters.verbose,'%s',[' penalty system matrices']); 34 [K_gg , p_g, melting_offset]=PenaltySystemMatrices(K_gg_nopenalty,p_g_nopenalty,m.elements,m.nodes, loads,m.materials,m.parameters,inputs,analysis_type,sub_analysis_type);34 [K_gg , p_g, melting_offset]=PenaltySystemMatrices(K_gg_nopenalty,p_g_nopenalty,m.elements,m.nodes,m.verticesloads,m.materials,m.parameters,inputs,analysis_type,sub_analysis_type); 35 35 else 36 36 displaystring(m.parameters.verbose,'%s',[' system matrices']); 37 [K_gg , p_g]=SystemMatrices(m.elements,m.nodes, loads,m.materials,m.parameters,inputs,analysis_type,sub_analysis_type);37 [K_gg , p_g]=SystemMatrices(m.elements,m.nodes,m.vertices,loads,m.materials,m.parameters,inputs,analysis_type,sub_analysis_type); 38 38 displaystring(m.parameters.verbose,'%s',[' penalty system matrices']); 39 [K_gg , p_g, melting_offset]=PenaltySystemMatrices(K_gg,p_g,m.elements,m.nodes, loads,m.materials,m.parameters,inputs,analysis_type,sub_analysis_type);39 [K_gg , p_g, melting_offset]=PenaltySystemMatrices(K_gg,p_g,m.elements,m.nodes,m.vertices,loads,m.materials,m.parameters,inputs,analysis_type,sub_analysis_type); 40 40 end 41 41 … … 57 57 inputs=add(inputs,'temperature',t_g,'doublevec',m.parameters.numberofdofspernode,m.parameters.numberofnodes); 58 58 displaystring(m.parameters.verbose,'%s',[' update inputs']); 59 [m.elements,m.nodes, loads,m.materials,m.parameters]=UpdateFromInputs(m.elements,m.nodes, loads,m.materials,m.parameters,inputs);59 [m.elements,m.nodes,m.vertices, loads,m.materials,m.parameters]=UpdateFromInputs(m.elements,m.nodes,m.vertices, loads,m.materials,m.parameters,inputs); 60 60 61 61 %penalty constraints -
issm/trunk/src/mex/PenaltySystemMatrices/PenaltySystemMatrices.cpp
r3445 r3479 79 79 { 80 80 _printf_("\n"); 81 _printf_(" usage: [Kgg,pg] = %s(Kggin,pgin,ele emnts,nodes,loads,materials,params,inputs,analysis_type,sub_analysis_type);\n",__FUNCT__);81 _printf_(" usage: [Kgg,pg] = %s(Kggin,pgin,elements,nodes,vertices,loads,materials,params,inputs,analysis_type,sub_analysis_type);\n",__FUNCT__); 82 82 _printf_("\n"); 83 83 } -
issm/trunk/src/mex/SystemMatrices/SystemMatrices.cpp
r3445 r3479 81 81 { 82 82 _printf_("\n"); 83 _printf_(" usage: [Kgg,pg] = %s(ele emnts,nodes,loads,materials,params,inputs,analysis_type);\n",__FUNCT__);83 _printf_(" usage: [Kgg,pg] = %s(elements,nodes,vertices,loads,materials,params,inputs,analysis_type);\n",__FUNCT__); 84 84 _printf_("\n"); 85 85 } -
issm/trunk/src/mex/UpdateFromInputs/UpdateFromInputs.cpp
r3445 r3479 64 64 { 65 65 _printf_("\n"); 66 _printf_(" usage: [elements,nodes, loads, materials, parameters] = %s(elements,nodes,loads,materials,parameters,inputs);\n",__FUNCT__);66 _printf_(" usage: [elements,nodes,vertices,loads,materials,parameters] = %s(elements,nodes,vertices,loads,materials,parameters,inputs);\n",__FUNCT__); 67 67 _printf_("\n"); 68 68 }
Note:
See TracChangeset
for help on using the changeset viewer.