Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support to build MOM5 with an external FMS and Generic Tracers using Spack #29

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

harshula
Copy link

  • Ideally we should use a better build system. However, this appears to be the
    least intrusive and simple way to introduce this feature.

@harshula harshula self-assigned this Nov 25, 2024
@harshula
Copy link
Author

FYI, I decided not to include this commit in this PR for the sake of simplicity:

commit a830e525565902b89faeb4d5fde65d187f7a3139 (dev_backup)
Author: Harshula Jayasuriya <harshula.jayasuriya@anu.edu.au>
Date:   Fri Nov 22 17:37:37 2024 +1100

    Ready for review

diff --git a/exp/MOM_compile.csh b/exp/MOM_compile.csh
index d72f477..8de451b 100755
--- a/exp/MOM_compile.csh
+++ b/exp/MOM_compile.csh
@@ -158,12 +158,14 @@ endif
 
 if ( ! $?SPACK_GTRACERS_EXTERNAL ) then
     echo "Building type=$type with internal FMS"
+    # Build FMS.
     source ./FMS_compile.csh
-    set includes = "-I$code_dir/shared/include -I$executable:h:h/lib_FMS -I$executable:h:h/lib_ocean"
+    set includes = "-I$executable:h:h/lib_FMS"
 else
     echo "Building type=$type with external FMS"
-    set includes = "-I$code_dir/shared/include -I$executable:h:h/lib_ocean"
+    set includes = ""
 endif
+set includes = "$includes -I$code_dir/shared/include -I$executable:h:h/lib_ocean"
 
 if ( $cosima_version ) then
     set includes = "$includes -I$executable:h:h/lib_version/"
diff --git a/exp/ocean_compile.csh b/exp/ocean_compile.csh
index 5eb000a..58f7887 100644
--- a/exp/ocean_compile.csh
+++ b/exp/ocean_compile.csh
@@ -9,13 +9,10 @@ if( $type == ACCESS-OM || $type == ACCESS-CM || $type == ACCESS-OM-BGC || $type
     if( $type ==  ACCESS-OM-BGC ) then
         set srcList = ( $srcList mom5/ocean_csiro_bgc )
     else if ( $type ==  ACCESS-OM || $type == ACCESS-ESM ) then
-
+        set srcList = ( $srcList mom5/ocean_bgc )
         if ( ! $?SPACK_GTRACERS_EXTERNAL ) then
-            set srcList = ( $srcList mom5/ocean_bgc access/generic_tracers/generic_tracers access/generic_tracers/mocsy/src )
-        else
-            set srcList = ( $srcList mom5/ocean_bgc )
+            set srcList = ( $srcList access/generic_tracers/generic_tracers access/generic_tracers/mocsy/src )
         endif
-
     endif
     mkdir -p $executable:h:h/$type/$lib_name
     cd $executable:h:h/$type/$lib_name

Copy link
Member

@aidanheerdegen aidanheerdegen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line 150 sets lib_include_dirs which is used in all the component build scripts

set lib_include_dirs = "$root/include $code_dir/shared/include $code_dir/shared/mpp/include"

I think it should also be bracketed with logic to test for external FMS.

exp/MOM_compile.csh Outdated Show resolved Hide resolved
@@ -260,8 +264,12 @@ if( $type == ACCESS-OM || $type == ACCESS-ESM) then
set srcList = ( $srcList access/shared )
endif

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be bracketed in logic that checks for an external FMS too.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

src/access/shared/gtracer_flux.F90:

module gtracer_flux_mod

It looks like it's required:

$ rg 'use gtracer_flux_mod' *
src/access/accesscm_coupler/mom_oasis3_interface.F90
97:use gtracer_flux_mod, only: set_coupler_type_data, extract_coupler_type_data

src/access/accesscm_coupler/ocean_solo.F90
158:  use gtracer_flux_mod,         only: flux_exchange_init, atmos_ocean_fluxes_calc
159:  use gtracer_flux_mod,         only: gas_fields_restore, gas_fields_restart

src/access/accessom_coupler/ocean_solo.F90
115:  use gtracer_flux_mod,         only: flux_exchange_init, atmos_ocean_fluxes_calc
116:  use gtracer_flux_mod,         only: gas_fields_restore, gas_fields_restart

src/access/accessom_coupler/mom_oasis3_interface.F90
109:use gtracer_flux_mod, only: set_coupler_type_data

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Status: No status
Status: No status
Development

Successfully merging this pull request may close these issues.

2 participants