Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[wip] homme DA #6765

Open
wants to merge 48 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
9ec25eb
Merge remote-tracking branch 'MAIN/master'
oksanaguba May 11, 2023
a6d0c69
start
oksanaguba May 11, 2023
63e427f
build fixes
May 12, 2023
e4bc9c7
current debug state
oksanaguba Oct 11, 2023
421886e
turn back on da terms, disable forcing
oksanaguba Nov 4, 2023
1f63557
new top BC
oksanaguba Nov 4, 2023
0a1c3c4
_eos3 call, use in imex
oksanaguba Nov 4, 2023
380b48a
fix forcing, fix bug in eos3 wrt dphi
oksanaguba Nov 5, 2023
208b630
clean up
oksanaguba Nov 5, 2023
708b2bf
switch to FD Jacobian
oksanaguba Nov 6, 2023
bd2dc19
an attempt to have mu=1 init
oksanaguba Nov 6, 2023
38de867
infra changes to have SA/DA setups in this branch, remove phi_from_eo…
oksanaguba Mar 30, 2024
5639810
imex timers
oksanaguba Apr 9, 2024
2810d76
explicit mu=1 with iteration, no u yet
oksanaguba May 19, 2024
b88353f
forcing for DA
oksanaguba May 19, 2024
210bb5a
extend init mu=1 to QHE, switcht baro to \deep\ option in ic routine,…
oksanaguba May 27, 2024
e78851c
inital code for baroclinic test with topo from Owen Hughes
mt5555 Jul 20, 2022
84ef0bd
test case bug fixes, add namelists
mt5555 Jul 21, 2022
a902f95
bugfix in v eqn
oksanaguba Jul 25, 2024
4b2db38
Merge remote-tracking branch 'MAIN/master' into og/da
oksanaguba Nov 4, 2024
f9dc13f
make preqx compile with new baro test
oksanaguba Nov 24, 2024
b3947a1
make new baro test work with theta only, add DA checks to supercell
oksanaguba Nov 24, 2024
3029312
clean DA logic
oksanaguba Nov 24, 2024
ebbaf38
disable acc targets, add comment
oksanaguba Nov 24, 2024
17c35a4
rework cmake to have 1 DA target instead
oksanaguba Nov 24, 2024
637a1fa
remove not needed ifdef
oksanaguba Nov 25, 2024
116b2dc
adding a DA test
oksanaguba Nov 25, 2024
241226d
make da test with moisture
oksanaguba Nov 25, 2024
7195751
uncomment forcing call
oksanaguba Nov 26, 2024
1856276
clean forcing routine
oksanaguba Nov 26, 2024
f6a93eb
safeguard is_deep
oksanaguba Nov 26, 2024
b3023f4
reorganize eos call for SA+DA routine
oksanaguba Nov 26, 2024
b7967b4
formatting
oksanaguba Nov 26, 2024
4f1509e
clean caar
oksanaguba Nov 27, 2024
a37311e
clean caar
oksanaguba Nov 27, 2024
843a387
fix builds, comments
oksanaguba Nov 27, 2024
c1b367c
set DA checks in nl
oksanaguba Nov 27, 2024
4ae1384
modify comment
oksanaguba Nov 27, 2024
7d0ffb6
fix preqx_kokkos build
oksanaguba Nov 29, 2024
3d102a0
fix calls for thetal_setup
oksanaguba Nov 29, 2024
5d64fe9
fix dirk_ut thanks to AMB
oksanaguba Nov 29, 2024
90379e5
set rsplit to 1 for da test
oksanaguba Nov 29, 2024
778d016
define HOMMEDA
oksanaguba Dec 2, 2024
b657e74
remove extra imex timers
oksanaguba Dec 2, 2024
6239d8a
clean comments
oksanaguba Dec 2, 2024
6695e4c
reorganize ifdefs
oksanaguba Dec 2, 2024
4187ea0
fix some precision issues thanks to MT, comments
oksanaguba Dec 3, 2024
237d520
start on energy conservation in da
oksanaguba Dec 10, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion components/homme/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ PROJECT(HOMME C Fortran)

INCLUDE(FortranCInterface)

#if machine file sets WITH_DA, then all targets are built with DA (for unit testing)
IF (WITH_DA)
ADD_DEFINITIONS(-DHOMMEDA)
ENDIF ()

