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

Icepack #750

Closed
wants to merge 24 commits into from
Closed
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
6547eaa
cice-scm work from Molly Wieringa summer visit
hkershaw-brown Apr 12, 2024
c4f7a6f
rename model directory cice-scm
hkershaw-brown Apr 12, 2024
f00a36d
remove outdated local algorithm_info_mod.f90
hkershaw-brown Apr 12, 2024
83e4162
model_mod - remove unneeded and update comments, remove svn info and …
mjs2369 Aug 27, 2024
70204d4
Remove unused variables and subroutines, including those commented ou…
mjs2369 Aug 27, 2024
fa5903e
dart_cice_mod.f90 and dart_to_cice.f90 - remove svn info and register…
mjs2369 Aug 27, 2024
673c2e8
dart_cice_mod: more cleaning and removing use statements for unused s…
mjs2369 Aug 27, 2024
8697962
Updating work/input.nml to have QCEFF namelists
mjs2369 Sep 25, 2024
eb5a29d
model_mod.f90: Remove unused subroutine find_var_type and unused vari…
mjs2369 Oct 1, 2024
6d31e55
dart_cice_mod.f90: remove unused variables and out-of-date comments
mjs2369 Oct 1, 2024
b0bc805
Fixing more comments in the model_mod
mjs2369 Oct 1, 2024
af4ad1c
Removed function set_model_time_step() from dart_cice_mod, using the …
mjs2369 Oct 1, 2024
3d910bb
Merge branch 'main' of https://github.com/NCAR/DART into icepack
mjs2369 Oct 1, 2024
54e6a83
Updating the namelist to reflect changes in the model_mod
mjs2369 Oct 1, 2024
e3a5129
Added a readme including a brief description of the model and instruc…
mjs2369 Oct 2, 2024
c7fefc3
Fixes the subroutine use_default_state_variables to use the correct n…
mjs2369 Oct 2, 2024
56ad321
Removing the subroutine use_default_state_variables as stated by the …
mjs2369 Oct 3, 2024
b8b9555
Erroring out in read_model_time when the model time has a year of 0
mjs2369 Oct 3, 2024
d74df86
Changing the dir name to icepack to match the docs. Removing icepack_…
mjs2369 Oct 3, 2024
293b033
Updating the documentation to reflect the removal of the icepack_test…
mjs2369 Oct 3, 2024
5223c24
One last sweep for unused variables
mjs2369 Oct 3, 2024
584b8aa
Adding conidtionals to check debug value before printing lots of info…
mjs2369 Oct 3, 2024
c33ba0b
Doc fixes
mjs2369 Oct 3, 2024
ff4ea2b
Remove comment from models/icepack/model_mod.f90 that was leftover fr…
mjs2369 Oct 8, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,7 @@ References
models/gitm/readme
models/gitm/netcdf_to_gitm_blocks
models/gitm/gitm_blocks_to_netcdf
models/icepack/readme
mjs2369 marked this conversation as resolved.
Show resolved Hide resolved
models/ikeda/readme
models/LMDZ/readme
models/lorenz_04/readme
Expand Down Expand Up @@ -494,7 +495,6 @@ References
models/template/readme
models/utilities/default_model_mod


.. toctree::
:maxdepth: 2
:caption: Contributing and Community
Expand Down
160 changes: 160 additions & 0 deletions models/icepack/dart_cice_mod.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
! DART software - Copyright UCAR. This open source software is provided
! by UCAR, "as is", without charge, subject to all terms of use at
! http://www.image.ucar.edu/DAReS/DART/DART_download

module dart_cice_mod

use types_mod, only : r8, rad2deg
use time_manager_mod, only : time_type, set_time, set_calendar_type
use utilities_mod, only : file_exist, error_handler, E_ERR, E_MSG
use netcdf_utilities_mod, only : nc_check

use netcdf

implicit none
private

public :: get_horiz_grid_dims, get_ncat_dim, read_horiz_grid

character(len=*), parameter :: source = 'dart_cice_mod.f90'
character(len=512) :: msgstring
logical, save :: module_initialized = .false.

character(len=256) :: ic_filename = 'cice.r.nc'

contains

!-----------------------------------------------------------------
! Read calendar information
! In 'restart' mode, this is primarily the calendar type and 'stop'
! information. The time attributes of the restart file override
! the namelist time information.

subroutine initialize_module

call set_calendar_type('gregorian')

! Make sure we have a cice restart file (for grid dims)
if ( .not. file_exist(ic_filename) ) then
msgstring = 'dart_cice_mod: '//trim(ic_filename)//' not found'
call error_handler(E_ERR,'initialize_module', msgstring, source)
endif

module_initialized = .true.

