Skip to content

Commit 122bcd6

Browse files
committed
NEW: adding continuous design QMU capabilities and Mmemasstransport
analysis. The Mmemasstransport analysis allows for dakota runs with mass tranposrt thickness times series that are an ensemble -> very nice to compute sea level change fingerprints in a MME manner.
1 parent 678e0b2 commit 122bcd6

30 files changed

+931
-318
lines changed

m4/analyses.m4

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,20 @@ fi
289289
AM_CONDITIONAL([GLHEIGHTADVECTION], [test x$HAVE_GLHEIGHTADVECTION = xyes])
290290
AC_MSG_RESULT($HAVE_GLHEIGHTADVECTION)
291291
dnl }}}
292+
dnl with-HydrologyArmapw{{{
293+
AC_ARG_WITH([HydrologyArmapw],
294+
AS_HELP_STRING([--with-HydrologyArmapw = YES], [compile with HydrologyArmapw capabilities (default is yes)]),
295+
[HYDROLOGYARMAPW=$withval],[HYDROLOGYARMAPW=yes])
296+
AC_MSG_CHECKING(for HydrologyArmapw capability compilation)
297+
298+
HAVE_HYDROLOGYARMAPW=no
299+
if test "x$HYDROLOGYARMAPW" = "xyes"; then
300+
HAVE_HYDROLOGYARMAPW=yes
301+
AC_DEFINE([_HAVE_HYDROLOGYARMAPW_],[1],[with HydrologyArmapw capability])
302+
fi
303+
AM_CONDITIONAL([HYDROLOGYARMAPW], [test x$HAVE_HYDROLOGYARMAPW = xyes])
304+
AC_MSG_RESULT($HAVE_HYDROLOGYARMAPW)
305+
dnl }}}
292306
dnl with-HydrologyDCEfficient{{{
293307
AC_ARG_WITH([HydrologyDCEfficient],
294308
AS_HELP_STRING([--with-HydrologyDCEfficient = YES], [compile with HydrologyDCEfficient capabilities (default is yes)]),
@@ -373,20 +387,6 @@ fi
373387
AM_CONDITIONAL([HYDROLOGYSHREVE], [test x$HAVE_HYDROLOGYSHREVE = xyes])
374388
AC_MSG_RESULT($HAVE_HYDROLOGYSHREVE)
375389
dnl }}}
376-
dnl with-HydrologyArmapw{{{
377-
AC_ARG_WITH([HydrologyArmapw],
378-
AS_HELP_STRING([--with-HydrologyArmapw = YES], [compile with HydrologyArmapw capabilities (default is yes)]),
379-
[HYDROLOGYARMAPW=$withval],[HYDROLOGYARMAPW=yes])
380-
AC_MSG_CHECKING(for HydrologyArmapw capability compilation)
381-
382-
HAVE_HYDROLOGYARMAPW=no
383-
if test "x$HYDROLOGYARMAPW" = "xyes"; then
384-
HAVE_HYDROLOGYARMAPW=yes
385-
AC_DEFINE([_HAVE_HYDROLOGYARMAPW_],[1],[with HydrologyArmapw capability])
386-
fi
387-
AM_CONDITIONAL([HYDROLOGYARMAPW], [test x$HAVE_HYDROLOGYARMAPW = xyes])
388-
AC_MSG_RESULT($HAVE_HYDROLOGYARMAPW)
389-
dnl }}}
390390
dnl with-L2ProjectionBase{{{
391391
AC_ARG_WITH([L2ProjectionBase],
392392
AS_HELP_STRING([--with-L2ProjectionBase = YES], [compile with L2ProjectionBase capabilities (default is yes)]),
@@ -457,6 +457,20 @@ fi
457457
AM_CONDITIONAL([MASSTRANSPORT], [test x$HAVE_MASSTRANSPORT = xyes])
458458
AC_MSG_RESULT($HAVE_MASSTRANSPORT)
459459
dnl }}}
460+
dnl with-Mmemasstransport{{{
461+
AC_ARG_WITH([Mmemasstransport],
462+
AS_HELP_STRING([--with-Mmemasstransport = YES], [compile with Mmemasstransport capabilities (default is yes)]),
463+
[MMEMASSTRANSPORT=$withval],[MMEMASSTRANSPORT=yes])
464+
AC_MSG_CHECKING(for Mmemasstransport capability compilation)
465+
466+
HAVE_MMEMASSTRANSPORT=no
467+
if test "x$MMEMASSTRANSPORT" = "xyes"; then
468+
HAVE_MMEMASSTRANSPORT=yes
469+
AC_DEFINE([_HAVE_MMEMASSTRANSPORT_],[1],[with Mmemasstransport capability])
470+
fi
471+
AM_CONDITIONAL([MMEMASSTRANSPORT], [test x$HAVE_MMEMASSTRANSPORT = xyes])
472+
AC_MSG_RESULT($HAVE_MMEMASSTRANSPORT)
473+
dnl }}}
460474
dnl with-Melting{{{
461475
AC_ARG_WITH([Melting],
462476
AS_HELP_STRING([--with-Melting = YES], [compile with Melting capabilities (default is yes)]),

src/c/Makefile.am

Lines changed: 11 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
AM_CPPFLAGS = @NEOPZINCL@ @DAKOTAINCL@ @SHAPELIBINCL@ @TRIANGLEINCL@ @PETSCINCL@ @AMPIINCL@ @ADJOINTMPIINCL@ @MEDIPACKINCL@ @MPIINCL@ @PARMETISINCL@ @METISINCL@ @CHACOINCL@ @SCOTCHINCL@ @PLAPACKINCL@ @MKLINCL@ @MUMPSINCL@ @SPAIINCL@ @HYPREINCL@ @PROMETHEUSINCL@ @SUPERLUINCL@ @SPOOLESINCL@ @PASTIXINCL@ @MLINCL@ @TAOINCL@ @ADOLCINCL@ @CODIPACKINCL@ @GSLINCL@ @BOOSTINCL@ @METEOIOINCL@ @SNOWPACKINCL@ @ESMFINCL@ @PROJINCL@ @MPLAPACKINCL@
1+
AM_CPPFLAGS = @NEOPZINCL@ @DAKOTAINCL@ @SHAPELIBINCL@ @TRIANGLEINCL@ @PETSCINCL@ @AMPIINCL@ @ADJOINTMPIINCL@ @MEDIPACKINCL@ @MPIINCL@ @PARMETISINCL@ @METISINCL@ @CHACOINCL@ @SCOTCHINCL@ @PLAPACKINCL@ @MKLINCL@ @MUMPSINCL@ @SPAIINCL@ @HYPREINCL@ @PROMETHEUSINCL@ @SUPERLUINCL@ @SPOOLESINCL@ @PASTIXINCL@ @MLINCL@ @TAOINCL@ @ADOLCINCL@ @CODIPACKINCL@ @GSLINCL@ @BOOSTINCL@ @METEOIOINCL@ @SNOWPACKINCL@ @PROJINCL@ @ESMFINCL@ @PROJINCL@ @MPLAPACKINCL@
22
AM_FCFLAGS = @SEMICINCL@
33

44
AUTOMAKE_OPTIONS = subdir-objects
@@ -165,7 +165,6 @@ issm_sources += \
165165
./shared/Numerics/extrema.cpp \
166166
./shared/Numerics/legendre.cpp \
167167
./shared/Numerics/XZvectorsToCoordinateSystem.cpp \
168-
./shared/Numerics/Normals.cpp \
169168
./shared/Exceptions/Exceptions.cpp \
170169
./shared/Sorting/binary_search.cpp \
171170
./shared/Elements/Cuffey.cpp \
@@ -197,6 +196,7 @@ issm_sources += \
197196
./toolkits/mpi/commops/GetOwnershipBoundariesFromRange.cpp \
198197
./toolkits/ToolkitOptions.cpp \
199198
./modules/MmeToInputFromIdx/MmeToInputFromIdx.cpp\
199+
./modules/MmeToInputx/MmeToInputx.cpp\
200200
./modules/ModelProcessorx/ModelProcessorx.cpp \
201201
./modules/ModelProcessorx/ElementsAndVerticesPartitioning.cpp \
202202
./modules/ModelProcessorx/NodesPartitioning.cpp \
@@ -248,6 +248,7 @@ issm_sources += \
248248
./modules/Solverx/Solverx.cpp \
249249
./modules/StochasticForcingx/StochasticForcingx.cpp \
250250
./modules/Mergesolutionfromftogx/Mergesolutionfromftogx.cpp \
251+
./modules/UpdateMmesx/UpdateMmesx.cpp \
251252
./cores/ProcessArguments.cpp \
252253
./cores/ResetBoundaryConditions.cpp \
253254
./cores/WrapperCorePointerFromSolutionEnum.cpp \
@@ -274,6 +275,7 @@ issm_sources += \
274275
./cores/transient_core.cpp \
275276
./cores/steadystate_core.cpp \
276277
./cores/masstransport_core.cpp \
278+
./cores/mmemasstransport_core.cpp \
277279
./cores/oceantransport_core.cpp \
278280
./cores/depthaverage_core.cpp \
279281
./cores/extrudefrombase_core.cpp \
@@ -344,7 +346,7 @@ issm_sources += \
344346
./classes/Inputs/DatasetInput.cpp \
345347
./classes/Inputs/ControlInput.cpp \
346348
./classes/Inputs/TransientInput.cpp \
347-
./classes/Inputs/ArrayInput.cpp \
349+
./classes/Inputs/ArrayInput.cpp\
348350
./classes/Inputs/IntArrayInput.cpp
349351
#}}}
350352
# ADJOINTMPI/MeDiPack sources {{{
@@ -497,7 +499,8 @@ if MELTING
497499
issm_sources += ./analyses/MeltingAnalysis.cpp
498500
endif
499501
if MASSTRANSPORT
500-
issm_sources += ./analyses/MasstransportAnalysis.cpp
502+
issm_sources += ./analyses/MasstransportAnalysis.cpp \
503+
./analyses/MmemasstransportAnalysis.cpp
501504
endif
502505
if OCEANTRANSPORT
503506
issm_sources += ./analyses/OceantransportAnalysis.cpp
@@ -541,28 +544,7 @@ if LOVE
541544
if FORTRAN
542545
issm_sources += \
543546
./cores/love_core.cpp \
544-
./analyses/LoveAnalysis.cpp \
545-
./modules/Zgesvx/Zgesvx.cpp \
546-
./modules/Zgesvx/Zgesvx.h \
547-
./modules/Zgesvx/dcabs1.f \
548-
./modules/Zgesvx/dlamch.f \
549-
./modules/Zgesvx/ieeeck.f \
550-
./modules/Zgesvx/ilaenv.f \
551-
./modules/Zgesvx/iparmq.f \
552-
./modules/Zgesvx/izamax.f \
553-
./modules/Zgesvx/lsame.f \
554-
./modules/Zgesvx/xerbla.f \
555-
./modules/Zgesvx/zgemm.f \
556-
./modules/Zgesvx/zgeru.f \
557-
./modules/Zgesvx/zgesv.f \
558-
./modules/Zgesvx/zgetf2.f \
559-
./modules/Zgesvx/zgetrf2.f \
560-
./modules/Zgesvx/zgetrf.f \
561-
./modules/Zgesvx/zgetrs.f \
562-
./modules/Zgesvx/zlaswp.f \
563-
./modules/Zgesvx/zscal.f \
564-
./modules/Zgesvx/zswap.f \
565-
./modules/Zgesvx/ztrsm.f
547+
./analyses/LoveAnalysis.cpp
566548
endif
567549
endif
568550
#}}}
@@ -740,7 +722,8 @@ endif
740722
libISSMCore_la_SOURCES = $(issm_sources)
741723
libISSMCore_la_CXXFLAGS = $(ALL_CXXFLAGS)
742724
libISSMCore_la_FFLAGS = $(AM_FFLAGS)
743-
libISSMCore_LIB_ADD = $(CHACOLIB) $(DAKOTALIB) $(PETSCLIB) $(MUMPSLIB) $(SCALAPACKLIB) $(BLASLAPACKLIB) $(PARMETISLIB) $(METISLIB) $(HDF5LIB) $(TAOLIB) $(M1QN3LIB) $(SEMICLIB) $(PLAPACKLIB) $(MPLAPACKLIB) $(SUPERLULIB) $(SPOOLESLIB) $(BLACSLIB) $(HYPRELIB) $(SPAILIB) $(PROMETHEUSLIB) $(PASTIXLIB) $(MLLIB) $(SCOTCHLIB) $(MKLLIB) $(MPILIB) $(MATHLIB) $(GRAPHICSLIB) $(MULTITHREADINGLIB) $(GSLLIB) $(ADOLCLIB) $(AMPILIB) $(ADJOINTMPILIB) $(METEOIOLIB) $(SNOWPACKLIB) $(PROJLIB)
725+
726+
libISSMCore_LIB_ADD = $(CHACOLIB) $(DAKOTALIB) $(PETSCLIB) $(MUMPSLIB) $(SCALAPACKLIB) $(BLASLAPACKLIB) $(PARMETISLIB) $(METISLIB) $(HDF5LIB) $(TAOLIB) $(M1QN3LIB) $(SEMICLIB) $(PLAPACKLIB) $(MPLAPACKLIB) $(SUPERLULIB) $(SPOOLESLIB) $(BLACSLIB) $(HYPRELIB) $(SPAILIB) $(PROMETHEUSLIB) $(PASTIXLIB) $(MLLIB) $(SCOTCHLIB) $(MKLLIB) $(MPILIB) $(MATHLIB) $(GRAPHICSLIB) $(MULTITHREADINGLIB) $(GSLLIB) $(ADOLCLIB) $(AMPILIB) $(ADJOINTMPILIB) $(METEOIOLIB) $(SNOWPACKLIB) $(PROJLIB)
744727
if FORTRAN
745728
libISSMCore_LIB_ADD += $(FLIBS) $(FORTRANLIB)
746729
endif
@@ -836,14 +819,6 @@ endif
836819
endif
837820
endif
838821

839-
if !STANDALONE_LIBRARIES
840-
if MAC
841-
if PROJ
842-
libISSMCore_la_LDFLAGS += -Wl,-rpath,$(PROJROOT)/lib
843-
endif
844-
endif
845-
endif
846-
847822
if !MSYS2
848823
libISSMOverload_la_SOURCES = ./shared/String/ApiPrintf.cpp
849824
libISSMOverload_la_CFLAGS = -D_C_ -fPIC $(CFLAGS) $(CXXFLAGS)
@@ -880,7 +855,7 @@ LDADD += ./libISSMModules.la $(TRIANGLELIB)
880855
endif
881856

882857
# External packages
883-
LDADD += $(DAKOTALIB) $(SEMICLIB) $(M1QN3LIB) $(CHACOLIB) $(PETSCLIB) $(MUMPSLIB) $(SCALAPACKLIB) $(BLASLAPACKLIB) $(PARMETISLIB) $(METISLIB) $(NEOPZLIB) $(TAOLIB) $(PLAPACKLIB) $(MPLAPACKLIB) $(SUPERLULIB) $(SPOOLESLIB) $(BLACSLIB) $(HDF5LIB) $(HYPRELIB) $(SPAILIB) $(PROMETHEUSLIB) $(PASTIXLIB) $(MLLIB) $(SCOTCHLIB) $(MKLLIB) $(MATHLIB) $(GRAPHICSLIB) $(MULTITHREADINGLIB) $(GSLLIB) $(AMPILIB) $(ADJOINTMPILIB) $(ADOLCLIB) $(MPILIB) $(METEOIOLIB) $(SNOWPACKLIB) $(ESMFLIB)
858+
LDADD += $(DAKOTALIB) $(SEMICLIB) $(M1QN3LIB) $(CHACOLIB) $(PETSCLIB) $(MUMPSLIB) $(SCALAPACKLIB) $(BLASLAPACKLIB) $(PARMETISLIB) $(METISLIB) $(NEOPZLIB) $(TAOLIB) $(PLAPACKLIB) $(MPLAPACKLIB) $(SUPERLULIB) $(SPOOLESLIB) $(BLACSLIB) $(HDF5LIB) $(HYPRELIB) $(SPAILIB) $(PROMETHEUSLIB) $(PASTIXLIB) $(MLLIB) $(SCOTCHLIB) $(MKLLIB) $(MATHLIB) $(GRAPHICSLIB) $(MULTITHREADINGLIB) $(GSLLIB) $(AMPILIB) $(ADJOINTMPILIB) $(ADOLCLIB) $(MPILIB) $(METEOIOLIB) $(SNOWPACKLIB) $(PROJLIB) $(ESMFLIB)
884859

885860
if FORTRAN
886861
LDADD += $(FLIBS) $(FORTRANLIB)

src/c/analyses/EnumToAnalysis.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,9 @@ Analysis* EnumToAnalysis(int analysis_enum){
109109
#ifdef _HAVE_MASSTRANSPORT_
110110
case MasstransportAnalysisEnum : return new MasstransportAnalysis();
111111
#endif
112+
#ifdef _HAVE_MMEMASSTRANSPORT_
113+
case MmemasstransportAnalysisEnum : return new MmemasstransportAnalysis();
114+
#endif
112115
#ifdef _HAVE_MELTING_
113116
case MeltingAnalysisEnum : return new MeltingAnalysis();
114117
#endif
Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
#include "./MmemasstransportAnalysis.h"
2+
#include <math.h>
3+
#include "../toolkits/toolkits.h"
4+
#include "../classes/classes.h"
5+
#include "../classes/Inputs/TransientInput.h"
6+
#include "../classes/Inputs/TriaInput.h"
7+
#include "../classes/gauss/Gauss.h"
8+
#include "../shared/shared.h"
9+
#include "../modules/modules.h"
10+
11+
/*Model processing*/
12+
void MmemasstransportAnalysis::CreateConstraints(Constraints* constraints,IoModel* iomodel){/*{{{*/
13+
/*No constraints*/
14+
}/*}}}*/
15+
void MmemasstransportAnalysis::CreateLoads(Loads* loads, IoModel* iomodel){/*{{{*/
16+
/*No loads*/
17+
}/*}}}*/
18+
void MmemasstransportAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel,bool isamr){/*{{{*/
19+
::CreateNodes(nodes,iomodel,MmemasstransportAnalysisEnum,P1Enum);
20+
}/*}}}*/
21+
int MmemasstransportAnalysis::DofsPerNode(int** doflist,int domaintype,int approximation){/*{{{*/
22+
return 3;
23+
}/*}}}*/
24+
void MmemasstransportAnalysis::UpdateElements(Elements* elements,Inputs* inputs,IoModel* iomodel,int analysis_counter,int analysis_type){/*{{{*/
25+
26+
int nature=0;
27+
bool isdakota=0;
28+
29+
/*Update elements: */
30+
int counter=0;
31+
for(int i=0;i<iomodel->numberofelements;i++){
32+
if(iomodel->my_elements[i]){
33+
Element* element=(Element*)elements->GetObjectByOffset(counter);
34+
element->Update(inputs,i,iomodel,analysis_counter,analysis_type,P1Enum);
35+
counter++;
36+
}
37+
}
38+
39+
/*Plug inputs into element:*/
40+
iomodel->FetchDataToInput(inputs,elements,"md.geometry.thickness",ThicknessEnum);
41+
iomodel->FetchDataToInput(inputs,elements,"md.geometry.surface",SurfaceEnum);
42+
iomodel->FetchDataToInput(inputs,elements,"md.geometry.base",BaseEnum);
43+
iomodel->FetchDataToInput(inputs,elements,"md.initialization.sealevel",SealevelEnum,0);
44+
iomodel->FetchDataToInput(inputs,elements,"md.mask.ice_levelset",MmemasstransportMaskIceLevelsetEnum);
45+
iomodel->FetchDataToInput(inputs,elements,"md.mask.ocean_levelset",MmemasstransportMaskOceanLevelsetEnum);
46+
iomodel->FetchDataToInput(inputs,elements,"md.mmemasstransport.thickness", MmemasstransportThicknessEnum);
47+
48+
/*Initialize sea level cumulated sea level loads :*/
49+
iomodel->ConstantToInput(inputs,elements,0.,AccumulatedDeltaIceThicknessEnum,P0Enum);
50+
iomodel->ConstantToInput(inputs,elements,0.,OldAccumulatedDeltaIceThicknessEnum,P0Enum);
51+
iomodel->ConstantToInput(inputs,elements,0.,DeltaIceThicknessEnum,P0Enum);
52+
53+
}/*}}}*/
54+
void MmemasstransportAnalysis::UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum){/*{{{*/
55+
56+
int numoutputs;
57+
char** requestedoutputs = NULL;
58+
59+
int nids,npart,nel;
60+
IssmDouble* ids=NULL;
61+
IssmDouble* partition = NULL;
62+
63+
iomodel->FetchData(&nel,"md.mesh.numberofelements");
64+
iomodel->FetchData(&ids,&nids,NULL,"md.mmemasstransport.ids");
65+
//_printf_("nids: " << nids << "\n"); for(int i=0;i<nids;i++)_printf_(ids[i] << "|"); _printf_("\n");
66+
parameters->AddObject(new DoubleMatParam(MmemasstransportModelidsEnum,ids,nids,1));
67+
iomodel->FetchData(&partition,&npart,NULL,"md.mmemasstransport.partition");
68+
if (npart!=nel)_error_("MmemasstransportAnalysis:UpdateParameters: partition vector should be distributed over elements, not vertices!");
69+
parameters->AddObject(new DoubleMatParam(MmemasstransportPartitionEnum,partition,nel,1));
70+
71+
xDelete<IssmDouble>(ids);
72+
xDelete<IssmDouble>(partition);
73+
74+
/*Requested outputs*/
75+
iomodel->FindConstant(&requestedoutputs,&numoutputs,"md.mmemasstransport.requested_outputs");
76+
parameters->AddObject(new IntParam(MmemasstransportNumRequestedOutputsEnum,numoutputs));
77+
if(numoutputs)parameters->AddObject(new StringArrayParam(MmemasstransportRequestedOutputsEnum,requestedoutputs,numoutputs));
78+
iomodel->DeleteData(&requestedoutputs,numoutputs,"md.mmemasstransport.requested_outputs");
79+
80+
}/*}}}*/
81+
82+
/*Finite Element Analysis*/
83+
void MmemasstransportAnalysis::Core(FemModel* femmodel){/*{{{*/
84+
_error_("not implemented");
85+
}/*}}}*/
86+
void MmemasstransportAnalysis::PreCore(FemModel* femmodel){/*{{{*/
87+
_error_("not implemented");
88+
}/*}}}*/
89+
ElementVector* MmemasstransportAnalysis::CreateDVector(Element* element){/*{{{*/
90+
/*Default, return NULL*/
91+
return NULL;
92+
}/*}}}*/
93+
ElementMatrix* MmemasstransportAnalysis::CreateJacobianMatrix(Element* element){/*{{{*/
94+
_error_("Not implemented");
95+
}/*}}}*/
96+
ElementMatrix* MmemasstransportAnalysis::CreateKMatrix(Element* element){/*{{{*/
97+
_error_("not implemented yet");
98+
}/*}}}*/
99+
ElementVector* MmemasstransportAnalysis::CreatePVector(Element* element){/*{{{*/
100+
_error_("not implemented yet");
101+
}/*}}}*/
102+
void MmemasstransportAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
103+
104+
/*do nothing:*/
105+
return;
106+
}/*}}}*/
107+
void MmemasstransportAnalysis::GradientJ(Vector<IssmDouble>* gradient,Element* element,int control_type,int control_interp,int control_index){/*{{{*/
108+
_error_("Not implemented yet");
109+
}/*}}}*/
110+
void MmemasstransportAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
111+
112+
/*Fetch number of nodes and dof for this finite element*/
113+
IssmDouble time;
114+
IssmDouble ice[3];
115+
IssmDouble ocean[3];
116+
IssmDouble height;
117+
int numnodes = element->GetNumberOfNodes();
118+
119+
element->parameters->FindParam(&time,TimeEnum);
120+
121+
TriaInput* h_input=xDynamicCast<TriaInput*>(element->GetInput(MmemasstransportThicknessEnum,time)); _assert_(h_input);
122+
TriaInput* i_input=xDynamicCast<TriaInput*>(element->GetInput(MmemasstransportMaskIceLevelsetEnum,time)); _assert_(i_input);
123+
TriaInput* o_input=xDynamicCast<TriaInput*>(element->GetInput(MmemasstransportMaskOceanLevelsetEnum,time)); _assert_(o_input);
124+
125+
Gauss* gauss=element->NewGauss();
126+
for(int iv=0;iv<3;iv++){
127+
gauss->GaussVertex(iv);
128+
i_input->GetInputValue(&ice[iv],gauss);
129+
o_input->GetInputValue(&ocean[iv],gauss);
130+
}
131+
h_input->GetInputAverage(&height);
132+
delete gauss;
133+
134+
/*Add thickness ice and ocean levelsets as inputs to the tria element: */
135+
element->AddInput(ThicknessEnum,&height,P0Enum); //very important, do not change the type of ThicknessEnum to P1 when it should be P0!
136+
element->AddInput(MaskIceLevelsetEnum,ice,P1Enum);
137+
element->AddInput(MaskOceanLevelsetEnum,ocean,P1Enum);
138+
139+
}/*}}}*/
140+
void MmemasstransportAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/
141+
/*Default, do nothing*/
142+
return;
143+
}/*}}}*/
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*! \file MmemasstransportAnalysis.h
2+
* \brief: header file for generic external result object
3+
*/
4+
5+
#ifndef _MmemasstransportAnalysis_
6+
#define _MmemasstransportAnalysis_
7+
8+
/*Headers*/
9+
#include "./Analysis.h"
10+
11+
class MmemasstransportAnalysis: public Analysis{
12+
13+
public:
14+
/*Model processing*/
15+
void CreateConstraints(Constraints* constraints,IoModel* iomodel);
16+
void CreateLoads(Loads* loads, IoModel* iomodel);
17+
void CreateNodes(Nodes* nodes,IoModel* iomodel,bool isamr=false);
18+
int DofsPerNode(int** doflist,int domaintype,int approximation);
19+
void UpdateElements(Elements* elements,Inputs* inputs,IoModel* iomodel,int analysis_counter,int analysis_type);
20+
void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum);
21+
22+
/*Finite element Analysis*/
23+
void Core(FemModel* femmodel);
24+
void PreCore(FemModel* femmodel);
25+
ElementVector* CreateDVector(Element* element);
26+
ElementMatrix* CreateJacobianMatrix(Element* element);
27+
ElementMatrix* CreateKMatrix(Element* element);
28+
ElementVector* CreatePVector(Element* element);
29+
void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
30+
void GradientJ(Vector<IssmDouble>* gradient,Element* element,int control_type,int control_interp,int control_index);
31+
void InputUpdateFromSolution(IssmDouble* solution,Element* element);
32+
void UpdateConstraints(FemModel* femmodel);
33+
};
34+
#endif

src/c/analyses/OceantransportAnalysis.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@ void OceantransportAnalysis::UpdateElements(Elements* elements,Inputs* inputs,Io
4949
iomodel->FetchData(&modelid,"md.dsl.modelid");
5050

5151
/*replace dataset of forcings with only one, the modelid'th:*/
52-
MmeToInputFromIdx(inputs,elements,modelid,OceantransportSpcbottompressureEnum, P1Enum);
53-
MmeToInputFromIdx(inputs,elements,modelid,OceantransportSpcdslEnum, P1Enum);
54-
MmeToInputFromIdx(inputs,elements,modelid,OceantransportSpcstrEnum, P0Enum);
52+
MmeToInputFromIdx(inputs,elements,NULL,modelid,OceantransportSpcbottompressureEnum, P1Enum);
53+
MmeToInputFromIdx(inputs,elements,NULL,modelid,OceantransportSpcdslEnum, P1Enum);
54+
MmeToInputFromIdx(inputs,elements,NULL,modelid,OceantransportSpcstrEnum, P0Enum);
5555
}
5656

5757
/*Initialize sea level cumulated sea level loads :*/

0 commit comments

Comments
 (0)