E3SM
E3SM copied to clipboard
Prevent multiple nodes from accessing the same file in FATES init_coldstart
This pull request seeks to address NGEET/fates#1391. FATES sub-routine init_coldstart needs to read in text files when the initial forest state comes from forest inventory datasets. When using multiple nodes, this can cause the model to crash because multiple files are accessing the same file at the same time.
This proposed implementation is borrowed from ED2, which uses MPI sub-routines MPI_Send and MPI_Recv to ensure only one node access the file at a time. This restriction is needed only when FATES is initialised with forest inventory files, so the code checks if this is the case.