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

User/f1p/merge gex ddep #1637

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

fabienpaulot
Copy link
Contributor

@fabienpaulot fabienpaulot commented Jan 27, 2025

Description

Update to add
a) ability to pass deposition fluxes from the atmosphere to the land (gex)
b) sink of gas/aerosol on land handled by LM4 [increase number of exchanged tracer]

Fixes # (issue)

n/a

How Has This Been Tested?

Tested on gaea (ESM4p5)

Checklist:

  • My code follows the style guidelines of this project
  • [x ] I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • Any dependent changes have been merged and published in downstream modules
  • New check tests, if applicable, are included
  • make distcheck passes

@rem1776
Copy link
Contributor

rem1776 commented Jan 27, 2025

@fabienpaulot Thanks for submitting these changes. I think we might need to change the module name to generic_exchange_mod. For FMS we typically follow the <filename>_mod naming scheme for any modules.

After that this will need some more changes to get the build systems working properly since a new module is being added.

For cmake, it would just need the new coupler/generic_exchange.F90 file path added to CMakeLists.txt, along with the other files from that directory:

FMS/CMakeLists.txt

Lines 114 to 116 in 15ec0c7

coupler/atmos_ocean_fluxes.F90
coupler/coupler_types.F90
coupler/ensemble_manager.F90

For autotools, you'll need to edit coupler/Makefile.am. The libcoupler_la_SOURCES will need the new file name added as well, and then MODFILES will need the compiled module output (ie. module <name> in the file), which would be:

generic_exchange_mod.$(FC_MODEXT) \

Once you made the module name change.

Let me know if need help/have any questions, hope this wasn't too confusing.

@fabienpaulot
Copy link
Contributor Author

fabienpaulot commented Jan 27, 2025 via email

@rem1776
Copy link
Contributor

rem1776 commented Jan 27, 2025

Can I change generic_exchange.F90 to gex.F90 instead? This would make my life much easier. Fabien

On Mon, Jan 27, 2025 at 4:27 PM Ryan Mulhall @.> wrote: @fabienpaulot https://github.com/fabienpaulot Thanks for submitting these changes. I think we might need to change the module name to generic_exchange_mod. For FMS we typically follow the _mod naming scheme for any modules. After that this will need some more changes to get the build systems working properly since a new module is being added. For cmake, it would just need the new coupler/generic_exchange.F90 file path added to CMakeLists.txt, along with the other files from that directory:

FMS/CMakeLists.txt

Lines 114 to 116 in 15ec0c7

coupler/atmos_ocean_fluxes.F90
coupler/coupler_types.F90
coupler/ensemble_manager.F90
For autotools, you'll need to edit coupler/Makefile.am. The libcoupler_la_SOURCES will need the new file name added as well, and then MODFILES will need the compiled module output (ie. module in the file), which would be: generic_exchange_mod.$(FC_MODEXT) \ Once you made the module name change. Let me know if need help/have any questions, hope this wasn't too confusing. — Reply to this email directly, view it on GitHub <#1637 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKAQA45VKGSIVHLY6V3OHTT2M2QCDAVCNFSM6AAAAABV6IKIECVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMMJWHEZDSOJVGU . You are receiving this because you were mentioned.Message ID: @.>

Yeah that works too! As long as it follows the convention it should be fine.

@fabienpaulot
Copy link
Contributor Author

@rem1776 I think I fixed the space/line length/CMake but it's still failing one check

@rem1776
Copy link
Contributor

rem1776 commented Feb 3, 2025

@rem1776 I think I fixed the space/line length/CMake but it's still failing one check

Looks like its just failing the autotools build from a file dependency. I think to fix it, you would have to make this change in the top level Makefile.am:
main...rem1776:FMS:pr1637#diff-0462e381b2fb3286568215681c8983490a37ac9ae0f0c5ee304df7fa6426d4af

Needs to have tracer_manager before coupler in the SUBDIRS list so the module dependency is satisfied.

…so the module dependency is satisfied per Ryan's recommendation
@fabienpaulot
Copy link
Contributor Author

fabienpaulot commented Feb 3, 2025 via email

Copy link
Member

@thomas-robinson thomas-robinson left a comment

