Changeset 22484
- Timestamp:
- 02/28/18 12:04:40 (7 years ago)
- Location:
- issm/trunk-jpl/src/c/analyses
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp
r22048 r22484 20 20 /*Output*/ 21 21 IssmDouble *spcvector = NULL; 22 IssmDouble *spcvectorstatic = NULL; 22 23 IssmDouble* times=NULL; 23 24 IssmDouble* values=NULL; 25 IssmDouble* issurface = NULL; 24 26 25 27 /*Fetch parameters: */ … … 32 34 33 35 /*Fetch data: */ 36 iomodel->FetchData(&issurface,&M,&N,"md.mesh.vertexonsurface"); _assert_(N>0); _assert_(M==iomodel->numberofvertices); 34 37 iomodel->FetchData(&spcvector,&M,&N,"md.thermal.spctemperature"); 35 36 /*Convert spcs from temperatures to enthalpy*/ 37 _assert_(N>0); _assert_(M>=iomodel->numberofvertices); 38 for(int i=0;i<iomodel->numberofvertices;i++){ 39 for(int j=0;j<N;j++){ 40 spcvector[i*N+j] = heatcapacity*(spcvector[i*N+j]-referencetemperature); 41 } 42 } 38 iomodel->FetchData(&spcvectorstatic,&M,&N,"md.thermal.spctemperature"); 43 39 44 40 /*Specific case for PDD, we want the constaints to be updated by the PDD scheme itself*/ … … 51 47 } 52 48 49 /*Convert spcs from temperatures to enthalpy*/ 50 _assert_(N>0); _assert_(M>=iomodel->numberofvertices); 51 for(int i=0;i<iomodel->numberofvertices;i++){ 52 for(int j=0;j<N;j++){ 53 if (isdynamic){ 54 if (issurface[i]==1){ 55 spcvector[i*N+j] = heatcapacity*(spcvector[i*N+j]-referencetemperature); 56 spcvectorstatic[i*N+j] = nan(""); 57 } 58 else{ 59 spcvector[i*N+j] = nan(""); 60 spcvectorstatic[i*N+j] = heatcapacity*(spcvectorstatic[i*N+j]-referencetemperature); 61 } 62 } 63 else{ 64 spcvector[i*N+j] = heatcapacity*(spcvector[i*N+j]-referencetemperature); 65 } 66 } 67 } 68 53 69 if(isdynamic){ 54 IoModelToDynamicConstraintsx(constraints,iomodel,spcvector,M,N,EnthalpyAnalysisEnum,finiteelement); 70 IoModelToDynamicConstraintsx(constraints,iomodel,spcvector,iomodel->numberofvertices,1,EnthalpyAnalysisEnum,finiteelement); 71 IoModelToConstraintsx(constraints,iomodel,spcvectorstatic,M,N,EnthalpyAnalysisEnum,finiteelement); 55 72 } 56 73 else{ … … 60 77 /*Free ressources:*/ 61 78 iomodel->DeleteData(spcvector,"md.thermal.spctemperature"); 79 iomodel->DeleteData(spcvectorstatic,"md.thermal.spctemperature"); 80 iomodel->DeleteData(issurface,"md.mesh.vertexonsurface"); 62 81 xDelete<IssmDouble>(times); 63 82 xDelete<IssmDouble>(values); -
issm/trunk-jpl/src/c/analyses/ThermalAnalysis.cpp
r22049 r22484 9 9 10 10 /*Intermediary*/ 11 int M,N; 11 12 int finiteelement; 12 13 iomodel->FindConstant(&finiteelement,"md.thermal.fe"); 13 14 _assert_(finiteelement==P1Enum); 15 16 /*Output*/ 17 IssmDouble *spcvector = NULL; 18 IssmDouble *spcvectorstatic = NULL; 19 IssmDouble *issurface = NULL; 14 20 15 21 /*Only 3d mesh supported*/ … … 34 40 } 35 41 42 /*Fetch data: */ 43 iomodel->FetchData(&issurface,&M,&N,"md.mesh.vertexonsurface"); _assert_(N>0); _assert_(M==iomodel->numberofvertices); 44 iomodel->FetchData(&spcvector,&M,&N,"md.thermal.spctemperature"); 45 iomodel->FetchData(&spcvectorstatic,&M,&N,"md.thermal.spctemperature"); 46 47 /*Convert spcs from temperatures to enthalpy*/ 48 _assert_(N>0); _assert_(M>=iomodel->numberofvertices); 49 for(int i=0;i<iomodel->numberofvertices;i++){ 50 for(int j=0;j<N;j++){ 51 if (isdynamic){ 52 if (issurface[i]==1)spcvectorstatic[i*N+j] = nan(""); 53 else spcvector[i*N+j] = nan(""); 54 } 55 } 56 } 57 36 58 if(isdynamic){ 37 IoModelToDynamicConstraintsx(constraints,iomodel,"md.thermal.spctemperature",ThermalAnalysisEnum,finiteelement); 59 IoModelToDynamicConstraintsx(constraints,iomodel,spcvector,iomodel->numberofvertices,1,ThermalAnalysisEnum,finiteelement); 60 IoModelToConstraintsx(constraints,iomodel,spcvectorstatic,M,N,ThermalAnalysisEnum,finiteelement); 38 61 } 39 62 else{ 40 IoModelToConstraintsx(constraints,iomodel,"md.thermal.spctemperature",ThermalAnalysisEnum,finiteelement); 41 } 63 IoModelToConstraintsx(constraints,iomodel,spcvector,M,N,ThermalAnalysisEnum,finiteelement); 64 } 65 66 /*Free ressources:*/ 67 iomodel->DeleteData(spcvector,"md.thermal.spctemperature"); 68 iomodel->DeleteData(spcvectorstatic,"md.thermal.spctemperature"); 69 iomodel->DeleteData(issurface,"md.mesh.vertexonsurface"); 42 70 43 71 }/*}}}*/
Note:
See TracChangeset
for help on using the changeset viewer.