diff --git a/src/glm_flow.c b/src/glm_flow.c index a2c9a3e..986b3da 100644 --- a/src/glm_flow.c +++ b/src/glm_flow.c @@ -491,15 +491,13 @@ AED_REAL do_overflow(int jday) // Too much water for the entire lake domain, remove this first - if ((VolSum - MaxVol) > 1e-4){ - //if (VolSum > MaxVol){ + if (VolSum > MaxVol){ do_single_outflow((CrestHeight+(MaxHeight-CrestHeight)*0.9), (VolSum - MaxVol), NULL); overflow = VolSum - Lake[surfLayer].Vol1; } VolSum = Lake[surfLayer].Vol1; // Water above the crest, which will overflow based on a weir equation - if ((VolSum - VolAtCrest) > 1e-4){ - //if (VolSum > VolAtCrest){ + if (VolSum > VolAtCrest){ AED_REAL ovfl_Q, ovfl_dz; ovfl_dz = MAX( Lake[surfLayer].Height - CrestHeight, zero ); diff --git a/src/glm_init.c b/src/glm_init.c index 3c3d1ee..41a86d3 100644 --- a/src/glm_init.c +++ b/src/glm_init.c @@ -1373,9 +1373,6 @@ void create_lake(int namlst) LenAtCrest = bsn_len; WidAtCrest = bsn_wid; - - fprintf(stdout, "crest_elev %f Base %f CrestHeight%f max_elev %f MaxHeight %f\n", crest_elev, Base, CrestHeight, max_elev, MaxHeight); - alpha_b = calloc(MaxLayers, sizeof(AED_REAL)); beta_b = calloc(MaxLayers, sizeof(AED_REAL)); @@ -1682,12 +1679,6 @@ void initialise_lake(int namlst) ice = TRUE; } - //if (deep_mixing == 1) { //constant diffusivity over whole water column - for (i = 0; i < NumLayers; i++) - Lake[i].Epsilon = coef_mix_hyp; - //} - - AvgSurfTemp = avg_surf_temp; if (restart_variables != NULL) { diff --git a/src/glm_layers.c b/src/glm_layers.c index 4004957..d6e9250 100644 --- a/src/glm_layers.c +++ b/src/glm_layers.c @@ -100,12 +100,6 @@ void check_layer_thickness(void) dbgprt(" CHKLAY 01 lake[44].depth = %20.15f\n", Lake[44].Height); - - //fprintf(stdout, "check_layer_thickness #1\n"); - // for (i = botmLayer; i <= surfLayer; i++) { - // fprintf(stdout, "layer %d %f %f %f\n", i, Lake[i].Temp, Lake[i].LayerVol, Lake[i].LayerArea); - // } - //# Check against vmin KLAST=botmLayer; // while (1) { // @@ -136,8 +130,7 @@ void check_layer_thickness(void) j = i; - if((Vup - Vdown) > 1e-4) j = i-1; - //if (Vup > Vdown) j = i-1; + if (Vup > Vdown) j = i-1; Lake[j].Salinity = combine(Lake[j].Salinity, Lake[j].LayerVol, Lake[j].Density, Lake[j+1].Salinity, Lake[j+1].LayerVol, Lake[j+1].Density); @@ -177,12 +170,6 @@ void check_layer_thickness(void) NumLayers--; } - //fprintf(stdout, "check_layer_thickness #2\n"); - // for (i = botmLayer; i <= surfLayer; i++) { - // fprintf(stdout, "layer %d %f %f %f\n", i, Lake[i].Temp, Lake[i].LayerVol, Lake[i].LayerArea); - // } - - // here when all layers have been checked for VMin, DMin if (surfLayer != botmLayer) { for (i = botmLayer+1; i <= surfLayer; i++) diff --git a/src/glm_mixer.c b/src/glm_mixer.c index 418b6fb..edea09c 100644 --- a/src/glm_mixer.c +++ b/src/glm_mixer.c @@ -191,7 +191,7 @@ static int convective_overturn(int *_Epi_botmLayer, int *_Meta_topLayer, ZeroMom = ZeroMom + tRho; FirstMom = FirstMom + tRho * Lake[Epi_botmLayer].MeanHeight; - if (Dens_Epil < Lake[Epi_botmLayer-1].Density+1e-4) break; + if (Dens_Epil < Lake[Epi_botmLayer-1].Density+1e-7) break; } else { AED_REAL tRho = (Lake[botmLayer].Density - rho0) * Lake[botmLayer].Height; ZeroMom = ZeroMom + tRho; diff --git a/src/glm_model.c b/src/glm_model.c index 7ef9461..c9b08f5 100644 --- a/src/glm_model.c +++ b/src/glm_model.c @@ -378,7 +378,6 @@ void do_model(int jstart, int nsave) // # after including the inflow and outflows. // # Output is not written on the last time step in a daily in the subdaily loop if ( stepnum == write_step){ - printf("writing daily at stepnum %d jday %d \n",stepnum, jday); #if PLOTS today = jday; @@ -535,7 +534,6 @@ void do_model_non_avg(int jstart, int nsave) // # after including the inflow and outflows. // # Output is not written on the last time step in a daily in the subdaily loop if ( stepnum == write_step){ - printf("writing daily at stepnum %d jday %d \n",stepnum, jday); #if PLOTS today = jday; @@ -679,7 +677,6 @@ void do_model_coupled(int step_start, int step_end, // # after including the inflow and outflows. // # Output is not written on the last time step in a daily in the subdaily loop if ( stepnum == write_step){ - printf("writing daily at stepnum %d jday %d \n",stepnum, jday); #if PLOTS today = jday; @@ -753,7 +750,6 @@ int do_subdaily_loop(int stepnum, int jday, int stoptime, int nsave, AED_REAL SW { int iclock; //# The seconds counter during a day AED_REAL Light_Surface; //# Light at the surface of the lake after do_surface - //int write_step, last_step; AED_REAL part_day_per_step; yearday = day_of_year(jday); @@ -788,16 +784,6 @@ int do_subdaily_loop(int stepnum, int jday, int stoptime, int nsave, AED_REAL SW stepnum++; _dbg_time(jday, iclock); - - fprintf(stdout, "iclock %d\n", iclock); - - -//fprintf(stderr, "Lake[surfLayer].Height = %f\n", Lake[surfLayer].Height); - - - //fprintf(stdout, "#1 %f %f %f\n", Lake[5].Temp, Lake[5].LayerVol, Lake[5].LayerArea); - - //# Thermal transfers are done by do_surface_thermodynamics do_surface_thermodynamics(jday, iclock, lw_ind, Latitude, SWold, SWnew); @@ -851,12 +837,15 @@ int do_subdaily_loop(int stepnum, int jday, int stoptime, int nsave, AED_REAL SW **********************************************************************/ if (wq_calc) wq_do_glm(&NumLayers, &ice); + //# If an output write is requested for the last time step of the day + //# then do not output in the subdaily. Output writing is moved to the + //# daily loop so it occurs after the inflow and output calculations. + if ( stepnum == write_step & (iclock + noSecs) != SecsPerDay) { #if PLOTS today = jday; #endif - printf("writing subdaily at stepnum %d jday %d iclock %d \n",stepnum, jday, iclock); write_output(jday, iclock, nsave, stepnum); write_step += nsave; if ( write_step > last_step ) write_step = last_step;