-
Notifications
You must be signed in to change notification settings - Fork 25
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
Split marbl_mod and marbl_ciso_mod #308
Split marbl_mod and marbl_ciso_mod #308
Conversation
Next will be to create marbl_interior_mod and pull out the interior routines. Note that this commit does not build - other modules are still trying to use marbl_mod, which no longer exists.
marbl_glo_avg_mod: has marbl_glo_avg_count_vars and marbl_glo_avg_init_rmean_vals (both called during init()) as well as module variables used by next two modules marbl_surface_mod: has set_surface_forcing marbl_interior_mod: has set_interior_forcing and marbl_set_global_scalars_interior as well as lots of small private functions called by those two Note: need to come up with better names for functions in marbl_surface_mod and marbl_interface_mod. One idea is to rename the modules again: marbl_surface_mod -> marbl_surface_fluxes_mod [with marbl_surface_fluxes_compute] marbl_interior_mod -> marbl_interior_tendencies_mod [with marbl_interior_tendencies_compute]; unsure of marbl_set_global_scalars_interior, though. Maybe marbl_interior_set_global_scalars? (maybe rename functions but not the modules?)
Also add a use statement to set_interior_forcing(); missing marbl_diagnostics use statement leads to linking error though libmarbl.a builds fine.
interface: set_surface_forcing() -> compute_fluxes() surface: marbl_set_surface_forcing() -> marbl_surface_compute_fluxes() ciso: marbl_ciso_set_surface_forcing() -> marbl_ciso_compute_fluxes() interface: set_interior_forcing() -> compute_fluxes() interior: marbl_set_interior_forcing() -> marbl_interior_compute_tendencies() ciso: marbl_ciso_set_interior_forcing() -> marbl_ciso_compute_tendencies()
Function is now marbl_nhx_surface_emis_compute(), conforming to the convention that all public functions in marbl_XYZ_mod have a name marbl_XYZ_[something]()
It is now marbl_surface_flux_mod, and marbl_surface_compute_fluxes() is now marbl_surface_flux_compute(). Similarly, marbl_interface%compute_fluxes() is now marbl_interface%surface_flux_compute().
It is now marbl_interior_tendency_mod, and marbl_interior_compute_tendencies() is now marbl_interior_tendency_compute(). Similarly, marbl_interface%compute_tendencies() is now marbl_interface%interior_tendency_compute().
Moved to marbl_ciso_surface_flux_mod, and next commit will split it to also create marbl_ciso_init_mod and marbl_ciso_interior_tendency_mod
Now resides in marbl_ciso_init_mod; also created marbl_ciso_interior_tendency_mod although it is empty as of this commit.
This completes the split of marbl_ciso_mod. I noticed that marbl_interior_tendency_mod and marbl_ciso_interior_tendency_mod both had similar update_particulate_terms_from_prior_level() routines that called identical marbl_update_sinking_particle_from_prior_level() routines, so I moved the latter to a new module (marbl_interior_share_mod) amd renamed it marbl_interior_share_update_sinking_particle_from_level_above()
flux_as and flux_sa were both set but then not used in marbl_ciso_compute_fluxes()
Still to do: clean up the module-level comments in all these new modules. The original comments from
Also, there are two things I want to look into doing:
|
marbl_ciso_surface_flux_compute() and marbl_ciso_interior_tendency_compute() both return immediately if ciso_on is false, so marbl_surface_flux_compute() and marbl_interior_tendency_compute() can both call those subroutines without checking the value of ciso_on first. Also, I moved two routines that pack share data types to marbl_interior_share_mod.F90 -- they get called regardless of ciso_on but return immediately if ciso_on is false. There are still a few places where we check the value of ciso_on that I would prefer to avoid, but that will require a little more refactoring to make possible.
Created marbl_ciso_diagnostics_mod.F90 to handle the ciso diagnostics as well as marbl_diagnostics_share_mod.F90 to house subroutines / datatypes that are used by both ciso and the base tracers.
nag caught three unnecessary use statements in marbl_ciso_diagnostics_mod.F90
I've split |
Always call marbl_ciso_init_tracer_metadata, return immediately if ciso_on is .false.
To clarify the last comment, I want to replace |
This may not be the final name change, I think we need to figure out a better name than "surface flux output" (it's confusing because surface_tracer_flux is the primary output of surface_flux_compute() and also Chl isn't a flux but is stored in this structure)
num_elements_surface_flux is a better name for the number of columns being computed simultaneously inside surface_flux_compute().
We don't use _tracer in the marbl_surface_flux_mod name or any subroutines, so I'm removing it from the variable as well. I also removed the "stf" shorthand, just using surface_fluxes everywhere.
Also added a comment that this datatype is designed to pass data from surface_flux_compute() to marbl_diagnostics_mod.F90
1. marbl_diagnostics_set_surface_forcing() is now marbl_diagnostics_surface_flux_compute() 2. store_diagnostics_ciso_surface_forcing() is now marbl_ciso_diagnostics_surface_flux_compute()
src/marbl_surface_flux_mod.F90
Outdated
! Compute carbon isotopes surface fluxes | ||
!----------------------------------------------------------------------- | ||
|
||
! pass in sections of surface_input_forcings instead of associated vars because of problems with intel/15.0.3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having the if (ciso_on)
check in marbl_ciso_surface_flux_mod
means I'm always trying to pass surface_input_forcings(ind%d1{3,4}c_id)
, and those indices are 0 for non-ciso runs. So I think we should pass all of surface_input_forcings
(as well as ind
) and let the subroutine pull out sst
, d13c
, and d14c
.
Since the check to see if ciso tracers are enabled is now in this routine, we can not specify surface_input_forcings(surface_forcing_ind%d13c_id)%field_0d in the argument list (because non-ciso runs will try try to pass surface_input_forcings(0)%field_0d, which is out of range).
Lots of comments and a few log messages still used "surface forcing" rather than "surface flux". As of this commit, I believe that all references to surface_forcing refer to the forcing fields requested by MARBL for the surface_flux_compute() routine. Next commit will be to rename surface_input_forcings to just plain surface_forcings as that is no longer an [incorrectly] overloaded term.
Now marbl_interior_tendency_share_type (matches marbl_surface_flux_share_type). Also, local variables of this type are now marbl_interior_tendency_share
It is now interior_tendency_forcing_ind (same with indexing_type).
dtracers, column_dtracers, etc are all now interior_tendencies. The subroutine compute_dtracer_local() is now compute_local_tendencies().
Variable is now interior_tendency_forcings
Now num_interior_tendency_forcing_fields
All occurences are now interior_tendency_forcing
Now tracers and tracers_at_surface, respectively.
All modules have a module-level "implicit none" so individual subroutines in the modules do not need it.
Expect 'interior_tendency' instead of 'interior' and 'surface_flux' instead of 'surface'
Renamed to autotroph_zero_consistency_enforce and also moved the ciso check to marbl_ciso_interior_tendency:marbl_ciso_autotroph_set_to_zero
* Renamed marbl_interior_share_mod to marbl_interior_tendency_share_mod (also updated public subroutines in the module) * Changed ciso_on check in share modules from "if (.not. ciso_on) return" to "if (ciso_on) then" blocks [more extensible once we add other tracer modules] * Created marbl_surface_flux_share_mod.F90 with an export_variables function to remove ciso_on from marbl_surface_flux_mod.
This removes ciso_on from marbl_interior_tendency_mod
marbl_interior_tendency_share_update_sinking_particle_from_level_above() is too long for a function name (NAG warns about more than 63 characters and gfortran throws an error (possibly because we elevate warnings to errors). New name is marbl_interior_tendency_share_update_particle_flux_from_above()
num_elements_surface -> num_elements_surface_flux num_elements_interior -> num_elements_interior_tendency num_interior_tendency_forcings -> num_elements_interior_tendency
set_global_scalars (from marbl_interface_class) can call adjust_bury_coeff directly. Now named marbl_interior_tendency_adjust_bury_coeff, the subroutine returns immediately if ladjust_bury_coeff is .false.
Now marbl_glo_avg_var_cnts_compute()
Variables and datatypes both relied on surface_saved_state and interior_saved_state rather than more descriptive names.
Now marbl_interior_tendency_diag_ind; also, included _tendency in type name
Instead of marbl_diagnostics_share_mod, these belong in marbl_interface_private_types.
This should be the last of the code clean-up commits following review of marbl-ecosys#308
f2ff0b1 updated marbl_glo_avg_mod.F90 but I didn't change the names of interface variables.
This commit renames the glo_scalar variables on the interface.
Lots of work has been done to the interface, and that is now reflected in the documentation.
Separate the initialization, surface flux computation, and interior tendency computations in both
marbl_mod.F90
andmarbl_ciso_mod.F90
: the end result is replacing those two modules with seven new ones and moving some routines tomarbl_init_mod.F90
:marbl_surface_flux_mod
-- containsmarbl_surface_flux_compute()
, formerlymarbl_set_surface_forcing()
marbl_interior_tendency_mod
-- containsmarbl_interior_tendency_compute()
, formerlymarbl_set_interior_forcing()
. Also hasmarbl_set_global_scalars_interior()
, which needs to be renamed (ideally it would be moved tomarbl_glo_avg_mod
but it callsadjust_bury_coeff()
which needs to stay inmarbl_interior_mod
)marbl_glo_avg_mod
-- containsmarbl_glo_avg_count_vars()
andmarbl_glo_avg_init_rmean_vals()
marbl_ciso_init_mod
-- containsmarbl_ciso_init_tracer_metadata()
marbl_ciso_surface_flux_mod
-- containsmarbl_ciso_surface_flux_compute()
, formerlymarbl_ciso_set_surface_forcing()
marbl_ciso_interior_tendency_mod
-- containsmarbl_ciso_interior_tendency_compute()
, formerlymarbl_ciso_set_interior_forcing()
.marbl_interior_share_mod
-- containsmarbl_interior_share_update_sinking_particle_from_level_above()
, which used to be a private routine (marbl_update_sinking_particle_from_prior_level()
) in bothmarbl_mod
andmarbl_ciso_mod
; now both tracer modules can use the same code. Perhaps this would also be a good place foradjust_bury_coeff()
, allowingmarbl_set_global_scalars_interior()
to be moved tomarbl_glo_avg_mod
?For consistency, the interface routines
set_surface_forcing()
andset_interior_forcing()
have been renamedsurface_flux_compute()
andinterior_tendency_compute()
, respectively, and renamesmarbl_comp_nhx_surface_emis()
tomarbl_nhx_surface_emis_compute()
.Addresses #86