Index: /issm/branches/trunk-larour-SLPS2022/src/c/Makefile.am
===================================================================
--- /issm/branches/trunk-larour-SLPS2022/src/c/Makefile.am	(revision 27075)
+++ /issm/branches/trunk-larour-SLPS2022/src/c/Makefile.am	(revision 27076)
@@ -250,4 +250,5 @@
 	./modules/StochasticForcingx/StochasticForcingx.cpp \
 	./modules/Mergesolutionfromftogx/Mergesolutionfromftogx.cpp \
+	./modules/UpdateMmesx/UpdateMmesx.cpp \
 	./cores/ProcessArguments.cpp \
 	./cores/ResetBoundaryConditions.cpp \
Index: /issm/branches/trunk-larour-SLPS2022/src/c/modules/UpdateMmesx/UpdateMmesx.cpp
===================================================================
--- /issm/branches/trunk-larour-SLPS2022/src/c/modules/UpdateMmesx/UpdateMmesx.cpp	(revision 27076)
+++ /issm/branches/trunk-larour-SLPS2022/src/c/modules/UpdateMmesx/UpdateMmesx.cpp	(revision 27076)
@@ -0,0 +1,35 @@
+/*!\file UpdateMmesx
+ * \brief: update Mmes prior to running any core
+ */
+
+#include "./UpdateMmesx.h"
+#include "../MmeToInputFromIdx/MmeToInputFromIdx.h"
+
+void  UpdateMmesx(FemModel* femmodel){ 
+
+	if(VerboseModule()) _printf0_("   Updating Mmes\n");
+
+	IssmDouble modelid=0;
+		 
+	/*Deal with solid earth: */
+	if (femmodel->inputs->Exist(SolidearthExternalDisplacementEastRateEnum) && femmodel->inputs->GetInputObjectEnum(SolidearthExternalDisplacementEastRateEnum)==DatasetInputEnum){
+		femmodel->parameters->FindParam(&modelid,SolidearthExternalModelidEnum);
+
+		/*replace dataset of forcings with only one, the modelid'th:*/
+		MmeToInputFromIdx(femmodel->inputs,femmodel->elements,femmodel->parameters,modelid-1,SolidearthExternalDisplacementNorthRateEnum, P1Enum);
+		MmeToInputFromIdx(femmodel->inputs,femmodel->elements,femmodel->parameters,modelid-1,SolidearthExternalDisplacementEastRateEnum, P1Enum);
+		MmeToInputFromIdx(femmodel->inputs,femmodel->elements,femmodel->parameters,modelid-1,SolidearthExternalDisplacementUpRateEnum, P1Enum);
+		MmeToInputFromIdx(femmodel->inputs,femmodel->elements,femmodel->parameters,modelid-1,SolidearthExternalGeoidRateEnum, P1Enum);
+
+	}
+	/*Deal with ocean: */
+	if (femmodel->inputs->Exist(OceantransportSpcbottompressureEnum) && femmodel->inputs->GetInputObjectEnum(OceantransportSpcbottompressureEnum)==DatasetInputEnum){
+		femmodel->parameters->FindParam(&modelid,DslModelidEnum);
+
+		/*replace dataset of forcings with only one, the modelid'th:*/
+		MmeToInputFromIdx(femmodel->inputs,femmodel->elements,femmodel->parameters,modelid-1,OceantransportSpcbottompressureEnum, P1Enum);
+		MmeToInputFromIdx(femmodel->inputs,femmodel->elements,femmodel->parameters,modelid-1,OceantransportSpcdslEnum, P1Enum);
+		MmeToInputFromIdx(femmodel->inputs,femmodel->elements,femmodel->parameters,modelid-1,OceantransportSpcstrEnum, P0Enum);
+	}
+} 
+	
Index: /issm/branches/trunk-larour-SLPS2022/src/c/modules/UpdateMmesx/UpdateMmesx.h
===================================================================
--- /issm/branches/trunk-larour-SLPS2022/src/c/modules/UpdateMmesx/UpdateMmesx.h	(revision 27076)
+++ /issm/branches/trunk-larour-SLPS2022/src/c/modules/UpdateMmesx/UpdateMmesx.h	(revision 27076)
@@ -0,0 +1,12 @@
+/*!\file:  UpdateMmesx.h
+ * \brief header file for updating Mmes prior to running any core
+ */ 
+
+#ifndef _UPDATEMMESX_H
+#define _UPDATEMMESX_H
+
+#include "../../classes/classes.h"
+
+void  UpdateMmesx(FemModel* femmodel);
+
+#endif  /* _UPDATEMMESX_H */
Index: /issm/branches/trunk-larour-SLPS2022/src/c/modules/modules.h
===================================================================
--- /issm/branches/trunk-larour-SLPS2022/src/c/modules/modules.h	(revision 27075)
+++ /issm/branches/trunk-larour-SLPS2022/src/c/modules/modules.h	(revision 27076)
@@ -103,4 +103,5 @@
 #include "./ThicknessAcrossGradientx/ThicknessAcrossGradientx.h"
 #include "./UpdateDynamicConstraintsx/UpdateDynamicConstraintsx.h"
+#include "./UpdateMmesx/UpdateMmesx.h"
 #include "./VertexCoordinatesx/VertexCoordinatesx.h"
 #include "./ElementCoordinatesx/ElementCoordinatesx.h"
