Skip to content

added sorting algorithm #3

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

Open
wants to merge 4 commits into
base: add_temp_coordinate
Choose a base branch
from

Conversation

gmacgilchrist
Copy link

Just pushing this initial commit to test workflow.

I have written a subroutine called sort_scalar_k, which is just a copy of the convective_adjustment bubble sorting algorithm, but designed to search through temperature and return only the sorted index ksort, nothing is done to the temperature field itself.

The code has not been tested, but it does compile.

Some outstanding questions:

  1. How to do generalize this for an arbitrary tracer in the ocean?
  2. The algorithm builds a 3d array, ksort. Would it perhaps be better if the subroutine operated on a single column, which could be called at some point in the grid building step (avoiding allocation of a full 3d array)?
  3. At present it follows convective adjustment by sorting everything to be monotonically increasing from surface to depth. This will mean inverting the whole water column in some places for temperature, which is likely to be inefficient. Perhaps functionality to choose it to be increasing or decreasing with depth would be valuable.

@ashao
Copy link
Owner

ashao commented May 11, 2020

  1. To generalize this, replace the tv argument with something else (for some reason I always use phi for arbitrary tracers). Whoever uses this function is then responsible for passing in the desired scalar.
  2. I think you're right that this subroutine should just work on a single column. I mean at some point, we'll have to store a 3D array, but it's probably better do that higher up in the call stack. There's a little bit of a push to columnarize (I think people refer to this as kernelizing?) some of these more basic routines for optimization purposes.
  3. That's interesting point. I think though that the build_and_interpolate_grid expects it to be monotonically increasing with k-space. If you want to make this more generally useable within MOM6, it would be good to have a separate (maybe optional argument?) to specificy the direction of monotonicity.

ashao pushed a commit that referenced this pull request Jun 15, 2021
MOM_domain_infra: Document FMS passthroughs
ashao pushed a commit that referenced this pull request Mar 15, 2022
* reads in porous topography parameters from CHANNEL_LIST_FILE

*new module to compute curve fit for porous topography

*porous constraints used to modify continuity_PPM, CoriolisAdv, and Rayleigh bottom channel drag
ashao pushed a commit that referenced this pull request Mar 15, 2022
(+) porous topography implementation
ashao pushed a commit that referenced this pull request Mar 15, 2022
  Use the por_face_area[UV] in the effective thickness calculations in
zonal_face_thickness and merid_face_thickness, so that they are more consistent
with their use elsewhere in the code for the relative weights in calculating the
barotropic accelerations.  Because these por_face_area arrays are still 1 in all
test cases, the answers are unchanged in any test cases from before a few weeks
ago, but there could be answer changes in cases that are using the very recently
added capability (in PR #3) to set fractional face areas.  This change was
discussed with Sam Ditkovsky, and agreed that there is no reason to keep the
ability to recover the previous answers in any cases that use the recently added
partial face width option.

  This commit also expanded the comments describing the h_u and h_v arguments to
btcalc(), zonal_face_thickness(), and merid_face_thickness() routines, the
diag_h[uv] elements of the accel_diag_ptrs type and the h_u and h_v elements of
the BT_cont_type.

  All answers and output are bitwise identical in the MOM6-examples test suite
and TC tests, but answer changes are possible in cases using a very recently
added code option.
ashao pushed a commit that referenced this pull request Feb 24, 2025
* Commit for coupling of land to ocean adot

* Remove unused ice sheet enabled flag

* add adot to Shelf restart

* Register sfc mass flux outside of initialize fluxes

* Gfdl cryo merge (#3)

* Removed second registration of sfc_mass_flux with register_diag_field.

* Registered sfc_mass_flux to runs with static and dynamic ice sheets.

* This commit removed the second registration of 'sfc_mass_flux' in 'register_diag_field()'

* Testing shelf_sfc_mass_flux restart.

* The earlier removed 'register_diag_field()' for 'mass_flux' has been added back and 'register_restart_field()' of 'fluxes_in%shelf_sfc_mass_flux' is moved before 'restore_state()'

* Corrected the line length error.

* Added back 'CS%id_mass_flux = register_diag_field()'

---------

Co-authored-by: NJSchlegel <nschlegel@gmail.com>
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.

2 participants