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 suspended sediment concentration tracer #858

Closed

Conversation

caozd999
Copy link

@caozd999 caozd999 commented Apr 28, 2021

This PR added suspended sediment as a tracer (without source/sink terms) in MPAS-O. The existing lock_exchange code was modified to support a new test case called sed_tracer in the compass (MPAS-Dev/compass#87). The new test case is to simulate 1) a pure diffusion process and 2) a advection-diffusion process (momentum generated by temperature), of suspended sediment and a debug tracer. The results of suspended sediment and the debug tracer will be compared to validate the implementation of suspended sediment as a new tracer in the model.

Comment on lines 75 to 80
</nml_record>
<nml_record name="init_vertical_grid" mode="init">
<nml_option name="config_init_vertical_grid_type" type="character" default_value="z-star" units="unitless"
description="Which vertical grid to initialize with. Without ice-shelf cavities (i.e. ssh=0 everywhere), 'z-star' and 'z-level' are the same."
possible_values="'z-star', 'z-level', or 'haney-number'"
/>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Oops, I don't think these whitespace changes should have happened. Can you figure out which commit they're in, do and interactive rebase (git rebase --interactive MPAS-Dev/MPAS-Model/ocean/develop) and edit that commit to remove these changes (e.g. git checkout src/core_ocean/mode_init/Registry.xml)?

Copy link
Author

Choose a reason for hiding this comment

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

Ok, I will do that. Thanks!

Comment on lines 248 to 254
! Set debugging tracer
if ( associated(debugTracers) ) then
do k = 1, nVertLevels
debugTracers(index_tracer1, k, iCell) = 1.0_RKIND
enddo
end if

Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm not an expert in debug tracers but my sense was that debugTracers(1, :, :) was purposefully set to all ones to be a check on conservation in the model. It might be better to modify debugTracer(2 :, :) to serve the purpose you have above.

Copy link
Author

Choose a reason for hiding this comment

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

Thanks, I will put back the debugTracer(index_tracer1, :, :) content and use index_tracer2 for my test case.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Sounds good. Make sure that actually works.

Copy link
Author

Choose a reason for hiding this comment

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

I updated the code and the test case (MPAS-Dev/compass#87) accordingly. I re-ran the case and plot the outputs with no issues.

@@ -126,6 +126,8 @@ function ocn_setup_packages(configPool, packagePool, iocontext) result(ierr)!{{{
logical, pointer :: tidalForcingActive
logical, pointer :: tidalPotentialForcingPKGActive
logical, pointer :: vegetationDragPKGActive
logical, pointer :: sedimentTransportPKGActive
logical, pointer :: sedimentTracersPKGActive

Choose a reason for hiding this comment

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

@caozd999 Does this package still exist?

Copy link
Author

Choose a reason for hiding this comment

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

The two packages both exist. sedimentTransportPKGActive is for general sediment transport, under which we define the sediment transport related variables such as sediment characteristics; sedimentTracersPKGActive is specifically for process-based suspended sediment transport.

@@ -226,6 +227,8 @@ function ocn_forward_mode_init(domain, startTimeStamp) result(ierr)!{{{
call ocn_tracer_nonlocalflux_init(err_tmp)
ierr = ior(ierr,err_tmp)
call ocn_tracer_ecosys_init(domain, err_tmp)
call ocn_tracer_sediment_init(domain, err_tmp)
ierr = ior(ierr,err_tmp)

Choose a reason for hiding this comment

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

Suggested change
ierr = ior(ierr,err_tmp)

This appears to be a duplicate line

Copy link
Author

Choose a reason for hiding this comment

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

I actually missed one ierr = ior(ierr,err_tmp) after call ocn_tracer_ecosys_init(domain, err_tmp), thank you for pointing it out.

description="Concentration of debug tracer1 in one half of the domain."
possible_values="Any real number"
/>
<nml_option name="config_lock_exchange_high_tracer1" type="real" default_value="10.0" units=""

Choose a reason for hiding this comment

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

Does having a default value >0 alter the behavior of the original test case?

Choose a reason for hiding this comment

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

Ok. I see now that the debug tracers are not active by default. Are you planning to post a comparison between the debugTracer behavior and the sedimentTracers behavior, perhaps in the compass PR?

Copy link
Author

Choose a reason for hiding this comment

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

@cbegeman yes I've submitted a separate PR to compass MPAS-Dev/compass#87

! treat negative values as zero and apply mask to locals
!---------------------------------------------------------------------------

sedConcen_loc(k,column) = max(0.0_SEDIMENT_r8, SEDIMENT_input%SEDIMENT_tracers(k,column,sedConcen_ind))

Choose a reason for hiding this comment

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

This is a naive question but can you explain why getting rid of negative values happens here as opposed to elsewhere?

Copy link
Author

Choose a reason for hiding this comment

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

I just emulated the codes of DMS and MACROS tracers.

Copy link
Contributor

Choose a reason for hiding this comment

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

we really don't want to act on any sed tracers with negative concentration, but for conservation we don't want to clip the value of the actual prognostic field, so it's done using a temporary.

subroutine SEDIMENT_init(SEDIMENT_indices)

! !DESCRIPTION:
! Initialize tracegas tracer module. This involves setting metadata, reading

Choose a reason for hiding this comment

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

Are you describing the sediment tracer module as tracegas or something else?

Copy link
Author

@caozd999 caozd999 Apr 28, 2021

Choose a reason for hiding this comment

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

Thanks for pointing them out. The code was for sediment source-sink, I just built the code structure but left the code empty. I will clean the comments.

if ( groupName == 'sedimentTracers' ) then
call ocn_tracer_sediment_compute(tracerGroup, &
nTracersGroup,forcingPool, &
nCellsOwned, maxLevelCell, &

Choose a reason for hiding this comment

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

We recently put in some code that allows for inactive top cells, so minLevelCell is needed here and in the subroutine.

Copy link
Contributor

Choose a reason for hiding this comment

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

@cbegeman is the designated enforcer of the minLevelCell requirement.

Copy link
Author

Choose a reason for hiding this comment

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

Thanks. I will add minLevelCell. The whole routine currently works as a placeholder, and I will modify it accordingly as the development work goes on.

@xylar
Copy link
Collaborator

xylar commented May 3, 2021

@caozd999, could you change the name of the PR to something like "Add sediment concentration tracer"?

@caozd999 caozd999 changed the title Ocean/sediment transport pr Add suspended sediment concentration tracer May 3, 2021
Copy link
Collaborator

@xylar xylar left a comment

Choose a reason for hiding this comment

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

This branch needs to be rebased onto ocean/develop to resolve 2 conflicts with the last merge. Other than that, it looks great to me.

I ran the nightly suite from the legacy compass branch on ocean/develop and a merge of this branch into ocean/develop. I ran with gnu on my Ubuntu laptop and intel on Anvil. Both passed.

I also successfully ran the compass test cases in MPAS-Dev/compass#87. I have made some suggestions on that branch, but they don't affect merging this branch.

@caozd999 caozd999 force-pushed the ocean/sediment_transport_PR branch from 6a666d9 to 0e70bb6 Compare May 4, 2021 16:29
@caozd999 caozd999 force-pushed the ocean/sediment_transport_PR branch from 0e70bb6 to c36a9c8 Compare May 4, 2021 17:11
@xylar
Copy link
Collaborator

xylar commented May 25, 2021

@caozd999, I'm pretty sure you're aware at this point that this PR will eventually need to move to E3SM. However, if it isn't ready yet to merge into E3SM (e.g. needs more testing or review, which seems likely to be the case), we should chat about whether it makes sense to keep it here for now or move to the new https://github.com/E3SM-Ocean-Discussion/E3SM space where we will have PRs open for discussion. @mark-petersen, what is your plan for PRs like this one?

@maltrud
Copy link
Contributor

maltrud commented May 26, 2021

@caozd999 did you create a design document for this? i think it would help me understand the implementation.

@caozd999
Copy link
Author

@caozd999 did you create a design document for this? i think it would help me understand the implementation.

@maltrud Thanks Mat. I will try to create a design document for this.

@caozd999
Copy link
Author

@caozd999, I'm pretty sure you're aware at this point that this PR will eventually need to move to E3SM. However, if it isn't ready yet to merge into E3SM (e.g. needs more testing or review, which seems likely to be the case), we should chat about whether it makes sense to keep it here for now or move to the new https://github.com/E3SM-Ocean-Discussion/E3SM space where we will have PRs open for discussion. @mark-petersen, what is your plan for PRs like this one?

Thanks @xylar. Yes I noticed what you mentioned. In addition, I will need to prepare a design doc for it as @maltrud suggested. Therefore, I am open to any decision.

@maltrud
Copy link
Contributor

maltrud commented May 26, 2021

@caozd999 thanks, Zhendong. it doesn't have to be really detailed. like @cbegeman i'm curious why there are 2 new modules that are very similar. can we combine them?

Also, i'm glad you used the BGC as a guide for this, but i think it would be fine to remove the "parms" module and just include them at the top of the sediment module. the "parms" is a legacy from CESM that we are going to remove with the new BGC implementation (MARBL).

@caozd999
Copy link
Author

@maltrud Yes you are right - we can combine them. I am now working on the sediment erosion, and I realize that I can actually put everything into one module. I will do that. Thanks!

@xylar
Copy link
Collaborator

xylar commented May 26, 2021

@caozd999, these sound like significant enough changes that I would suggest closing this PR and opening a new one (perhaps referencing this one) in https://github.com/E3SM-Ocean-Discussion/E3SM. That way, it will be a lot easier to move over the E3SM-Project/E3SM when you're ready to get final approval and merge. Sorry this has been such a moving target. Bad timing.

@mark-petersen
Copy link
Contributor

PR moved to E3SM-Ocean-Discussion/E3SM#4

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

Successfully merging this pull request may close these issues.

5 participants