IF (${HOMME_BUILD_EXECS})
OPTION(HOMME_ENABLE_TESTING "Whether tests should be enabled" TRUE)
IF (${HOMME_ENABLE_TESTING})
Expand Down Expand Up @@ -119,7 +124,7 @@ OPTION(BUILD_HOMME_SWEQX "Shallow water equations FEM" ON)
OPTION(BUILD_HOMME_PREQX "Primitive equations FEM" ON)
OPTION(BUILD_HOMME_THETA "SB81 NH model with theta and Exner pressure" ON)
OPTION(BUILD_HOMME_THETA_KOKKOS "SB81 NH model with theta and Exner pressure, Kokkos target" OFF)
OPTION(BUILD_HOMME_PREQX_ACC "Primitive equations FEM with OpenACC" ON)
OPTION(BUILD_HOMME_PREQX_ACC "Primitive equations FEM with OpenACC" OFF)
OPTION(BUILD_HOMME_PREQX_KOKKOS "Primitive equations FEM with Kokkos" OFF)
OPTION(BUILD_HOMME_SWIM "Shallow water equations implicit" OFF)
OPTION(BUILD_HOMME_PRIM "Primitive equations implicit" OFF)
Expand Down Expand Up @@ -567,3 +572,5 @@ ADD_CUSTOM_TARGET(clean-all
COMMAND ${CMAKE_BUILD_TOOL} clean
COMMAND ${CMAKE_COMMAND} -P "${CMAKE_CURRENT_SOURCE_DIR}/cmake/clean-cmake-files.cmake"
)


2 changes: 2 additions & 0 deletions components/homme/cmake/machineFiles/chrysalis.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ EXECUTE_PROCESS(COMMAND pnetcdf-config --prefix
)
SET (PnetCDF_PATH "${PNCCONFIG_OUTPUT}" CACHE STRING "")

SET (WITH_DA FALSE CACHE BOOL "")