end subroutine initialize_module

!-----------------------------------------------------------------
! Read the lon, lat grid size from the restart netcdf file.
! The actual grid file is a binary file with no header information.

subroutine get_horiz_grid_dims(Nx)

integer, intent(out) :: Nx ! Number of Longitudes

integer :: grid_id, dimid, nc_rc

if ( .not. module_initialized ) call initialize_module

call nc_check(nf90_open(trim(ic_filename), nf90_nowrite, grid_id), &
'get_horiz_grid_dims','open '//trim(ic_filename))

! Longitudes : get dimid for 'ni' or 'nlon', and then get value
nc_rc = nf90_inq_dimid(grid_id, 'ni', dimid)
if (nc_rc /= nf90_noerr) then
msgstring = "unable to find either 'ni' or 'nlon' in file "//trim(ic_filename)
call error_handler(E_ERR, 'get_horiz_grid_dims', msgstring, source)
endif

call nc_check(nf90_inquire_dimension(grid_id, dimid, len=Nx), &
'get_horiz_grid_dims','inquire_dimension ni '//trim(ic_filename))

call nc_check(nf90_close(grid_id), 'get_horiz_grid_dims','close '//trim(ic_filename) )

end subroutine get_horiz_grid_dims

!-----------------------------------------------------------------
! Read the ncat size from the restart netcdf file.

subroutine get_ncat_dim(Ncat)

integer, intent(out) :: Ncat ! Number of categories in ice-thick dist

integer :: grid_id, dimid, nc_rc

if ( .not. module_initialized ) call initialize_module

call nc_check(nf90_open(trim(ic_filename), nf90_nowrite, grid_id), &
'get_ncat_dim','open '//trim(ic_filename))

! ncat : get dimid for 'ncat' and then get value
nc_rc = nf90_inq_dimid(grid_id, 'ncat', dimid)
if (nc_rc /= nf90_noerr) then
nc_rc = nf90_inq_dimid(grid_id, 'Ncat', dimid)
if (nc_rc /= nf90_noerr) then
msgstring = "unable to find either 'ncat' or 'Ncat' in file "//trim(ic_filename)
call error_handler(E_ERR, 'get_horiz_grid_dims', msgstring, source)
endif
endif

call nc_check(nf90_inquire_dimension(grid_id, dimid, len=Ncat), &
'get_ncat_dim','inquire_dimension ni '//trim(ic_filename))

call nc_check(nf90_close(grid_id), 'get_ncat_dim','close '//trim(ic_filename) )

end subroutine get_ncat_dim

!-----------------------------------------------------------------

subroutine read_horiz_grid(nx, TLAT, TLON)

integer, intent(in) :: nx
real(r8), dimension(nx), intent(out) :: TLAT, TLON

integer :: grid_id, reclength, VarId

if ( .not. module_initialized ) call initialize_module

! Check to see that the file exists.
if ( .not. file_exist(ic_filename) ) then
msgstring = 'cice grid '//trim(ic_filename)//' not found'
call error_handler(E_ERR,'read_horiz_grid', msgstring, source)
endif

! Open it and read them in the EXPECTED order.
call nc_check(nf90_open(trim(ic_filename), nf90_nowrite, grid_id), &
'read_horiz_grid', 'open '//trim(ic_filename))

! Latitude
call nc_check(nf90_inq_varid(grid_id, 'tlat', VarId), &
'read_horiz_grid', 'inquiring tlat from '//trim(ic_filename))
call nc_check(nf90_get_var(grid_id, VarId, TLAT, start=(/1/), &
count=(/nx/)), 'read_horiz_grid', &
'getting tlat from '//trim(ic_filename))

! Longitude
call nc_check(nf90_inq_varid(grid_id, 'tlon', VarId), &
'read_horiz_grid', 'inquiring tlon from '//trim(ic_filename))
call nc_check(nf90_get_var(grid_id, VarId, TLON, &
start=(/1/), count=(/nx/)), &
'read_horiz_grid', 'getting tlon from '//trim(ic_filename))

call nc_check(nf90_close(grid_id), 'read_horiz_grid', 'close '//trim(ic_filename))

TLAT = TLAT * rad2deg
TLON = TLON * rad2deg

! ensure [0,360) [-90,90]
where (TLON < 0.0_r8) TLON = TLON + 360.0_r8
where (TLON > 360.0_r8) TLON = TLON - 360.0_r8

where (TLAT < -90.0_r8) TLAT = -90.0_r8
where (TLAT > 90.0_r8) TLAT = 90.0_r8

end subroutine read_horiz_grid

!===================================================================
! End of module dart_cice_mod
!===================================================================

end module dart_cice_mod
Loading