Changeset 22484


Ignore:
Timestamp:
02/28/18 12:04:40 (7 years ago)
Author:
schlegel
Message:

CHG: add option for static spc for the SMB Pdd schemes

Location:
issm/trunk-jpl/src/c/analyses
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp

    r22048 r22484  
    2020        /*Output*/
    2121        IssmDouble *spcvector  = NULL;
     22        IssmDouble *spcvectorstatic  = NULL;
    2223        IssmDouble* times=NULL;
    2324        IssmDouble* values=NULL;
     25        IssmDouble* issurface = NULL;
    2426
    2527        /*Fetch parameters: */
     
    3234
    3335        /*Fetch data: */
     36        iomodel->FetchData(&issurface,&M,&N,"md.mesh.vertexonsurface"); _assert_(N>0); _assert_(M==iomodel->numberofvertices);
    3437        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");
    4339
    4440        /*Specific case for PDD, we want the constaints to be updated by the PDD scheme itself*/
     
    5147        }
    5248
     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
    5369        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);
    5572        }
    5673        else{
     
    6077        /*Free ressources:*/
    6178        iomodel->DeleteData(spcvector,"md.thermal.spctemperature");
     79        iomodel->DeleteData(spcvectorstatic,"md.thermal.spctemperature");
     80        iomodel->DeleteData(issurface,"md.mesh.vertexonsurface");
    6281        xDelete<IssmDouble>(times);
    6382        xDelete<IssmDouble>(values);
  • issm/trunk-jpl/src/c/analyses/ThermalAnalysis.cpp

    r22049 r22484  
    99
    1010        /*Intermediary*/
     11        int        M,N;
    1112        int finiteelement;
    1213        iomodel->FindConstant(&finiteelement,"md.thermal.fe");
    1314        _assert_(finiteelement==P1Enum);
     15
     16        /*Output*/
     17        IssmDouble *spcvector  = NULL;
     18        IssmDouble *spcvectorstatic  = NULL;
     19        IssmDouble *issurface = NULL;
    1420
    1521        /*Only 3d mesh supported*/
     
    3440        }
    3541
     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
    3658        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);
    3861        }
    3962        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");
    4270
    4371}/*}}}*/
Note: See TracChangeset for help on using the changeset viewer.