The algorithms for the Modularized Flux Testbed (MFT) can be downloaded through this web site or taken from our public FTP site (anonymous FTP to coaps.fsu.edu, change directories to pub/bourasssa/mft).
The following files are needed to call the MFT library from IDL.
mft12.c: the library of algorithms,
mft12.h: header file with function prototypes,
The following files are needed to determine fluxes without height adjustment (currently not available)
mft12.pro: IDL subroutine used to call shell for bvw 'C' code,
call_mft12.c: 'C' shell used to call bvw 'C' code from the IDL subroutine (bvw99.pro),
testdata12.dat: input and output data for the test program.
test_mft.pro: example and test program for 'IDL'.
The following files are needed to determine fluxes and height adjust wind, potential temperature and humidity
ht_adj12.pro: IDL subroutine used to call shell for bvw 'C' code,
call_ht_adj12.c: 'C' shell used to call bvw 'C' code from the IDL subroutine (bvw99.pro),
call_ht_adj12.h: Definition file for the 'C' shell used to call bvw 'C' code from the IDL subroutine (bvw99.pro),
testdata12.dat: input and output data for the test program.
test_ht_adj12.pro: example and test program for 'IDL'.
How to Compile BVW (Flux and sea state) Code
cc -c -fPIC call_mft12.c
ld -shared -o call_mft12.so call_mft12.o
The file call_mft12.so can be called from the IDL routine. This subroutine must be in the same directory as the main IDL program.
How to Compile Height Adjustment Code
cc -c -fPIC call_ht_adj12.c
ld -shared -o call_ht_adj12.so call_ht_adj12.o
The file call_ht_adj12.so can be called from the IDL routine.
Use of the Test Routine
The test program can be used to check for compiler related changes in output. The test code also demonstrates how to call the main MFT routine. The test program reads in data from the file testdata12.dat, and outputs to the screen. This output from test_mft12.pro should match the second table in the file testdata12.dat. The output from test_ht_adj12.pro should match the 3rd table. There are differences that depend on the compiler settings. Differences in the 3rd significant decimal place can be expected; the more troublesome comparisons (late in the list) could have larger errors.Example Variable Declaration and Calls
It is a lot easier to program if you have examples, and even better if you can cut and paste. These examples are taken from the test codes.
pmix (Not working at this time; notes also need updating)
lhf = 0.0
shf = 0.0
tau = FLTARR(2)
tau = [0.0, 0.0]
u_star = FLTARR(2)
u_star = [0.0, 0.0]
t_star = 0.0
q_star = 0.0
z_over_L = 0.0
wave_age = 0.0
dom_phs_spd = 0.0
h_sig = 0.0
ww_stab = 0.0
zo_m = [0.0, 0.0]
u_at_z = 0.0
t_at_z = 0.0
q_at_z = 0.0
CONV_CRIT = 0.00005 ; convergence critereon (fractional change) [] */
CONVECT = 1.25 ; convective parameter */
warn = 1L ; warning are given */
eqv_neut_prm = 0L ; output winds are winds rather than equivalent neutral winds
sst_prm = 0L ; skin (0) vs. bulk (1)
Qnet = 25.0 ; Radiative flux in W/m^2
z_wanted = 10.0; ; height to which winds, potential temp,
flux_model = 9L ; 0L = BVW model
z0_mom_prm = 0L ; not used - select z0 parameterization for momentum
z0_TQ_prm = 0L ; not used - select z0 parameterization for momentum
stable_prm = 0L ; not used - select z0 parameterization for momentum
; read in test data
READF, test_data, dyn_in_prm, dyn_in_val, rel_wind_ang, $
ss_prm, ss_val, air_moist_prm, air_moist_val, sfc_moist_prm, $
sfc_moist_val, t_skin, t_air, ref_ht_wind, ref_ht_tq, $
press_sfc, salinity, CONVECT, astab
ss_prm = LONG( ss_prm )
air_moist_prm = LONG( air_moist_prm )
sfc_moist_prm = LONG( sfc_moist_prm )
astab = LONG( astab )
dyn_in_prm = LONG( dyn_in_prm )
; run the flux code
result = bvw99( dyn_in_prm, dyn_in_val, rel_wind_ang, CONVECT, conv_crit, $
press_sfc, air_moist_prm, air_moist_val, sfc_moist_prm, sfc_moist_val, $
salinity, ss_prm, ss_val, t_air, t_skin, ref_ht_wind, ref_ht_tq, $
astab, warn, shf, lhf, tau, u_star, t_star, q_star, z_over_L, $
wave_age, dom_phs_spd, h_sig, ww_stab, zo_m )
ht_adj
lhf = 0.0
shf = 0.0
tau = FLTARR(2)
tau = [0.0, 0.0]
u_star = FLTARR(2)
u_star = [0.0, 0.0]
t_star = 0.0
q_star = 0.0
z_over_L = 0.0
wave_age = 0.0
dom_phs_spd = 0.0
h_sig = 0.0
ww_stab = 0.0
zo_m = [0.0, 0.0]
u_at_z = 0.0
t_at_z = 0.0
q_at_z = 0.0
CONV_CRIT = 0.00005 ; convergence critereon (fractional change) [] */
CONVECT = 1.25 ; convective parameter */
warn = 1L ; warning are given */
eqv_neut_prm = 0L ; output winds are winds rather than equivalent neutral winds
sst_prm = 0L ; skin (0) vs. bulk (1)
Qnet = 25.0 ; Radiative flux in W/m^2
z_wanted = 10.0; ; height to which winds, potential temp,
flux_model = 9L ; 0L = BVW model
z0_mom_prm = 0L ; not used - select z0 parameterization for momentum
z0_TQ_prm = 0L ; not used - select z0 parameterization for momentum
stable_prm = 0L ; not used - select z0 parameterization for momentum
lhf = 0.0
shf = 0.0
tau = [0.0, 0.0]
u_star = [0.0, 0.0]
t_star = 0.0
q_star = 0.0
z_over_L = 0.0
wave_age = 0.0
dom_phs_spd = 0.0
h_sig = 0.0
ww_stab = 0.0
zo_m = [0.0, 0.0]
eqv_neut = LONG(false)
u_at_z = miss
t_at_z = miss
q_at_z = miss
count = ht_adj12( dyn_in_prm, dyn_in_val, dyn_in_val2, CONVECT, conv_crit, $
pressure, air_moist_prm, air_moist_val, sfc_moist_prm, sfc_moist_val, $
salinity, ss_prm, ss_val, t_air, sst_prm, t_skin, ref_ht_wind, ref_ht_tq, $
z_wanted, astab, eqv_neut_prm, Qnet, warn, flux_model, z0_mom_prm, $
z0_TQ_prm, stable_prm, $
shf, lhf, tau, u_star, t_star, q_star, z_over_L, wave_age, $
dom_phs_spd, h_sig, ww_stab, zo_m, u_at_z, t_at_z, q_at_z );
Additional Information
The flux and seastate model is programmed in 'C'. The bulk of the documentation is in the subroutine pmix. Wrappers for calling the programs from IDL and FORTRAN have been developed for the '12 version of the code.Status: mostly tested for ht_adj; pmix still needs work for mixed languages and testing
Warnings:
1) There are very few checks on the range of input parameters: unbelievable input will result in unbelievable output.
2) Use the output count. If it is zero or less, there is a problem. In some cases the fluxes are near zero, but in other cases they are grossly unreliable.Last update: 26 Sept. 2012