Changeset 26546


Ignore:
Timestamp:
11/05/21 06:37:05 (3 years ago)
Author:
Mathieu Morlighem
Message:

CHG: make levelset work for every case (dynamic and forced)

File:
1 edited

Legend:

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

    r26526 r26546  
    1212
    1313void LevelsetAnalysis::CreateConstraints(Constraints* constraints,IoModel* iomodel){/*{{{*/
     14       
     15        /*intermediary: */
    1416        int finiteelement;
     17        int         code,vector_layout;
     18        IssmDouble *spcdata = NULL;
     19        int         M,N;
     20
     21        /*Get finite element type for this analysis*/
    1522        iomodel->FindConstant(&finiteelement,"md.levelset.fe");
    16         IoModelToDynamicConstraintsx(constraints,iomodel,"md.levelset.spclevelset",LevelsetAnalysisEnum,finiteelement);
    17         //IoModelToConstraintsx(constraints,iomodel,"md.levelset.spclevelset",LevelsetAnalysisEnum,finiteelement);
     23
     24        /*First of, find the record for the enum, and get code  of data type: */
     25        iomodel->SetFilePointerToData(&code, &vector_layout,"md.levelset.spclevelset");
     26        if(code!=7)_error_("expecting a IssmDouble vector for constraints md.levelset.spclevelset");
     27        if(vector_layout!=1)_error_("expecting a nodal vector for constraints md.levelset.spclevelset");
     28
     29        /*Fetch vector:*/
     30        iomodel->FetchData(&spcdata,&M,&N,spc_name);
     31
     32        /*Call IoModelToConstraintsx*/
     33        if(N>1){
     34                /*If it is a time series, most likely we are forcing the ice front position and do not want to have a Dynamic Constraint*/
     35                _assert_(M==iomodel->numberofvertices+1);
     36                IoModelToConstraintsx(constraints,iomodel,spcdata,M,N,LevelsetAnalysisEnum,finite_element);
     37        }
     38        else{
     39                /*This is not a time series, we probably have calving on, we need the levelset constraints to update as the levelset moves*/
     40                _assert_(N==1);
     41                _assert_(M==iomodel->numberofvertices);
     42                IoModelToDynamicConstraintsx(constraints,iomodel,spcdata,M,N,LevelsetAnalysisEnum,finite_element);
     43        }
     44
     45        /*Clean up*/
     46        xDelete<IssmDouble>(spcdata);
    1847}
    1948/*}}}*/
Note: See TracChangeset for help on using the changeset viewer.