Skip to content

Commit

Permalink
cleaning up debugging additions
Browse files Browse the repository at this point in the history
  • Loading branch information
rqthomas committed Jul 16, 2024
1 parent fb40167 commit c9593fa
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 43 deletions.
6 changes: 2 additions & 4 deletions src/glm_flow.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down
9 changes: 0 additions & 9 deletions src/glm_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));

Expand Down Expand Up @@ -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) {
Expand Down
15 changes: 1 addition & 14 deletions src/glm_layers.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) { //
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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++)
Expand Down
2 changes: 1 addition & 1 deletion src/glm_mixer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
19 changes: 4 additions & 15 deletions src/glm_model.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit c9593fa

Please sign in to comment.