Skip to content

Commit

Permalink
write to output if patch has been disturbed (1) or not (0) this year.
Browse files Browse the repository at this point in the history
  • Loading branch information
lucialayr committed Mar 28, 2022
1 parent 025d6dc commit 79565a8
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 4 deletions.
Binary file modified trunk/build/guess
Binary file not shown.
2 changes: 1 addition & 1 deletion trunk/build/submit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# /home/lucia/lpjguess/code/trunk/build/guess
# as a parallel job using SLURM on Simba2. Based on Aurora.tmpl.
#
# Created automatically on Mo 28. Feb 16:36:55 CET 2022
# Created automatically on Mo 28. Mär 14:11:26 CEST 2022
#
# Usage:
#
Expand Down
4 changes: 3 additions & 1 deletion trunk/framework/framework.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include "soilmethane.h"

#include <memory>
#include <iostream>

/// Prints the date and time together with the name of this simulation
void print_logfile_heading() {
Expand Down Expand Up @@ -141,7 +142,8 @@ void simulate_day(Gridcell& gridcell, InputModule* input_module) {
crop_rotation(stand);

if (date.islastday && date.islastmonth) {
// LAST DAY OF YEAR

// LAST DAY OF YEAR
stand.firstobj();
while (stand.isobj) {

Expand Down
6 changes: 5 additions & 1 deletion trunk/modules/vegdynam.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include "vegdynam.h"
#include "growth.h"
#include "driver.h"
#include <iostream>


/// Upper LAI limit for wetland species. No limit: 0 //TODO remove this after daily allocation.
Expand Down Expand Up @@ -1498,7 +1499,10 @@ void disturbance(Patch& patch, double disturb_prob) {
patch.age = 0;
}

else patch.disturbed = false;
else {
patch.disturbed = false;
}

}


Expand Down
17 changes: 16 additions & 1 deletion trunk/modules/vegstructoutput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ namespace GuessOutput {
full_path.c_str());
} else {
dprintf("dummy\n");
fprintf(out_vegstruct_patch, "Lon Lat Year SID PID PFT cmass lai lai1 lai2 lai3 lai4 lai5 lai6 lai7 lai8 lai9 lai10 lai11 lai12 dens\n");
fprintf(out_vegstruct_patch, "Lon Lat Year SID PID PFT cmass lai lai1 lai2 lai3 lai4 lai5 lai6 lai7 lai8 lai9 lai10 lai11 lai12 dens dhist\n");
}
}
}
Expand Down Expand Up @@ -214,6 +214,21 @@ namespace GuessOutput {
fprintf(out_vegstruct_patch, " %6.2f", mlai[m]);
}
fprintf(out_vegstruct_patch, " %6.2f ", patchpft_dens);
fprintf(out_vegstruct_patch, " %i", patch.disturbed);
fprintf(out_vegstruct_patch, "\n");
}
else if (patch.disturbed){ //Make sure disturbance years are printed out even tho biomass is zero
fprintf(out_vegstruct_patch, "%7.2f %6.2f %4i ", lon, lat, date.get_calendar_year() );
fprintf(out_vegstruct_patch, " %i ", stand.id);
fprintf(out_vegstruct_patch, " %i ", patch.id);
fprintf(out_vegstruct_patch, " %10s", (char*) pft.name);
fprintf(out_vegstruct_patch, " %6.2f ", patchpft_cmass);
fprintf(out_vegstruct_patch, " %6.2f", patchpft_lai);
for (m=0;m<12;m++) {
fprintf(out_vegstruct_patch, " %6.2f", mlai[m]);
}
fprintf(out_vegstruct_patch, " %6.2f ", patchpft_dens);
fprintf(out_vegstruct_patch, " %i", patch.disturbed);
fprintf(out_vegstruct_patch, "\n");
}

Expand Down

0 comments on commit 79565a8

Please sign in to comment.