Changeset 27095


Ignore:
Timestamp:
06/22/22 16:12:28 (3 years ago)
Author:
Eric.Larour
Message:

CHG: various debugging.

Location:
issm/branches/trunk-larour-SLPS2022/src/c
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified issm/branches/trunk-larour-SLPS2022/src/c/analyses/MmemasstransportAnalysis.cpp

    r27084 r27095  
    1 #include "./MmemasstransporttransportAnalysis.h"
     1#include "./MmemasstransportAnalysis.h"
    22#include <math.h>
    33#include "../toolkits/toolkits.h"
     
    88
    99/*Model processing*/
    10 void MmemasstransporttransportAnalysis::CreateConstraints(Constraints* constraints,IoModel* iomodel){/*{{{*/
     10void MmemasstransportAnalysis::CreateConstraints(Constraints* constraints,IoModel* iomodel){/*{{{*/
    1111        /*No constraints*/
    1212}/*}}}*/
    13 void MmemasstransporttransportAnalysis::CreateLoads(Loads* loads, IoModel* iomodel){/*{{{*/
     13void MmemasstransportAnalysis::CreateLoads(Loads* loads, IoModel* iomodel){/*{{{*/
    1414        /*No loads*/
    1515}/*}}}*/
    16 void MmemasstransporttransportAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel,bool isamr){/*{{{*/
    17         ::CreateNodes(nodes,iomodel,MmemasstransporttransportAnalysisEnum,P1Enum);
     16void MmemasstransportAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel,bool isamr){/*{{{*/
     17        ::CreateNodes(nodes,iomodel,MmemasstransportAnalysisEnum,P1Enum);
    1818}/*}}}*/
    19 int  MmemasstransporttransportAnalysis::DofsPerNode(int** doflist,int domaintype,int approximation){/*{{{*/
     19int  MmemasstransportAnalysis::DofsPerNode(int** doflist,int domaintype,int approximation){/*{{{*/
    2020        return 3;
    2121}/*}}}*/
    22 void MmemasstransporttransportAnalysis::UpdateElements(Elements* elements,Inputs* inputs,IoModel* iomodel,int analysis_counter,int analysis_type){/*{{{*/
     22void MmemasstransportAnalysis::UpdateElements(Elements* elements,Inputs* inputs,IoModel* iomodel,int analysis_counter,int analysis_type){/*{{{*/
    2323
    2424        int  nature=0;
     
    3636
    3737        /*Plug inputs into element:*/
    38         iomodel->FetchDataToInput(inputs,elements,"md.mmemasstransport.deltathickness", MmemasstransportDeltathicknessEnum);
     38        iomodel->FetchDataToInput(inputs,elements,"md.geometry.thickness",ThicknessEnum);
     39        iomodel->FetchDataToInput(inputs,elements,"md.geometry.surface",SurfaceEnum);
     40        iomodel->FetchDataToInput(inputs,elements,"md.geometry.base",BaseEnum);
     41        iomodel->FetchDataToInput(inputs,elements,"md.initialization.sealevel",SealevelEnum,0);
     42        iomodel->FetchDataToInput(inputs,elements,"md.mask.ice_levelset",MaskIceLevelsetEnum);
     43        iomodel->FetchDataToInput(inputs,elements,"md.mask.ocean_levelset",MaskOceanLevelsetEnum);
     44        iomodel->FetchDataToInput(inputs,elements,"md.mmemasstransport.thickness", MmemasstransportThicknessEnum);
    3945
    4046        /*Initialize sea level cumulated sea level loads :*/
    41         iomodel->ConstantToInput(inputs,elements,0.,AccumulatedDeltaThicknessEnum,P0Enum);
    42         iomodel->ConstantToInput(inputs,elements,0.,OldAccumulatedDeltaThicknessEnum,P0Enum);
     47        iomodel->ConstantToInput(inputs,elements,0.,AccumulatedDeltaIceThicknessEnum,P1Enum);
     48        iomodel->ConstantToInput(inputs,elements,0.,OldAccumulatedDeltaIceThicknessEnum,P1Enum);
    4349
    4450}/*}}}*/
    45 void MmemasstransporttransportAnalysis::UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum){/*{{{*/
     51void MmemasstransportAnalysis::UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum){/*{{{*/
    4652
    4753        int     numoutputs;
    4854        char**  requestedoutputs = NULL;
    4955
    50         /*Deal with multi-model ensembles: {{{*/
    51 
    5256        int nids,npart,nel;
    53         IssmDouble* modelids=NULL;
     57        IssmDouble* ids=NULL;
    5458        IssmDouble* partition = NULL;
    5559
    5660        iomodel->FetchData(&nel,"md.mesh.numberofelements");
    57         iomodel->FetchData(&modelids,&nids,NULL,"md.mmemasstransport.modelids");
    58         parameters->AddObject(new DoubleParam(MmemasstransportModelidsEnum,modelids,nids,1));
     61        iomodel->FetchData(&ids,&nids,NULL,"md.mmemasstransport.ids");
     62        //_printf_("nids: " << nids << "\n"); for(int i=0;i<nids;i++)_printf_(ids[i] << "|");  _printf_("\n");
     63        parameters->AddObject(new DoubleMatParam(MmemasstransportModelidsEnum,ids,nids,1));
    5964        iomodel->FetchData(&partition,&npart,NULL,"md.mmemasstransport.partition");
    6065        if (npart!=nel)_error_("MmemasstransportAnalysis:UpdateParameters: partition vector should be distributed over elements, not vertices!");
    61         parameters->AddObject(new DoubleParam(MmemasstransportPartitionEnum,partition,nel,1));
     66        parameters->AddObject(new DoubleMatParam(MmemasstransportPartitionEnum,partition,nel,1));
    6267       
    63         xDelete<IssmDouble>(modelids);
     68        xDelete<IssmDouble>(ids);
    6469        xDelete<IssmDouble>(partition);
    65 
    66         } /*}}}*/
    67         /*Requested outputs {{{*/
    68         iomodel->FindConstant(&requestedoutputs,&numoutputs,"md.solidearth.requested_outputs");
    69         if(numoutputs)parameters->AddObject(new StringArrayParam(SealevelchangeRequestedOutputsEnum,requestedoutputs,numoutputs));
    70         iomodel->DeleteData(&requestedoutputs,numoutputs,"md.solidearth.requested_outputs");
    71         /*}}}*/
     70       
     71        /*Requested outputs*/
     72        iomodel->FindConstant(&requestedoutputs,&numoutputs,"md.mmemasstransport.requested_outputs");
     73        parameters->AddObject(new IntParam(MmemasstransportNumRequestedOutputsEnum,numoutputs));
     74        if(numoutputs)parameters->AddObject(new StringArrayParam(MmemasstransportRequestedOutputsEnum,requestedoutputs,numoutputs));
     75        iomodel->DeleteData(&requestedoutputs,numoutputs,"md.mmemasstransport.requested_outputs");
    7276
    7377}/*}}}*/
    7478
    7579/*Finite Element Analysis*/
    76 void           MmemasstransporttransportAnalysis::Core(FemModel* femmodel){/*{{{*/
     80void           MmemasstransportAnalysis::Core(FemModel* femmodel){/*{{{*/
    7781        _error_("not implemented");
    7882}/*}}}*/
    79 void           MmemasstransporttransportAnalysis::PreCore(FemModel* femmodel){/*{{{*/
     83void           MmemasstransportAnalysis::PreCore(FemModel* femmodel){/*{{{*/
    8084        _error_("not implemented");
    8185}/*}}}*/
    82 ElementVector* MmemasstransporttransportAnalysis::CreateDVector(Element* element){/*{{{*/
     86ElementVector* MmemasstransportAnalysis::CreateDVector(Element* element){/*{{{*/
    8387        /*Default, return NULL*/
    8488        return NULL;
    8589}/*}}}*/
    86 ElementMatrix* MmemasstransporttransportAnalysis::CreateJacobianMatrix(Element* element){/*{{{*/
     90ElementMatrix* MmemasstransportAnalysis::CreateJacobianMatrix(Element* element){/*{{{*/
    8791_error_("Not implemented");
    8892}/*}}}*/
    89 ElementMatrix* MmemasstransporttransportAnalysis::CreateKMatrix(Element* element){/*{{{*/
     93ElementMatrix* MmemasstransportAnalysis::CreateKMatrix(Element* element){/*{{{*/
    9094        _error_("not implemented yet");
    9195}/*}}}*/
    92 ElementVector* MmemasstransporttransportAnalysis::CreatePVector(Element* element){/*{{{*/
     96ElementVector* MmemasstransportAnalysis::CreatePVector(Element* element){/*{{{*/
    9397_error_("not implemented yet");
    9498}/*}}}*/
    95 void           MmemasstransporttransportAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
     99void           MmemasstransportAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
    96100
    97         /*retrieve thickness from MmemasstransporttransportAnalysis spcs in our element:*/
     101        /*retrieve thickness from MmemasstransportAnalysis spcs in our element:*/
    98102
    99103        IssmDouble h;
     
    107111        /*Get dof list and inputs */
    108112        element->GetDofList(&doflist,NoneApproximationEnum,GsetEnum);
    109         Input* dh_input=element->GetInput(MmemasstransportDeltathicknessEnum); _assert_(h_input);
     113        Input* h_input=element->GetInput(MmemasstransportThicknessEnum); _assert_(h_input);
    110114
    111115        /*Ok, we have the thickness in inputs, fill in solution */
     
    113117        for(int i=0;i<numnodes;i++){
    114118                gauss->GaussVertex(i);
    115                 dh_input->GetInputValue(&dh,gauss);
    116                 values[i+0]=dh;
     119                h_input->GetInputValue(&h,gauss);
     120                values[i+0]=h;
    117121        }
    118122
     
    125129        xDelete<IssmDouble>(values);
    126130}/*}}}*/
    127 void           MmemasstransporttransportAnalysis::GradientJ(Vector<IssmDouble>* gradient,Element*  element,int control_type,int control_interp,int control_index){/*{{{*/
     131void           MmemasstransportAnalysis::GradientJ(Vector<IssmDouble>* gradient,Element*  element,int control_type,int control_interp,int control_index){/*{{{*/
    128132        _error_("Not implemented yet");
    129133}/*}}}*/
    130 void           MmemasstransporttransportAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
     134void           MmemasstransportAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
    131135
    132136        int         i,domaintype;
     
    154158        }
    155159
    156         /*Add bp, dsl and str as inputs to the tria element: */
     160        /*Add thickness as inputs to the tria element: */
    157161        element->AddInput(ThicknessEnum,h,P1Enum);
    158162
     
    163167
    164168}/*}}}*/
    165 void           MmemasstransporttransportAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/
     169void           MmemasstransportAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/
    166170        /*Default, do nothing*/
    167171        return;
  • TabularUnified issm/branches/trunk-larour-SLPS2022/src/c/classes/Profiler.h

    r26469 r27095  
    2222#define MOVINGFRONTCORE         9 /*Profiling MOVINGFRONT */
    2323#define MASSTRANSPORTCORE       10 /*Profiling MASSTRANSPORT */
    24 #define OCEANTRANSPORTCORE      11 /*Profiling OCEANTRANSPORT */
    25 #define SMBCORE                         12 /*Profiling SMB */
    26 #define GROUNDINGLINECORE       13 /*Profiling GROUDINGLINE MIGRATION */
    27 #define ESACORE                         14 /*Profiling ESA */
    28 #define SLRCORE                         15 /*Profiling SLR */
    29 #define SAMPLINGCORE    16 /*Profiling SAMPLING */
    30 #define MPISERIAL                               17 /*Profiling MPISerial */
    31 #define SEDLOOP                         18 /*Profiling MPISerial */
    32 #define SEDMatrix                               19 /*Profiling MPISerial */
    33 #define SEDUpdate                               20 /*Profiling MPISerial */
    34 #define EPLLOOP                         21 /*Profiling MPISerial */
    35 #define EPLMasking                      22 /*Profiling MPISerial */
    36 #define EPLMatrices                     23 /*Profiling MPISerial */
    37 #define EPLUpdate                               24 /*Profiling MPISerial */
    38 #define MAXPROFSIZE                     25 /*Used to initialize static arrays*/
     24#define MMEMASSTRANSPORTCORE 11 /*Profiling MMEMASSTRANSPORT */
     25#define OCEANTRANSPORTCORE      12 /*Profiling OCEANTRANSPORT */
     26#define SMBCORE                         13 /*Profiling SMB */
     27#define GROUNDINGLINECORE       14 /*Profiling GROUDINGLINE MIGRATION */
     28#define ESACORE                         15/*Profiling ESA */
     29#define SLRCORE                         16 /*Profiling SLR */
     30#define SAMPLINGCORE    17 /*Profiling SAMPLING */
     31#define MPISERIAL                               18 /*Profiling MPISerial */
     32#define SEDLOOP                         19 /*Profiling MPISerial */
     33#define SEDMatrix                               20 /*Profiling MPISerial */
     34#define SEDUpdate                               21 /*Profiling MPISerial */
     35#define EPLLOOP                         22 /*Profiling MPISerial */
     36#define EPLMasking                      23 /*Profiling MPISerial */
     37#define EPLMatrices                     24 /*Profiling MPISerial */
     38#define EPLUpdate                               25 /*Profiling MPISerial */
     39#define MAXPROFSIZE                     26 /*Used to initialize static arrays*/
    3940
    4041class Profiler: public Object{
  • TabularUnified issm/branches/trunk-larour-SLPS2022/src/c/modules/InputUpdateFromDakotax/InputUpdateFromDakotax.cpp

    r27080 r27095  
    162162
    163163        /*Here, we put all the code that cannot be handled any other place: */
    164         if (strncmp(root,"SurfaceloadModelid",18)==0){ //surface load in solid earth class {{{
     164        if (strncmp(root,"MmemasstransportThickness",25)==0){ //surface load in solid earth class {{{
    165165
    166166                if(VerboseQmu()){
    167                         _printf0_("      SurfaceloadModelid MME, with ids: ");
     167                        _printf0_("      Masstransport Thickness MME with ids: ");
    168168                        for (int i=0;i<npart;i++)_printf0_((int)distributed_values[i] << " ");
    169169                        _printf0_("\n");
    170170                }
    171171
    172                 if (femmodel->inputs->GetInputObjectEnum(MasstransportSpcthicknessEnum)==DatasetInputEnum)
    173                         MmeToInput(femmodel,distributed_values,variable_partition,npart,MasstransportSpcthicknessEnum, P0Enum);
     172                if (femmodel->inputs->GetInputObjectEnum(MmemasstransportThicknessEnum)==DatasetInputEnum)
     173                        MmeToInputx(femmodel,distributed_values,variable_partition,npart,MmemasstransportThicknessEnum, P0Enum);
    174174
    175175                if (femmodel->inputs->GetInputObjectEnum(MaskIceLevelsetEnum)==DatasetInputEnum)
    176                         MmeToInput(femmodel,distributed_values,variable_partition,npart,MaskIceLevelsetEnum, P1Enum);
     176                        MmeToInputx(femmodel,distributed_values,variable_partition,npart,MaskIceLevelsetEnum, P1Enum);
    177177
    178178                if (femmodel->inputs->GetInputObjectEnum(MaskOceanLevelsetEnum)==DatasetInputEnum)
    179                         MmeToInput(femmodel,distributed_values,variable_partition,npart,MaskOceanLevelsetEnum, P1Enum);
     179                        MmeToInputx(femmodel,distributed_values,variable_partition,npart,MaskOceanLevelsetEnum, P1Enum);
    180180
    181181        } /*}}}*/
     
    183183
    184184}       //}}}
    185 void  MmeToInput(FemModel* femmodel,IssmDouble* distributed_values,IssmDouble* variable_partition,int npart,int rootenum, int interpolationenum){ /*{{{*/
     185void  MmeToInputx(FemModel* femmodel,IssmDouble* distributed_values,IssmDouble* variable_partition,int npart,int rootenum, int interpolationenum){ /*{{{*/
    186186
    187187        TransientInput* transientinput  = NULL;
     
    201201        transientinput->GetAllTimes(&times,&N);
    202202        femmodel->inputs->SetTransientInput(DummyEnum,times,N);
    203         transientinput2 = femmodel->inputs->GetTransientInput(DummyEnum);
     203        transientinput2 = femmodel->inputs->GetTransientInput(DummyEnum); transientinput2->Configure(femmodel->parameters);
    204204
    205205        for(Object* & object : femmodel->elements->objects){
     
    239239        femmodel->inputs->ChangeEnum(DummyEnum,rootenum);
    240240
    241         //reconfigure:
    242         transientinput2->Configure(femmodel->parameters);
    243241}       //}}}
    244242void  InputScaleFromDakotax(FemModel* femmodel,IssmDouble* distributed_values,IssmDouble* partition, int npart, int nt, int name){ /*{{{*/
  • TabularUnified issm/branches/trunk-larour-SLPS2022/src/c/modules/InputUpdateFromDakotax/InputUpdateFromDakotax.h

    r26469 r27095  
    1010void  InputUpdateFromDakotax(FemModel* femmodel,double* variables,char* *variables_descriptors,int numvariables);
    1111void  InputUpdateSpecialtyCode(FemModel* femmodel,IssmDouble* distributed_values,IssmDouble* variable_partition,int npart,char* root);
    12 void  MmeToInput(FemModel* femmodel,IssmDouble* distributed_values,IssmDouble* variable_partition,int npart,int rootenum, int interpolationenum);
     12void  MmeToInputx(FemModel* femmodel,IssmDouble* distributed_values,IssmDouble* variable_partition,int npart,int rootenum, int interpolationenum);
    1313void InputScaleFromDakotax(FemModel* femmodel,IssmDouble* distributed_values,IssmDouble* partition, int npart, int nt, int name);
    1414
  • TabularUnified issm/branches/trunk-larour-SLPS2022/src/c/modules/ModelProcessorx/CreateParameters.cpp

    r26947 r27095  
    7878                parameters->AddObject(iomodel->CopyConstantObject("md.transient.isstressbalance",TransientIsstressbalanceEnum));
    7979                parameters->AddObject(iomodel->CopyConstantObject("md.transient.ismasstransport",TransientIsmasstransportEnum));
     80                parameters->AddObject(iomodel->CopyConstantObject("md.transient.ismmemasstransport",TransientIsmmemasstransportEnum));
    8081                parameters->AddObject(iomodel->CopyConstantObject("md.transient.isoceantransport",TransientIsoceantransportEnum));
    8182                parameters->AddObject(iomodel->CopyConstantObject("md.transient.issmb",TransientIssmbEnum));
  • TabularUnified issm/branches/trunk-larour-SLPS2022/src/c/modules/UpdateMmesx/UpdateMmesx.cpp

    r27084 r27095  
    55#include "./UpdateMmesx.h"
    66#include "../MmeToInputFromIdx/MmeToInputFromIdx.h"
     7#include "../InputUpdateFromDakotax/InputUpdateFromDakotax.h"
    78
    89void  UpdateMmesx(FemModel* femmodel){
     
    3536                MmeToInputFromIdx(femmodel->inputs,femmodel->elements,femmodel->parameters,modelid-1,OceantransportSpcstrEnum, P0Enum);
    3637        } /*}}}*/
    37         if (femmodel->inputs->Exist(MmemasstransportThicknessEnum) && femmodel->inputs->GetInputObjectEnum(MmemasstransportThicknessEnum)==DatasetInputEnum){ /*{{{*/
     38        /*Deal with solid earth ice loads: {{{*/
     39        if (femmodel->inputs->Exist(MmemasstransportThicknessEnum) && femmodel->inputs->GetInputObjectEnum(MmemasstransportThicknessEnum)==DatasetInputEnum){
    3840       
    39                 /*Deal with solid earth ice loads: */
    4041
    4142                int nids;
     
    4647                femmodel->parameters->FindParam(&modelids,&nids,NULL,MmemasstransportModelidsEnum);
    4748                femmodel->parameters->FindParam(&partition,NULL,NULL,MmemasstransportPartitionEnum);
     49                //_printf_("modelids: " << nids << "|ids:" << modelids[0] << "|" << modelids[1] << "|" << modelids[2] << "|\n");
    4850
    49                 MmeToInput(femmodel,modelids,partition,nids,MmemasstransportThicknessEnum, P0Enum);
     51                MmeToInputx(femmodel,modelids,partition,nids,MmemasstransportThicknessEnum, P0Enum);
    5052
    5153                if (femmodel->inputs->GetInputObjectEnum(MaskIceLevelsetEnum)==DatasetInputEnum)
    52                         MmeToInput(femmodel,modelids,partition,nids,MaskIceLevelsetEnum, P1Enum);
     54                        MmeToInputx(femmodel,modelids,partition,nids,MaskIceLevelsetEnum, P1Enum);
    5355
    5456                if (femmodel->inputs->GetInputObjectEnum(MaskOceanLevelsetEnum)==DatasetInputEnum)
    55                         MmeToInput(femmodel,modelids,partition,nids,MaskOceanLevelsetEnum, P1Enum);
     57                        MmeToInputx(femmodel,modelids,partition,nids,MaskOceanLevelsetEnum, P1Enum);
    5658
    5759                /*free ressources:*/
Note: See TracChangeset for help on using the changeset viewer.