/* test program for 'C' version of air/sea boundary layer model */ #include #include #include "mft12.h" main() { /* feeds input into the sea state / flux subroutine */ int astab, air_moist_prm, count, dyn_in_prm, eqv_neut, flux_model, i, num, sfc_moist_prm, ss_prm, sst_prm, warn, z0_mom_prm, z0_TQ_prm, stable_prm; float *dom_phs_spd, *h_sig, *lhf, *q_at_z, *q_star, *shf, *t_at_z, *tau, *t_star, *u_at_z, *u_star, *wave_age, *ww_stab, *z_over_L, *zo_m; float air_moist_val, CONVECT, CONV_CRIT, dyn_in_val, dyn_in_val2, Qnet, pressure, ref_ht_tq, ref_ht_wind, salinity, sfc_moist_val, ss_val, t_air, t_skin, wave_ang, wind_ang, z_wanted; FILE *fp_test_data; if( ( fp_test_data = fopen( "testdata12.dat", "r" )) == NULL) { printf( "Can not open the file testdata12.dat\n" ); exit( 1 ); } lhf = (float *) malloc( sizeof( float ) ); shf = (float *) malloc( sizeof( float ) ); tau = (float *) malloc( 2 * sizeof( float ) ); u_star = (float *) malloc( 2 * sizeof( float ) ); t_star = (float *) malloc( sizeof( float ) ); q_star = (float *) malloc( sizeof( float ) ); z_over_L = (float *) malloc( sizeof( float ) ); wave_age = (float *) malloc( sizeof( float ) ); dom_phs_spd = (float *) malloc( sizeof( float ) ); h_sig = (float *) malloc( sizeof( float ) ); ww_stab = (float *) malloc( sizeof( float ) ); zo_m = (float *) malloc( 2 * sizeof( float ) ); u_at_z = (float *) malloc( sizeof( float ) ); t_at_z = (float *) malloc( sizeof( float ) ); q_at_z = (float *) malloc( sizeof( float ) ); CONV_CRIT = 0.00005; /* convergence critereon (fractional change) [] */ CONVECT = 1.25; /* convective parameter */ warn = 0; /* warning are given */ eqv_neut = 0; /* output winds are winds rather than equivalent neutral winds */ z_wanted = 10.0; /* height to which winds, potential temp, and humidity are adjusted */ flux_model = 9; /* BVW model=0 */ Qnet = 300.0; sst_prm = 1; z0_mom_prm = 0; z0_TQ_prm = 0; stable_prm = 0; /* begin loop for series of test_data */ fscanf( fp_test_data, "%*[^\n]\n" ); /* skip the header line */ printf( "run U |ustar| ustar1 ustar2 tstar qstar zref/L cp wa Hsig tau1 tau2 shf lhf u(z) t(z) q(z)\n" ); for (i= 0; i < 62; i++) { fscanf( fp_test_data, "%i %i %f %f %i %f %i %f %i %f %f %f %f %f %f %f %f %i\n", &num, &dyn_in_prm, &dyn_in_val, &dyn_in_val2, &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, &pressure, &salinity, &CONVECT, &astab ); /* convert angle to the 'mathimatical' coordinate system */ wind_ang = wind_ang - 270.0; /* conversion from meteorological direction convention */ wave_ang = wave_ang - 90; /* conversion from oceanographic direction convention */ /* ss_prm = 2; ss_val = 43.64; */ count = ht_adj_( 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, 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 ); /* check for convergence */ if ( count <= 1 ) printf( "non-convergence:\n" ); printf( "%2i %5.2f %6.3f %6.3f %6.3f %7.4f %9.6f %8.5f %6.2f %6.2f %5.2f %6.3f %6.3f %6.2f %6.2f %6.2f %6.2f %6.3f\n", i+1, dyn_in_val, sqrt( u_star[0] * u_star[0] + u_star[1] * u_star[1] ), u_star[0], u_star[1], *t_star, *q_star, *z_over_L, *dom_phs_spd, *wave_age, *h_sig, tau[0], tau[1], *shf, *lhf, *u_at_z, *t_at_z, *q_at_z ); } /* end of (main) test program */ }