Write the energy exchange to netCDF
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | file_id |
NetCDF ID of the file to write to |
||
integer, | intent(in) | :: | nout |
Current output timestep |
||
real, | intent(in), | dimension (:,:,:) | :: | exchange |
Energy exchange |
|
real, | intent(in), | dimension (:) | :: | exchange_avg |
Volume-averaged energy exchange |
subroutine nc_exchange (file_id, nout, exchange, exchange_avg)
# ifdef NETCDF
use run_parameters, only: has_phi
use neasyf, only: neasyf_write
# endif
implicit none
!> NetCDF ID of the file to write to
integer, intent(in) :: file_id
!> Current output timestep
integer, intent (in) :: nout
!> Energy exchange
real, dimension (:,:,:), intent (in) :: exchange
!> Volume-averaged energy exchange
real, dimension (:), intent (in) :: exchange_avg
# ifdef NETCDF
if (has_phi) then
call neasyf_write (file_id, "es_exchange", exchange_avg, &
dim_names=flux_dims, start=starts(2, nout))
call neasyf_write (file_id, "es_exchange_by_k", exchange, &
dim_names=fluxk_dims, start=starts(4, nout))
end if
# endif
end subroutine nc_exchange