source:
issm/oecreview/Archive/15392-16133/ISSM-15483-15484.diff
Last change on this file was 16134, checked in by , 12 years ago | |
---|---|
File size: 12.6 KB |
-
../trunk-jpl/src/c/modules/ModelProcessorx/Prognostic/CreateConstraintsPrognostic.cpp
15 15 16 16 /*Do not add constraints in DG, they are weakly imposed*/ 17 17 if(stabilization!=3){ 18 IoModelToConstraintsx(constraints,iomodel,PrognosticSpcthicknessEnum,PrognosticAnalysisEnum );18 IoModelToConstraintsx(constraints,iomodel,PrognosticSpcthicknessEnum,PrognosticAnalysisEnum,P1Enum); 19 19 } 20 20 21 21 /*Assign output pointer: */ -
../trunk-jpl/src/c/modules/ModelProcessorx/HydrologyShreve/CreateConstraintsHydrologyShreve.cpp
19 19 20 20 if(hydrology_model!=HydrologyshreveEnum) return; 21 21 22 IoModelToConstraintsx(constraints,iomodel,HydrologyshreveSpcwatercolumnEnum,HydrologyShreveAnalysisEnum );22 IoModelToConstraintsx(constraints,iomodel,HydrologyshreveSpcwatercolumnEnum,HydrologyShreveAnalysisEnum,P1Enum); 23 23 24 24 /*Assign output pointer: */ 25 25 *pconstraints=constraints; -
../trunk-jpl/src/c/modules/ModelProcessorx/DiagnosticHoriz/CreateConstraintsDiagnosticHoriz.cpp
10 10 void CreateConstraintsDiagnosticHoriz(Constraints** pconstraints, IoModel* iomodel){ 11 11 12 12 /*Intermediary*/ 13 int i,j;14 int count;15 IssmDouble 16 IssmDouble 17 IssmDouble 18 IssmDouble 19 bool isstokes,isl1l2,ismacayealpattyn;20 int fe_ssa;21 bool spcpresent=false;22 int Mx,Nx;23 int My,Ny;24 int Mz,Nz;13 int i,j; 14 int count; 15 IssmDouble yts; 16 IssmDouble g; 17 IssmDouble rho_ice; 18 IssmDouble stokesreconditioning; 19 bool isstokes,isl1l2,ismacayealpattyn; 20 int fe_ssa; 21 bool spcpresent = false; 22 int Mx,Nx; 23 int My,Ny; 24 int Mz,Nz; 25 25 IssmDouble *spcvx = NULL; 26 26 IssmDouble *spcvy = NULL; 27 27 IssmDouble *spcvz = NULL; … … 328 328 329 329 if(!xIsNan<IssmDouble>(spcvx[v1]) && !xIsNan<IssmDouble>(spcvx[v2])){ 330 330 constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+iomodel->numberofvertices+i+1, 331 1,(spcvx[v1]+spcvx[v2])/ yts,DiagnosticHorizAnalysisEnum));331 1,(spcvx[v1]+spcvx[v2])/(2.*yts),DiagnosticHorizAnalysisEnum)); 332 332 count++; 333 333 } 334 334 if(!xIsNan<IssmDouble>(spcvy[v1]) && !xIsNan<IssmDouble>(spcvy[v2])){ 335 335 constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+iomodel->numberofvertices+i+1, 336 2,(spcvy[v1]+spcvy[v2])/ yts,DiagnosticHorizAnalysisEnum));336 2,(spcvy[v1]+spcvy[v2])/(2.*yts),DiagnosticHorizAnalysisEnum)); 337 337 count++; 338 338 } 339 339 if (reCast<int,IssmDouble>(vertices_type[v1])==StokesApproximationEnum || (reCast<int,IssmDouble>(vertices_type[v1])==NoneApproximationEnum)){ 340 340 if(!xIsNan<IssmDouble>(spcvz[v1]) && !xIsNan<IssmDouble>(spcvz[v2])){ 341 341 constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+iomodel->numberofvertices+i+1, 342 3,(spcvz[v1]+spcvz[v2])/ yts,DiagnosticHorizAnalysisEnum));342 3,(spcvz[v1]+spcvz[v2])/(2.*yts),DiagnosticHorizAnalysisEnum)); 343 343 count++; 344 344 } 345 345 } -
../trunk-jpl/src/c/modules/ModelProcessorx/Balancethickness/CreateConstraintsBalancethickness.cpp
15 15 16 16 /*Do not add constraints in DG*/ 17 17 if(stabilization!=3){ 18 IoModelToConstraintsx(constraints,iomodel,BalancethicknessSpcthicknessEnum,BalancethicknessAnalysisEnum );18 IoModelToConstraintsx(constraints,iomodel,BalancethicknessSpcthicknessEnum,BalancethicknessAnalysisEnum,P1Enum); 19 19 } 20 20 21 21 /*Assign output pointer: */ -
../trunk-jpl/src/c/modules/ModelProcessorx/HydrologyDCEfficient/CreateConstraintsHydrologyDCEfficient.cpp
23 23 iomodel->Constant(&isefficientlayer,HydrologydcIsefficientlayerEnum); 24 24 if(!isefficientlayer) return; 25 25 26 IoModelToConstraintsx(constraints,iomodel,HydrologydcSpceplHeadEnum,HydrologyDCEfficientAnalysisEnum );26 IoModelToConstraintsx(constraints,iomodel,HydrologydcSpceplHeadEnum,HydrologyDCEfficientAnalysisEnum,P1Enum); 27 27 28 28 /*Assign output pointer: */ 29 29 *pconstraints=constraints; -
../trunk-jpl/src/c/modules/ModelProcessorx/HydrologyDCInefficient/CreateConstraintsHydrologyDCInefficient.cpp
18 18 iomodel->Constant(&hydrology_model,HydrologyModelEnum); 19 19 if(hydrology_model!=HydrologydcEnum) return; 20 20 21 IoModelToConstraintsx(constraints,iomodel,HydrologydcSpcsedimentHeadEnum,HydrologyDCInefficientAnalysisEnum );21 IoModelToConstraintsx(constraints,iomodel,HydrologydcSpcsedimentHeadEnum,HydrologyDCInefficientAnalysisEnum,P1Enum); 22 22 23 23 /*Assign output pointer: */ 24 24 *pconstraints=constraints; -
../trunk-jpl/src/c/modules/ModelProcessorx/Thermal/CreateConstraintsThermal.cpp
15 15 16 16 /*Only 3d mesh supported*/ 17 17 if(iomodel->dim==3){ 18 IoModelToConstraintsx(constraints,iomodel,ThermalSpctemperatureEnum,ThermalAnalysisEnum );18 IoModelToConstraintsx(constraints,iomodel,ThermalSpctemperatureEnum,ThermalAnalysisEnum,P1Enum); 19 19 } 20 20 21 21 /*Assign output pointer: */ -
../trunk-jpl/src/c/modules/IoModelToConstraintsx/IoModelToConstraintsx.h
7 7 #include "../../classes/classes.h" 8 8 9 9 /* local prototypes: */ 10 void IoModelToConstraintsx(Constraints* constraints,IoModel* iomodel,int vector_enum,int analysis_type );10 void IoModelToConstraintsx(Constraints* constraints,IoModel* iomodel,int vector_enum,int analysis_type,int finite_element); 11 11 12 12 #endif /* _IOMODELTOELEMENTINPUTX_H */ -
../trunk-jpl/src/c/modules/IoModelToConstraintsx/IoModelToConstraintsx.cpp
5 5 #include "./IoModelToConstraintsx.h" 6 6 #include "../../shared/shared.h" 7 7 #include "../../toolkits/toolkits.h" 8 #include "../ModelProcessorx/ModelProcessorx.h" 8 9 9 void IoModelToConstraintsx(Constraints* constraints,IoModel* iomodel,int vector_enum,int analysis_type ){10 void IoModelToConstraintsx(Constraints* constraints,IoModel* iomodel,int vector_enum,int analysis_type,int finite_element){ 10 11 11 12 /*intermediary: */ 12 int i,j; 13 IssmDouble yts; 14 bool transient = false; 13 int i,j,count; 14 IssmDouble yts; 15 15 FILE *fid = NULL; 16 int code = 0; 17 int vector_layout = 0; 16 int code,vector_layout; 18 17 IssmDouble *times = NULL; 19 18 IssmDouble *values = NULL; 20 19 bool spcpresent = false; 21 int count = 0;22 20 21 /*P2 finite elements*/ 22 int v1,v2; 23 bool *my_edges = NULL; 24 23 25 /*variables being fetched: */ 24 IssmDouble * IssmDoublevector= NULL;25 int M,N;26 IssmDouble *spcdata = NULL; 27 int M,N; 26 28 27 29 /*Fetch parameters: */ 28 30 iomodel->Constant(&yts,ConstantsYtsEnum); 29 31 30 32 /*First of, find the record for the enum, and get code of data type: */ 31 33 fid=iomodel->SetFilePointerToData(&code, &vector_layout,vector_enum); 32 33 34 if(code!=7)_error_("expecting a IssmDouble vector for constraints with enum " << EnumToStringx(vector_enum)); 34 35 if(vector_layout!=1)_error_("expecting a nodal vector for constraints with enum " << EnumToStringx(vector_enum)); 35 36 36 37 /*Fetch vector:*/ 37 iomodel->FetchData(& IssmDoublevector,&M,&N,vector_enum);38 iomodel->FetchData(&spcdata,&M,&N,vector_enum); 38 39 39 /*Transient or static?:*/ 40 /*Partition edges if we are using P2 finite elements*/ 41 if(finite_element==P2Enum){ 42 EdgesPartitioning(&my_edges,iomodel); 43 } 44 40 45 if(M==iomodel->numberofvertices){ 41 /* static: just create Constraints objects*/46 /*Static constraint*/ 42 47 count=0; 43 44 /*Create Constraints from x,y,z: */45 48 for (i=0;i<iomodel->numberofvertices;i++){ 46 47 /*keep only this partition's nodes:*/48 49 if((iomodel->my_vertices[i])){ 49 50 if (!xIsNan<IssmDouble>(IssmDoublevector[i])){ 51 52 constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,1,IssmDoublevector[i],analysis_type)); 50 if (!xIsNan<IssmDouble>(spcdata[i])){ 51 constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,1,spcdata[i],analysis_type)); 53 52 count++; 54 53 } 55 54 } 56 55 } 56 if(finite_element==P2Enum){ 57 for(i=0;i<iomodel->numberofedges;i++){ 58 if(my_edges[i]){ 59 v1 = iomodel->edges[4*i+0]-1; 60 v2 = iomodel->edges[4*i+1]-1; 61 if(!xIsNan<IssmDouble>(spcdata[v1]) && !xIsNan<IssmDouble>(spcdata[v2])){ 62 constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+iomodel->numberofvertices+i+1, 63 1,(spcdata[v1]+spcdata[v2])/2.,analysis_type)); 64 count++; 65 } 66 } 67 } 68 } 57 69 } 58 70 else if (M==(iomodel->numberofvertices+1)){ 59 71 /*transient: create transient SpcTransient objects. Same logic, except we need to retrieve … … 62 74 63 75 /*figure out times: */ 64 76 times=xNew<IssmDouble>(N); 65 for(j=0;j<N;j++){ 66 times[j]=IssmDoublevector[(M-1)*N+j]*yts; 67 } 77 for(j=0;j<N;j++) times[j]=spcdata[(M-1)*N+j]*yts; 68 78 69 /*Create constraints from x,y,z: */79 /*Create constraints: */ 70 80 for (i=0;i<iomodel->numberofvertices;i++){ 71 72 /*keep only this partition's nodes:*/73 81 if((iomodel->my_vertices[i])){ 74 82 75 83 /*figure out times and values: */ 76 84 values=xNew<IssmDouble>(N); 77 85 spcpresent=false; 78 86 for(j=0;j<N;j++){ 79 values[j]= IssmDoublevector[i*N+j];87 values[j]=spcdata[i*N+j]; 80 88 if(!xIsNan<IssmDouble>(values[j]))spcpresent=true; //NaN means no spc by default 81 89 } 82 90 … … 87 95 xDelete<IssmDouble>(values); 88 96 } 89 97 } 98 if(finite_element==P2Enum){ 99 for(i=0;i<iomodel->numberofedges;i++){ 100 if(my_edges[i]){ 101 v1 = iomodel->edges[4*i+0]-1; 102 v2 = iomodel->edges[4*i+1]-1; 103 values=xNew<IssmDouble>(N); 104 spcpresent=false; 105 for(j=0;j<N;j++){ 106 values[j]=(spcdata[v1*N+j]+spcdata[v2*N+j])/2.; 107 if(!xIsNan<IssmDouble>(values[j])) spcpresent=true; //NaN means no spc by default 108 } 109 if(spcpresent){ 110 constraints->AddObject(new SpcTransient(iomodel->constraintcounter+count+1,iomodel->nodecounter+iomodel->numberofvertices+i+1,1, 111 N,times,values,analysis_type)); 112 count++; 113 } 114 } 115 } 116 } 90 117 } 91 118 else{ 92 119 _error_("Size of field " << EnumToStringx(vector_enum) << " not supported"); 93 120 } 94 121 95 122 /*Free ressources:*/ 96 xDelete<IssmDouble>( IssmDoublevector);123 xDelete<IssmDouble>(spcdata); 97 124 xDelete<IssmDouble>(times); 98 125 xDelete<IssmDouble>(values); 99 126 }
Note:
See TracBrowser
for help on using the repository browser.