Skip to content

Commit 84a0218

Browse files
cacraigucarnusbaumejimmielin
authored
Bring in cam_in/cam_out variables to the registry (#402)
Tag name (required for release branches): Originator(s): cacraigucar nusbaume Description (include the issue title, and the keyword ['closes', 'fixes', 'resolves'] followed by the issue number): Closes #23 Describe any changes made to build system: N/A Describe any changes made to the namelist: N/A List any changes to the defaults for the input datasets (e.g. boundary datasets): N/A List all files eliminated and why: D src/control/camsrfexch.F90 D src/control/camsrfexch.meta - camsrfexch is not needed in CAM-SIMA and was just a temporary routine until cam_in/cam_out were fully implemented List all files added and what they do: A test/unit/python/sample_files/physics_types_ddt_mf.F90 A test/unit/python/sample_files/physics_types_ddt_mf.meta - test new functionality List all existing files that have been modified, and describe the changes: (Helpful git command: `git diff --name-status development...<your_branch_name>`) M .gitmodules - Update atmospheric_physics external M src/control/cam_comp.F90 M src/cpl/nuopc/atm_comp_nuopc.F90 M src/dynamics/mpas/stepon.F90 M src/dynamics/none/stepon.F90 M src/dynamics/se/stepon.F90 - Use cam_in/cam_out from the registry now (physics_types) M src/cpl/nuopc/atm_import_export.F90 M src/cpl/nuopc/atm_stream_ndep.F90 - Use cam_in/cam_out from the registry now (physics_types) - Fix bugs in code which was previously #if def'd out M src/physics/utils/phys_comp.F90 - New interface for allocate_physics_types_fields M src/data/generate_registry_data.py - Grab dimensions via 'use' statements instead of input arguments in the generated 'allocate_physics_types_fields' subroutine to allow for arbitrary registry variable order M test/unit/python/sample_files/physics_types_complete.F90 M test/unit/python/sample_files/physics_types_complete.meta M test/unit/python/sample_files/physics_types_ddt2.F90 M test/unit/python/sample_files/physics_types_ddt_array.F90 M test/unit/python/sample_files/physics_types_ddt_eul.F90 M test/unit/python/sample_files/physics_types_ddt_eul.meta M test/unit/python/sample_files/physics_types_ddt_fv.F90 M test/unit/python/sample_files/physics_types_ddt_fv.meta M test/unit/python/sample_files/physics_types_ddt_se.F90 M test/unit/python/sample_files/physics_types_ddt_se.meta M test/unit/python/sample_files/physics_types_parameter.F90 M test/unit/python/sample_files/physics_types_simple.F90 M test/unit/python/sample_files/reg_good_complete.xml M test/unit/python/sample_files/reg_good_ddt.xml M test/unit/python/sample_files/reg_good_mf.xml M test/unit/python/test_registry.py - update tests as needed with the new code M src/data/registry.xml - Fully implement cam_in/cam_out If there are new failures (compared to the `test/existing-test-failures.txt` file), have them OK'd by the gatekeeper, note them here, and add them to the file. If there are baseline differences, include the test and the reason for the diff. What is the nature of the change? Roundoff? derecho/intel/aux_sima: All BFB derecho/gnu/aux_sima: All BFB --------- Co-authored-by: Jesse Nusbaumer <nusbaume@ucar.edu> Co-authored-by: Haipeng Lin <myself@jimmielin.me>
1 parent 420b269 commit 84a0218

32 files changed

+998
-345
lines changed

.gitmodules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
[submodule "ncar-physics"]
2121
path = src/physics/ncar_ccpp
2222
url = https://github.com/ESCOMP/atmospheric_physics
23-
fxtag = e92f76351e7f7703fb6d91cb5e76dcbbc6dcb3f2
23+
fxtag = 754a0c28631655289765e99f747c1d96a6d882f4
2424
fxrequired = AlwaysRequired
2525
fxDONOTUSEurl = https://github.com/ESCOMP/atmospheric_physics
2626
[submodule "rrtmgp-data"]

src/control/cam_comp.F90

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ module cam_comp
2525
use time_manager, only: is_first_step, is_first_restart_step
2626
use time_manager, only: get_curr_calday
2727

28-
use camsrfexch, only: cam_out_t, cam_in_t
28+
use physics_types, only: cam_out_t, cam_in_t
2929
use physics_types, only: phys_state, phys_tend
3030
use physics_types, only: dtime_phys
3131
use physics_types, only: calday
@@ -90,7 +90,6 @@ subroutine cam_init(caseid, ctitle, model_doi_url, &
9090
use phys_comp, only: phys_register
9191
use dyn_comp, only: dyn_init
9292
! use cam_restart, only: cam_read_restart
93-
use camsrfexch, only: hub2atm_alloc, atm2hub_alloc
9493
use cam_history, only: history_init_files
9594
! use history_scam, only: scm_intht
9695
use cam_pio_utils, only: init_pio_subsystem
@@ -232,10 +231,6 @@ subroutine cam_init(caseid, ctitle, model_doi_url, &
232231

233232
call dyn_init(cam_runtime_opts, dyn_in, dyn_out)
234233

235-
! Allocate and setup surface exchange data
236-
call atm2hub_alloc(cam_out)
237-
call hub2atm_alloc(cam_in)
238-
239234
else
240235

241236
!!XXgoldyXX: v need to import this
@@ -563,7 +558,6 @@ subroutine cam_final(cam_out, cam_in)
563558
use stepon, only: stepon_final
564559
use phys_comp, only: phys_final
565560
use cam_initfiles, only: cam_initfiles_close
566-
use camsrfexch, only: atm2hub_deallocate, hub2atm_deallocate
567561
! use ionosphere_interface, only: ionosphere_final
568562
use cam_control_mod, only: initial_run
569563

@@ -583,9 +577,6 @@ subroutine cam_final(cam_out, cam_in)
583577
call cam_initfiles_close()
584578
end if
585579

586-
call hub2atm_deallocate(cam_in)
587-
call atm2hub_deallocate(cam_out)
588-
589580
! This flush attempts to ensure that asynchronous diagnostic prints
590581
! from all processes do not get mixed up with the "END OF MODEL RUN"
591582
! message printed by masterproc below. The test-model script

src/control/camsrfexch.F90

Lines changed: 0 additions & 186 deletions
This file was deleted.

src/control/camsrfexch.meta

Lines changed: 0 additions & 13 deletions
This file was deleted.

src/cpl/nuopc/atm_comp_nuopc.F90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ module atm_comp_nuopc
4343
use cam_instance , only : cam_instance_init, inst_suffix, inst_index
4444
use cam_comp , only : cam_init, cam_run1, cam_run2, cam_run3, cam_run4, cam_final
4545
use cam_comp , only : cam_timestep_init, cam_timestep_final
46-
use camsrfexch , only : cam_out_t, cam_in_t
46+
use physics_types , only : cam_out_t, cam_in_t
4747
! use radiation , only : nextsw_cday !uncomment once radiation has been CCPP-ized -JN
4848
use cam_logfile , only : cam_set_log_unit, iulog
4949
use cam_abortutils , only : check_allocate

src/cpl/nuopc/atm_import_export.F90

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,7 @@ subroutine import_fields( gcomp, cam_in, restart_init, rc)
458458
! copy from field pointer to CAM-SIMA array data structure
459459
! -----------------------------------------------------
460460

461-
use camsrfexch , only : cam_in_t
461+
use physics_types , only : cam_in_t
462462
use shr_const_mod , only : shr_const_stebol
463463
use shr_sys_mod , only : shr_sys_abort
464464
use nuopc_shr_methods , only : chkerr
@@ -526,9 +526,6 @@ subroutine import_fields( gcomp, cam_in, restart_init, rc)
526526
! Required atmosphere input fields
527527
!--------------------------
528528

529-
!Remove once the "cam_in" object has been fully implemented. -JN
530-
#if 0
531-
532529
if (overwrite_flds) then
533530
call state_getfldptr(importState, 'Faxx_taux', fldptr=fldptr_taux, rc=rc)
534531
if (ChkErr(rc,__LINE__,u_FILE_u)) return
@@ -540,7 +537,7 @@ subroutine import_fields( gcomp, cam_in, restart_init, rc)
540537
if (ChkErr(rc,__LINE__,u_FILE_u)) return
541538
do i = 1, columns_on_task
542539
cam_in%wsx(i) = -fldptr_taux(i) * med2mod_areacor(i)
543-
cam_in%wsy(i) = -fldptr_tauy(g) * med2mod_areacor(i)
540+
cam_in%wsy(i) = -fldptr_tauy(i) * med2mod_areacor(i)
544541
cam_in%shf(i) = -fldptr_sen(i) * med2mod_areacor(i)
545542
cam_in%cflx(i,1) = -fldptr_evap(i) * med2mod_areacor(i)
546543
end do
@@ -599,6 +596,8 @@ subroutine import_fields( gcomp, cam_in, restart_init, rc)
599596
cam_in%landfrac(i) = fldptr_lfrac(i)
600597
end do
601598

599+
! Commented out until dimensions and usage are figured out
600+
#if 0
602601
! Optional fields
603602

604603
call state_getfldptr(importState, 'Sl_ram1', fldptr=fldptr1d, exists=exists, rc=rc)
@@ -676,7 +675,11 @@ subroutine import_fields( gcomp, cam_in, restart_init, rc)
676675
cam_in%fireztop(i) = fldptr1d(i)
677676
end do
678677
end if
678+
#endif
679679

680+
#if 0
681+
! Ignoring depvel for now as it has a problematic second dimension (number of dry deposited species)
682+
! and it was determined that it probably will not be used in CAM-SIMA for some time
680683
! dry dep velocities
681684
call state_getfldptr(importState, 'Sl_ddvel', fldptr2d=fldptr2d, exists=exists, rc=rc)
682685
if (ChkErr(rc,__LINE__,u_FILE_u)) return
@@ -687,7 +690,10 @@ subroutine import_fields( gcomp, cam_in, restart_init, rc)
687690
end do
688691
end do
689692
end if
693+
#endif
690694

695+
#if 0
696+
! Commented out until water isotopes or carbon ccle fluxe are implemented in CAM-SIMA
691697
! fields needed to calculate water isotopes to ocean evaporation processes
692698
call state_getfldptr(importState, 'So_ustar', fldptr=fldptr1d, exists=exists, rc=rc)
693699
if (ChkErr(rc,__LINE__,u_FILE_u)) return
@@ -806,7 +812,9 @@ subroutine import_fields( gcomp, cam_in, restart_init, rc)
806812
cam_in%cflx(i,c_i(4)) = cam_in%cflx(i,c_i(1)) + cam_in%cflx(i,c_i(2)) + cam_in%cflx(i,c_i(3))
807813
end do
808814
end do
815+
809816
end if
817+
#endif
810818

811819
! if first step, determine longwave up flux from the surface temperature
812820
if (first_time) then
@@ -818,9 +826,6 @@ subroutine import_fields( gcomp, cam_in, restart_init, rc)
818826
first_time = .false.
819827
end if
820828

821-
!Remove once the "cam_in" object has been fully implemented. -JN
822-
#endif
823-
824829
end subroutine import_fields
825830

826831
!===============================================================================
@@ -835,7 +840,7 @@ subroutine export_fields( gcomp, model_mesh, model_clock, cam_out, rc)
835840
use ESMF , only : ESMF_Clock
836841
use nuopc_shr_methods , only : chkerr
837842
use srf_field_check , only : active_Faxa_nhx, active_Faxa_noy
838-
use camsrfexch , only : cam_out_t
843+
use physics_types , only : cam_out_t
839844
use time_manager , only : is_first_step, get_nstep
840845
use physics_grid , only : columns_on_task
841846
use atm_stream_ndep , only : stream_ndep_init, stream_ndep_interp
@@ -884,9 +889,6 @@ subroutine export_fields( gcomp, model_mesh, model_clock, cam_out, rc)
884889
call NUOPC_ModelGet(gcomp, exportState=exportState, rc=rc)
885890
if (ChkErr(rc,__LINE__,u_FILE_u)) return
886891

887-
!Remove once the "cam_in" object has been fully implemented. -JN
888-
#if 0
889-
890892
! required export state variables
891893
call state_getfldptr(exportState, 'Sa_topo', fldptr=fldptr_topo, rc=rc)
892894
if (ChkErr(rc,__LINE__,u_FILE_u)) return
@@ -947,8 +949,8 @@ subroutine export_fields( gcomp, model_mesh, model_clock, cam_out, rc)
947949
fldptr_swnet(i) = cam_out%netsw(i) * mod2med_areacor(i)
948950
fldptr_snowc(i) = cam_out%precsc(i)*1000._r8 * mod2med_areacor(i)
949951
fldptr_snowl(i) = cam_out%precsl(i)*1000._r8 * mod2med_areacor(i)
950-
fldptr_rainc(i) = (cam_out%precc(i) - cam_out(c)%precsc(i))*1000._r8 * mod2med_areacor(i)
951-
fldptr_rainl(i) = (cam_out%precl(i) - cam_out(c)%precsl(i))*1000._r8 * mod2med_areacor(i)
952+
fldptr_rainc(i) = (cam_out%precc(i) - cam_out%precsc(i))*1000._r8 * mod2med_areacor(i)
953+
fldptr_rainl(i) = (cam_out%precl(i) - cam_out%precsl(i))*1000._r8 * mod2med_areacor(i)
952954
fldptr_soll(i) = cam_out%soll(i) * mod2med_areacor(i)
953955
fldptr_sols(i) = cam_out%sols(i) * mod2med_areacor(i)
954956
fldptr_solld(i) = cam_out%solld(i) * mod2med_areacor(i)
@@ -1035,13 +1037,10 @@ subroutine export_fields( gcomp, model_mesh, model_clock, cam_out, rc)
10351037
scale_ndep = 1._r8
10361038
end if
10371039
do i = 1, columns_on_task
1038-
fldptr_ndep(1,i) = cam_out(c)%nhx_nitrogen_flx(i) * scale_ndep * mod2med_areacor(i)
1039-
fldptr_ndep(2,i) = cam_out(c)%noy_nitrogen_flx(i) * scale_ndep * mod2med_areacor(i)
1040+
fldptr_ndep(1,i) = cam_out%nhx_nitrogen_flx(i) * scale_ndep * mod2med_areacor(i)
1041+
fldptr_ndep(2,i) = cam_out%noy_nitrogen_flx(i) * scale_ndep * mod2med_areacor(i)
10401042
end do
10411043

1042-
!Remove once the "cam_in" object has been fully implemented. -JN
1043-
#endif
1044-
10451044
end subroutine export_fields
10461045

10471046
!===============================================================================

0 commit comments

Comments
 (0)