Skip to content

Commit ff4e906

Browse files
committed
Only necessary changes for Double Gyre setup
1 parent b6e661c commit ff4e906

11 files changed

+443
-5
lines changed

env.sh

+2
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@ elif [[ $LOGINHOST =~ \.bullx$ ]]; then
8989
STRATEGY="atosecmwf"
9090
elif [[ $LOGINHOST =~ uan[0-9][0-9] ]]; then
9191
STRATEGY="lumi"
92+
elif [[ $LOGINHOST =~ nesh-login[1-3] ]]; then
93+
STRATEGY="nesh"
9294
elif [[ -d $DIR/env/$LOGINHOST ]]; then # check if directory with LOGINHOST exists in env
9395
STRATEGY=$LOGINHOST
9496
else

env/nesh/shell

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Inspired by environment for albedo
2+
module load oneapi2023-env/2023.2.0
3+
4+
module load cmake/3.27.4
5+
module load oneapi/2023.2.0
6+
module load oneapi-mkl/2023.1.0
7+
module load oneapi-mpi/2021.10.0
8+
module load netcdf-c/4.9.2-with-oneapi-mpi-2021.10.0
9+
module load netcdf-fortran/4.6.0-with-oneapi-mpi-2021.10.0
10+
export FC=mpiifort CC=mpiicc CXX=mpiicpc
11+
12+
13+
# haven't set any environment variables. hopefully fine by now
14+
export I_MPI_PMI=pmi2
15+
export I_MPI_PMI_LIBRARY=/usr/lib64/libpmi2.so

src/gen_modules_backscatter.F90

+1-1
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ subroutine uke_update(dynamics, partit, mesh)
361361

362362
!Taking out that one place where it is always weird (Pacific Southern Ocean)
363363
!Should not really be used later on, once we fix the issue with the 1/4 degree grid
364-
if(.not. (TRIM(which_toy)=="soufflet")) then
364+
if(.not. (TRIM(which_toy)=="soufflet") .AND. .not. (TRIM(which_toy)=="nemo") ) then
365365
call elem_center(ed, ex, ey)
366366
!a1=-104.*rad
367367
!a2=-49.*rad

src/io_meandata.F90

+5
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,11 @@ subroutine ini_mean_io(ice, dynamics, tracers, partit, mesh)
210210
call def_stream(nod2D, myDim_nod2D, 'ssh', 'sea surface elevation', 'm', dynamics%eta_n, io_list(i)%freq, io_list(i)%unit, io_list(i)%precision, partit, mesh)
211211
CASE ('vve_5 ')
212212
call def_stream(nod2D, myDim_nod2D, 'vve_5', 'vertical velocity at 5th level', 'm/s', dynamics%w(5,:), io_list(i)%freq, io_list(i)%unit, io_list(i)%precision, partit, mesh)
213+
CASE ('t_star ')
214+
call def_stream(nod2D, myDim_nod2D,'t_star' , 'air temperature' , 'C' , t_star(:) , io_list(i)%freq, io_list(i)%unit, io_list(i)%precision, partit, mesh)
215+
CASE ('qsr ')
216+
call def_stream(nod2D, myDim_nod2D,'qsr' , 'solar radiation' , 'W/s^2' , qsr_c(:) , io_list(i)%freq, io_list(i)%unit, io_list(i)%precision, partit, mesh)
217+
213218

214219
! 2d ssh diagnostic variables
215220
CASE ('ssh_rhs ')

src/oce_ale.F90

