Skip to content

Commit

Permalink
feature/chgres_thom_mp This commit references ufs-community#106.
Browse files Browse the repository at this point in the history
Add write of qnifa.
  • Loading branch information
GeorgeGayno-NOAA committed Jun 9, 2020
1 parent cbae9ea commit 7137428
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion sorc/chgres_cube.fd/write_data.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1098,6 +1098,7 @@ subroutine write_fv3_atm_data_netcdf(localpet)
ps_target_grid, &
zh_target_grid, &
dzdt_target_grid, &
qnifa_target_grid, &
tracers_target_grid, &
temp_target_grid, &
delp_target_grid, &
Expand Down Expand Up @@ -1134,7 +1135,7 @@ subroutine write_fv3_atm_data_netcdf(localpet)
integer :: id_lat_w, id_lon_w
integer :: id_w, id_zh, id_u_w
integer :: id_v_w, id_u_s, id_v_s
integer :: id_t, id_delp
integer :: id_t, id_delp, id_qnifa
integer :: i_start, i_end, j_start, j_end
integer :: i_target_out, j_target_out
integer :: ip1_target_out, jp1_target_out
Expand Down Expand Up @@ -1289,6 +1290,11 @@ subroutine write_fv3_atm_data_netcdf(localpet)
call netcdf_err(error, 'DEFINING TRACERS COORD' )
enddo

error = nf90_def_var(ncid, 'qnifa', NF90_FLOAT, (/dim_lon,dim_lat,dim_lev/), id_qnifa)
call netcdf_err(error, 'DEFINING QNIFA' )
error = nf90_put_att(ncid, id_qnifa, "coordinates", "geolon geolat")
call netcdf_err(error, 'DEFINING QNIFA COORD' )

error = nf90_def_var(ncid, 'u_w', NF90_FLOAT, (/dim_lonp,dim_lat,dim_lev/), id_u_w)
call netcdf_err(error, 'DEFINING U_W' )
error = nf90_put_att(ncid, id_u_w, "coordinates", "geolon_w geolat_w")
Expand Down Expand Up @@ -1463,6 +1469,22 @@ subroutine write_fv3_atm_data_netcdf(localpet)

enddo

! qnifa

do tile = 1, num_tiles_target_grid
print*,"- CALL FieldGather FOR TARGET GRID QNIFA FOR TILE: ", tile
call ESMF_FieldGather(qnifa_target_grid, data_one_tile_3d, rootPet=tile-1, tile=tile, rc=error)
if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) &
call error_handler("IN FieldGather", error)
enddo

if (localpet < num_tiles_target_grid) then
dum3d(:,:,:) = data_one_tile_3d(i_start:i_end,j_start:j_end,:)
dum3d(:,:,1:lev_target) = dum3d(:,:,lev_target:1:-1)
error = nf90_put_var( ncid, id_qnifa, dum3d)
call netcdf_err(error, 'WRITING QNIFA RECORD' )
endif

deallocate(dum3d, data_one_tile_3d)

! lat/lon_s
Expand Down

0 comments on commit 7137428

Please sign in to comment.