Changeset 28093


Ignore:
Timestamp:
02/05/24 17:44:43 (14 months ago)
Author:
Mathieu Morlighem
Message:

CHG: adding constraints to free surfaces as a temporary hack

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

Legend:

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

    r27284 r28093  
    77/*Model processing*/
    88void FreeSurfaceBaseAnalysis::CreateConstraints(Constraints* constraints,IoModel* iomodel){/*{{{*/
     9
     10        /*Use spcthickness for now*/
     11        IssmDouble* spcthickness = NULL;
     12        int         M,N;
     13        iomodel->FetchData(&spcthickness,&M,&N,"md.masstransport.spcthickness");
     14        if(M!=iomodel->numberofvertices || N!=1) _error_("Size of constraints not supported yet");
     15
     16        /*Check if there is any NaN*/
     17        bool isconstraints = false;
     18        for(int i=0;i<M;i++) if(!xIsNan<IssmDouble>(spcthickness[i])) isconstraints = true;
     19        if(!isconstraints){
     20                iomodel->DeleteData(spcthickness,"md.masstransport.spcthickness");
     21                return;
     22        }
     23
     24        _printf0_("   WARNING: using md.geometry to constrain free base solver\n");
     25
     26        /*Use spcthickness for now*/
     27        IssmDouble* base= NULL;
     28        iomodel->FetchData(&base,&M,&N,"md.geometry.base");
     29        if(M!=iomodel->numberofvertices || N!=1) _error_("Size of constraints not supported yet");
     30        for(int i=0;i<M;i++) if(xIsNan<IssmDouble>(spcthickness[i])) base[i] = NAN;
     31
     32        /*Create Constraints based on this new vector*/
     33        IoModelToConstraintsx(constraints,iomodel,base,M, N, FreeSurfaceBaseAnalysisEnum, P1Enum, 0);
     34
     35        /*Cleanup and return*/
     36        iomodel->DeleteData(spcthickness,"md.masstransport.spcthickness");
     37        iomodel->DeleteData(base,"md.geometry.base");
    938}/*}}}*/
    1039void FreeSurfaceBaseAnalysis::CreateLoads(Loads* loads, IoModel* iomodel){/*{{{*/
  • issm/trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.cpp

    r27102 r28093  
    77/*Model processing*/
    88void FreeSurfaceTopAnalysis::CreateConstraints(Constraints* constraints,IoModel* iomodel){/*{{{*/
     9
     10        /*Use spcthickness for now*/
     11        IssmDouble* spcthickness = NULL;
     12        int         M,N;
     13        iomodel->FetchData(&spcthickness,&M,&N,"md.masstransport.spcthickness");
     14        if(M!=iomodel->numberofvertices || N!=1) _error_("Size of constraints not supported yet");
     15
     16        /*Check if there is any NaN*/
     17        bool isconstraints = false;
     18        for(int i=0;i<M;i++) if(!xIsNan<IssmDouble>(spcthickness[i])) isconstraints = true;
     19        if(!isconstraints){
     20                iomodel->DeleteData(spcthickness,"md.masstransport.spcthickness");
     21                return;
     22        }
     23
     24        _printf0_("   WARNING: using md.geometry to constrain free surface solver\n");
     25
     26        /*Use spcthickness for now*/
     27        IssmDouble* surface= NULL;
     28        iomodel->FetchData(&surface,&M,&N,"md.geometry.surface");
     29        if(M!=iomodel->numberofvertices || N!=1) _error_("Size of constraints not supported yet");
     30        for(int i=0;i<M;i++) if(xIsNan<IssmDouble>(spcthickness[i])) surface[i] = NAN;
     31
     32        /*Create Constraints based on this new vector*/
     33        IoModelToConstraintsx(constraints,iomodel,surface,M, N, FreeSurfaceTopAnalysisEnum,P1Enum,0);
     34
     35        /*Cleanup and return*/
     36        iomodel->DeleteData(spcthickness,"md.masstransport.spcthickness");
     37        iomodel->DeleteData(surface,"md.geometry.surface");
    938}/*}}}*/
    1039void FreeSurfaceTopAnalysis::CreateLoads(Loads* loads, IoModel* iomodel){/*{{{*/
Note: See TracChangeset for help on using the changeset viewer.