+11-3
Original file line numberDiff line numberDiff line change
@@ -3114,7 +3114,7 @@ subroutine impl_vert_visc_ale(dynamics, partit, mesh)
31143114
USE MOD_PARTIT
31153115
USE MOD_PARSUP
31163116
USE MOD_DYN
3117-
USE g_CONFIG,only: dt
3117+
USE g_CONFIG !,only: dt
31183118
IMPLICIT NONE
31193119
type(t_dyn) , intent(inout), target :: dynamics
31203120
type(t_partit), intent(inout), target :: partit
@@ -3239,8 +3239,16 @@ subroutine impl_vert_visc_ale(dynamics, partit, mesh)
32393239
zinv=1.0_WP*dt/(zbar_n(nzmax-1)-zbar_n(nzmax))
32403240
!!PS friction=-C_d*sqrt(UV(1,nlevels(elem)-1,elem)**2+ &
32413241
!!PS UV(2,nlevels(elem)-1,elem)**2)
3242-
friction=-C_d*sqrt(UV(1,nzmax-1,elem)**2+ &
3243-
UV(2,nzmax-1,elem)**2)
3242+
3243+
if ((toy_ocean) .AND. (TRIM(which_toy)=="soufflet")) then
3244+
friction=-0.005
3245+
elseif ((toy_ocean) .AND. (TRIM(which_toy)=="nemo")) then
3246+
friction=-0.001
3247+
else
3248+
friction=-C_d*sqrt(UV(1,nzmax-1,elem)**2+ &
3249+
UV(2,nzmax-1,elem)**2)
3250+
end if
3251+
32443252
ur(nzmax-1)=ur(nzmax-1)+zinv*friction*UV(1,nzmax-1,elem)
32453253
vr(nzmax-1)=vr(nzmax-1)+zinv*friction*UV(2,nzmax-1,elem)
32463254

src/oce_ale_pressure_bv.F90

+2
Original file line numberDiff line numberDiff line change
@@ -3068,6 +3068,8 @@ SUBROUTINE density_linear(t, s, bulk_0, bulk_pz, bulk_pz2, rho_out)
30683068

30693069
IF((toy_ocean) .AND. (TRIM(which_toy)=="soufflet")) THEN
30703070
rho_out = density_0 - 0.00025_WP*(t - 10.0_WP)*density_0
3071+
ELSE IF((toy_ocean) .AND. (TRIM(which_toy)=="nemo")) THEN
3072+
rho_out = density_0 - density_0*0.0002052_WP*(t - 10.0_WP) + density_0*0.00079_WP*(s - 35.0_WP)
30713073
ELSE
30723074
rho_out = density_0 + 0.8_WP*(s - 34.0_WP) - 0.2*(t - 20.0_WP)
30733075
END IF

src/oce_ale_tracer.F90

+12-1
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,9 @@ subroutine solve_tracers_ale(ice, dynamics, tracers, partit, mesh)
158158
use g_comm_auto
159159
use o_tracers
160160
use Toy_Channel_Soufflet
161+
use Toy_Channel_Nemo
162+
use o_ARRAYS, only: heat_flux
163+
use g_forcing_arrays, only: sw_3d
161164
use diff_tracers_ale_interface
162165
use oce_adv_tra_driver_interfaces
163166
#if defined(__recom)
@@ -981,12 +984,20 @@ subroutine diff_ver_part_impl_ale(tr_num, dynamics, tracers, ice, partit, mesh)
981984

982985
!_______________________________________________________________________
983986
! case of activated shortwave penetration into the ocean, ad 3d contribution
984-
if (use_sw_pene .and. tracers%data(tr_num)%ID==1) then
987+
if (use_sw_pene .and. tracers%data(tr_num)%ID==1 .and. .not. toy_ocean) then
985988
do nz=nzmin, nzmax-1
986989
zinv=1.0_WP*dt !/(zbar(nz)-zbar(nz+1)) ale!
987990
!!PS tr(nz)=tr(nz)+(sw_3d(nz, n)-sw_3d(nz+1, n) * ( area(nz+1,n)/areasvol(nz,n)) ) * zinv
988991
tr(nz)=tr(nz)+(sw_3d(nz, n)-sw_3d(nz+1, n) * area(nz+1,n)/areasvol(nz,n)) * zinv
989992
end do
993+
elseif (use_sw_pene .and. (tracers%data(tr_num)%ID==1) .and. toy_ocean .and. TRIM(which_toy)=="nemo") then
994+
995+
call cal_shortwave_rad_nemo(ice, tracers, partit, mesh)
996+
do nz=nzmin, nzmax-1
997+
zinv=1.0_WP*dt !/(zbar(nz)-zbar(nz+1)) ale!
998+
tr(nz)=tr(nz)+(sw_3d(nz, n)-sw_3d(nz+1, n)*area(nz+1,n)/area(nz,n))*zinv
999+
end do
1000+
9901001
end if
9911002

