Skip to content

Commit

Permalink
WIP Adapt gw_drag.F90 to import ftorch and read in a net from file. T…
Browse files Browse the repository at this point in the history
…ODO: Move reading net to init routine.
  • Loading branch information
jatkinson1000 committed Aug 6, 2024
1 parent def03f0 commit 12a8003
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/physics/cam/gw_drag.F90
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ module gw_drag
use cam_logfile, only: iulog
use cam_abortutils, only: endrun

use ftorch

use ref_pres, only: do_molec_diff, nbot_molec, press_lim_idx
use physconst, only: cpair

Expand Down Expand Up @@ -1414,6 +1416,17 @@ subroutine gw_tend(state, pbuf, dt, ptend, cam_in, flx_heat)
real(r8) :: zi(state%ncol,pver+1)
!------------------------------------------------------------------------

type(torch_tensor), dimension(1) :: in_tensors
type(torch_module) :: gw_convect_dp_nn

gw_convect_dp_nn = torch_module_load(gw_convect_dp_ml_net)

if (masterproc) then
write(iulog,*) 'Made a torch tensor and loaded a net!'
endif
call torch_tensor_delete(in_tensors(1))
call torch_module_delete(gw_convect_dp_nn)

! Make local copy of input state.
call physics_state_copy(state, state1)

Expand Down

0 comments on commit 12a8003

Please sign in to comment.