EXECUTE_PROCESS(COMMAND nf-config --prefix
RESULT_VARIABLE NFCONFIG_RESULT
OUTPUT_VARIABLE NFCONFIG_OUTPUT
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
!
! preqx: namelist for dcmip2016 test1: moist baroclinic wave
!_______________________________________________________________________
&ctl_nl
nthreads = -1 ! use OMP_NUM_THREADS
partmethod = 4 ! mesh parition method: 4 = space filling curve
topology = "cube" ! mesh type: cubed sphere
test_case = "dcmip2016_test1" ! test identifier
sub_case = 2
ne = 30 ! number of elements per cube face
qsize = 6 ! num tracer fields
ndays = 6
statefreq = 72 ! number of steps between screen dumps
restartfreq = -1 ! don't write restart files if < 0
runtype = 0 ! 0 => new run
tstep = 300 ! largest timestep in seconds
theta_advect_form = 1
integration = 'explicit' ! explicit time integration
tstep_type = 5 ! use 9 if running NH
dt_remap_factor = 2
dt_tracer_factor = 1
hypervis_scaling = 3.0 ! turn on RRM HV
nu = 3.4e-8 ! for all resolutions
nu_top = 0 ! default = 2.5e5
limiter_option = 10
hypervis_order = 2 ! 2 = hyperviscosity
hypervis_subcycle = 1 ! 1 = no hyperviz subcycling
moisture = 'dry'
theta_hydrostatic_mode = .true.
dcmip16_prec_type = -1 ! 0=kessler physics
dcmip16_pbl_type = -1 ! 0=reed-jablonowski pbl, -1 = none
/
&vert_nl
vfile_mid = "../vcoord/camm-30.ascii"
vfile_int = "../vcoord/cami-30.ascii"
/
&analysis_nl
! output_prefix = "r100-dry-"
output_dir = "./movies/" ! destination dir for netcdf file
output_timeunits = 2, ! 0=timesteps, 1=days, 2=hours, 3=seconds
output_frequency = 24 ! every N hours
! output_varnames1 ='T','ps','pnh','geo','u','v','w','omega','Th','Q','Q2','Q3','Q4','Q5','rho','precl','zeta' ! variables to write to file
output_varnames1 ='T','ps','pnh','geo','u','Th','Q','Q2','Q3','Q4','Q5','precl','zeta' ! variables to write to file
interp_type = 1 ! 0=native grid, 1=bilinear
output_type ='netcdf' ! netcdf or pnetcdf
num_io_procs = 16
interp_nlon = 1024
interp_nlat = 513
interp_gridtype = 1
/
&prof_inparm
profile_outpe_num = 100
profile_single_file = .true.
/
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
!
! preqx: namelist for dcmip2016 test1: moist baroclinic wave
!_______________________________________________________________________
&ctl_nl
nthreads = -1 ! use OMP_NUM_THREADS
partmethod = 4 ! mesh parition method: 4 = space filling curve
topology = "cube" ! mesh type: cubed sphere
test_case = "dcmip2016_test1" ! test identifier
sub_case = 2
ne = 120 ! number of elements per cube face
qsize = 6 ! num tracer fields
ndays = 6
statefreq = 72 ! number of steps between screen dumps
restartfreq = -1 ! don't write restart files if < 0
runtype = 0 ! 0 => new run
tstep = 75 ! largest timestep in seconds
theta_advect_form = 1
integration = 'explicit' ! explicit time integration
tstep_type = 5 ! use 9 if running NH
dt_remap_factor = 2
dt_tracer_factor = 1
hypervis_scaling = 3.0 ! turn on RRM HV
nu = 3.4e-8 ! for all resolutions
nu_top = 0 ! default = 2.5e5
limiter_option = 10
hypervis_order = 2 ! 2 = hyperviscosity
hypervis_subcycle = 1 ! 1 = no hyperviz subcycling
moisture = 'dry'
theta_hydrostatic_mode = .true.
dcmip16_prec_type = -1 ! 0=kessler physics
dcmip16_pbl_type = -1 ! 0=reed-jablonowski pbl, -1 = none
/
&vert_nl
vfile_mid = "../vcoord/camm-30.ascii"
vfile_int = "../vcoord/cami-30.ascii"
/
&analysis_nl
! output_prefix = "r100-dry-"
output_dir = "./movies/" ! destination dir for netcdf file
output_timeunits = 2, ! 0=timesteps, 1=days, 2=hours, 3=seconds
output_frequency = 24 ! every N hours
! output_varnames1 ='T','ps','pnh','geo','u','v','w','omega','Th','Q','Q2','Q3','Q4','Q5','rho','precl','zeta' ! variables to write to file
output_varnames1 ='T','ps','pnh','geo','u','Th','Q','Q2','Q3','Q4','Q5','precl','zeta' ! variables to write to file
interp_type = 1 ! 0=native grid, 1=bilinear
output_type ='netcdf' ! netcdf or pnetcdf
num_io_procs = 16
interp_nlon = 4096
interp_nlat = 2049
interp_gridtype = 1
/
&prof_inparm
profile_outpe_num = 100
profile_single_file = .true.
/
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
!
! preqx: namelist for dcmip2016 test1: moist baroclinic wave
!_______________________________________________________________________
&ctl_nl
nthreads = -1 ! use OMP_NUM_THREADS
partmethod = 4 ! mesh parition method: 4 = space filling curve
topology = "cube" ! mesh type: cubed sphere
test_case = "dcmip2016_test1" ! test identifier
sub_case = 2
ne = 0 ! number of elements per cube face
mesh_file = '/lcrc/group/e3sm/data/inputdata/atm/cam/inic/homme/northamericax4v1.g'
qsize = 6 ! num tracer fields
ndays = 6
statefreq = 72 ! number of steps between screen dumps
restartfreq = -1 ! don't write restart files if < 0
runtype = 0 ! 0 => new run
tstep = 75 ! largest timestep in seconds
theta_advect_form = 1
integration = 'explicit' ! explicit time integration
tstep_type = 5 ! use 9 if running NH
dt_remap_factor = 2
dt_tracer_factor = 1
hypervis_scaling = 3.0
nu = 3.4e-8
nu_top = 0 ! default = 2.5e5
limiter_option = 10
hypervis_order = 2 ! 2 = hyperviscosity
hypervis_subcycle = 2 ! is 1 stable?
moisture = 'dry'
theta_hydrostatic_mode = .true.
dcmip16_prec_type = -1 ! 0=kessler physics
dcmip16_pbl_type = -1 ! 0=reed-jablonowski pbl, -1 = none
/
&vert_nl
vfile_mid = "../vcoord/camm-30.ascii"
vfile_int = "../vcoord/cami-30.ascii"
/
&analysis_nl
! output_prefix = "r100-dry-"
output_dir = "./movies/" ! destination dir for netcdf file
output_timeunits = 2, ! 0=timesteps, 1=days, 2=hours, 3=seconds
output_frequency = 24 ! every N hours
! output_varnames1 ='T','ps','pnh','geo','u','v','w','omega','Th','Q','Q2','Q3','Q4','Q5','rho','precl','zeta' ! variables to write to file
output_varnames1 ='T','ps','pnh','geo','u','Th','min_dx','zeta' ! variables to write to file
interp_type = 1 ! 0=native grid, 1=bilinear
output_type ='netcdf' ! netcdf or pnetcdf
num_io_procs = 16
interp_nlon = 4096
interp_nlat = 2049
interp_gridtype = 1
/
&prof_inparm
profile_outpe_num = 100
profile_single_file = .true.
/
3 changes: 2 additions & 1 deletion components/homme/src/preqx/derivative_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ module derivative_mod
gradient_sphere_wk_testcov, gradient_sphere_wk_testcontra, ugradv_sphere, vorticity_sphere, vorticity_sphere_diag, &
curl_sphere,curl_sphere_wk_testcov, vlaplace_sphere_wk, element_boundary_integral, &
limiter_optim_iter_full, limiter_clip_and_sum, laplace_sphere_wk, divergence_sphere_wk, gradient_sphere, &
divergence_sphere, laplace_z
divergence_sphere, laplace_z, &
get_deriv
implicit none
end module derivative_mod
2 changes: 1 addition & 1 deletion components/homme/src/preqx_kokkos/derivative_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ module derivative_mod
gradient_sphere_wk_testcov, gradient_sphere_wk_testcontra, ugradv_sphere, vorticity_sphere, vorticity_sphere_diag, &
curl_sphere,curl_sphere_wk_testcov, vlaplace_sphere_wk, element_boundary_integral, &
limiter_optim_iter_full, limiter_clip_and_sum, laplace_sphere_wk, divergence_sphere_wk, gradient_sphere, &
divergence_sphere, laplace_z
divergence_sphere, laplace_z, get_deriv
implicit none
end module derivative_mod
6 changes: 5 additions & 1 deletion components/homme/src/share/cube_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -788,11 +788,15 @@ subroutine coriolis_init_atomic(elem)
if ( rotate_grid /= 0) then
lat = elem%spherep(i,j)%lat
lon = elem%spherep(i,j)%lon
elem%fcor(i,j)= 2*omega* &
elem%fcor(i,j)= 2*omega* &
(-cos(lon)*cos(lat)*sin(rangle) + sin(lat)*cos(rangle))
else
elem%fcor(i,j) = 2.0D0*omega*SIN(elem%spherep(i,j)%lat)
endif
#ifdef HOMMEDA
!DA term, only nonrotated version
elem%fcorcosine(i,j) = 2.0D0*omega*COS(elem%spherep(i,j)%lat)
#endif
end do
end do

Expand Down
6 changes: 4 additions & 2 deletions components/homme/src/share/element_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,10 @@ module element_mod

integer(kind=long_kind) :: gdofP(np,np) ! global degree of freedom (P-grid)

real (kind=real_kind) :: fcor(np,np) ! Coriolis term

real (kind=real_kind) :: fcor(np,np) ! Coriolis term sin
#ifdef HOMMEDA
real (kind=real_kind) :: fcorcosine(np,np) ! Coriolis term cos
#endif
type (index_t) :: idxP
integer :: FaceNum

Expand Down
24 changes: 24 additions & 0 deletions components/homme/src/share/namelist_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -819,7 +819,9 @@ subroutine readnl(par)
call MPI_bcast(smooth_phis_nudt,1,MPIreal_t ,par%root,par%comm,ierr)
call MPI_bcast(initial_total_mass ,1,MPIreal_t ,par%root,par%comm,ierr)
call MPI_bcast(u_perturb ,1,MPIreal_t ,par%root,par%comm,ierr)

call MPI_bcast(rotate_grid ,1,MPIreal_t ,par%root,par%comm,ierr)

call MPI_bcast(integration,MAX_STRING_LEN,MPIChar_t ,par%root,par%comm,ierr)
#ifndef HOMME_WITHOUT_PIOLIBRARY
call MPI_bcast(mesh_file,MAX_FILE_LEN,MPIChar_t ,par%root,par%comm,ierr)
Expand Down Expand Up @@ -911,6 +913,22 @@ subroutine readnl(par)
call MPI_bcast(use_column_solver, 1, MPIlogical_t, par%root, par%comm, ierr)
#endif

!all DA warnings together
#ifdef HOMMEDA
if ( rotate_grid /= 0 ) then
if(par%masterproc) print *, 'DA (deep atmosphere) cannot run with rotate_grid != 0'
call abortmp('stopping')
endif
if ( ( rsplit == 0 ) .or. (dt_remap_factor == 0) ) then
if(par%masterproc) print *, 'DA (deep atmosphere) cannot run with rsplit or dt_remap = 0'
call abortmp('stopping')
endif
if ( theta_hydrostatic_mode ) then
if(par%masterproc) print *, 'DA (deep atmosphere) cannot run with theta_hydrostatic_mode=T'
call abortmp('stopping')
endif
#endif

! should we assume Q(:,:,:,1) has water vapor:
use_moisture = ( moisture /= "dry")
if (qsize<1) use_moisture = .false.
Expand Down Expand Up @@ -1271,6 +1289,12 @@ subroutine readnl(par)
write(iulog,*)"physconst: rearth = ",rearth
write(iulog,*)"physconst: rrearth= ",rrearth
write(iulog,*)""
#ifdef HOMMEDA
write(iulog,*)"--- DEEP ATMOSPHERE ----------"
#else
write(iulog,*)"--- SHALLOW ATMOSPHERE -------"
#endif
write(iulog,*)""
#endif

#if !defined(CAM) && !defined(SCREAM)
Expand Down
Loading
Loading