9921003
!_______________________________________________________________________

src/oce_modules.F90

+1
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ MODULE o_ARRAYS
199199
real(kind=WP), allocatable :: Ssurf_ib(:) ! kh 15.03.21 additional array for asynchronous iceberg computations
200200
real(kind=WP), allocatable :: virtual_salt(:), relax_salt(:)
201201
real(kind=WP), allocatable :: Tclim(:,:), Sclim(:,:)
202+
real(kind=WP), allocatable :: t_star(:), qsr_c(:)
202203

203204
!--------------
204205
! LA: add iceberg tracer arrays 2023-02-08

src/oce_setup_step.F90

+5
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ subroutine ocean_setup(dynamics, tracers, partit, mesh)
9191
use g_cvmix_tidal
9292
use g_backscatter
9393
use Toy_Channel_Soufflet
94+
use Toy_Channel_Nemo
9495
use oce_initial_state_interface
9596
use oce_adv_tra_fct_interfaces
9697
use init_ale_interface
@@ -226,6 +227,8 @@ subroutine ocean_setup(dynamics, tracers, partit, mesh)
226227
call compute_zonal_mean_ini(partit, mesh)
227228
call compute_zonal_mean(dynamics, tracers, partit, mesh)
228229
end if
230+
CASE("nemo")
231+
call initial_state_nemo(dynamics, tracers, partit, mesh)
229232
END SELECT
230233
else
231234
if (flag_debug .and. partit%mype==0) print *, achar(27)//'[36m'//' --> call oce_initial_state'//achar(27)//'[0m'
@@ -748,6 +751,8 @@ SUBROUTINE arrays_init(num_tracers, partit, mesh)
748751
! ================
749752
!allocate(stress_diag(2, elem_size))!delete me
750753
!!PS allocate(Visc(nl-1, elem_size))
754+
allocate(t_star(node_size))
755+
allocate(qsr_c(node_size))
751756
! ================
752757
! elevation and its rhs
753758
! ================

src/oce_shortwave_pene_nemo.F90

