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_t_cell_cutoff_function #41

Merged
merged 25 commits into from
Nov 7, 2024
Merged

add_t_cell_cutoff_function #41

merged 25 commits into from
Nov 7, 2024

Conversation

ezhilsabareesh8
Copy link
Contributor

This PR adds a subroutine to remove smaller T cells, particularly in regions near the tripole where smaller grid cells contribute to instability. These cells were previously removed in OM2 to enhance stability, and this change has now been incorporated into domain-tools in the current PR.

Copy link
Contributor

@micaeljtoliveira micaeljtoliveira left a comment

Choose a reason for hiding this comment

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

@ezhilsabareesh8 Just a few comments, mostly about style. Otherwise code looks fine.

src/topography.f90 Outdated Show resolved Hide resolved
src/topography.f90 Outdated Show resolved Hide resolved
src/topography.f90 Outdated Show resolved Hide resolved
src/topography.f90 Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
src/topography.f90 Outdated Show resolved Hide resolved
src/topography.f90 Outdated Show resolved Hide resolved
src/topography.f90 Outdated Show resolved Hide resolved
@micaeljtoliveira
Copy link
Contributor

One last comment: there's actually no need to store the full dy_t array if you combine the two loops over all elements of dy_t. Something like this:

    do i = 1, ny_len / 2
      do j = 1, (nxp_len - 1) / 2
          if (dy(2 * i - 1, 2 * j) + dy(2 * i, 2 * j) < cutoff*1000.0) then  !Input cutoff in Kilometers covert it to meters
            this%depth(i, j) = MISSING_VALUE  ! Set values below cutoff to zero or another value as needed
          end if
        end do
    end do

@ezhilsabareesh8
Copy link
Contributor Author

One last comment: there's actually no need to store the full dy_t array if you combine the two loops over all elements of dy_t. Something like this:

Thanks @micaeljtoliveira I have removed the intermediate array in this commit Updated in this commit 63bc14f

@micaeljtoliveira
Copy link
Contributor

Note that you also need to add the new case here:

  select case (name)
  case ('gen_topo', 'deseas', 'min_max_depth', 'fill_fraction', 'fix_nonadvective', 'mask')
    file_out = sget('output')
    if (file_out == 'unset') then
      write(error_unit,'(a)') 'ERROR: no output file specified'
      error stop
    end if
end select

so that the code stops code if no output file was specified.

@micaeljtoliveira
Copy link
Contributor

@ezhilsabareesh8 Thanks for the changes! Just a couple more comments. We are almost there! :)

src/topogtools.f90 Outdated Show resolved Hide resolved
src/topography.f90 Outdated Show resolved Hide resolved
src/topography.f90 Outdated Show resolved Hide resolved
src/topography.f90 Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
src/topogtools.f90 Outdated Show resolved Hide resolved
src/topogtools.f90 Outdated Show resolved Hide resolved
src/topogtools.f90 Outdated Show resolved Hide resolved
Copy link
Contributor

@aekiss aekiss left a comment

Choose a reason for hiding this comment

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

Thanks @ezhilsabareesh8, looks good but I've made some suggestions to hopefully improve clarity.

src/topogtools.f90 Outdated Show resolved Hide resolved
ezhilsabareesh8 and others added 2 commits November 1, 2024 16:24
Co-authored-by: Andrew Kiss <[email protected]>
Co-authored-by: Andrew Kiss <[email protected]>
@aekiss
Copy link
Contributor

aekiss commented Nov 3, 2024

Also, would it be better to avoid unit conversion for <cutoff_value>, ie use the same units as ocean_hgrid.nc (m) instead of km? Some advantages are:

  • a user familiar withocean_hgrid.nc would know that the units are m and would probably assume that the units for cut_off_T_cells are the same
  • MOM uses SI base units throughout, so it could trip up users to remember to use km in this one case
  • making no assumptions about the units used for dy makes it more general (ie fewer changes needed for it could work for grids of other models using other units) - the documentation could simply say "<cutoff_value> is the minimum T-cell y-size in the units used for dy in ocean_hgrid.nc"

ezhilsabareesh8 and others added 2 commits November 5, 2024 11:04
Co-authored-by: Andrew Kiss <[email protected]>
Co-authored-by: Andrew Kiss <[email protected]>
Copy link
Contributor

@micaeljtoliveira micaeljtoliveira left a comment

Choose a reason for hiding this comment

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

Thanks @ezhilsabareesh8 for the latest changes! All good from my side, so I'll approve.

@ezhilsabareesh8
Copy link
Contributor Author

Thanks @micaeljtoliveira and @aekiss, all the comments have been addressed now and I checked the output, it looks fine. I will merge this PR if there's no further comments or suggestions.

README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
src/topogtools.f90 Outdated Show resolved Hide resolved
src/topogtools.f90 Outdated Show resolved Hide resolved
src/topography.f90 Outdated Show resolved Hide resolved
src/topography.f90 Outdated Show resolved Hide resolved
@aekiss
Copy link
Contributor

aekiss commented Nov 6, 2024

Thanks @ezhilsabareesh8, I've suggested some tweaks to the documentation. Otherwise it looks great.

Co-authored-by: Andrew Kiss <[email protected]>
ezhilsabareesh8 and others added 6 commits November 7, 2024 10:42
Co-authored-by: Andrew Kiss <[email protected]>
Co-authored-by: Andrew Kiss <[email protected]>
Co-authored-by: Andrew Kiss <[email protected]>
Co-authored-by: Andrew Kiss <[email protected]>
Co-authored-by: Andrew Kiss <[email protected]>
Co-authored-by: Andrew Kiss <[email protected]>
@ezhilsabareesh8
Copy link
Contributor Author

Thanks @aekiss, I have made the suggested changes.

@aekiss
Copy link
Contributor

aekiss commented Nov 6, 2024

Thanks @ezhilsabareesh8, I'm happy for this to be merged

@ezhilsabareesh8
Copy link
Contributor Author

Thanks @aekiss, Could you please approve this PR?

@micaeljtoliveira micaeljtoliveira merged commit 2cba76b into master Nov 7, 2024
4 checks passed
@micaeljtoliveira micaeljtoliveira deleted the add_t_cell_cutoff branch November 7, 2024 00:13
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.

3 participants