diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..e627ed90f69b3b3d8559760944babc6051aa86fe
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,10 @@
+# Ignore the object directories generated by the fcm compilation
+/build/with_fcm/arch_*
+
+# Ignore the content of the fcm directory but not the directory itself
+/build/with_fcm/fcm/**
+!/build/with_fcm/fcm/.gitkeep
+
+# Ignore the content of the fiat directory but not the directory itself
+/build/with_fcm/fiat/**
+!/build/with_fcm/fiat/.gitkeep
diff --git a/build/with_fcm/README.md b/build/with_fcm/README.md
new file mode 100644
index 0000000000000000000000000000000000000000..bf27fb29e11acc416a184ecd60891c268c27f3e8
--- /dev/null
+++ b/build/with_fcm/README.md
@@ -0,0 +1,16 @@
+Directory organisation:
+- the fcm subdirectory contains the fcm tool. In the PHYEX git repository, this directory is empty.
+  It will be populated on first call to the make\_fcm.sh script and content is not tracked by git.
+- the fiat subdirectory contains the fiat package from the ECMWF. In the PHYEX git repository, this directory is empty.
+  It will be populated on first call to the make\_fcm.sh script and content is not tracked by git.
+- the arch subdirectory contains architecture specific files. An alternative arch directory can be
+  provided on the command line when calling the make\_fcm.sh script
+- arch\_\* subdirectories are automatically created by the make\_fcm.sh script and are tracked by git.
+- the make\_fcm.sh script will:
+  - populate the fcm and fiat directories on first call
+  - create the arch\_$ARCH directory, poulate it with arch specific files and a compilation script
+  - execute the newly created compilation script
+
+Note: full cleaning is achieved by removing the arch\_\* subdirectories.
+Note: documentation of the make\_fcm.sh script can be obtained with the -h option
+
diff --git a/build/with_fcm/TODO b/build/with_fcm/TODO
new file mode 100644
index 0000000000000000000000000000000000000000..a7409b6b2ce027011d2293b341bb1aa5e7109480
--- /dev/null
+++ b/build/with_fcm/TODO
@@ -0,0 +1,7 @@
+#Fichier configuration
+comment avoir un .so comme cible
+
+#Script make_fcm
+revoir les options disponibles --full? --jobs N? --ignore-lock?: sont-elles les mêmes avec le passage à la dernière version de fcm (make)?
+faire un ticket fcm à propos du pb de compilation fiat (toto.F90 avec toto.c)
+utiliser les configurations spécifiques aux architectures dans le fichier de config fcm
diff --git a/build/with_fcm/arch/arch-X64_JEANZAY.env b/build/with_fcm/arch/arch-X64_JEANZAY.env
new file mode 100644
index 0000000000000000000000000000000000000000..d62b4f56797f4c056d3fd6b3d10314397e214484
--- /dev/null
+++ b/build/with_fcm/arch/arch-X64_JEANZAY.env
@@ -0,0 +1,8 @@
+module purge
+module load gcc/9.1.0
+module load intel-all
+module load gcc/9.1.0
+module load hdf5/1.10.5-mpi
+module load netcdf/4.7.2-mpi 
+module load netcdf-fortran/4.5.2-mpi 
+source $I_MPI_ROOT/intel64/bin/mpivars.sh release_mt
diff --git a/build/with_fcm/arch/arch-X64_JEANZAY.fcm b/build/with_fcm/arch/arch-X64_JEANZAY.fcm
new file mode 100644
index 0000000000000000000000000000000000000000..e951421cbcc1f9e2982aa97c8e9def829ce839e3
--- /dev/null
+++ b/build/with_fcm/arch/arch-X64_JEANZAY.fcm
@@ -0,0 +1,16 @@
+%COMPILER            mpiifort
+%LINK                mpiifort
+%FPP                 mpiifort -E
+%AR                  ar
+%MAKE                gmake
+%FPP_FLAGS           -P
+%FPP_DEF             KEY_NONE CPP_NETCDF4
+%BASE_FFLAGS         -fPIC -i4 -r8 -auto -align all -fp-model strict
+%PROD_FFLAGS         -g -traceback -O3 -xHost -qopt-zmm-usage=high
+%DEV_FFLAGS          -g -O1 -traceback
+%DEBUG_FFLAGS        -g -traceback -check bounds 
+%MPI_FFLAGS
+%OMP_FFLAGS          -qopenmp -qopenmp-threadprivate=compat
+%BASE_LD             -fPIC -i4 -r8 -auto 
+%MPI_LD
+%OMP_LD              -qopenmp -qopenmp-threadprivate=compat
diff --git a/build/with_fcm/arch/arch-gnu.env b/build/with_fcm/arch/arch-gnu.env
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/build/with_fcm/arch/arch-gnu.fcm b/build/with_fcm/arch/arch-gnu.fcm
new file mode 100644
index 0000000000000000000000000000000000000000..923e3089ffd1441afbf562229ba992245d232bef
--- /dev/null
+++ b/build/with_fcm/arch/arch-gnu.fcm
@@ -0,0 +1,16 @@
+%COMPILER            gfortran
+%LINK                gfortran
+%FPP                 gfortran -E
+%AR                  ar
+%MAKE                gmake
+%FPP_FLAGS           -P
+%FPP_DEF             
+%BASE_FFLAGS         -c -fPIC -fdefault-real-8 -fdefault-double-8 -ffree-line-length-none
+%PROD_FFLAGS         -O3
+%DEV_FFLAGS          -O1
+%DEBUG_FFLAGS        -check bounds 
+%MPI_FFLAGS
+%OMP_FFLAGS          
+%BASE_LD             -fPIC  -fdefault-real-8 -fdefault-double-8
+%MPI_LD
+%OMP_LD              
diff --git a/build/with_fcm/fcm-make.cfg b/build/with_fcm/fcm-make.cfg
new file mode 100644
index 0000000000000000000000000000000000000000..8205a80bd271998f31fd04ec5c6c56a0bf4b5c48
--- /dev/null
+++ b/build/with_fcm/fcm-make.cfg
@@ -0,0 +1,61 @@
+steps = build
+
+#inc arch.fcm
+#inc config.fcm
+#
+#%FFLAGS           %BASE_FFLAGS %COMPIL_FFLAGS
+
+#bld::tool::fc        %COMPILER
+#bld::tool::ld        %LINK
+#bld::tool::ldflags   %LD_FLAGS %LIB
+#bld::tool::fflags    %FFLAGS
+#bld::tool::fppkeys   %CPP_KEY %FPP_DEF
+#bld::tool::fpp       %FPP
+#bld::tool::fppflags  %FPP_FLAGS
+#
+## Pre-process code before analysing dependencies
+#bld::pp              false
+
+## Set Fortran compiler/linker
+#build.prop{fc} = ifort
+## Set Fortran compiler options
+#build.prop{fc.flags} = -i8 -r8 -O3
+## Add include paths to Fortran compiler
+#build.prop{fc.include-paths} = /a/path/to/include /more/path/to/include
+## Set link libraries for Fortran executables
+#build.prop{fc.lib-paths} = /path/to/my-lib
+#build.prop{fc.libs} = mine
+## Set C compiler/linker
+#build.prop{cc} = icc
+## Set C compiler options
+#build.prop{cc.flags} = -O3
+## Set C++ compiler options
+#build.prop{cxx.flags} = -O2
+## Set link libraries for C executables
+#build.prop{cc.lib-paths} = /path/to/my-lib /path/to/your-lib
+#build.prop{cc.libs} = mine yours
+## Set linker, if compiler cannot be used as linker
+##build.prop{ld} = ld
+
+#build.prop{fc.defs} = DEFS TO BUILD THIS   # 4
+
+#A terme, c'est un .so qu'il faut générérer avec des points d'entrée à définir
+build.target = libo.a
+#build.target-rename = libo.a:libphyex.a
+build.source[common] = src/common/
+
+#It would be easier to put the entire fiat directory but there are issues
+#with entry points declared twice: in C and in fortran
+#FCM hate this
+#build.source[fiat] = src/fiat/
+build.source[parkind] = src/fiat/parkind
+build.source[drhook] = src/fiat/fiat/drhook
+build.source[include] = src/fiat/fiat/include/fiat
+build.source[ec_parkind] = src/fiat/fiat/util/ec_parkind.F90
+build.source[ec_args_mod] = src/fiat/fiat/util/ec_args_mod.F90
+build.source[ec_lun] = src/fiat/fiat/util/ec_lun.F90
+build.source[ec_env_mod] = src/fiat/fiat/util/ec_env_mod.F90
+build.source[mpif] = src/fiat/mpi_serial/mpif.h
+build.source[mpl] = src/fiat/fiat/mpl/internal
+build.source[oml] = src/fiat/fiat/oml
+build.source[yomgstats] = src/fiat/fiat/gstats/yomgstats.F90
diff --git a/build/with_fcm/fcm/.gitkeep b/build/with_fcm/fcm/.gitkeep
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/build/with_fcm/fiat/.gitkeep b/build/with_fcm/fiat/.gitkeep
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/build/with_fcm/make_fcm.sh b/build/with_fcm/make_fcm.sh
new file mode 100755
index 0000000000000000000000000000000000000000..88110efedc69dd290f26a634f6b3c60e94b2abcf
--- /dev/null
+++ b/build/with_fcm/make_fcm.sh
@@ -0,0 +1,142 @@
+#!/bin/bash
+
+fcm_version=tags/2021.05.0
+fiat_version=1295120464c3905e5edcbb887e4921686653eab8
+
+function parse_args()
+{
+    # default values
+    ARCH_PATH=$PWD/arch
+    ARCH=gnu
+    # pass unrecognized arguments to fcm
+    FCM_ARGS=""
+    
+    while (($# > 0))
+    do
+	OPTION="$1" ; shift
+	case "$OPTION" in
+	    "-h") cat <<EOF
+	    Usage :
+$0 [options]
+--help -h   help
+--arch-path ARCH_PATH directory for architecture specific files (see below) [./arch]
+--arch ARCH  	        build using arch files $ARCH_PATH/arch-ARCH.* [gnu]
+
+Unrecognized options are passed to the fcm build command. Useful options include :
+--full                  clean build tree before building
+--jobs N                parallel build, similar to make -j N
+--ignore-lock           ignore lock indicating another build is ongoing, useful after an interrupted build
+
+For details on FCM, see 
+    http://metomi.github.io/fcm/doc/user_guide/build.html
+    http://metomi.github.io/fcm/doc/user_guide/command_ref.html#fcm-build
+EOF
+		  exit;;
+	    "--arch")
+		ARCH=$1 ; shift ;; 
+	    "--arch-path")
+		ARCH_PATH=$1 ; shift ;; 
+	    *)
+		FCM_ARGS="$FCM_ARGS $OPTION"
+		;;
+	esac
+    done
+}
+
+function check_install_fcm()
+{
+  if [ ! -f fcm/bin/fcm ]; then
+    echo "Performing FCM installation..."
+    cd fcm
+    rm -f .gitkeep
+    git clone https://github.com/metomi/fcm.git .
+    git checkout tags/$fcm_version
+    touch .gitkeep
+    cd ..
+    echo "...FCM installation done"
+  fi
+}
+
+function check_install_fiat()
+{
+  if [ ! -d fiat/src ]; then
+    echo "Performing fiat cloning..."
+    cd fiat
+    rm -f .gitkeep
+    git clone https://github.com/ecmwf-ifs/fiat.git .
+    git checkout $fiat_version
+    touch .gitkeep
+    cd ..
+    echo "...fiat cloning done"
+  fi
+echo
+}
+
+function build_compilation_script()
+{
+cat <<EOF > compilation.sh
+#!/bin/bash
+
+. arch.env
+
+COMPIL_FFLAGS="%PROD_FFLAGS"
+COMPIL_FFLAGS="\$COMPIL_FFLAGS %OMP_FFLAGS"
+
+LD_FLAGS="%BASE_LD"
+LD_FLAGS="\$LD_FLAGS %OMP_LD"
+
+#DEPS_LIB="\$NETCDF_LIBDIR \$NETCDF_LIB \$HDF5_LIBDIR \$HDF5_LIB"
+
+FCM_ARGS=$FCM_ARGS
+
+echo "%COMPIL_FFLAGS \$COMPIL_FFLAGS" > config.fcm
+echo "%LD_FLAGS \$LD_FLAGS" >> config.fcm
+echo "%CPP_KEY \$CPP_KEY" >> config.fcm
+echo "%LIB">> config.fcm
+
+export PATH=$PWD/../fcm/bin/:\$PATH
+
+echo "This script has generated config.fcm which is included by bld.cfg, the FCM configuration file."
+echo "Running : fcm build \$FCM_ARGS"
+echo "Be patient while FCM first pre-processes all .F90 source files which may take about 30s."
+
+fcm make \$FCM_ARGS
+EOF
+chmod +x compilation.sh
+}
+
+####################################
+
+# Parse command line arguments
+parse_args $*
+
+# Change current working dir
+cd -P $(dirname $0)
+
+# Check the fcm installation
+check_install_fcm
+
+# Check the fiat installation
+check_install_fiat
+
+# Create the build directory and populate it
+builddir=arch_$ARCH
+if [ -d $builddir ]; then
+  echo "$builddir already exists. To rerun compilation, please enter this directory and use the compilation.sh script."
+  echo "Otherwise, you can remove the $builddir directory and execute again this script."
+  exit 1
+fi
+mkdir $builddir
+cp ${ARCH_PATH}/arch-${ARCH}.env $builddir/arch.env
+cp ${ARCH_PATH}/arch-${ARCH}.fcm $builddir/arch.fcm 
+cp fcm-make.cfg $builddir
+cd $builddir
+mkdir src
+cd src
+ln -s ../../../../src/common .
+ln -s ../../fiat/src fiat
+cd ..
+build_compilation_script
+
+# Run the compilation
+./compilation.sh