+127
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
subroutine cal_shortwave_rad_nemo(ice, tracers, partit, mesh)
2+
! This routine is inherited from FESOM 1.4 and adopted appropreately. It calculates
3+
! shortwave penetration into the ocean assuming the constant chlorophyll concentration.
4+
! No penetration under the ice is applied. A decent way for ice region is to be discussed.
5+
! This routine should be called after ice2oce coupling done if ice model is used.
6+
! Ref.: Morel and Antoine 1994, Sweeney et al. 2005
7+
USE MOD_MESH
8+
USE MOD_ICE
9+
USE o_PARAM
10+
USE o_ARRAYS
11+
USE MOD_PARSUP
12+
USE MOD_PARTIT
13+
USE MOD_TRACER
14+
USE g_CONFIG
15+
use g_forcing_arrays!, only: chl, sw_3d
16+
use g_comm_auto
17+
! use i_param
18+
! use i_arrays
19+
! use i_therm_param
20+
! use Toy_Channel_Nemo!, only: qsr_c, t_star
21+
IMPLICIT NONE
22+
type(t_ice) ,intent(in), target :: ice
23+
type(t_tracer), intent(inout), target :: tracers
24+
type(t_partit), intent(inout), target :: partit
25+
type(t_mesh), intent(in) , target :: mesh
26+
27+
28+
integer :: m, n2, n3, k, nzmax, nzmin
29+
real(kind=WP):: swsurf, aux, zTstar, ztrp
30+
real(kind=WP):: c, c2, c3, c4, c5
31+
real(kind=WP):: v1, v2, sc1, sc2
32+
real(kind=WP), pointer :: albw
33+
34+
35+
#include "associate_part_def.h"
36+
#include "associate_mesh_def.h"
37+
#include "associate_part_ass.h"
38+
#include "associate_mesh_ass.h"
39+
40+
sw_3d=0.0_WP
41+
albw => ice%thermo%albw
42+
43+
44+
do n2=1, myDim_nod2D+eDim_nod2D
45+
46+
!calculate heat flux
47+
zTstar = 28.3 ! intensity from 28.3 a -5 deg
48+
ztrp = 4.0 ! retroaction term on heat fluxes (W/m2/K)
49+
50+
!lat = coord_nod2D(2,n2)
51+
52+
!t_star (n2) = zTstar * cos(pi*((lat / rad - 5.0 ) / 107.0))
53+
heat_flux(n2) = ztrp * (tracers%data(1)%values(1,n2) - t_star(n2))
54+
55+
56+
57+
! shortwave rad.
58+
swsurf=(1.0_WP-albw)*qsr_c(n2)
59+
! the visible part (300nm-750nm)
60+
swsurf=swsurf*0.54_WP
61+
! subtract visible sw rad. from heat_flux, which is '+' for upward
62+
63+
!if (mype==0) write(*,*) "heat_flux_routine", heat_flux(100)
64+
!if (mype==0) write(*,*) "radiation_routine", qsr_c(100)
65+
66+
heat_flux(n2)=heat_flux(n2)+swsurf
67+
68+
! attenuation func. for vis. sw rad. according to Morel/Antoine param.
69+
! the four parameters in the func.
70+
71+
72+
73+
! limit chl from below
74+
if (chl(n2) < 0.02_WP) chl(n2)=0.02_WP
75+
76+
77+
c=log10(chl(n2))
78+
c2=c*c
79+
c3=c2*c
80+
c4=c3*c
81+
c5=c4*c
82+
! --> coefficients come from Sweeney et al. 2005, "Impacts of shortwave
83+
! penetration depthon large scale ocean circulation and heat transport" see
84+
! Appendix A
85+
86+
87+
88+
v1=0.008_WP*c+0.132_WP*c2+0.038_WP*c3-0.017_WP*c4-0.007_WP*c5
89+
v2=0.679_WP-v1
90+
v1=0.321_WP+v1
91+
sc1=1.54_WP-0.197_WP*c+0.166_WP*c2-0.252_WP*c3-0.055_WP*c4+0.042_WP*c5
92+
sc2=7.925_WP-6.644_WP*c+3.662_WP*c2-1.815_WP*c3-0.218_WP*c4+0.502_WP*c5
93+
94+
95+
96+
! convert from heat flux [W/m2] to temperature flux [K m/s]
97+
swsurf=swsurf/vcpw
98+
! vis. sw. rad. in the colume
99+
nzmax=(mesh%nlevels(n2))
100+
nzmin=(mesh%ulevels(n2))
101+
sw_3d(nzmin, n2)=swsurf
102+
do k=nzmin+1, nzmax
103+
aux=(v1*exp(mesh%zbar_3d_n(k,n2)/sc1)+v2*exp(mesh%zbar_3d_n(k,n2)/sc2))
104+
sw_3d(k, n2)=swsurf*aux
105+
if (aux < 1.e-5_WP .OR. k==nzmax) then
106+
sw_3d(k, n2)=0.0_WP
107+
exit
108+
end if
109+
end do
110+
111+
! sw_3d --> TEMPERATURE FLUX through full depth level interfaces into/out off
112+
! the tracer volume
113+
! sum(sw_3d(1:nlevels(n2)-1,n2)-sw_3d(2:nlevels(n2),n2)) = swsurf !!!
114+
115+
!for testing the subroutine
116+
!if (mype==30 .and. n2==100) then
117+
!write(*,*) 'heat_flux=', heat_flux(n2)
118+
!write(*,*) 'short/longwave=', shortwave(n2), longwave(n2), swsurf*vcpw
119+
!do k=1, nzmax
120+
! write(*,*) sw_3d(k, n2)*vcpw
121+
!end do
122+
!end if
123+
124+
end do
125+
!call par_ex
126+
!stop
127+
end subroutine cal_shortwave_rad_nemo

0 commit comments

Comments
 (0)