﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
870	CLARIFICATION: Surface net freshwater flux	arango		"Several changes were introduced in src:ticket:869 about how to process the surface/bottom tracer fluxes that are used as top/bottom boundary conditions to the vertical diffusion terms. A couple of additional changes are made here to remove any ambiguity about the surface freshwater flux needed for ROMS.

Notice that ROMS has the following vertical surface/bottom boundary condition for temperature and salinity:

[[Image(https://www.myroms.org/trac/stflux.png, center, 600)]]

In particular, the blue square shows what ROMS needs as a freshwater flux.  Usually, '''E-P''' is in units of '''kilogram meter-2 second-1'''.  Then, the flux is divided by freshwater density, which converts to '''meter second-1'''.  In routine '''set_vbc.F''' such flux is multiplied by the surface salinity.  Since the salinity does not have [https://www.myroms.org/forum/viewtopic.php?t=294 physical units], the vertical boundary condition is still in '''meter second-1'''.

I cleaned the metadata in '''varinfo.dat''', now we have:
{{{
'ssflux'                                           ! Output
  'kinematic surface net salt flux, SALT*(E-P)/rhow'
  'meter second-1'                                 ! [PSS m/s]
  'surface net salt flux, scalar, series'
  'ssf_time'
  'idTsur(isalt)'
  'r2dvar'
  1.0d0

'swflux'                                           ! Input
  'data surface net freshwater flux, (E-P)/rhow'
  'meter second-1'                                 ! Input:  [m/s]
  'surface net freshwater flux, scalar, series'    ! [PSS m/s]
  'swf_time'
  'idsfwf'
  'r2dvar'
  1.0d0

'EminusP'                                          ! Input/Output
  'modeled surface net freshwater flux, (E-P)/rhow'
  'meter second-1'                                 ! computed by NLM ROMS
  'EminusP, scalar, series'                        ! bulk_flux.F or coupling
  'ocean_time'
  'idEmPf'
  'r2dvar'
  1.0d0
}}}

As specified in the preamble of '''varinfo.dat''', the '''PSS''' information is added to indicate that the Practical Salinity Scale was used to determine conductivity, but it is not a physical unit.  We are not using the latest UNESCO equation of state.

We have two different variables for input freshwater flux: '''swflux''' and '''EminusP'''. Historically, '''swflux''' has been used for available datasets while '''EminusP''' has been used when derived from parameterizations ('''BULK_FLUXES''' and atmospheric coupling).  To avoid any confusion, the units and scale for '''swflux''' were changed to '''meter second-1''' and '''1.0d0''', respectively. It is the standard unit for freshwater flux.  If such field is in '''centimeter day-1''', I recomend to add the '''scale_factor''' attribute to the NetCDF, so the conversion is done during reading in ROMS:
{{{
        float swflux(swf_time, eta_rho, xi_rho) ;
                swflux:long_name = ""surface freshwater flux, (E-P)/rhow"" ;
                swflux:units = ""meter second-1"" ;
                swflux:negative = ""net evaporation"" ;
                swflux:positive = ""net precipitation"" ;
                swflux:time = ""swf_time"" ;
                swflux:coordinates = ""lon_rho lat_rho swf_time"" ;
                swflux:scale_factor = 1.157407e-07f ;
}}}
We could use the Matlab script to adjust the NetCDF file:
{{{
nc_attadd('my_file.nc','scale_factor',0.01/86400,'swflux')
}}}

----

* Corrected '''get_data.F''' and '''set_data.F''' processing of the freshwater flux when the '''SCORRECTION''' is activated.

* Corrected compiling issue in '''regrid.F'''.  It was missing the '''MASKING''' conditional."	upgrade	closed	major	Release ROMS/TOMS 3.9	Nonlinear	3.9	Done		
