From 34b4503062be156d6d08ff04a1b50f4857757fb6 Mon Sep 17 00:00:00 2001 From: Dom Heinzeller Date: Tue, 14 Apr 2020 07:30:18 -0600 Subject: [PATCH 1/5] Merge NCAR:dtc/develop into NOAA-EMC:dev/emc - bugfix for GNU compiler - reduce noise in stdout Squashed commit of the following: commit 86c127f5b810b87004aeed3a625f9445d469c27e Merge: ce66d6a f9bbb4f Author: Dom Heinzeller Date: Fri Apr 10 11:32:21 2020 -0600 Merge pull request #11 from climbfuji/update_dtc_develop_from_dev_emc_20200409 Update dtc/develop from dev/emc 2020/04/09 commit f9bbb4f12e032378050cef4b7e5ac4b65a16bb70 Author: Dom Heinzeller Date: Thu Apr 9 20:14:24 2020 -0600 Bugfix for GNU compiler in model/fv_regional_bc.F90, reduce verbosity in driver/fvGFS/atmosphere.F90 commit ecca9978802ec9cc39dc114fd7363386f7ad9422 Merge: ce66d6a 80ce8ce Author: Dom Heinzeller Date: Thu Apr 9 09:38:48 2020 -0600 Merge branch 'dev/emc' of https://github.com/NOAA-EMC/GFDL_atmos_cubed_sphere into HEAD commit ce66d6a56e89b6330a2bef763755c7154047d829 Merge: 4279bf7 9bacf55 Author: Dom Heinzeller Date: Fri Mar 13 13:00:41 2020 -0600 Merge pull request #10 from climbfuji/update_from_dev_emc_20200312_and_other_changes Update from dev/emc 2020/03/12 commit 9bacf554ed078dfa8c09ee662e7608442288e2d5 Merge: 4279bf7 371a29a Author: Dom Heinzeller Date: Thu Mar 12 10:33:44 2020 -0600 Merge branch 'dev/emc' of https://github.com/NOAA-EMC/GFDL_atmos_cubed_sphere into HEAD commit 4279bf78eb4ae0bad908eb991e3fb216018b7aea Merge: 846f5a5 4858d33 Author: Dom Heinzeller Date: Mon Mar 9 12:41:51 2020 -0600 Merge pull request #9 from climbfuji/update_dtc_develop_from_emc Update dtc/develop from dev/emc 2020/03/04 commit 4858d33838adcd87c1cd000ab4737dc0e7e56731 Merge: 846f5a5 db3acfb Author: Dom Heinzeller Date: Fri Feb 28 08:46:55 2020 -0700 Merge branch 'dev/emc' of https://github.com/NOAA-EMC/GFDL_atmos_cubed_sphere into HEAD commit 846f5a54b0764db1478c9aca49a74bd38322d9ad Merge: 3a4dfd8 9a290ee Author: Dom Heinzeller Date: Mon Feb 3 07:43:08 2020 -0700 Merge pull request #7 from climbfuji/update_dtc_develop_from_dev-emc dtc/develop: update from dev/emc 2020/01/27 commit 9a290ee5f3307a9d7b02762fe6c29a1f5ccd7f55 Merge: 3a4dfd8 a56907a Author: Dom Heinzeller Date: Mon Jan 27 09:28:57 2020 -0700 Merge branch 'dev/emc' of https://github.com/noaa-emc/GFDL_atmos_cubed_sphere into HEAD commit 3a4dfd8c6c4ceb8cec06397f25cb229ecd98065b Merge: 0c9ab9e 68576a6 Author: Dom Heinzeller Date: Tue Dec 3 15:19:24 2019 -0700 Merge pull request #6 from climbfuji/dtc_develop_udpate_from_emc_20191127 dtc/develop: update from EMC 2019/11/27 commit 68576a61f2a57236931e5ef1b8bd73a4256b0a5f Merge: 0c9ab9e 452333a Author: Dom Heinzeller Date: Wed Nov 27 14:13:08 2019 -0700 Merge branch 'dev/emc' of https://github.com/NOAA-EMC/GFDL_atmos_cubed_sphere into HEAD commit 0c9ab9e3dfe6cda6fc78315b86a107a369756024 Merge: 9871607 b280b37 Author: Dom Heinzeller Date: Fri Nov 22 16:17:57 2019 -0700 Merge pull request #5 from mzhangw/HAFS_fer_hires minimal changes to make nwat =4 compatible with Ferrier-Aligo MP scheme commit b280b373b421fcb9d84bd1196a40ec56fcf279ff Author: Man.Zhang Date: Tue Nov 19 14:53:57 2019 -0700 bug fix commit 98c58ad3d0444859aae54c31bc2b86ba30b4a9ac Author: Man.Zhang Date: Tue Nov 19 14:35:10 2019 -0700 bug fix commit 8805acd93152bb76d5c4d0900f314631f549fbe2 Author: Man.Zhang Date: Tue Nov 19 14:16:22 2019 -0700 From Chunxi: The file fv_mapz.F90 also needs to be modified (K_warm) commit f8a257a922a9047e98c176affec054e2a4d9c6a9 Author: Man.Zhang Date: Thu Nov 14 19:12:39 2019 -0700 use upper-case CCPP commit 77f4fbad9311ad406c6486ad0912069de3085f07 Author: Man.Zhang Date: Thu Nov 14 13:40:59 2019 -0700 implement FA scheme water loading option if nwat =4 commit 987160799b3a1c0f11de9883843f20421eb03fe8 Merge: ed75004 786447c Author: Dom Heinzeller Date: Tue Nov 5 06:59:34 2019 +0900 Merge branch 'dev/emc' of https://github.com/NOAA-EMC/GFDL_atmos_cubed_sphere into HEAD commit ed75004634374b02f8b222dd873190a91126ce4f Merge: 1d6035a f627bfb Author: Dom Heinzeller Date: Sat Oct 12 08:45:14 2019 +0900 Merge pull request #4 from climbfuji/update_gmtb_develop_with_vlab_master_20191006 Update NCAR gmtb/develop with NOAA-EMC dev/emc 2019/10/06 commit f627bfb177dc1f2d0bd10371540c43c51ce8eec4 Author: Dom Heinzeller Date: Mon Oct 7 12:12:24 2019 +0900 Add missing change in fv_cmp.F90 - now identical with EMC code commit e868186fd7d64fc2eeb7ec2c59e88c889e62fc93 Author: Dusan Jovic Date: Tue Sep 24 01:57:11 2019 +0000 change delz from positive value to the original value in the model commit 672eb0e8d67c008437724681250e7aa8aa81ec31 Author: fanglin.yang Date: Thu Sep 5 19:24:09 2019 +0000 VLab Issue #68141 modified: docs/FV3_citations.bib modified: model/fv_cmp.F90 1) Add an option (namelist parameter: intqs) to use temperature instead of the liquid frozen temperature to calculate saturation mixing ratio in deriving GFDLMP PDF cloud cover. 2) Add a literature reference. commit 1d6035ab053a6b5257b32dd9b4a49faa7ee4c78d Merge: 94ab0e1 fec8205 Author: Dom Heinzeller Date: Mon Sep 23 09:32:55 2019 -0600 Merge pull request #2 from climbfuji/remove_transition_mode Remove TRANSITION mode commit fec8205b9418dea28de4e2c9f05f347f3cf460d2 Author: climbfuji Date: Fri Sep 20 08:52:01 2019 -0600 Remove TRANSITION mode commit 94ab0e1317ffa50279dd6269a462999a2bea15e7 Author: Jun.Wang Date: Mon Aug 26 21:03:55 2019 +0000 add option to output omega commit b700cae673038f82189a1e6e0cb48a10a58ea726 Author: climbfuji Date: Fri Aug 30 11:58:00 2019 -0600 model/fv_dynamics.F90: replicating previous change to gmtb/develop branch of FV3, always allocate dtdt_m for IPD version commit 3df11713e0ba9299d95512476a9ee784048629c9 Author: Laurie Carson Date: Fri Aug 16 10:46:56 2019 -0600 Add codeowners for NCAR fork --- driver/fvGFS/atmosphere.F90 | 4 ++-- model/fv_regional_bc.F90 | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/driver/fvGFS/atmosphere.F90 b/driver/fvGFS/atmosphere.F90 index d1ed7e005..6cbd71756 100644 --- a/driver/fvGFS/atmosphere.F90 +++ b/driver/fvGFS/atmosphere.F90 @@ -112,7 +112,7 @@ module atmosphere_mod ! ! mpp_mod ! mpp_error, stdout, FATAL, NOTE, input_nml_file, mpp_root_pe, -! mpp_npes, mpp_pe, mpp_chksum,mpp_get_current_pelist, +! mpp_npes, mpp_pe, mpp_chksum,mpp_get_current_pelist, ! mpp_set_current_pelist ! ! @@ -1269,7 +1269,7 @@ subroutine atmosphere_get_bottom_layer (Atm_block, DYCORE_Data) rrg = rdgas / grav if (first_time) then - print *, 'calculating slp kr value' + if (mpp_pe() == mpp_root_pe()) print *, 'calculating slp kr value' ! determine 0.8 sigma reference level sigtop = Atm(mytile)%ak(1)/pstd_mks+Atm(mytile)%bk(1) do k = 1, npz diff --git a/model/fv_regional_bc.F90 b/model/fv_regional_bc.F90 index f73ee8909..9bd8e2b8a 100644 --- a/model/fv_regional_bc.F90 +++ b/model/fv_regional_bc.F90 @@ -5539,14 +5539,14 @@ subroutine create_restart_with_bcs(Atm) ,'yaxis_1' & ,'yaxis_2' & ,'zaxis_1' & - ,'Time' & + ,'Time ' & /) ! character(len=9),dimension(ndims_tracers) :: dim_names_tracers=(/ & 'xaxis_1' & ,'yaxis_1' & ,'zaxis_1' & - ,'Time' & + ,'Time ' & /) ! !----------------------------------------------------------------------- From ed226dd83675aa330337709f7125026c95a15da3 Mon Sep 17 00:00:00 2001 From: Dom Heinzeller Date: Tue, 14 Apr 2020 07:56:17 -0600 Subject: [PATCH 2/5] Delete print statement in driver/fvGFS/atmosphere.F90 --- driver/fvGFS/atmosphere.F90 | 1 - 1 file changed, 1 deletion(-) diff --git a/driver/fvGFS/atmosphere.F90 b/driver/fvGFS/atmosphere.F90 index 6cbd71756..046e2a5f1 100644 --- a/driver/fvGFS/atmosphere.F90 +++ b/driver/fvGFS/atmosphere.F90 @@ -1269,7 +1269,6 @@ subroutine atmosphere_get_bottom_layer (Atm_block, DYCORE_Data) rrg = rdgas / grav if (first_time) then - if (mpp_pe() == mpp_root_pe()) print *, 'calculating slp kr value' ! determine 0.8 sigma reference level sigtop = Atm(mytile)%ak(1)/pstd_mks+Atm(mytile)%bk(1) do k = 1, npz From f9d4483a45fa9b538184b1bd607faf203511be92 Mon Sep 17 00:00:00 2001 From: Dom Heinzeller Date: Thu, 23 Apr 2020 09:54:28 -0600 Subject: [PATCH 3/5] Remove CCPP dynamic build from framework (#18) --- driver/fvGFS/atmosphere.F90 | 48 ++----------------------------------- model/fv_mapz.F90 | 25 ++++--------------- 2 files changed, 7 insertions(+), 66 deletions(-) diff --git a/driver/fvGFS/atmosphere.F90 b/driver/fvGFS/atmosphere.F90 index 046e2a5f1..6d46233d1 100644 --- a/driver/fvGFS/atmosphere.F90 +++ b/driver/fvGFS/atmosphere.F90 @@ -270,30 +270,13 @@ module atmosphere_mod !! and diagnostics. subroutine atmosphere_init (Time_init, Time, Time_step, Grid_box, area) #ifdef CCPP -#ifdef STATIC -! For static builds, the ccpp_physics_{init,run,finalize} calls -! are not pointing to code in the CCPP framework, but to auto-generated -! ccpp_suite_cap and ccpp_group_*_cap modules behind a ccpp_static_api - use ccpp_api, only: ccpp_init use ccpp_static_api, only: ccpp_physics_init -#else - use iso_c_binding, only: c_loc - use ccpp_api, only: ccpp_init, & - ccpp_physics_init, & - ccpp_field_add, & - ccpp_error -#endif use CCPP_data, only: ccpp_suite, & cdata => cdata_tile, & CCPP_interstitial #ifdef OPENMP use omp_lib #endif -#ifndef STATIC -! Begin include auto-generated list of modules for ccpp -#include "ccpp_modules_fast_physics.inc" -! End include auto-generated list of modules for ccpp -#endif #endif type (time_type), intent(in) :: Time_init, Time, Time_step type(grid_box_type), intent(inout) :: Grid_box @@ -443,15 +426,8 @@ subroutine atmosphere_init (Time_init, Time, Time_step, Grid_box, area) #ifdef CCPP ! Do CCPP fast physics initialization before call to adiabatic_init (since this calls fv_dynamics) - ! Initialize the cdata structure - call ccpp_init(trim(ccpp_suite), cdata, ierr) - if (ierr/=0) then - cdata%errmsg = ' atmosphere_dynamics: error in ccpp_init: ' // trim(cdata%errmsg) - call mpp_error (FATAL, cdata%errmsg) - end if - - ! For fast physics running over the entire domain, block and thread - ! number are not used; set to safe values + ! For fast physics running over the entire domain, block + ! and thread number are not used; set to safe values cdata%blk_no = 1 cdata%thrd_no = 1 @@ -487,18 +463,9 @@ subroutine atmosphere_init (Time_init, Time, Time_step, Grid_box, area) #endif mpirank=mpp_pe(), mpiroot=mpp_root_pe()) -#ifndef STATIC -! Populate cdata structure with fields required to run fast physics (auto-generated). -#include "ccpp_fields_fast_physics.inc" -#endif - if (Atm(mytile)%flagstruct%do_sat_adj) then ! Initialize fast physics -#ifdef STATIC call ccpp_physics_init(cdata, suite_name=trim(ccpp_suite), group_name="fast_physics", ierr=ierr) -#else - call ccpp_physics_init(cdata, group_name="fast_physics", ierr=ierr) -#endif if (ierr/=0) then cdata%errmsg = ' atmosphere_dynamics: error in ccpp_physics_init for group fast_physics: ' // trim(cdata%errmsg) call mpp_error (FATAL, cdata%errmsg) @@ -715,15 +682,8 @@ end subroutine atmosphere_dynamics !! FV3 dynamical core responsible for writing out a restart and final diagnostic state. subroutine atmosphere_end (Time, Grid_box, restart_endfcst) #ifdef CCPP -#ifdef STATIC -! For static builds, the ccpp_physics_{init,run,finalize} calls -! are not pointing to code in the CCPP framework, but to auto-generated -! ccpp_suite_cap and ccpp_group_*_cap modules behind a ccpp_static_api use ccpp_static_api, only: ccpp_physics_finalize use CCPP_data, only: ccpp_suite -#else - use ccpp_api, only: ccpp_physics_finalize -#endif use CCPP_data, only: cdata => cdata_tile #endif type (time_type), intent(in) :: Time @@ -735,11 +695,7 @@ subroutine atmosphere_end (Time, Grid_box, restart_endfcst) if (Atm(mytile)%flagstruct%do_sat_adj) then ! Finalize fast physics -#ifdef STATIC call ccpp_physics_finalize(cdata, suite_name=trim(ccpp_suite), group_name="fast_physics", ierr=ierr) -#else - call ccpp_physics_finalize(cdata, group_name="fast_physics", ierr=ierr) -#endif if (ierr/=0) then cdata%errmsg = ' atmosphere_dynamics: error in ccpp_physics_finalize for group fast_physics: ' // trim(cdata%errmsg) call mpp_error (FATAL, cdata%errmsg) diff --git a/model/fv_mapz.F90 b/model/fv_mapz.F90 index 2c72074a1..5eaf9f11a 100644 --- a/model/fv_mapz.F90 +++ b/model/fv_mapz.F90 @@ -95,17 +95,10 @@ module fv_mapz_mod #ifndef CCPP use fv_cmp_mod, only: qs_init, fv_sat_adj #else -#ifdef STATIC -! For static builds, the ccpp_physics_{init,run,finalize} calls -! are not pointing to code in the CCPP framework, but to auto-generated -! ccpp_suite_cap and ccpp_group_*_cap modules behind a ccpp_static_api - use ccpp_api, only: ccpp_initialized use ccpp_static_api, only: ccpp_physics_run use CCPP_data, only: ccpp_suite -#else - use ccpp_api, only: ccpp_initialized, ccpp_physics_run -#endif - use CCPP_data, only: cdata => cdata_tile, CCPP_interstitial + use CCPP_data, only: cdata => cdata_tile + use CCPP_data, only: CCPP_interstitial #endif #ifdef MULTI_GASES use multi_gases_mod, only: virq, virqd, vicpqd, vicvqd, num_gas @@ -259,7 +252,7 @@ subroutine Lagrangian_to_Eulerian(last_step, consv, ps, pe, delp, pkz, pk, & endif !$OMP parallel do default(none) shared(is,ie,js,je,km,pe,ptop,kord_tm,hydrostatic, & -!$OMP pt,pk,rg,peln,q,nwat,liq_wat,rainwat,ice_wat,snowwat, & +!$OMP pt,pk,rg,peln,q,nwat,liq_wat,rainwat,ice_wat,snowwat, & !$OMP graupel,q_con,sphum,cappa,r_vir,rcp,k1k,delp, & !$OMP delz,akap,pkz,te,u,v,ps, gridstruct, last_step, & !$OMP ak,bk,nq,isd,ied,jsd,jed,kord_tr,fill, adiabatic, & @@ -627,9 +620,7 @@ subroutine Lagrangian_to_Eulerian(last_step, consv, ps, pe, delp, pkz, pk, & !$OMP ng,gridstruct,E_Flux,pdt,dtmp,reproduce_sum,q, & !$OMP mdt,cld_amt,cappa,dtdt,out_dt,rrg,akap,do_sat_adj, & !$OMP kord_tm,cdata,CCPP_interstitial) & -#ifdef STATIC !$OMP shared(ccpp_suite) & -#endif #ifdef MULTI_GASES !$OMP shared(num_gas) & #endif @@ -643,9 +634,7 @@ subroutine Lagrangian_to_Eulerian(last_step, consv, ps, pe, delp, pkz, pk, & !$OMP ng,gridstruct,E_Flux,pdt,dtmp,reproduce_sum,q, & !$OMP mdt,cld_amt,cappa,dtdt,out_dt,rrg,akap,do_sat_adj, & !$OMP fast_mp_consv,kord_tm,cdata, CCPP_interstitial) & -#ifdef STATIC !$OMP shared(ccpp_suite) & -#endif #ifdef MULTI_GASES !$OMP shared(num_gas) & #endif @@ -808,15 +797,11 @@ subroutine Lagrangian_to_Eulerian(last_step, consv, ps, pe, delp, pkz, pk, & if ( do_sat_adj ) then call timing_on('sat_adj2') #ifdef CCPP - if (ccpp_initialized(cdata)) then -#ifdef STATIC + if (cdata%initialized()) then call ccpp_physics_run(cdata, suite_name=trim(ccpp_suite), group_name='fast_physics', ierr=ierr) -#else - call ccpp_physics_run(cdata, group_name='fast_physics', ierr=ierr) -#endif if (ierr/=0) call mpp_error(FATAL, "Call to ccpp_physics_run for group 'fast_physics' failed") else - call mpp_error (FATAL, 'Lagrangian_to_Eulerian: can not call CCPP fast physics because cdata not initialized') + call mpp_error (FATAL, 'Lagrangian_to_Eulerian: can not call CCPP fast physics because CCPP not initialized') endif #else !$OMP do From 15c615f80e745848d0af50a47174e7c6dc851236 Mon Sep 17 00:00:00 2001 From: Dom Heinzeller Date: Tue, 12 May 2020 15:23:30 -0600 Subject: [PATCH 4/5] Remove namphysics include flags and add new arguments required for CCPP_interstitial%create routine (#20) --- driver/fvGFS/atmosphere.F90 | 1 + makefile | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/driver/fvGFS/atmosphere.F90 b/driver/fvGFS/atmosphere.F90 index 6d46233d1..c2e24927e 100644 --- a/driver/fvGFS/atmosphere.F90 +++ b/driver/fvGFS/atmosphere.F90 @@ -444,6 +444,7 @@ subroutine atmosphere_init (Time_init, Time, Time_step, Grid_box, area) Atm(mytile)%npz, Atm(mytile)%ng, & dt_atmos, p_split, Atm(mytile)%flagstruct%k_split, & zvir, Atm(mytile)%flagstruct%p_ref, Atm(mytile)%ak, Atm(mytile)%bk, & + liq_wat>0, ice_wat>0, rainwat>0, snowwat>0, graupel>0, & cld_amt>0, kappa, Atm(mytile)%flagstruct%hydrostatic, & Atm(mytile)%flagstruct%do_sat_adj, & Atm(mytile)%delp, Atm(mytile)%delz, Atm(mytile)%gridstruct%area_64, & diff --git a/makefile b/makefile index 523dc111b..530a73d19 100644 --- a/makefile +++ b/makefile @@ -23,7 +23,7 @@ endif LIBRARY = libfv3core.a -FFLAGS += -I$(FMS_DIR) -I../gfsphysics -I../ipd -I../io -I../namphysics +FFLAGS += -I$(FMS_DIR) -I../gfsphysics -I../ipd -I../io SRCS_f = From 66c8df23500bde286907a26cb3feab987dd2dba5 Mon Sep 17 00:00:00 2001 From: Dom Heinzeller Date: Fri, 5 Jun 2020 11:15:56 -0600 Subject: [PATCH 5/5] Butterfly effect (from @DusanJovic-NOAA) (#21) * Add butterfly effect option. * Move butterfly effect option from external_ic.F90 to fv_restart.F90 * model/fv_arrays.F90: provide clarification of butterfly effect in comment Co-authored-by: Dusan Jovic --- model/fv_arrays.F90 | 4 ++++ model/fv_control.F90 | 4 +++- tools/fv_restart.F90 | 21 +++++++++++++++++++++ 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/model/fv_arrays.F90 b/model/fv_arrays.F90 index d6a818857..c8d8258d6 100644 --- a/model/fv_arrays.F90 +++ b/model/fv_arrays.F90 @@ -974,6 +974,10 @@ module fv_arrays_mod !< Useful for perturbing initial conditions. -1 by default; !< disabled if 0 or negative. + logical :: butterfly_effect = .false. !< Flip the least-significant-bit of the lowest level temperature + !< at the center of the domain (the center of tile 1), if set to .true. + !< The default value is .false. + integer :: a2b_ord = 4 !< Order of interpolation used by the pressure gradient force !< to interpolate cell-centered (A-grid) values to the grid corners. !< The default value is 4 (recommended), which uses fourth-order diff --git a/model/fv_control.F90 b/model/fv_control.F90 index 25eef2317..2af7dd6d2 100644 --- a/model/fv_control.F90 +++ b/model/fv_control.F90 @@ -316,6 +316,7 @@ module fv_control_mod logical , pointer :: make_hybrid_z logical , pointer :: nudge_qv real, pointer :: add_noise + logical , pointer :: butterfly_effect integer , pointer :: a2b_ord integer , pointer :: c2l_ord @@ -669,7 +670,7 @@ subroutine run_setup(Atm, dt_atmos, grids_on_this_pe, p_split) pnats, dnats, a2b_ord, remap_t, p_ref, d2_bg_k1, d2_bg_k2, & c2l_ord, dx_const, dy_const, umax, deglat, & deglon_start, deglon_stop, deglat_start, deglat_stop, & - phys_hydrostatic, use_hydro_pressure, make_hybrid_z, old_divg_damp, add_noise, & + phys_hydrostatic, use_hydro_pressure, make_hybrid_z, old_divg_damp, add_noise, butterfly_effect, & nested, twowaynest, parent_grid_num, parent_tile, nudge_qv, & refinement, nestbctype, nestupdate, nsponge, s_weight, & ioffset, joffset, check_negative, nudge_ic, halo_update_type, gfs_phil, agrid_vel_rst, & @@ -1328,6 +1329,7 @@ subroutine setup_pointers(Atm) make_hybrid_z => Atm%flagstruct%make_hybrid_z nudge_qv => Atm%flagstruct%nudge_qv add_noise => Atm%flagstruct%add_noise + butterfly_effect => Atm%flagstruct%butterfly_effect a2b_ord => Atm%flagstruct%a2b_ord c2l_ord => Atm%flagstruct%c2l_ord ndims => Atm%flagstruct%ndims diff --git a/tools/fv_restart.F90 b/tools/fv_restart.F90 index fbe46d676..3b37ac94d 100644 --- a/tools/fv_restart.F90 +++ b/tools/fv_restart.F90 @@ -222,6 +222,8 @@ subroutine fv_restart(fv_domain, Atm, dt_atmos, seconds, days, cold_start, grid_ integer :: npts real :: sumpertn + integer :: i_butterfly, j_butterfly + rgrav = 1. / grav if(.not.module_is_initialized) call mpp_error(FATAL, 'You must call fv_restart_init.') @@ -627,6 +629,25 @@ subroutine fv_restart(fv_domain, Atm, dt_atmos, seconds, days, cold_start, grid_ call mpp_error(NOTE, errstring) endif + if (Atm(n)%flagstruct%butterfly_effect) then + if (n==1 .and. Atm(n)%tile == 1) then + i_butterfly = Atm(n)%npx / 2 + j_butterfly = Atm(n)%npy / 2 + if (isc <= i_butterfly .and. i_butterfly <= iec) then + if (jsc <= j_butterfly .and. j_butterfly <= jec) then + + write(*,'(A, I0, A, I0)') "Adding butterfly effect at (i,j) ", i_butterfly, ", ", j_butterfly + write(*,'(A, E24.17)') "pt (before) :", Atm(n)%pt(i_butterfly,j_butterfly,Atm(n)%npz) + + Atm(n)%pt(i_butterfly,j_butterfly,Atm(n)%npz) = nearest(Atm(n)%pt(i_butterfly,j_butterfly,Atm(n)%npz), -1.0) + + write(*,'(A, E24.17)') "pt (after) :", Atm(n)%pt(i_butterfly,j_butterfly,Atm(n)%npz) + + endif + endif + endif + endif + if (Atm(n)%grid_number > 1) then write(gn,'(A2, I1)') " g", Atm(n)%grid_number else