diff --git a/CMakeLists.txt b/CMakeLists.txt index 59cc0b15a..7966f7cd8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,7 +12,7 @@ set(CMAKE_VERBOSE_MAKEFILE ON) option(BUILD_SHARED_LIBS "Build using shared libraries" OFF) # cmake-internal switch to toggle if library targets are being build as STATIC or SHARED, see https://cmake.org/cmake/help/latest/guide/tutorial/Selecting%20Static%20or%20Shared%20Libraries.html set(TOPLEVEL_DIR ${CMAKE_CURRENT_LIST_DIR}) -set(FESOM_COUPLED ON CACHE BOOL "compile fesom standalone or with oasis support (i.e. coupled)") +set(FESOM_COUPLED OFF CACHE BOOL "compile fesom standalone or with oasis support (i.e. coupled)") set(OIFS_COUPLED OFF CACHE BOOL "compile fesom coupled to OpenIFS. (Also needs FESOM_COUPLED to work)") set(CRAY OFF CACHE BOOL "compile with cray ftn") set(USE_ICEPACK OFF CACHE BOOL "compile fesom with the Iceapck modules for sea ice column physics.") diff --git a/env/levante.dkrz.de/shell b/env/levante.dkrz.de/shell index e863d83d3..f92a5ed96 120000 --- a/env/levante.dkrz.de/shell +++ b/env/levante.dkrz.de/shell @@ -1 +1 @@ -shell.intel \ No newline at end of file +shell.gnu \ No newline at end of file diff --git a/src/fesom_module.F90 b/src/fesom_module.F90 index 0e55c3982..eb9bdbc0c 100755 --- a/src/fesom_module.F90 +++ b/src/fesom_module.F90 @@ -29,12 +29,9 @@ module fesom_main_storage_module use read_mesh_interface use fesom_version_info_module use command_line_options_module - ! Define icepack module - - ! -------------- - ! LA icebergs: 2023-05-17 use iceberg_params - ! -------------- + use iceberg_step + ! Define icepack module #if defined (__icepack) use icedrv_main, only: set_icepack, init_icepack, alloc_icepack diff --git a/src/icb_dyn.F90 b/src/icb_dyn.F90 index b0fb3c53d..0ca798c3e 100644 --- a/src/icb_dyn.F90 +++ b/src/icb_dyn.F90 @@ -1,3 +1,23 @@ +module iceberg_dynamics + USE MOD_MESH + use MOD_PARTIT + use MOD_ICE + USE MOD_DYN + use iceberg_params + use iceberg_element + !use iceberg_step + +implicit none + + public :: iceberg_dyn + public :: iceberg_frozen + public :: iceberg_acceleration + public :: compute_areas + public :: iceberg_average_andkeel + public :: iceberg_avvelo + + contains + !============================================================================== ! calculates basically the new iceberg velocity; if melting is enabled, the ! iceberg dimensions are adjusted as well. @@ -12,28 +32,10 @@ subroutine iceberg_dyn(mesh, partit, ice, dynamics, ib, new_u_ib, new_v_ib, u_ib f_u_ib_old, f_v_ib_old, l_semiimplicit, & semiimplicit_coeff, AB_coeff, file3, rho_icb) -! kh 19.02.21 use g_forcing_arrays !for u_wind, v_wind or u_wind_ib, v_wind_ib respectively - -! kh 19.02.21 -! use i_arrays !for u_ice , v_ice or u_ice_ib, v_ice_ib respectively - -! kh 17.03.21 specification of structures used -!use o_arrays, only: coriolis_ib, Tsurf_ib, Ssurf_ib - !LA 2023-03-07 - !use o_arrays, only: coriolis, Tsurf_ib, Ssurf_ib use o_arrays, only: Tsurf_ib, Ssurf_ib - use o_param !for dt - !use o_mesh - use iceberg_params,only: l_melt, coriolis_scale !are icebergs allowed to melt? - - USE MOD_MESH - use MOD_PARTIT - use MOD_ICE - USE MOD_DYN - - implicit none + !use iceberg_params,only: l_melt, coriolis_scale !are icebergs allowed to melt? integer, intent(IN) :: ib !current iceberg's index real, intent(OUT) :: new_u_ib, new_v_ib @@ -83,15 +85,10 @@ subroutine iceberg_dyn(mesh, partit, ice, dynamics, ib, new_u_ib, new_v_ib, u_ib #include "associate_part_ass.h" #include "associate_mesh_ass.h" - ! u_ice => ice%uice(:) - ! v_ice => ice%vice(:) - ! u_ice_ib => ice%uice_ib(:) - ! v_ice_ib => ice%vice_ib(:) - !OCEAN VELOCITIES: ! - (uo_ib, vo_ib) : integrated mean velocity at location of iceberg ! - (uo_skin_ib, vo_skin_ib) : velocity below the draft of the iceberg - ! call iceberg_avvelo_ufkeel(uo_dz,vo_dz, uo_keel,vo_keel, depth_ib,iceberg_elem) + ! call iceberg_avvelo_ufkeel(uo_dz,vo_dz, uo_keel,vo_keel, depth_ib,iceberg_elem) call iceberg_average_andkeel(mesh, partit, dynamics, uo_dz,vo_dz, uo_keel,vo_keel, T_dz,S_dz, T_keel,S_keel, depth_ib,iceberg_elem, ib) call FEM_3eval(mesh, partit, uo_ib,vo_ib,lon,lat,uo_dz,vo_dz,iceberg_elem) call FEM_3eval(mesh, partit, uo_skin_ib,vo_skin_ib,lon,lat,uo_keel,vo_keel,iceberg_elem) @@ -103,16 +100,14 @@ subroutine iceberg_dyn(mesh, partit, ice, dynamics, ib, new_u_ib, new_v_ib, u_ib call FEM_3eval(mesh, partit, T_ave_ib,S_ave_ib,lon,lat,T_dz,S_dz,iceberg_elem) call FEM_3eval(mesh, partit, T_keel_ib,S_keel_ib,lon,lat,T_keel,S_keel,iceberg_elem) + !ATMOSPHERIC VELOCITY ua_ib, va_ib - ! kh 11.02.21 call FEM_eval(mesh, partit, ua_ib,va_ib,lon,lat,u_wind_ib,v_wind_ib,iceberg_elem) !ICE VELOCITY ui_ib, vi_ib - ! kh 11.02.21 call FEM_eval(mesh, partit, ui_ib,vi_ib,lon,lat,ice%uice_ib,ice%vice_ib,iceberg_elem) !ICE THICKNESS (CONCENTRATION) hi_ib, conci_ib - hi_ib3 => ice%data(size(ice%data))%values(:) !ice%m_ice_ib(tmp_arr) conci_ib3 => ice%data(size(ice%data)-1)%values(:) !ice%a_ice_ib(tmp_arr) call FEM_3eval(mesh, partit, hi_ib,conci_ib,lon,lat,hi_ib3,conci_ib3,iceberg_elem) @@ -121,11 +116,6 @@ subroutine iceberg_dyn(mesh, partit, ice, dynamics, ib, new_u_ib, new_v_ib, u_ib call compute_areas(Ao, Aa, Ai, Ad, depth_ib, & height_ib, length_ib, width_ib, hi_ib) - - !fcoriolis = coriolis_param_elem2D(iceberg_elem) * coriolis_scale(ib) - -! kh 16.03.21 use coriolis_ib buffered values here, test only -!fcoriolis = coriolis_ib(iceberg_elem) * coriolis_scale(ib) coriolis => mesh%coriolis(:) fcoriolis = coriolis(iceberg_elem) * coriolis_scale(ib) @@ -144,9 +134,7 @@ subroutine iceberg_dyn(mesh, partit, ice, dynamics, ib, new_u_ib, new_v_ib, u_ib !========================THERMODYNAMICS============================ if(l_melt) then -! kh 15.03.21 use Tsurf_ib and Ssurf_ib buffered values here call FEM_eval(mesh, partit, sst_ib,sss_ib,lon,lat,Tsurf_ib,Ssurf_ib,iceberg_elem) - call iceberg_meltrates( M_b, M_v, M_e, M_bv, & u_ib,v_ib, uo_ib,vo_ib, ua_ib,va_ib, & sst_ib, length_ib, conci_ib, & @@ -228,7 +216,7 @@ end subroutine iceberg_dyn subroutine iceberg_frozen(festgefroren, P_sill, P_ib, conc_sill, conci_ib, ib) - use iceberg_params, only : l_freeze !use 'capturing mechanism' of sea ice? + !use iceberg_params, only : l_freeze !use 'capturing mechanism' of sea ice? implicit none real, intent(OUT) :: festgefroren @@ -289,19 +277,14 @@ subroutine iceberg_acceleration(mesh, partit, dynamics, ib, au_ib, av_ib, Ao, Aa lon_rad, lat_rad, output, f_u_ib_old, & f_v_ib_old, l_semiimplicit, & semiimplicit_coeff, AB_coeff ) - -! kh 17.03.21 not really used here -! use o_arrays !for ssh - - + use o_param !for g use g_config !for istep use MOD_PARTIT !for mype use g_rotate_grid, only: vector_r2g, vector_g2r - use iceberg_params, only: l_wave, l_tides, l_geo_out, surfslop_scale, ascii_out - -use MOD_MESH - USE MOD_DYN + !use iceberg_params, only: l_wave, l_tides, l_geo_out, surfslop_scale, ascii_out + use MOD_MESH + use MOD_DYN implicit none @@ -362,9 +345,6 @@ subroutine iceberg_acceleration(mesh, partit, dynamics, ib, au_ib, av_ib, Ao, Aa ocean_drag_u = (0.5 * Co * rho_h2o * Ao & * abs_omib * uo_ib)/mass_ib !calculate part of it implicitly - - !ocean_skin_u = (rho_h2o * Cdo_skin * Ad & - ! * abs_omib * uo_ib)/mass_ib !calculate part of it implicitly ocean_skin_u = (rho_h2o * Cdo_skin * Ad & * abs_omib_skin * uo_skin_ib)/mass_ib !calculate part of it implicitly @@ -393,19 +373,13 @@ subroutine iceberg_acceleration(mesh, partit, dynamics, ib, au_ib, av_ib, Ao, Aa slope_tides_u = 0.0 end if - !surface_slope_u = -g * sum( ssh(elem2D_nodes(:,iceberg_elem)) & - ! * bafux_2D(:,iceberg_elem) ) !-g* nabla ssh surface_slope_u = (-g * nablaeta(1) + slope_tides_u) * surfslop_scale(ib) !default scaling is 1.0 ! v-components - !ocean_drag_v = (0.5 * Co * rho_h2o * Ao & - ! * abs_omib * (vo_ib - v_ib))/mass_ib ocean_drag_v = (0.5 * Co * rho_h2o * Ao & * abs_omib * vo_ib)/mass_ib !calculate part of it implicitly - !ocean_skin_v = (rho_h2o * Cdo_skin * Ad & - ! * abs_omib * vo_ib)/mass_ib !calculate part of it implicitly ocean_skin_v = (rho_h2o * Cdo_skin * Ad & * abs_omib_skin * vo_skin_ib)/mass_ib !calculate part of it implicitly @@ -432,8 +406,6 @@ subroutine iceberg_acceleration(mesh, partit, dynamics, ib, au_ib, av_ib, Ao, Aa slope_tides_v = 0.0 end if - !surface_slope_v = -g * sum( ssh(elem2D_nodes(:,iceberg_elem)) & - ! * bafuy_2D(:,iceberg_elem) ) surface_slope_v = (-g * nablaeta(2) + slope_tides_v) * surfslop_scale(ib) !default scaling is 1.0 @@ -525,75 +497,67 @@ subroutine iceberg_acceleration(mesh, partit, dynamics, ib, au_ib, av_ib, Ao, Aa end if !use semiimplicit scheme or AB method? - !if(.false.) then - if(output .AND. ascii_out) then - - accs_u_out(1) = ocean_drag_u - (0.5 * Co * rho_h2o * Ao * abs_omib * u_ib)/mass_ib - accs_u_out(2) = ocean_skin_u - (rho_h2o * Cdo_skin * Ad * abs_omib_skin * u_ib)/mass_ib - accs_u_out(3) = air_drag_u - accs_u_out(4) = air_skin_u - accs_u_out(5) = ice_drag_u - accs_u_out(6) = wave_radiation_u - accs_u_out(7) = surface_slope_u - accs_u_out(8) = fcoriolis*v_ib - vels_u_out(1) = uo_ib - vels_u_out(2) = uo_skin_ib - vels_u_out(3) = ua_ib - vels_u_out(4) = ui_ib - - accs_v_out(1) = ocean_drag_v - (0.5 * Co * rho_h2o * Ao * abs_omib * v_ib)/mass_ib - accs_v_out(2) = ocean_skin_v - (rho_h2o * Cdo_skin * Ad * abs_omib_skin * v_ib)/mass_ib - accs_v_out(3) = air_drag_v - accs_v_out(4) = air_skin_v - accs_v_out(5) = ice_drag_v - accs_v_out(6) = wave_radiation_v - accs_v_out(7) = surface_slope_v - accs_v_out(8) = -fcoriolis*u_ib - vels_v_out(1) = vo_ib - vels_v_out(2) = vo_skin_ib - vels_v_out(3) = va_ib - vels_v_out(4) = vi_ib - - if(l_geo_out) then - do i=1,8 - call vector_r2g(accs_u_out(i), accs_v_out(i), lon_rad, lat_rad, 0) - end do - do i=1,4 - call vector_r2g(vels_u_out(i), vels_v_out(i), lon_rad, lat_rad, 0) - end do - end if - - !test1 = -0.1 - !test2 = 0.1 - !write(*,*) 'Test rotation:', ib, test1, test2 - !call vector_r2g(test1, test2, lon_rad, lat_rad, 0) - !write(*,*) 'After vector_r2g:', ib, test1, test2 - !call vector_g2r(test1, test2, lon_rad, lat_rad, 0) - !write(*,*) 'After vector_g2r (should be the same):', ib, test1, test2 - - open(unit=icbID,file=file1,position='append') - write(icbID,'(2I,12e15.7)') mype, istep, & - accs_u_out(1), accs_u_out(2), & - accs_u_out(3), accs_u_out(4), & - accs_u_out(5), accs_u_out(6), & - accs_u_out(7), accs_u_out(8), & - vels_u_out(1), vels_u_out(2), & - vels_u_out(3), vels_u_out(4) - - - - close(icbID) - - open(unit=icbID,file=file2,position='append') - write(icbID,'(2I,12e15.7)') mype,istep, & - accs_v_out(1), accs_v_out(2), & - accs_v_out(3), accs_v_out(4), & - accs_v_out(5), accs_v_out(6), & - accs_v_out(7), accs_v_out(8), & - vels_v_out(1), vels_v_out(2), & - vels_v_out(3), vels_v_out(4) - close(icbID) - end if !output +! !if(.false.) then +! if(output .AND. ascii_out) then +! +! accs_u_out(1) = ocean_drag_u - (0.5 * Co * rho_h2o * Ao * abs_omib * u_ib)/mass_ib +! accs_u_out(2) = ocean_skin_u - (rho_h2o * Cdo_skin * Ad * abs_omib_skin * u_ib)/mass_ib +! accs_u_out(3) = air_drag_u +! accs_u_out(4) = air_skin_u +! accs_u_out(5) = ice_drag_u +! accs_u_out(6) = wave_radiation_u +! accs_u_out(7) = surface_slope_u +! accs_u_out(8) = fcoriolis*v_ib +! vels_u_out(1) = uo_ib +! vels_u_out(2) = uo_skin_ib +! vels_u_out(3) = ua_ib +! vels_u_out(4) = ui_ib +! +! accs_v_out(1) = ocean_drag_v - (0.5 * Co * rho_h2o * Ao * abs_omib * v_ib)/mass_ib +! accs_v_out(2) = ocean_skin_v - (rho_h2o * Cdo_skin * Ad * abs_omib_skin * v_ib)/mass_ib +! accs_v_out(3) = air_drag_v +! accs_v_out(4) = air_skin_v +! accs_v_out(5) = ice_drag_v +! accs_v_out(6) = wave_radiation_v +! accs_v_out(7) = surface_slope_v +! accs_v_out(8) = -fcoriolis*u_ib +! vels_v_out(1) = vo_ib +! vels_v_out(2) = vo_skin_ib +! vels_v_out(3) = va_ib +! vels_v_out(4) = vi_ib +! +! if(l_geo_out) then +! do i=1,8 +! call vector_r2g(accs_u_out(i), accs_v_out(i), lon_rad, lat_rad, 0) +! end do +! do i=1,4 +! call vector_r2g(vels_u_out(i), vels_v_out(i), lon_rad, lat_rad, 0) +! end do +! end if +! +! !open(unit=icbID,file=file1,position='append') +! !write(icbID,'(2I,12e15.7)') mype, istep, & +! ! accs_u_out(1), accs_u_out(2), & +! ! accs_u_out(3), accs_u_out(4), & +! ! accs_u_out(5), accs_u_out(6), & +! ! accs_u_out(7), accs_u_out(8), & +! ! vels_u_out(1), vels_u_out(2), & +! ! vels_u_out(3), vels_u_out(4) +! ! +! ! +! ! +! !close(icbID) +! +! !open(unit=icbID,file=file2,position='append') +! !write(icbID,'(2I,12e15.7)') mype,istep, & +! ! accs_v_out(1), accs_v_out(2), & +! ! accs_v_out(3), accs_v_out(4), & +! ! accs_v_out(5), accs_v_out(6), & +! ! accs_v_out(7), accs_v_out(8), & +! ! vels_v_out(1), vels_v_out(2), & +! ! vels_v_out(3), vels_v_out(4) +! !close(icbID) +! end if !output end subroutine iceberg_acceleration @@ -617,8 +581,9 @@ subroutine compute_areas(Ao, Aa, Ai, Ad, depth_ib, & end subroutine compute_areas - !*************************************************************************************************************************** - !*************************************************************************************************************************** + +!*************************************************************************************************************************** +!*************************************************************************************************************************** subroutine iceberg_average_andkeel(mesh, partit, dynamics, uo_dz,vo_dz, uo_keel,vo_keel, T_dz,S_dz, T_keel,S_keel, depth_ib,iceberg_elem, ib) @@ -626,6 +591,7 @@ subroutine iceberg_average_andkeel(mesh, partit, dynamics, uo_dz,vo_dz, uo_keel, use o_param use MOD_PARTIT use MOD_DYN + use o_arrays, only: Tclim_ib, Sclim_ib !, UV_ib, Z_3d_n_ib use g_clock @@ -678,19 +644,21 @@ subroutine iceberg_average_andkeel(mesh, partit, dynamics, uo_dz,vo_dz, uo_keel, ! LOOP: consider all neighboring pairs (n_up,n_low) of 3D nodes ! below n2.. - innerloop: do k=1, nl !+1 - - - !################################################## - ! *** LA changed to zbar_3d_n *** + !innerloop: do k=1, nl+1 + innerloop: do k=1, nlevels_nod2D(n2) -! kh 18.03.21 use zbar_3d_n_ib buffered values here if( k==1 ) then lev_up = 0.0 else lev_up = mesh%Z_3d_n_ib(k-1, n2) + !lev_up = mesh%Z_3d_n_ib(k-1, n2) + end if + + if( k==nlevels_nod2D(n2) ) then + lev_low = mesh%zbar_n_bot(n2) + else + lev_low = mesh%Z_3d_n_ib(k, n2) end if - lev_low = mesh%Z_3d_n_ib(k, n2) dz = abs( lev_low - lev_up ) !if( abs(lev_up)>=abs(depth_ib) ) then @@ -705,24 +673,12 @@ subroutine iceberg_average_andkeel(mesh, partit, dynamics, uo_dz,vo_dz, uo_keel, ! if cavity node .. if( cavity_flag_nod2d(elem2D_nodes(m,iceberg_elem))==1 .AND. abs(depth_ib)=0.0 for all icebergs - - !cavity_count=cavity_count + 1 - !if(cavity_count==3) then - ! write(*,*) '3 cavity nodes in the same element! Iceberg should not be here!' - !end if - -! kh 08.03.21 use UV_ib buffered values here + uo_dz(m)=UV_ib(1,k-1,n2)*abs(depth_ib) vo_dz(m)=UV_ib(2,k-1,n2)*abs(depth_ib) uo_keel(m)=UV_ib(1,k-1,n2) vo_keel(m)=UV_ib(2,k-1,n2) - ! *** LA changed to tr_arr(nl-1,node_size,num_tr) *** -! kh 15.03.21 use tr_arr_ib buffered values here - !T_dz(m)=tr_arr_ib(k-1,n2,1)*abs(depth_ib) - !S_dz(m)=tr_arr_ib(k-1,n2,2)*abs(depth_ib) - !T_keel(m)=tr_arr_ib(k-1,n2,1) - !S_keel(m)=tr_arr_ib(k-1,n2,2) ! check those choices with RT: OK T_dz(m)=Tclim_ib(k-1,n2)*abs(depth_ib) S_dz(m)=Sclim_ib(k-1,n2)*abs(depth_ib) T_keel(m)=Tclim_ib(k-1,n2) @@ -737,7 +693,6 @@ subroutine iceberg_average_andkeel(mesh, partit, dynamics, uo_dz,vo_dz, uo_keel, ! LA 23.11.21 case if depth_ib=abs(depth_ib) ) then !.AND. (abs(lev_up)<=abs(depth_ib)) ) then #else - !if( abs(coord_nod3D(3, n_low))>=abs(depth_ib) .AND. abs(coord_nod3D(3, n_up))<=abs(depth_ib) ) then if( abs(lev_low)>=abs(depth_ib) ) then !.AND. (abs(lev_up)<=abs(depth_ib)) ) then #endif if( abs(lev_up)70.) then - !write(*,*) 'innerloop, dz:',dz,', depth:',depth_ib,',S_dz(m):',S_dz(m),"m:",m,", k:",k,", tr_arr_ib(k-1,n2,1):",tr_arr_ib(k-1,n2,1),", tr_arr_ib(k,n2,1):", tr_arr_ib(k,n2,1),", Salkeel:",Salkeel,", lev_low:",lev_low,", lev_up:",lev_up write(*,*) 'innerloop, dz:',dz,', depth:',depth_ib,',S_dz(m):',S_dz(m),"m:",m,", k:",k,", Tclim_ib(k-1,n2):",Tclim_ib(k-1,n2),", Tclim_ib(k,n2):", Tclim_ib(k,n2),", Salkeel:",Salkeel,", lev_low:",lev_low,", lev_up:",lev_up end if if(T_dz(m)/abs(depth_ib)>70.) then - !write(*,*) 'innerloop, dz:',dz,', depth:',depth_ib,',T_dz(m):',T_dz(m),"m:",m,", k:",k,", tr_arr_ib(k-1,n2,2):",tr_arr_ib(k-1,n2,2),", tr_arr_ib(k,n2,2):", tr_arr_ib(k,n2,2),",Temkeel:",Temkeel,", lev_low:",lev_low,", lev_up:",lev_up write(*,*) 'innerloop, dz:',dz,', depth:',depth_ib,',T_dz(m):',T_dz(m),"m:",m,", k:",k,", Sclim_ib(k-1,n2):",Sclim_ib(k-1,n2),", Sclim_ib(k,n2):", Sclim_ib(k,n2),",Temkeel:",Temkeel,", lev_low:",lev_low,", lev_up:",lev_up end if @@ -808,41 +760,42 @@ subroutine iceberg_average_andkeel(mesh, partit, dynamics, uo_dz,vo_dz, uo_keel, end if - ! .. and sum up the layer-integrated velocities .. -! kh 08.03.21 use UV_ib buffered values here - uo_dz(m)=uo_dz(m)+ 0.5*(UV_ib(1,k-1,n2)+UV_ib(1,k,n2))*dz - vo_dz(m)=vo_dz(m)+ 0.5*(UV_ib(2,k-1,n2)+UV_ib(2,k,n2))*dz - ! .. and T & S: - - -! kh 15.03.21 use tr_arr_ib buffered values here - !T_dz(m)=T_dz(m)+ 0.5*(tr_arr_ib(k-1,n2,1)+ tr_arr_ib(k,n2,1))*dz - !S_dz(m)=S_dz(m)+ 0.5*(tr_arr_ib(k-1,n2,2)+ tr_arr_ib(k,n2,2))*dz - T_dz(m)=T_dz(m)+ 0.5*(Tclim_ib(k-1,n2)+ Tclim_ib(k,n2))*dz - S_dz(m)=S_dz(m)+ 0.5*(Sclim_ib(k-1,n2)+ Sclim_ib(k,n2))*dz - + if (k.eq.nlevels_nod2D(n2)) then ! LA 2023-08-31 + ! .. and sum up the layer-integrated velocities .. + ! kh 08.03.21 use UV_ib buffered values here + uo_dz(m)=uo_dz(m)+ UV_ib(1,k-1,n2)*dz + vo_dz(m)=vo_dz(m)+ UV_ib(2,k-1,n2)*dz + T_dz(m)=T_dz(m)+ Tclim_ib(k-1,n2)*dz + S_dz(m)=S_dz(m)+ Sclim_ib(k-1,n2)*dz + else + uo_dz(m)=uo_dz(m)+ 0.5*(UV_ib(1,k-1,n2)+UV_ib(1,k,n2))*dz + vo_dz(m)=vo_dz(m)+ 0.5*(UV_ib(2,k-1,n2)+UV_ib(2,k,n2))*dz + T_dz(m)=T_dz(m)+ 0.5*(Tclim_ib(k-1,n2)+ Tclim_ib(k,n2))*dz + S_dz(m)=S_dz(m)+ 0.5*(Sclim_ib(k-1,n2)+ Sclim_ib(k,n2))*dz + end if if(S_dz(m)/abs(depth_ib)>70.) then - !write(*,*) 'innerloop, dz:',dz,', depth:',depth_ib,',S_dz(m):',S_dz(m),"m:",m,", k:",k,", tr_arr_ib(k-1,n2,1):",tr_arr_ib(k-1,n2,1),", tr_arr_ib(k,n2,1):", tr_arr_ib(k,n2,1),", lev_low:",lev_low,", lev_up:",lev_up write(*,*) 'innerloop, dz:',dz,', depth:',depth_ib,',S_dz(m):',S_dz(m),"m:",m,", k:",k,", Tclim_ib(k-1,n2):",Tclim_ib(k-1,n2),", Tclim_ib(k,n2):", Tclim_ib(k,n2),", lev_low:",lev_low,", lev_up:",lev_up end if if(T_dz(m)/abs(depth_ib)>70.) then - !write(*,*) 'innerloop, dz:',dz,', depth:',depth_ib,',T_dz(m):',T_dz(m),"m:",m,", k:",k,", tr_arr_ib(k-1,n2,2):",tr_arr_ib(k-1,n2,2),", tr_arr_ib(k,n2,2):", tr_arr_ib(k,n2,2),", lev_low:",lev_low,", lev_up:",lev_up write(*,*) 'innerloop, dz:',dz,', depth:',depth_ib,',T_dz(m):',T_dz(m),"m:",m,", k:",k,", Sclim_ib(k-1,n2):",Sclim_ib(k-1,n2),", Sclim_ib(k,n2):", Sclim_ib(k,n2),", lev_low:",lev_low,", lev_up:",lev_up end if -! save the current deepest values; will be overwritten most of the time in lines 707 to 713. -! kh 08.03.21 use UV_ib buffered values here - uo_keel(m)=UV_ib(1,k,n2) - vo_keel(m)=UV_ib(2,k,n2) - -! kh 15.03.21 use tr_arr_ib buffered values here - !T_keel(m)=tr_arr_ib(k,n2,1) - !S_keel(m)=tr_arr_ib(k,n2,2) - T_keel(m)=Tclim_ib(k,n2) - S_keel(m)=Sclim_ib(k,n2) + if (k.eq.nlevels_nod2D(n2)) then ! LA 2023-08-31 + uo_keel(m)=UV_ib(1,k-1,n2) + vo_keel(m)=UV_ib(2,k-1,n2) + + T_keel(m)=Tclim_ib(k-1,n2) + S_keel(m)=Sclim_ib(k-1,n2) + else + uo_keel(m)=UV_ib(1,k,n2) + vo_keel(m)=UV_ib(2,k,n2) + + T_keel(m)=Tclim_ib(k,n2) + S_keel(m)=Sclim_ib(k,n2) + end if end if end do innerloop @@ -852,10 +805,6 @@ subroutine iceberg_average_andkeel(mesh, partit, dynamics, uo_dz,vo_dz, uo_keel, vo_dz(m)=vo_dz(m)/abs(depth_ib) T_dz(m)=T_dz(m)/abs(depth_ib) S_dz(m)=S_dz(m)/abs(depth_ib) - - !if(T_dz(m)>70.) then - ! write(*,*) 'nodeloop, dz:',dz,'z_up:',coord_nod3D(3, n_up),'z_lo:',coord_nod3D(3, n_low),'depth:',depth_ib,'T_up:',tracer(n_up,2),'T_lo:',tracer(n_low,2) - !end if end do nodeloop !loop over all nodes of iceberg element @@ -870,124 +819,18 @@ real function interpol1D(x0,f0,x1,f1,x) interpol1D = f0 + frac * (x - x0) end function interpol1D - end subroutine iceberg_average_andkeel - !*************************************************************************************************************************** - !*************************************************************************************************************************** - - -!subroutine iceberg_avvelo_layer3(uo_dz,vo_dz,depth_ib,iceberg_elem) -! use MOD_PARTIT !for myDim_nod3D, eDim_nod3D -! !use o_mesh !for coord_nod3D -! use o_arrays !for uf -! implicit none -! -! !inout -! real, dimension(3),intent(out):: uo_dz -! real, dimension(3),intent(out):: vo_dz -! real, intent(in) :: depth_ib -! integer, intent(in) :: iceberg_elem -! !local -! real :: displ3, dz, depth, ufkeel1, ufkeel2 -! integer :: m, k, n2, n_up, n_low, l3_node -! -! displ3=myDim_nod3d+eDim_nod3D -! uo_dz=0. -! vo_dz=0. -! -! do m=1, 3 -! n2=elem2D_nodes(m,iceberg_elem) -! depth=0.0 -! -! if(num_layers_below_nod2d(n2)+1 <= 3) then -! !the following do loop will not start then -! write(*,*) 'no ocean velocity computed' -! call par_ex -! stop 'NO OCEAN VELOCITY COMPUTED' -! end if -! -! !start with second node below n2; neglect upper layers -! do k=4, num_layers_below_nod2d(n2)+1 -! ! ..consider all neighboring pairs (n_up,n_low) of 3D nodes -! ! below n2.. -! n_up = nod3d_below_nod2d(k-1, n2) ! for k=4 we have second node below n2 -! n_low= nod3d_below_nod2d(k, n2) -! dz = abs( coord_nod3D(3, n_up)-coord_nod3D(3, n_low) ) -! -! if(k .EQ. 4) then -! l3_node = n_up -! !WHAT IF ICEBERG IS SO SMALL THAT THE DRAFT IS -! !ABOVE THE THIRD LAYER? -! if(abs(coord_nod3D(3, l3_node))>= abs(depth_ib)) then -! !just take layer 3 value -! write(*,*) 'took layer 3 value' -! uo_dz(m)= uf(l3_node) -! vo_dz(m)= uf(l3_node+displ3) -! depth=1. -! exit -! end if -! end if -! -! ! if the lowest z coord is below the iceberg draft, exit -! if ( abs(coord_nod3D(3, n_low))>= abs(depth_ib)) then -! dz = abs( coord_nod3D(3, n_up)- depth_ib ) -! ufkeel1 = interpol1D( abs(coord_nod3D(3, n_up)),UV(1,k-1,n2), & -! abs(coord_nod3D(3, n_low)),UV(1,k,n2), & -! abs(depth_ib) ) -! ufkeel2 = interpol1D( abs(coord_nod3D(3, n_up)),UV(2,k-1,n2), & -! abs(coord_nod3D(3, n_low)),UV(2,k,n2), & -! abs(depth_ib) ) -! uo_dz(m)=uo_dz(m)+0.5*(UV(1,k-1,n2)+ ufkeel1)*dz -! vo_dz(m)=vo_dz(m)+0.5*(UV(2,k-1,n2)+ ufkeel2)*dz -! depth=depth+dz -! exit -! -! else -! ! .. and sum up the layer-integrated velocities: -! uo_dz(m)=uo_dz(m)+0.5*(UV(1,k-1,n2)+UV(1,k,n2))*dz -! vo_dz(m)=vo_dz(m)+0.5*(UV(2,k-1,n2)+UV(2,k,n2))*dz -! depth=depth+dz -! -! end if -! end do -! -! ! divide by depth over which was integrated -! uo_dz(m)=uo_dz(m)/abs(depth) -! vo_dz(m)=vo_dz(m)/abs(depth) -! -! end do !loop over all nodes of iceberg element -! -! contains -! -! real function interpol1D(x0,f0,x1,f1,x) -! implicit none -! real, intent(IN) :: x0,f0,x1,f1,x -! real :: frac -! -! frac = (f1 - f0)/(x1 - x0) -! interpol1D = f0 + frac * (x - x0) -! -! end function interpol1D -!end subroutine iceberg_avvelo_layer3 - - !*************************************************************************************************************************** - !*************************************************************************************************************************** - +!*************************************************************************************************************************** +!*************************************************************************************************************************** subroutine iceberg_avvelo(mesh, partit, dynamics, uo_dz,vo_dz,depth_ib,iceberg_elem) - !use o_mesh USE MOD_MESH use o_param - !use i_therm_param - !use i_param - !use i_arrays use MOD_PARTIT use MOD_DYN -! kh 17.03.21 specification of structures used - !use o_arrays, only: UV_ib, tr_arr_ib, Z_3d_n_ib use o_arrays, only: Tclim_ib, Sclim_ib !, UV_ib, Z_3d_n_ib use g_clock @@ -1059,10 +902,8 @@ subroutine iceberg_avvelo(mesh, partit, dynamics, uo_dz,vo_dz,depth_ib,iceberg_e uo_dz(m)= ufkeel1*dz vo_dz(m)= ufkeel2*dz else -! kh 08.03.21 use UV_ib buffered values here ufkeel1 = interpol1D(abs(lev_up),UV_ib(1,k-1,n2),abs(lev_low),UV_ib(1,k,n2),abs(depth_ib)) ufkeel2 = interpol1D(abs(lev_up),UV_ib(2,k-1,n2),abs(lev_low),UV_ib(2,k,n2),abs(depth_ib)) -! kh 08.03.21 use UV_ib buffered values here uo_dz(m)=uo_dz(m)+0.5*(UV_ib(1,k-1,n2)+ ufkeel1)*dz vo_dz(m)=vo_dz(m)+0.5*(UV_ib(2,k-1,n2)+ ufkeel2)*dz end if @@ -1100,421 +941,4 @@ real function interpol1D(x0,f0,x1,f1,x) end function interpol1D end subroutine iceberg_avvelo - - !*************************************************************************************************************************** - !*************************************************************************************************************************** - - -!subroutine iceberg_avvelo_ufkeel(uo_dz,vo_dz, uo_keel,vo_keel, depth_ib,iceberg_elem) -! !use o_mesh -! use o_param -! use i_therm_param -! use i_param -! use i_arrays -! use MOD_PARTIT -! -! use o_arrays -! use g_clock -! use g_forcing_index -! use g_forcing_arrays -! use g_rotate_grid -! -! implicit none -! -! REAL, DIMENSION(3), INTENT(OUT) :: uo_dz -! REAL, DIMENSION(3), INTENT(OUT) :: vo_dz -! REAL, DIMENSION(3), INTENT(OUT) :: uo_keel -! REAL, DIMENSION(3), INTENT(OUT) :: vo_keel -! REAl, INTENT(IN) :: depth_ib -! INTEGER, INTENT(IN) :: iceberg_elem -! -! integer :: m, k, n2, n_up, n_low, displ3 -! ! depth over which is integrated (layer and sum) -! real :: dz, depth, ufkeel1, ufkeel2 -! ! variables for velocity correction -! real :: delta_depth, u_bottom_x, u_bottom_y -! -! displ3=myDim_nod3d+eDim_nod3D -! -! ! loop over all nodes of the iceberg element -! do m=1, 3 -! !for each 2D node of the iceberg element.. -! n2=elem2D_nodes(m,iceberg_elem) -! depth=0.0 -! uo_dz(m)=0.0 -! vo_dz(m)=0.0 -! uo_keel(m)=0.0 -! vo_keel(m)=0.0 -! -! ! ..consider all neighboring pairs (n_up,n_low) of 3D nodes -! ! below n2.. -! do k=2, num_layers_below_nod2d(n2)+1 -! n_up = nod3d_below_nod2d(k-1, n2) ! for k=2 we have n2 -! n_low= nod3d_below_nod2d(k, n2) -! -! ! ..compute their distance dz .. -! dz = abs( coord_nod3D(3, n_up)-coord_nod3D(3, n_low) ) -! -! if(dz < 1) then -! write(*,*) 'dz 0!', dz -! write(*,*) 'z coord of up node', n_up, ':', coord_nod3D(3, n_up), 'z coord of low node', n_low, ':', coord_nod3D(3, n_low) -! call par_ex -! stop -! end if -! -! ! if the lowest z coord is below the iceberg draft, exit -! if ( abs(coord_nod3D(3, n_low))>= abs(depth_ib)) then -! -! dz = abs( coord_nod3D(3, n_up)- depth_ib ) -! -! ufkeel1 = interpol1D(abs(coord_nod3D(3, n_up)),UV(1,k-1,n2),abs(coord_nod3D(3, n_low)),UV(1,k,n2),abs(depth_ib)) -! ufkeel2 = interpol1D(abs(coord_nod3D(3, n_up)),UV(2,k-1,n2),abs(coord_nod3D(3, n_low)),UV(2,k,n2),abs(depth_ib)) -! -! uo_dz(m)=uo_dz(m)+0.5*(UV(1,k-1,n2)+ ufkeel1)*dz -! vo_dz(m)=vo_dz(m)+0.5*(UV(2,k-1,n2)+ ufkeel2)*dz -! uo_keel(m)=ufkeel1 -! vo_keel(m)=ufkeel2 -! exit -! -! else -! ! .. and sum up the layer-integrated velocities: -! uo_dz(m)=uo_dz(m)+0.5*(UV(1,k-1,n2)+UV(1,k,n2))*dz -! vo_dz(m)=vo_dz(m)+0.5*(UV(2,k-1,n2)+UV(2,k,n2))*dz -! -! end if -! end do -! -! ! divide by depth over which was integrated -! uo_dz(m)=uo_dz(m)/abs(depth_ib) -! vo_dz(m)=vo_dz(m)/abs(depth_ib) -! -! end do !loop over all nodes of iceberg element -! -! contains -! -! real function interpol1D(x0,f0,x1,f1,x) -! implicit none -! real, intent(IN) :: x0,f0,x1,f1,x -! real :: frac -! -! frac = (f1 - f0)/(x1 - x0) -! interpol1D = f0 + frac * (x - x0) -! -! end function interpol1D -! -!end subroutine iceberg_avvelo_ufkeel - - - !*************************************************************************************************************************** - !*************************************************************************************************************************** - - -!subroutine init_global_tides -! ! initialize tides: read constituents (amplitude and phase) -! ! The global tidal data should be on a grid with longitude range 0-360 degree. -! ! Assumption: the number of columes/rows of the grids for global tidal data -! ! are the same for all constituents and types (U,V, z), though -! ! the exact lon/lat values can be (are) different for different -! ! types. -! ! -! ! This is an adapted version of the subroutine init_tidal_opbnd for use of -! ! global tides in iceberg case; external model data is interpolated on the -! ! grid and can be added to the surface slope ssh computed by FESOM for process studies. -! ! -! ! Thomas Rackow, 17.12.2010, some cleaning up still to be done -! ! -! use o_param -! use o_arrays -! !use o_mesh -! use g_rotate_grid -! use MOD_PARTIT -! implicit none -! ! -! integer :: i, j, n, num, fid, nodmin,m(1) -! integer :: num_lon_reg, num_lat_reg -! integer :: p_flag -! character(2) :: cons_name -! real(kind=8) :: lon, lat, dep -! real(kind=8) :: x, y, x2, y2, d, dmin -! real(kind=8), allocatable, dimension(:) :: lon_reg_4u, lat_reg_4u -! real(kind=8), allocatable, dimension(:) :: lon_reg_4v, lat_reg_4v -! real(kind=8), allocatable, dimension(:) :: lon_reg_4z, lat_reg_4z -! real(kind=8), allocatable, dimension(:,:) :: amp_reg, pha_reg -! real(kind=8), allocatable, dimension(:) :: lon_opbnd_n2d, lat_opbnd_n2d -! integer :: mySize2D -! -! mySize2D=myDim_nod2D+eDim_nod2D -! -! ! check -! num=len(trim(tidal_constituent)) -! if(mod(num,2) /= 0 .or. num/2 /= nmbr_tidal_cons) then -! write(*,*) 'wrong specification of tidal constituents in O_module' -! call par_ex -! stop -! end if -! -! ! allocate arrays -! if(trim(tide_opbnd_type)=='Flather') then -! allocate(opbnd_u_tide(nmbr_opbnd_t2D)) -! allocate(opbnd_v_tide(nmbr_opbnd_t2D)) -! allocate(opbnd_z_tide(nmbr_opbnd_t2D)) -! opbnd_u_tide=0. -! opbnd_v_tide=0. -! opbnd_z_tide=0. -! elseif(trim(tide_opbnd_type)=='ssh') then -! allocate(opbnd_z_tide(mySize2D)) !CHANGED: opbnd_z_tide(nmbr_opbnd_t2D) -! allocate(opbnd_z0_tide(mySize2D)) !CHANGED: opbnd_z0_tide(nmbr_opbnd_t2D) -! opbnd_z_tide=0. -! opbnd_z0_tide=0. -! else !'vel' -! allocate(opbnd_u_tide(nmbr_opbnd_t2D)) -! allocate(opbnd_v_tide(nmbr_opbnd_t2D)) -! opbnd_u_tide=0. -! opbnd_v_tide=0. -! end if -! -! ! allocate tidal amp and pha arrays -! allocate(tide_period_coeff(nmbr_tidal_cons)) -! tide_period_coeff=0. -! if(trim(tide_opbnd_type)/='ssh') then -! allocate(tide_u_amp(nmbr_opbnd_t2d, nmbr_tidal_cons)) -! allocate(tide_v_amp(nmbr_opbnd_t2d, nmbr_tidal_cons)) -! allocate(tide_u_pha(nmbr_opbnd_t2d, nmbr_tidal_cons)) -! allocate(tide_v_pha(nmbr_opbnd_t2d, nmbr_tidal_cons)) -! tide_u_amp=0. -! tide_v_amp=0. -! tide_u_pha=0. -! tide_v_pha=0. -! end if -! if(trim(tide_opbnd_type)/='vel') then !'ssh' enters here -! allocate(tide_z_amp(mySize2D, nmbr_tidal_cons)) !tide_z_amp(nmbr_opbnd_t2d, nmbr_tidal_cons) -! allocate(tide_z_pha(mySize2D, nmbr_tidal_cons)) !tide_z_pha(nmbr_opbnd_t2d, nmbr_tidal_cons) -! tide_z_amp=0. -! tide_z_pha=0. -! end if -! -! ! read the regular grid (for velocity) -! if(trim(tide_opbnd_type)/='ssh') then -! open(101,file=trim(TideForcingPath)//'lonlat_4U_'//trim(tidemodelname)//'.dat', status='old') -! read(101,*) num_lon_reg, num_lat_reg -! allocate(lon_reg_4u(num_lon_reg), lat_reg_4u(num_lat_reg)) -! do i=1,num_lon_reg -! read(101,*) lon_reg_4u(i) -! end do -! do i=1,num_lat_reg -! read(101,*) lat_reg_4u(i) -! end do -! close(101) -! open(102,file=trim(TideForcingPath)//'lonlat_4V_'//trim(tidemodelname)//'.dat', status='old') -! read(102,*) num_lon_reg, num_lat_reg -! allocate(lon_reg_4v(num_lon_reg), lat_reg_4v(num_lat_reg)) -! do i=1,num_lon_reg -! read(102,*) lon_reg_4v(i) -! end do -! do i=1,num_lat_reg -! read(102,*) lat_reg_4v(i) -! end do -! close(102) -! end if -! -! ! read the regular grid (for ssh) -! if(trim(tide_opbnd_type)/='vel') then !'ssh' enters here -! open(103,file=trim(TideForcingPath)//'lonlat_4z_'//trim(tidemodelname)//'.dat', status='old') -! read(103,*) num_lon_reg, num_lat_reg -! allocate(lon_reg_4z(num_lon_reg), lat_reg_4z(num_lat_reg)) -! do i=1,num_lon_reg -! read(103,*) lon_reg_4z(i) -! end do -! do i=1,num_lat_reg -! read(103,*) lat_reg_4z(i) -! end do -! close(103) -! end if -! -! ! allocate arrays for global data on regular grids -! allocate(amp_reg(num_lon_reg, num_lat_reg), pha_reg(num_lon_reg, num_lat_reg)) -! -! ! open-boundary nodes coordinates -! !allocate(lon_opbnd_n2d(nmbr_opbnd_n2d), lat_opbnd_n2d(nmbr_opbnd_n2d)) -! !do i=1, nmbr_opbnd_n2d -! ! n=opbnd_n2d(i) -! ! if(rotated_grid) then -! ! call r2g(lon, lat, coord_nod2d(1,n), coord_nod2d(2,n)) -! ! lon_opbnd_n2d(i)=lon/rad ! change unit to degree -! ! lat_opbnd_n2d(i)=lat/rad -! ! else -! ! lon_opbnd_n2d(i)=coord_nod2d(1,n)/rad -! ! lat_opbnd_n2d(i)=coord_nod2d(2,n)/rad -! ! end if -! ! ! change lon range to [0 360] -! ! if(lon_opbnd_n2d(i)<0.) lon_opbnd_n2d(i)=lon_opbnd_n2d(i) + 360.0 -! !end do -! allocate(lon_opbnd_n2d(mySize2D), lat_opbnd_n2d(mySize2D)) -! do i=1, mySize2D -! ! n=opbnd_n2d(i) -! if(rotated_grid) then -! call r2g(lon, lat, coord_nod2d(1,i), coord_nod2d(2,i)) -! lon_opbnd_n2d(i)=lon/rad ! change unit to degree -! lat_opbnd_n2d(i)=lat/rad -! else -! lon_opbnd_n2d(i)=coord_nod2d(1,i)/rad -! lat_opbnd_n2d(i)=coord_nod2d(2,i)/rad -! end if -! ! change lon range to [0 360] -! if(lon_opbnd_n2d(i)<0.) lon_opbnd_n2d(i)=lon_opbnd_n2d(i) + 360.0 -! end do -! -! -! ! read and interpolate each constituent (for U,V,z and their phase) -! do n=1,nmbr_tidal_cons -! cons_name=tidal_constituent(2*n-1:2*n) -! call tide_period(cons_name, tide_period_coeff(n)) -! -! if(trim(tide_opbnd_type)/='ssh') then -! fid=103+n -! open(fid,file=trim(TideForcingPath)//'U_'//cons_name//'_'//trim(tidemodelname)//'.dat', status='old') -! do i=1, num_lon_reg -! do j=1, num_lat_reg -! read(fid, *) amp_reg(i,j) -! end do -! end do -! do i=1, num_lon_reg -! do j=1, num_lat_reg -! read(fid, *) pha_reg(i,j) -! end do -! end do -! close(fid) -! -! p_flag=0 -! call interp_2d_field(num_lon_reg, num_lat_reg, lon_reg_4u, lat_reg_4u, amp_reg, & -! nmbr_opbnd_n2D, lon_opbnd_n2d, lat_opbnd_n2d, tide_u_amp(1:nmbr_opbnd_n2d,n),p_flag) -! tide_u_amp(:,n)=tide_u_amp(:,n)/opbnd_dep ! change transport (m^2/s) to depth mean velocity (m/s) -! -! p_flag=1 -! call interp_2d_field(num_lon_reg, num_lat_reg, lon_reg_4u, lat_reg_4u, pha_reg, & -! nmbr_opbnd_n2D, lon_opbnd_n2d, lat_opbnd_n2d, tide_u_pha(1:nmbr_opbnd_n2d,n),p_flag) -! tide_u_pha(:,n)=tide_u_pha(:,n)*rad ! change units of phase from degree to radian -! -! -! open(fid,file=trim(TideForcingPath)//'V_'//cons_name//'_'//trim(tidemodelname)//'.dat', status='old') -! do i=1, num_lon_reg -! do j=1, num_lat_reg -! read(fid, *) amp_reg(i,j) -! end do -! end do -! do i=1, num_lon_reg -! do j=1, num_lat_reg -! read(fid, *) pha_reg(i,j) -! end do -! end do -! close(fid) -! -! p_flag=0 -! call interp_2d_field(num_lon_reg, num_lat_reg, lon_reg_4v, lat_reg_4v, amp_reg, & -! nmbr_opbnd_n2D, lon_opbnd_n2d, lat_opbnd_n2d, tide_v_amp(1:nmbr_opbnd_n2d,n),p_flag) -! tide_v_amp(:,n)=tide_v_amp(:,n)/opbnd_dep ! change transport (m^2/s) to depth mean velocity (m/s) -! -! p_flag=1 -! call interp_2d_field(num_lon_reg, num_lat_reg, lon_reg_4v, lat_reg_4v, pha_reg, & -! nmbr_opbnd_n2D, lon_opbnd_n2d, lat_opbnd_n2d, tide_v_pha(1:nmbr_opbnd_n2d,n),p_flag) -! tide_v_pha(:,n)=tide_v_pha(:,n)*rad ! change units of phase from degree to radian -! -! end if -! -! -! if(trim(tide_opbnd_type)/='vel') then !'ssh' enters here -! fid=103+n -! open(fid,file=trim(TideForcingPath)//'z_'//cons_name//'_'//trim(tidemodelname)//'.dat', status='old') -! do i=1, num_lon_reg -! do j=1, num_lat_reg -! read(fid, *) amp_reg(i,j) -! end do -! end do -! do i=1, num_lon_reg -! do j=1, num_lat_reg -! read(fid, *) pha_reg(i,j) -! end do -! end do -! close(fid) -! -! p_flag=0 -! !CHANGED: -! !call interp_2d_field(num_lon_reg, num_lat_reg, lon_reg_4z, lat_reg_4z, amp_reg, & -! ! nmbr_opbnd_n2D, lon_opbnd_n2d, lat_opbnd_n2d, tide_z_amp(1:nmbr_opbnd_n2d,n),p_flag) -! call interp_2d_field(num_lon_reg, num_lat_reg, lon_reg_4z, lat_reg_4z, amp_reg, & -! mySize2D, lon_opbnd_n2d, lat_opbnd_n2d, tide_z_amp(1:mySize2D,n),p_flag) -! -! p_flag=1 -! !CHANGED: -! !call interp_2d_field(num_lon_reg, num_lat_reg, lon_reg_4z, lat_reg_4z, pha_reg, & -! ! nmbr_opbnd_n2D, lon_opbnd_n2d, lat_opbnd_n2d, tide_z_pha(1:nmbr_opbnd_n2d,n),p_flag) -! call interp_2d_field(num_lon_reg, num_lat_reg, lon_reg_4z, lat_reg_4z, pha_reg, & -! mySize2D, lon_opbnd_n2d, lat_opbnd_n2d, tide_z_pha(1:mySize2D,n),p_flag) -! tide_z_pha(:,n)=tide_z_pha(:,n)*rad ! change units of phase from degree to radian -! end if -! end do -! -! ! amplifying the magnitude for process studies -! if(trim(tide_opbnd_type)/='ssh') then -! tide_u_amp=tide_u_amp*tide_amplify_coeff -! tide_v_amp=tide_v_amp*tide_amplify_coeff -! end if -! if(trim(tide_opbnd_type)/='vel') then !'ssh' enters here -! tide_z_amp=tide_z_amp*tide_amplify_coeff -! end if -! -! -! ! deallocate temporary arrays -! deallocate(lat_opbnd_n2d, lon_opbnd_n2d) -! deallocate(pha_reg, amp_reg) -! if(trim(tide_opbnd_type)/='ssh') deallocate(lat_reg_4v,lon_reg_4v,lat_reg_4u,lon_reg_4u) -! if(trim(tide_opbnd_type)/='vel') deallocate(lat_reg_4z,lon_reg_4z) !for 'ssh' -! -! if(mype==0) then -! write(*,*) 'Global Tidal Constituents ', trim(tidal_constituent), ' have been loaded for Iceberg Case' -! write(*,*) '*************************************************************' -! end if -!end subroutine init_global_tides - - !*************************************************************************************************************************** - !*************************************************************************************************************************** - -!subroutine update_global_tides -! ! -! ! This is an adapted version of the subroutine update_tidal_opbnd; -! ! Thomas Rackow, 17.12.2010, some clean up still to be done -! ! -! use o_param -! use o_arrays -! use g_config !for istep -! !use o_mesh -! implicit none -! integer :: n -! real(kind=8) :: aux -! ! -! aux=2.0*pi*istep*dt -! if(trim(tide_opbnd_type)=='Flather') then -! opbnd_u_tide=0. -! opbnd_v_tide=0. -! opbnd_z_tide=0. -! do n=1, nmbr_tidal_cons -! opbnd_u_tide=opbnd_u_tide + tide_u_amp(:,n)*cos(aux/tide_period_coeff(n)-tide_u_pha(:,n)) -! opbnd_v_tide=opbnd_v_tide + tide_v_amp(:,n)*cos(aux/tide_period_coeff(n)-tide_v_pha(:,n)) -! opbnd_z_tide=opbnd_z_tide + tide_z_amp(:,n)*cos(aux/tide_period_coeff(n)-tide_z_pha(:,n)) -! end do -! elseif(trim(tide_opbnd_type)=='ssh') then -! opbnd_z0_tide=opbnd_z_tide -! opbnd_z_tide=0. -! do n=1, nmbr_tidal_cons -! opbnd_z_tide=opbnd_z_tide + tide_z_amp(:,n)*cos(aux/tide_period_coeff(n)-tide_z_pha(:,n)) -! end do -! else -! opbnd_u_tide=0. -! opbnd_v_tide=0. -! do n=1, nmbr_tidal_cons -! opbnd_u_tide=opbnd_u_tide + tide_u_amp(:,n)*cos(aux/tide_period_coeff(n)-tide_u_pha(:,n)) -! opbnd_v_tide=opbnd_v_tide + tide_v_amp(:,n)*cos(aux/tide_period_coeff(n)-tide_v_pha(:,n)) -! end do -! end if -! ! -!end subroutine update_global_tides +end module iceberg_dynamics diff --git a/src/icb_elem.F90 b/src/icb_elem.F90 index 8e744aa61..c989f24d3 100644 --- a/src/icb_elem.F90 +++ b/src/icb_elem.F90 @@ -1,12 +1,26 @@ -subroutine mean_gradient(mesh, partit, dynamics, elem, lon_rad, lat_rad, nablaeta) - !!use o_mesh +module iceberg_element use MOD_PARTIT USE MOD_MESH USE MOD_DYN - ! kh 18.03.21 specification of structure used -! use o_arrays, only: eta_n_ib - + use iceberg_params +! use iceberg_dynamics +! use iceberg_step + implicit none + + public :: mean_gradient + public :: nodal_average + public :: FEM_eval + public :: FEM_3eval + public :: iceberg_elem4all + public :: find_new_iceberg_elem + public :: global2local + public :: com_integer + public :: matrix_inverse_2x2 + + contains + +subroutine mean_gradient(mesh, partit, dynamics, elem, lon_rad, lat_rad, nablaeta) integer, intent(IN) :: elem real, intent(IN) :: lon_rad, lat_rad @@ -59,12 +73,9 @@ end subroutine mean_gradient !*************************************************************************************************************************** subroutine nodal_average(mesh, partit, dynamics, local_idx, gradientx, gradienty, notmynode) - !use o_mesh use MOD_PARTIT USE MOD_MESH USE MOD_DYN -! kh 18.03.21 specification of structure used -! use o_arrays, only: eta_n_ib implicit none @@ -137,7 +148,6 @@ end subroutine nodal_average subroutine FEM_eval(mesh, partit, u_at_ib,v_at_ib,lon,lat,field_u,field_v,elem) use MOD_PARTIT !for myDim_nod2D, eDim_nod2D use o_param !for rad - !use o_mesh USE MOD_MESH implicit none @@ -198,18 +208,7 @@ end subroutine FEM_eval ! elem (the LOCAL element the iceberg lies in) !================================================================= subroutine FEM_eval_old(mesh, partit, u_at_ib,v_at_ib,lon,lat,field_u,field_v,elem) - !use o_mesh - USE MOD_MESH use o_param -! use i_therm_param -! use i_param -! use i_arrays - use MOD_PARTIT -! use MOD_ICE - -! kh 18.03.21 not really used here -! use o_arrays - use g_clock use g_forcing_arrays use g_rotate_grid @@ -325,9 +324,9 @@ end subroutine FEM_eval_old ! elem (the LOCAL element the iceberg lies in) !================================================================= subroutine FEM_3eval(mesh, partit, u_at_ib,v_at_ib,lon,lat,ocean_u,ocean_v,elem) - use MOD_MESH use MOD_PARTIT !for myDim_nod2D, eDim_nod2D use o_param !for rad + use MOD_MESH implicit none real, intent(in) :: lon, lat @@ -354,7 +353,7 @@ subroutine FEM_3eval(mesh, partit, u_at_ib,v_at_ib,lon,lat,ocean_u,ocean_v,elem) !values of the 3 local basisfunctions at the !position 'coords' coords_tmp = [lon_deg, lat_deg] - call locbafu_2D(mesh, partit, phi, elem, coords_tmp) + call locbafu_2D(mesh, partit, phi,elem, coords_tmp) u_at_ib = sum( ocean_u(:) * phi(:)) v_at_ib = sum( ocean_v(:) * phi(:)) @@ -371,142 +370,15 @@ subroutine FEM_3eval(mesh, partit, u_at_ib,v_at_ib,lon,lat,ocean_u,ocean_v,elem) !if (interp > maxval(values, 1)) interp=maxval(values, 1) end subroutine FEM_3eval - - !*************************************************************************************************************************** - !*************************************************************************************************************************** - -!================================================================= -! interpolates ocean velocity to ib's location (lon, lat) [radiant] -! OUT: u_at_ib, v_at_ib (u and v component at location of iceberg) -! IN : lon, lat (position of iceberg in radiant) -! ocean_u, ocean_v (3 nodal values for u and v component where -! ocean_u(m) is value of -! elem2D_nodes(m,iceberg_elem), m=1,2,3 ) -! elem (the LOCAL element the iceberg lies in) -!================================================================= -subroutine FEM_3eval_old(mesh, partit, u_at_ib,v_at_ib,lon,lat,ocean_u,ocean_v,elem) - !use o_mesh - USE MOD_MESH - use o_param -! use i_therm_param -! use i_param -! use i_arrays - use MOD_PARTIT - -! kh 18.03.21 not really used here -! use o_arrays - - use g_clock - use g_forcing_arrays - use g_rotate_grid - - !use iceberg module - !use iceberg_params - - implicit none - real, intent(in) :: lon, lat - real, dimension(3), intent(in) :: ocean_u - real, dimension(3), intent(in) :: ocean_v - integer :: elem - real, intent(out) :: u_at_ib - real, intent(out) :: v_at_ib - - real :: x, y, x1,x2,x3,y1,y2,y3 - real :: T1_u, T1_v, T2_u, T2_v, T3_u, T3_v - real, dimension(2,2) :: inv_matrix - real, dimension(2) :: alphabeta - real :: maxlon, minlon, maxlat, minlat - -type(t_mesh), intent(in) , target :: mesh -type(t_partit), intent(inout), target :: partit -#include "associate_part_def.h" -#include "associate_mesh_def.h" -#include "associate_part_ass.h" -#include "associate_mesh_ass.h" - - !location of iceberg - x = lon - y = lat - - - !coords of the 3 nodes - x1 = coord_nod2D(1,elem2D_nodes(1,elem)) - y1 = coord_nod2D(2,elem2D_nodes(1,elem)) - x2 = coord_nod2D(1,elem2D_nodes(2,elem)) - y2 = coord_nod2D(2,elem2D_nodes(2,elem)) - x3 = coord_nod2D(1,elem2D_nodes(3,elem)) - y3 = coord_nod2D(2,elem2D_nodes(3,elem)) - - - !check whether iceberg position is in the element - maxlon = maxval( (/ x1, x2, x3 /) ) - minlon = minval( (/ x1, x2, x3 /) ) - maxlat = maxval( (/ y1, y2, y3 /) ) - minlat = minval( (/ y1, y2, y3 /) ) - if( (x > maxlon) .OR. (x < minlon) ) then - write(*,*) 'FEM_eval error: iceberg lon ', x, ' outside element!' - write(*,*) 'maxlon:', maxlon, ' minlon:', minlon - call par_ex - stop - else if( (y > maxlat) .OR. (y < minlat)) then - write(*,*) 'FEM_eval error: iceberg lat', y, ' outside element!' - write(*,*) 'maxlat:', maxlat, ' minlat:', minlat - call par_ex - stop - else - !everything okay - end if - - - !distances wrt node 1 - x2 = x2 - x1 - y2 = y2 - y1 - x3 = x3 - x1 - y3 = y3 - y1 - x = x - x1 - y = y - y1 - - !nodal values Ti_u, Ti_v - T1_u = ocean_u(1) - T1_v = ocean_v(1) - T2_u = ocean_u(2) - T2_v = ocean_v(2) - T3_u = ocean_u(3) - T3_v = ocean_v(3) - - !differences wrt node 1 - T2_u = T2_u - T1_u - T2_v = T2_v - T1_v - T3_u = T3_u - T1_u - T3_v = T3_v - T1_v - - !determine alpha and beta for u velocity - inv_matrix(1,1) = y2 - inv_matrix(1,2) = -y3 - inv_matrix(2,1) = -x2 - inv_matrix(2,2) = x3 - inv_matrix = (1./(x3*y2 - x2*y3)) * inv_matrix - alphabeta = MATMUL(inv_matrix, (/ T3_u, T2_u /)) - - u_at_ib = T1_u + alphabeta(1)*x + alphabeta(2)*y - - !same for v velocity - alphabeta = MATMUL(inv_matrix, (/ T3_v, T2_v /)) - - v_at_ib = T1_v + alphabeta(1)*x + alphabeta(2)*y -end subroutine FEM_3eval_old - - !*************************************************************************************************************************** !*************************************************************************************************************************** subroutine iceberg_elem4all(mesh, partit, elem, lon_deg, lat_deg) - !use o_mesh !for index_nod2d, elem2D_nodes USE MOD_MESH use MOD_PARTIT !for myDim_nod2D, myList_elem2D -#ifdef use_cavity - use iceberg_params, only: reject_elem -#endif +!#ifdef use_cavity +! use iceberg_params, only: reject_elem +!#endif implicit none @@ -539,18 +411,6 @@ subroutine iceberg_elem4all(mesh, partit, elem, lon_deg, lat_deg) #endif end if call com_integer(partit, i_have_element,elem) !max 1 PE sends element here; - !if no PE found elem,it remains 0. - - !call point_in_triangle(elem, (/ lon_deg, lat_deg /)) !all PEs search here - !i_have_element= (elem .ne. 0) !up to 3 PEs .true. - ! - !if(i_have_element) then - ! i_have_element= (elem2D_nodes(1,elem) <= myDim_nod2D) !max 1 PE .true. - ! elem=myList_elem2D(elem) !global now - !end if - ! - !call com_integer(i_have_element,elem) !max 1 PE sends element here; - ! !if no PE found elem,it remains 0. end subroutine iceberg_elem4all @@ -558,17 +418,10 @@ end subroutine iceberg_elem4all !*************************************************************************************************************************** subroutine find_new_iceberg_elem(mesh, partit, old_iceberg_elem, pt, left_mype) - !use o_mesh !for index_nod2d, elem2D_nodes - USE MOD_MESH use o_param - -! kh 18.03.21 not really used here -! use o_arrays - - use MOD_PARTIT -#ifdef use_cavity - use iceberg_params, only: reject_elem -#endif +!#ifdef use_cavity +! use iceberg_params, only: reject_elem +!#endif implicit none @@ -906,51 +759,51 @@ end subroutine com_integer !*************************************************************************************************************************** !*************************************************************************************************************************** - !============================================================================== -! routine for visualizing the distribution of the processors involved +! !============================================================================== +!! routine for visualizing the distribution of the processors involved +!! +!! Thomas Rackow, 30.07.2010 +!!============================================================================== +!SUBROUTINE processor_distr(mesh, partit) +! !use o_mesh +! USE MOD_MESH +! use o_param +!! use i_therm_param +!! use i_param +!! use i_arrays +! use MOD_PARTIT ! -! Thomas Rackow, 30.07.2010 -!============================================================================== -SUBROUTINE processor_distr(mesh, partit) - !use o_mesh - USE MOD_MESH - use o_param -! use i_therm_param -! use i_param -! use i_arrays - use MOD_PARTIT - -! kh 18.03.21 not really used here -! use o_arrays - - use g_clock - use g_forcing_arrays - use g_rotate_grid - - IMPLICIT NONE - - character :: mype_char*3 - INTEGER :: m, row - -type(t_mesh), intent(in) , target :: mesh -type(t_partit), intent(inout), target :: partit -#include "associate_part_def.h" -#include "associate_mesh_def.h" -#include "associate_part_ass.h" -#include "associate_mesh_ass.h" - - write(mype_char,*) mype - !left-adjust the string.. - mype_char = adjustl(mype_char) - - DO m=1, myDim_nod2d - row=myList_nod2d(m) - open(unit=mype+66, file='/work/ab0046/a270046/results/ICB02processor' // trim(mype_char) // '.dat', position='append') - ! global local lon lat PE - write(mype+66,*) row, m, coord_nod2D(1,m), coord_nod2D(2,m), mype - close(mype+66) - END DO -END SUBROUTINE processor_distr +!! kh 18.03.21 not really used here +!! use o_arrays +! +! use g_clock +! use g_forcing_arrays +! use g_rotate_grid +! +! IMPLICIT NONE +! +! character :: mype_char*3 +! INTEGER :: m, row +! +!type(t_mesh), intent(in) , target :: mesh +!type(t_partit), intent(inout), target :: partit +!#include "associate_part_def.h" +!#include "associate_mesh_def.h" +!#include "associate_part_ass.h" +!#include "associate_mesh_ass.h" +! +! write(mype_char,*) mype +! !left-adjust the string.. +! mype_char = adjustl(mype_char) +! +! DO m=1, myDim_nod2d +! row=myList_nod2d(m) +! open(unit=mype+66, file='/work/ab0046/a270046/results/ICB02processor' // trim(mype_char) // '.dat', position='append') +! ! global local lon lat PE +! write(mype+66,*) row, m, coord_nod2D(1,m), coord_nod2D(2,m), mype +! close(mype+66) +! END DO +!END SUBROUTINE processor_distr !*************************************************************************************************************************** @@ -1023,5 +876,4 @@ subroutine matrix_inverse_2x2 (A, AINV, DET) AINV(2,2) = A(1,1)/DET endif end subroutine matrix_inverse_2x2 - !*************************************************************************************************************************** - !*************************************************************************************************************************** +end module iceberg_element diff --git a/src/icb_step.F90 b/src/icb_step.F90 index fa2a73d60..e688093e3 100644 --- a/src/icb_step.F90 +++ b/src/icb_step.F90 @@ -1,3 +1,35 @@ +module iceberg_step + USE MOD_MESH + use MOD_PARTIT + use MOD_ICE + USE MOD_DYN + use iceberg_params + use iceberg_dynamics + use iceberg_element + +implicit none + + public :: iceberg_calculation + public :: iceberg_step1 + public :: get_total_iceberg_area + public :: iceberg_step2 + public :: initialize_velo + public :: trajectory + public :: depth_bathy + public :: parallel2coast + public :: projection + public :: iceberg_restart + public :: iceberg_restart_with_icesheet + public :: iceberg_out + public :: init_buoys + public :: init_icebergs + public :: init_icebergs_with_icesheet + public :: determine_save_count + public :: init_buoy_output + public :: write_buoy_props_netcdf + +contains + subroutine iceberg_calculation(ice, mesh, partit, dynamics, istep) !======================================================================! ! ! @@ -11,21 +43,11 @@ subroutine iceberg_calculation(ice, mesh, partit, dynamics, istep) != use o_param !for ? != use g_config !for istep, step_per_day, logfile_outfreq != - use iceberg_params !for ..all others != - -use MOD_ICE -use MOD_MESH -use MOD_PARTIT - USE MOD_DYN != implicit none != != integer :: ib, times, istep - -! kh 16.03.21 integer :: istep_end_synced - -! kh 25.03.21 integer:: req, status(MPI_STATUS_SIZE) logical:: completed real(kind=8) :: t0, t1, t2, t3, t4, t0_restart, t1_restart != @@ -53,11 +75,10 @@ subroutine iceberg_calculation(ice, mesh, partit, dynamics, istep) istep_end_synced = istep + steps_per_ib_step - 1 if(firstcall) then - !write(*,*) 'ib_num: ', ib_num !overwrite icb_modules if restart, initialize netcdf output if no restart: t0_restart=MPI_Wtime() - if (use_icesheet_coupling==.true.) then + if (use_icesheet_coupling) then call iceberg_restart_with_icesheet(partit) else call iceberg_restart(partit) @@ -95,15 +116,13 @@ subroutine iceberg_calculation(ice, mesh, partit, dynamics, istep) lastsubstep = .true. !do output every timestep - if( melted(ib) == .false. ) then + if( .not.melted(ib) ) then call iceberg_step1(ice, mesh, partit, dynamics, ib, height_ib(ib),length_ib(ib),width_ib(ib), lon_deg(ib),lat_deg(ib),& Co(ib),Ca(ib),Ci(ib), Cdo_skin(ib),Cda_skin(ib), rho_icb(ib), & conc_sill(ib),P_sill(ib), rho_h2o(ib),rho_air(ib),rho_ice(ib), & u_ib(ib),v_ib(ib), iceberg_elem(ib), find_iceberg_elem(ib), lastsubstep,& f_u_ib_old(ib), f_v_ib_old(ib), l_semiimplicit, & semiimplicit_coeff, AB_coeff, istep) - !call MPI_Barrier(MPI_COMM_WORLD, MPIERR) !necessary? - !end do end if end if end do @@ -116,10 +135,7 @@ subroutine iceberg_calculation(ice, mesh, partit, dynamics, istep) !all PEs need the array arr(15) and the iceberg element !in step2 !ALLREDUCE: arr_block, elem_block - -!kh 12.02.21 not really needed here -!call MPI_Barrier(MPI_COMM_FESOM_IB, MPIERR_IB) - + arr_block_red = 0.0 elem_block_red= 0 vl_block_red = 0.0 @@ -135,9 +151,6 @@ subroutine iceberg_calculation(ice, mesh, partit, dynamics, istep) !$omp end critical end do -! kh 25.03.21 orig -! call MPI_AllREDUCE(elem_block, elem_block_red, ib_num, MPI_INTEGER, MPI_SUM, & -! MPI_COMM_FESOM_IB, MPIERR_IB) !$omp critical call MPI_IAllREDUCE(elem_block, elem_block_red, ib_num, MPI_INTEGER, MPI_SUM, partit%MPI_COMM_FESOM_IB, req, partit%MPIERR_IB) !$omp end critical @@ -149,10 +162,6 @@ subroutine iceberg_calculation(ice, mesh, partit, dynamics, istep) !$omp end critical end do - !ALLREDUCE: vl_block, containing the volume losses (IBs may switch PE during the output interval) -! kh 25.03.21 orig -! call MPI_AllREDUCE(vl_block, vl_block_red, 4*ib_num, MPI_DOUBLE_PRECISION, MPI_SUM, & -! MPI_COMM_FESOM_IB, MPIERR_IB) !$omp critical call MPI_IAllREDUCE(vl_block, vl_block_red, 4*ib_num, MPI_DOUBLE_PRECISION, MPI_SUM, partit%MPI_COMM_FESOM_IB, req, partit%MPIERR_IB) !$omp end critical @@ -164,19 +173,6 @@ subroutine iceberg_calculation(ice, mesh, partit, dynamics, istep) !$omp end critical end do -! call MPI_Barrier(MPI_COMM_WORLD,MPIerr) -! arr_block_red = 0.0 -! elem_block_red= 0 -! vl_block_red = 0.0 -! call MPI_AllREDUCE(arr_block, arr_block_red, 15*ib_num, MPI_DOUBLE_PRECISION, MPI_SUM, & -! MPI_COMM_WORLD, MPIerr) -! call MPI_AllREDUCE(elem_block, elem_block_red, ib_num, MPI_INTEGER, MPI_SUM, & -! MPI_COMM_WORLD, MPIerr) -! !ALLREDUCE: vl_block, containing the volume losses (IBs may switch PE during the output interval) -! call MPI_AllREDUCE(vl_block, vl_block_red, 4*ib_num, MPI_DOUBLE_PRECISION, MPI_SUM, & -! MPI_COMM_WORLD, MPIerr) - - !is filled in STEP 2 buoy_props=0. t2=MPI_Wtime() @@ -202,24 +198,18 @@ subroutine iceberg_calculation(ice, mesh, partit, dynamics, istep) if( real(istep) > real(step_per_day)*calving_day(ib) ) then !iceberg calved !substeps don't work anymore with new communication - !do times=1, steps_per_FESOM_step - !if(times == steps_per_FESOM_step) lastsubstep = .true. !do output at last substep lastsubstep = .true. !do output every timestep - if( melted(ib) == .false. ) then + if( .not.melted(ib) ) then call iceberg_step2(mesh, partit, arr_from_block, elem_from_block, ib, height_ib(ib),length_ib(ib),width_ib(ib), lon_deg(ib),lat_deg(ib),& Co(ib),Ca(ib),Ci(ib), Cdo_skin(ib),Cda_skin(ib), rho_icb(ib), & conc_sill(ib),P_sill(ib), rho_h2o(ib),rho_air(ib),rho_ice(ib), & u_ib(ib),v_ib(ib), iceberg_elem(ib), find_iceberg_elem(ib), lastsubstep,& f_u_ib_old(ib), f_v_ib_old(ib), l_semiimplicit, & semiimplicit_coeff, AB_coeff, istep) - !call MPI_Barrier(MPI_COMM_WORLD, MPIERR) !necessary? - !end do end if end if end do - - !call MPI_Barrier(MPI_COMM_WORLD, MPIERR) !MK: necessary for output !commented 1 JAN 2000 t3=MPI_Wtime() @@ -230,9 +220,7 @@ subroutine iceberg_calculation(ice, mesh, partit, dynamics, istep) !istep, lon_deg_geo, lat_deg_geo, u_ib_geo, v_ib_geo, volume losses (set to zero) !introduce force_last_output(ib)? -! kh 16.03.21 (asynchronous) iceberg calculation starts with the content in common arrays at istep and will merge its results at istep_end_synced -!if (mod(istep,icb_outfreq)==0 .AND. ascii_out==.false.) then - if (mod(istep_end_synced,icb_outfreq)==0 .AND. ascii_out==.false.) then + if (mod(istep_end_synced,icb_outfreq)==0 .AND. .not.ascii_out) then if (mype==0 .AND. (real(istep) > real(step_per_day)*calving_day(1) ) ) call write_buoy_props_netcdf(partit) @@ -246,16 +234,15 @@ subroutine iceberg_calculation(ice, mesh, partit, dynamics, istep) t4=MPI_Wtime() - -! if (mod(istep,logfile_outfreq)==0 .and. mype==0) then -! write(*,*) 'icebergs took', t4-t0 -! write(*,*) 'iceberg step1 took', t1-t0 -! write(*,*) 'NEW comvalues took', t2-t1 -! write(*,*) 'iceberg step2 took', t3-t2 -! write(*,*) 'vector output took', t4-t3 -! write(*,*) 'reading restart took', t1_restart-t0_restart -! write(*,*) '*************************************************************' -! end if + if (mod(istep,logfile_outfreq)==0 .and. mype==0) then + write(*,*) 'icebergs took', t4-t0 + write(*,*) 'iceberg step1 took', t1-t0 + write(*,*) 'NEW comvalues took', t2-t1 + write(*,*) 'iceberg step2 took', t3-t2 + write(*,*) 'vector output took', t4-t3 + write(*,*) 'reading restart took', t1_restart-t0_restart + write(*,*) '*************************************************************' + end if end subroutine iceberg_calculation @@ -274,23 +261,14 @@ subroutine iceberg_step1(ice, mesh, partit, dynamics, ib, height_ib,length_ib,wi !============================= MODULES & DECLARATIONS =========================================!= != use o_param !for rad != - -! kh 17.03.21 specification of structure used -! use o_arrays, only: coriolis - - !use o_mesh !for nod2D, (cavities: for cavity_flag_nod2d) != - USE MOD_MESH - use MOD_PARTIT !for myDim_elem2D, myList_nod2D != - use MOD_ICE - USE MOD_DYN use g_rotate_grid !for subroutine g2r, logfile_outfreq != use g_config, only: steps_per_ib_step != -#ifdef use_cavity - use iceberg_params, only: smallestvol_icb, arr_block, elem_block, l_geo_out, icb_outfreq, l_allowgrounding, draft_scale, reject_elem, melted, grounded, scaling !, length_ib, width_ib, scaling -#else - use iceberg_params, only: smallestvol_icb, arr_block, elem_block, l_geo_out, icb_outfreq, l_allowgrounding, draft_scale, melted, grounded, scaling !, length_ib, width_ib, scaling -#endif +!#ifdef use_cavity +! use iceberg_params, only: smallestvol_icb, arr_block, elem_block, l_geo_out, icb_outfreq, l_allowgrounding, draft_scale, reject_elem, melted, grounded, scaling !, length_ib, width_ib, scaling +!#else +! use iceberg_params, only: smallestvol_icb, arr_block, elem_block, l_geo_out, icb_outfreq, l_allowgrounding, draft_scale, melted, grounded, scaling !, length_ib, width_ib, scaling +!#endif != implicit none != @@ -308,12 +286,8 @@ subroutine iceberg_step1(ice, mesh, partit, dynamics, ib, height_ib,length_ib,wi logical, intent(in) :: l_semiimplicit real, intent(in) :: semiimplicit_coeff real, intent(in) :: AB_coeff - -!LA 2023-03-07 -real, dimension(:), pointer :: coriolis - -! kh 16.03.21 -integer :: istep_end_synced + real, dimension(:), pointer :: coriolis + integer :: istep_end_synced integer, dimension(:), save, allocatable :: local_idx_of real :: depth_ib, volume_ib, mass_ib @@ -362,9 +336,7 @@ subroutine iceberg_step1(ice, mesh, partit, dynamics, ib, height_ib,length_ib,wi #include "associate_mesh_ass.h" mype =>partit%mype - !t0=MPI_Wtime() -! kh 16.03.21 (asynchronous) iceberg calculation starts with the content in common arrays at istep and will merge its results at istep_end_synced istep_end_synced = istep + steps_per_ib_step - 1 depth_ib = -height_ib * rho_icb/rho_h2o @@ -376,8 +348,6 @@ subroutine iceberg_step1(ice, mesh, partit, dynamics, ib, height_ib,length_ib,wi if(volume_ib .le. smallestvol_icb) then melted(ib) = .true. -! kh 16.03.21 (asynchronous) iceberg calculation starts with the content in common arrays at istep and will merge its results at istep_end_synced -! if (mod(istep,logfile_outfreq)==0 .and. mype==0 .and. lastsubstep) then if (mod(istep_end_synced,logfile_outfreq)==0 .and. mype==0 .and. lastsubstep) then write(*,*) 'iceberg ', ib,' melted' end if @@ -397,7 +367,6 @@ subroutine iceberg_step1(ice, mesh, partit, dynamics, ib, height_ib,length_ib,wi if (find_iceberg_elem) then lon_rad = lon_deg*rad lat_rad = lat_deg*rad - !write(*,*) 'IB ',ib,' not rot. coords:', lon_deg, lat_deg !,lon_rad, lat_rad call g2r(lon_rad, lat_rad, lon_rad, lat_rad) lat_deg=lat_rad/rad !rotated lat in degree lon_deg=lon_rad/rad !rotated lon in degree @@ -430,15 +399,6 @@ subroutine iceberg_step1(ice, mesh, partit, dynamics, ib, height_ib,length_ib,wi stop 'ICEBERG OUTSIDE MODEL DOMAIN OR IN ICE SHELF REGION' end if - if(i_have_element) then - !write(*,*) 'IB ',ib,' in element ',iceberg_elem - !write(*,*) 'IB ',ib,' rot. coords:', lon_deg, lat_deg !,lon_rad, lat_rad - !do i=1,3 - ! iceberg_node=elem2D_nodes(i,local_idx_of(iceberg_elem)) - ! write(*,*) 'node ', i, 's coords lon:', coord_nod2d(1,iceberg_node)/rad,' lat: ', coord_nod2d(2,iceberg_node)/rad - !end do - end if - ! initialize the iceberg velocity call initialize_velo(mesh, partit, dynamics, i_have_element, ib, u_ib, v_ib, lon_rad, lat_rad, depth_ib, local_idx_of(iceberg_elem)) @@ -447,12 +407,6 @@ subroutine iceberg_step1(ice, mesh, partit, dynamics, ib, height_ib,length_ib,wi coriolis => mesh%coriolis(:) !for AB method - !f_u_ib_old = coriolis_param_elem2D(local_idx_of(iceberg_elem))*u_ib - !f_v_ib_old = coriolis_param_elem2D(local_idx_of(iceberg_elem))*v_ib - -! kh 18.03.21 use coriolis_ib buffered values here, test only -! f_u_ib_old = coriolis_ib(local_idx_of(iceberg_elem))*u_ib -! f_v_ib_old = coriolis_ib(local_idx_of(iceberg_elem))*v_ib ! kh 06.08.21 observed via -check bounds: forrtl: severe (408): fort: (3): Subscript #1 of the array CORIOLIS has value 0 which is less than the lower bound of 1 if(local_idx_of(iceberg_elem) > 0) then @@ -461,31 +415,10 @@ subroutine iceberg_step1(ice, mesh, partit, dynamics, ib, height_ib,length_ib,wi f_u_ib_old = coriolis(local_idx_of(iceberg_elem))*u_ib f_v_ib_old = coriolis(local_idx_of(iceberg_elem))*v_ib - !else - ! write(*,*) 'Error local_idx_of(iceberg_elem) > myDim_elem2D, istep, local_idx_of(iceberg_elem), myDim_elem2D', istep, local_idx_of(iceberg_elem), myDim_elem2D endif - !else - ! write(*,*) 'Error local_idx_of(iceberg_elem) <= 0, istep, local_idx_of(iceberg_elem)', istep, local_idx_of(iceberg_elem) endif end if - !file_track='/work/ollie/lackerma/iceberg/iceberg_ICBref_' - !file_forces_u='/work/ollie/lackerma/iceberg/iceberg_ICBref_forces_u_' - !file_forces_v='/work/ollie/lackerma/iceberg/iceberg_ICBref_forces_v_' - !file_meltrates='/work/ollie/lackerma/iceberg/iceberg_ICBref_melt_' - - !!convert ib integer to string - !write(ib_char,'(I10)') ib - ! - !!left-adjust the string.. - !ib_char = adjustl(ib_char) - ! - !!.. and trim while concatenating: - !file_track = trim(file_track) // trim(ib_char) // '.dat' - !file_forces_u = trim(file_forces_u) // trim(ib_char) // '.dat' - !file_forces_v = trim(file_forces_v) // trim(ib_char) // '.dat' - !file_meltrates = trim(file_meltrates) // trim(ib_char) // '.dat' - ! ================== START ICEBERG CALCULATION ==================== @@ -515,28 +448,21 @@ subroutine iceberg_step1(ice, mesh, partit, dynamics, ib, height_ib,length_ib,wi f_v_ib_old, l_semiimplicit, semiimplicit_coeff, & AB_coeff, file_meltrates, rho_icb) call prepare_icb2fesom(mesh,partit,ib,i_have_element,local_idx_of(iceberg_elem),depth_ib) - !new_u_ib = 2.0 - !new_v_ib = 0.0 dudt = (new_u_ib-u_ib)/REAL(steps_per_ib_step) / dt dvdt = (new_v_ib-v_ib)/REAL(steps_per_ib_step) / dt - !new_u_ib = 0. - !new_v_ib = -0.20 - !P_ib = 20000. - !conci_ib = 0.3 - !=======================END OF DYNAMICS============================ call depth_bathy(mesh,partit, Zdepth3, local_idx_of(iceberg_elem)) !interpolate depth to location of iceberg (2 times because FEM_3eval expects a 2 component vector...) call FEM_3eval(mesh,partit, Zdepth,Zdepth,lon_rad,lat_rad,Zdepth3,Zdepth3,local_idx_of(iceberg_elem)) - !write(*,*) 'nodal depth in iceberg ', ib,'s element:', Zdepth3 !write(*,*) 'depth at iceberg ', ib, 's location:', Zdepth !=================CHECK IF ICEBERG IS GROUNDED...=================== if((draft_scale(ib)*abs(depth_ib) .gt. Zdepth) .and. l_allowgrounding ) then + !if((draft_scale(ib)*abs(depth_ib) .gt. minval(Zdepth3)) .and. l_allowgrounding ) then !icebergs remains stationary (iceberg can melt above in iceberg_dyn!) left_mype = 0.0 u_ib = 0.0 @@ -550,7 +476,6 @@ subroutine iceberg_step1(ice, mesh, partit, dynamics, ib, height_ib,length_ib,wi !!########################################### ! kh 16.03.21 (asynchronous) iceberg calculation starts with the content in common arrays at istep and will merge its results at istep_end_synced -! if (mod(istep,logfile_outfreq)==0) then if (mod(istep_end_synced,logfile_outfreq)==0) then write(*,*) 'iceberg ib ', ib, 'is grounded' grounded(ib) = .true. @@ -607,7 +532,7 @@ subroutine iceberg_step1(ice, mesh, partit, dynamics, ib, height_ib,length_ib,wi if((area_ib_tot > elem_area(local_idx_of(iceberg_elem))) .and. & (iceberg_elem .ne. old_element) .and. & (old_element .ne. 0) .and. & - (grounded(ib) .ne. .true.)) then + (.not.grounded(ib))) then lon_rad = old_lon lat_rad = old_lat lon_deg = lon_rad/rad @@ -642,14 +567,13 @@ subroutine iceberg_step1(ice, mesh, partit, dynamics, ib, height_ib,length_ib,wi end subroutine iceberg_step1 -! LA subroutine get_total_iceberg_area(mesh, partit,iceberg_elem, area_ib_tot) use o_param !for rad != USE MOD_MESH use MOD_PARTIT !for myDim_elem2D, myList_nod2D != use g_rotate_grid !for subroutine g2r, logfile_outfreq != - use iceberg_params, only: arr_block, elem_block, length_ib, width_ib, scaling + !use iceberg_params, only: arr_block, elem_block, length_ib, width_ib, scaling implicit none != @@ -686,21 +610,14 @@ subroutine iceberg_step2(mesh, partit,arr, elem_from_block, ib, height_ib,length !============================= MODULES & DECLARATIONS =========================================!= != use o_param !for rad != - -! kh 17.03.21 not really used here -! use o_arrays !for coriolis_param_elem2D != - - !use o_mesh !for nod2D, (cavities: for cavity_flag_nod2d) != - USE MOD_MESH - use MOD_PARTIT !for myDim_elem2D, myList_nod2D != use g_rotate_grid !for subroutine g2r, logfile_outfreq != use g_config, only: steps_per_ib_step != -#ifdef use_cavity - use iceberg_params, only: smallestvol_icb, buoy_props, bvl_mean, lvlv_mean, lvle_mean, lvlb_mean, ascii_out, l_geo_out, icb_outfreq, l_allowgrounding, draft_scale, reject_elem, elem_block -#else - use iceberg_params, only: smallestvol_icb, buoy_props, bvl_mean, lvlv_mean, lvle_mean, lvlb_mean, ascii_out, l_geo_out, icb_outfreq, l_allowgrounding, draft_scale, elem_block -#endif +!#ifdef use_cavity +! use iceberg_params, only: smallestvol_icb, buoy_props, bvl_mean, lvlv_mean, lvle_mean, lvlb_mean, ascii_out, l_geo_out, icb_outfreq, l_allowgrounding, draft_scale, reject_elem, elem_block +!#else +! use iceberg_params, only: smallestvol_icb, buoy_props, bvl_mean, lvlv_mean, lvle_mean, lvlb_mean, ascii_out, l_geo_out, icb_outfreq, l_allowgrounding, draft_scale, elem_block +!#endif != implicit none != @@ -875,26 +792,26 @@ subroutine iceberg_step2(mesh, partit,arr, elem_from_block, ib, height_ib,length lat_deg_out = lat_deg end if - if(ascii_out) then !use old ASCII output - - file_track='/work/ollie/lackerma/iceberg/iceberg_ICBref_' - !convert ib integer to string - write(ib_char,'(I10)') ib - !left-adjust the string.. - ib_char = adjustl(ib_char) - !.. and trim while concatenating: - file_track = trim(file_track) // trim(ib_char) // '.dat' - - open(unit=42,file=file_track,position='append') - -! kh 16.03.21 (asynchronous) iceberg calculation starts with the content in common arrays at istep and will merge its results at istep_end_synced -! write(42,'(I,12e15.7)') istep, lon_rad_out, lat_rad_out, lon_deg_out, lat_deg_out, & -! u_ib_out, v_ib_out, frozen_in, P_sill, P_ib, conci_ib, dudt_out, dvdt_out - write(42,'(I,12e15.7)') istep_end_synced, lon_rad_out, lat_rad_out, lon_deg_out, lat_deg_out, & - u_ib_out, v_ib_out, frozen_in, P_sill, P_ib, conci_ib, dudt_out, dvdt_out - close(42) - - else !write in array for faster netcdf output +! if(ascii_out) then !use old ASCII output +! +! file_track='/work/ollie/lackerma/iceberg/iceberg_ICBref_' +! !convert ib integer to string +! write(ib_char,'(I10)') ib +! !left-adjust the string.. +! ib_char = adjustl(ib_char) +! !.. and trim while concatenating: +! file_track = trim(file_track) // trim(ib_char) // '.dat' +! +! open(unit=42,file=file_track,position='append') +! +!! kh 16.03.21 (asynchronous) iceberg calculation starts with the content in common arrays at istep and will merge its results at istep_end_synced +!! write(42,'(I,12e15.7)') istep, lon_rad_out, lat_rad_out, lon_deg_out, lat_deg_out, & +!! u_ib_out, v_ib_out, frozen_in, P_sill, P_ib, conci_ib, dudt_out, dvdt_out +! write(42,'(I,12e15.7)') istep_end_synced, lon_rad_out, lat_rad_out, lon_deg_out, lat_deg_out, & +! u_ib_out, v_ib_out, frozen_in, P_sill, P_ib, conci_ib, dudt_out, dvdt_out +! close(42) +! +! else !write in array for faster netcdf output buoy_props(ib, 1) = lon_rad_out buoy_props(ib, 2) = lat_rad_out @@ -910,7 +827,7 @@ subroutine iceberg_step2(mesh, partit,arr, elem_from_block, ib, height_ib,length buoy_props(ib,12) = width_ib buoy_props(ib,13) = iceberg_elem - end if +! end if end if @@ -932,11 +849,7 @@ end subroutine iceberg_step2 subroutine initialize_velo(mesh,partit,dynamics, i_have_element, ib, u_ib, v_ib, lon_rad, lat_rad, depth_ib, localelem) use g_rotate_grid, only: vector_g2r - use iceberg_params, only: l_initial, l_iniuser, ini_u, ini_v - -use MOD_MESH -use MOD_PARTIT -use MOD_DYN +! use iceberg_params, only: l_initial, l_iniuser, ini_u, ini_v implicit none logical, intent(in) :: i_have_element @@ -974,7 +887,7 @@ subroutine initialize_velo(mesh,partit,dynamics, i_have_element, ib, u_ib, v_ib, else !OCEAN VELOCITY uo_ib, voib is start velocity call iceberg_avvelo(mesh, partit, dynamics, startu,startv,depth_ib,localelem) - call FEM_3eval(mesh, partit,u_ib,v_ib,lon_rad,lat_rad,startu,startv,localelem) + call FEM_3eval(mesh, partit,u_ib,v_ib,lon_rad,lat_rad,startu,startv,localelem) end if end if @@ -1024,18 +937,7 @@ end subroutine trajectory !**************************************************************************************************************************** subroutine depth_bathy(mesh, partit,Zdepth3, elem) - !use o_mesh - USE MOD_MESH use o_param -! use MOD_ICE -! use i_therm_param -! use i_param -! use i_arrays - use MOD_PARTIT - -! kh 17.03.21 not really used here -! use o_arrays - use g_clock use g_forcing_arrays use g_rotate_grid @@ -1048,7 +950,6 @@ subroutine depth_bathy(mesh, partit,Zdepth3, elem) type(t_mesh), intent(in) , target :: mesh type(t_partit), intent(inout), target :: partit -!type(t_ice), intent(inout), target :: ice #include "associate_part_def.h" #include "associate_mesh_def.h" #include "associate_part_ass.h" @@ -1067,8 +968,10 @@ subroutine depth_bathy(mesh, partit,Zdepth3, elem) !..compute depth below this node: !Zdepth3(m) = abs(coord_nod3D(3, n_low)) - Zdepth3(m) = abs(mesh%zbar(k)) - !if (Zdepth3(m)<0.0) then + !Zdepth3(m) = abs(mesh%Z_3d_n_ib(k, n2)) + Zdepth3(m) = abs(mesh%zbar_n_bot(n2)) + !Zdepth3(m) = abs(mesh%zbar(k)) + !if (!Zdepth3(m)<0.0) then ! Zdepth3(m) = -Zdepth3(m) !end if end do @@ -1080,12 +983,9 @@ end subroutine depth_bathy !**************************************************************************************************************************** subroutine parallel2coast(mesh, partit,u, v, lon,lat, elem) - !use o_mesh !for index_nod2D, (cavities: for cavity_flag_nod2d) - USE MOD_MESH - use MOD_PARTIT !for myDim_nod2D -#ifdef use_cavity - use iceberg_params, only: coastal_nodes -#endif +!#ifdef use_cavity +! use iceberg_params, only: coastal_nodes +!#endif implicit none real, intent(inout) :: u, v !velocity @@ -1203,9 +1103,6 @@ end subroutine parallel2coast subroutine projection(mesh, partit, velocity, n1, n2) - !use o_mesh !for coord_nod2D - USE MOD_MESH - use MOD_PARTIT implicit none real, dimension(2), intent(inout) :: velocity @@ -1239,8 +1136,7 @@ end subroutine projection subroutine iceberg_restart(partit) - use iceberg_params - use MOD_PARTIT !for mype +! use iceberg_params use g_config, only : ib_num implicit none @@ -1260,7 +1156,7 @@ subroutine iceberg_restart(partit) do ib=1, ib_num !read all parameters that icb_step needs: - read(icbID,'(18e15.7,I,L,3e15.7,L,I)') & + read(icbID) & !,'(18e15.7,I,L,3e15.7,L,I)') & height_ib(ib),length_ib(ib),width_ib(ib), lon_deg(ib),lat_deg(ib), & Co(ib),Ca(ib),Ci(ib), Cdo_skin(ib),Cda_skin(ib), rho_icb(ib), & conc_sill(ib),P_sill(ib), rho_h2o(ib),rho_air(ib),rho_ice(ib), & @@ -1303,8 +1199,7 @@ end subroutine iceberg_restart subroutine iceberg_restart_with_icesheet(partit) - use iceberg_params - use MOD_PARTIT !for mype +! use iceberg_params use g_config, only : ib_num implicit none @@ -1329,7 +1224,7 @@ subroutine iceberg_restart_with_icesheet(partit) open(unit=icbID_ISM,file=IcebergRestartPath_ISM,status='old') do ib=1, num_non_melted_icb !read all parameters that icb_step needs: - read(icbID_ISM,'(18e15.7,I,L,3e15.7,L,I,L)',iostat=st) & + read(icbID_ISM) & !,'(18e15.7,I,L,3e15.7,L,I,L)',iostat=st) & height_ib(ib),length_ib(ib),width_ib(ib), lon_deg(ib),lat_deg(ib), & Co(ib),Ca(ib),Ci(ib), Cdo_skin(ib),Cda_skin(ib), rho_icb(ib), & conc_sill(ib),P_sill(ib), rho_h2o(ib),rho_air(ib),rho_ice(ib), & @@ -1371,8 +1266,7 @@ end subroutine iceberg_restart_with_icesheet subroutine iceberg_out(partit) - use iceberg_params - use MOD_PARTIT !for mype +! use iceberg_params use g_clock !for dayold implicit none integer :: icbID, icbID_ISM, ib, istep @@ -1401,7 +1295,7 @@ subroutine iceberg_out(partit) do ib=1, ib_num !write all parameters that icb_step needs: - write(icbID,'(18e15.7,I,L,3e15.7,L,I,L)') & + write(icbID) & !,'(18e15.7,I,L,3e15.7,L,I,L)') & height_ib(ib),length_ib(ib),width_ib(ib), lon_deg(ib),lat_deg(ib), & Co(ib),Ca(ib),Ci(ib), Cdo_skin(ib),Cda_skin(ib), rho_icb(ib), & conc_sill(ib),P_sill(ib), rho_h2o(ib),rho_air(ib),rho_ice(ib), & @@ -1410,9 +1304,9 @@ subroutine iceberg_out(partit) !*************************************************************** !write new restart file with only non melted icebergs - if(melted(ib)==.false.) then + if(.not.melted(ib)) then !write all parameters that icb_step needs: - write(icbID_ISM,'(18e15.7,I,L,3e15.7,L,I,L)') & + write(icbID_ISM) & !,'(18e15.7,I,L,3e15.7,L,I,L)') & height_ib(ib),length_ib(ib),width_ib(ib), lon_deg(ib),lat_deg(ib), & Co(ib),Ca(ib),Ci(ib), Cdo_skin(ib),Cda_skin(ib), rho_icb(ib), & conc_sill(ib),P_sill(ib), rho_h2o(ib),rho_air(ib),rho_ice(ib), & @@ -1432,16 +1326,12 @@ end subroutine iceberg_out ! written by Madlen Kimmritz, 25.07.2015 !======================================================================== subroutine init_buoys - use iceberg_params +! use iceberg_params use g_config -! use MOD_PARTIT implicit none integer :: i integer :: io_error -!type(t_partit), intent(inout), target :: partit -!#include "associate_part_def.h" -!#include "associate_part_ass.h" !buoys_xlon_file > lon_deg open(unit=97, file=buoys_xlon_file,status='old',action='read',iostat=io_error) @@ -1469,7 +1359,7 @@ end subroutine init_buoys ! added length for iceberg case, 07.10.2015 !======================================================================== subroutine init_icebergs - use iceberg_params +! use iceberg_params use g_config ! use MOD_PARTIT @@ -1529,7 +1419,7 @@ end subroutine init_icebergs ! subroutine init_icebergs_with_icesheet - use iceberg_params +! use iceberg_params use g_config ! use MOD_PARTIT @@ -1592,9 +1482,8 @@ subroutine determine_save_count(partit) ! computes save_count_buoys and prev_sec_in_year from records in existing netcdf file !----------------------------------------------------------- use g_clock - use iceberg_params, only : file_icb_netcdf, save_count_buoys, prev_sec_in_year +! use iceberg_params, only : file_icb_netcdf, save_count_buoys, prev_sec_in_year !use iceberg_params, only : save_count_buoys, prev_sec_in_year - use MOD_PARTIT implicit none #include "netcdf.inc" @@ -1650,9 +1539,7 @@ subroutine init_buoy_output(partit) !----------------------------------------------------------- use g_clock use g_config, only : ib_num - use iceberg_params, only : file_icb_netcdf, save_count_buoys !ggf in namelist - !use iceberg_params, only : ib_num, save_count_buoys !ggf in namelist - use MOD_PARTIT +! use iceberg_params, only : file_icb_netcdf, save_count_buoys !ggf in namelist implicit none #include "netcdf.inc" @@ -1986,18 +1873,7 @@ subroutine write_buoy_props_netcdf(partit) use g_config use g_clock - use MOD_PARTIT - use iceberg_params, only : buoy_props, file_icb_netcdf, save_count_buoys, prev_sec_in_year, bvl_mean, lvlv_mean, lvle_mean, lvlb_mean - !use iceberg_params, only : ib_num, buoy_props, save_count_buoys, prev_sec_in_year, bvl_mean, lvlv_mean, lvle_mean, lvlb_mean - -! kh 17.03.21 not really used here -! use o_arrays - -! use o_mesh - !use o_passive_tracer_mod - !use o_age_tracer_mod -! use i_arrays -! use MOD_ICE +! use iceberg_params, only : buoy_props, file_icb_netcdf, save_count_buoys, prev_sec_in_year, bvl_mean, lvlv_mean, lvle_mean, lvlb_mean use g_forcing_param implicit none @@ -2189,3 +2065,4 @@ subroutine write_buoy_props_netcdf(partit) end subroutine write_buoy_props_netcdf +end module iceberg_step diff --git a/src/ice_setup_step.F90 b/src/ice_setup_step.F90 index 16cd3db21..663e8e954 100755 --- a/src/ice_setup_step.F90 +++ b/src/ice_setup_step.F90 @@ -353,7 +353,7 @@ subroutine ice_initial_state(ice, tracers, partit, mesh) !--------------------------------------------- m_snow => ice%data(3)%values(:) m_snow=0._WP -if (use_icebergs == 0) then +if (.not.use_icebergs) then u_ice => ice%uice(:) v_ice => ice%vice(:) a_ice => ice%data(1)%values(:)