Choose a reason for hiding this comment

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

  1. Please make sure that the doxygen style is followed for the module, module variables, subroutines, and subroutine variables. Please make sure documentation style is consistent with other modules in this repository (ie. remove the !######s that are around routine documentation.) An example can be found here https://github.com/NOAA-GFDL/FMS/blob/main/field_manager/fm_yaml.F90
  2. New modules and routines should be prefixed with fms_coupler_gex_. This is consistent with the modernized approach in FMS. The filename should be fms_coupler_gex.F90.
  3. The public routines need to be added to libFMS.F90 and made public through that interface. That's how they should be accessed in the FMScoupler also (through use FMS)
  4. The new file needs the LGPL licence header.

@@ -0,0 +1,220 @@
!>simple routine to pass non-tracer fields across components (regrid)

module gex_mod
Copy link
Member

Choose a reason for hiding this comment

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

The module should be named fms_coupler_gex_mod because it is a new module in FMS in the coupler subdirectory.


implicit none ; private

public :: gex_init, gex_get_index,gex_get_n_ex, gex_get_property, gex_name, gex_units
Copy link
Member

Choose a reason for hiding this comment

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

All of these public routines should be prefixed with fms_coupler_

public :: fms_coupler_gex_init, fms_coupler_gex_get_index, fms_coupler_gex_get_n_ex, fms_coupler_gex_get_property, fms_coupler_gex_name, fms_coupler_gex_units

coupler/gex.F90 Outdated
@@ -0,0 +1,220 @@
!>simple routine to pass non-tracer fields across components (regrid)
Copy link
Member

Choose a reason for hiding this comment

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

The doxygen formatting should be updated to reflect that this is a module. Please refer to other modules in FMS to see a proper example.

Also, please add more detail to the documentation. What is gex an abbreviation for?

coupler/gex.F90 Outdated
Comment on lines 19 to 35
character(3) :: module_name = 'gex'
logical :: initialized = .FALSE.

integer, parameter :: gex_name = 1
integer, parameter :: gex_units = 2

type gex_type
character(fm_field_name_len):: name = ''
character(fm_string_len) :: units = ''
logical :: set = .FALSE.
end type gex_type
type gex_type_r
type(gex_type), allocatable:: field(:)
end type gex_type_r

integer, allocatable :: n_gex(:,:)
type(gex_type_r), allocatable :: gex_fields(:,:)
Copy link
Member

Choose a reason for hiding this comment

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

Every variable needs to be documented with the correct doxygen format.

Comment on lines +64 to +68
if (mpp_pe()==mpp_root_pe()) then
write(*,*) ''
write(*,*) '####################################'
write(*,*) ''
end if
Copy link
Member

Choose a reason for hiding this comment

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

Why does this happen?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

my attempt to do pretty formatting. Feel free to edit/remove @thomas-robinson

Comment on lines +80 to +90
character(len=*), intent(in) :: listroot ! name of the field manager list
integer, intent(in) :: MODEL_SRC ! index of the model where the tracer comes FROM
integer, intent(in) :: MODEL_REC ! index of the model where the tracer goes TO

type(fm_list_iter_type) :: iter ! iterator over the list of tracers
character(fm_field_name_len) :: name = '' ! name of the tracer
character(fm_type_name_len) :: ftype ! type of the field table entry (not used)
! character(fm_path_name_len) :: current_list ! storage for current location in the fiels manager tree
character(fm_path_name_len) :: listname ! name of the field manager list for each tracer

integer :: n
Copy link
Member

Choose a reason for hiding this comment

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

These variables all need doxygen style comments

Comment on lines +147 to +148
integer, intent(in) :: MODEL_SRC, MODEL_REC
integer gex_get_n_ex
Copy link
Member

Choose a reason for hiding this comment

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

document each variable with doxygen

Comment on lines +162 to +164
integer, intent(in) :: MODEL_SRC, MODEL_REC,index
integer :: property
character(len=64) :: gex_get_property
Copy link
Member

Choose a reason for hiding this comment

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

please document each variable with doxygen style comments

Comment on lines +190 to +194
integer, intent(in) :: MODEL_SRC, MODEL_REC
logical, intent(in), optional :: record !record that this exchanged has been found and will be set

integer :: i
integer :: gex_get_index
Copy link
Member

Choose a reason for hiding this comment

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

please document each variable with doxygen style comments

coupler/gex.F90 Outdated
@@ -0,0 +1,220 @@
!>simple routine to pass non-tracer fields across components (regrid)
Copy link
Member

Choose a reason for hiding this comment

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

The license header is missing.

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

Successfully merging this pull request may close these issues.

4 participants