Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14,408 changes: 14,408 additions & 0 deletions Caesar Lisflood 1.9j.cs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ TARGET := bin/HAIL-CAESAR.exe
SRCEXT := cpp
SOURCES := $(shell find $(SRCDIR) -type f -name *.$(SRCEXT))
OBJECTS := $(patsubst $(SRCDIR)/%,$(BUILDDIR)/%,$(SOURCES:.$(SRCEXT)=.o))
CFLAGS := -g -std=c++11 -fopenmp $(GITREV) -DOMP_COMPILE_FOR_PARALLEL #-Wall -DDEBUG
CFLAGS := -O3 -std=c++11 -fopenmp $(GITREV) -DOMP_COMPILE_FOR_PARALLEL #-DDEBUG
LIB := -fopenmp
INC := -I include

Expand Down
76 changes: 71 additions & 5 deletions include/catchmentmodel/LSDCatchmentModel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,15 @@ class LSDCatchmentModel: public LSDRaster
/// @brief Is this a hydrology only simulation?
/// I.e. no erosion methods.
bool is_hydro_only() const { return hydro_only; }
bool is_stage_mode() const { return stage_mode_input; }
bool is_tide_mode() const { return tide_mode_input; }
bool groundwater_mode() const { return groundwater_on; }
bool groundwater_basic_model() const { return groundwater_basic; }
bool groundwater_SLiM_model() const { return groundwater_SLiM; }

// Number of stage input stations (or tidal inputs)
int get_number_stage_inputs() const { return number_of_stage_points; }

//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
// INPUT/OUTPUT
// Methods for loading and manipulating files
Expand All @@ -113,6 +118,8 @@ class LSDCatchmentModel: public LSDRaster
/// as well as those default initial values in the code.
void print_parameters();

void print_stage_data(std::vector<double>);

/// @brief Loads the rainfall data file which is in a special format (headerless text file)
/// @author DAV
/// @details Rainfall data file is not too big, so think it's okay to use the vector<vector>
Expand All @@ -122,6 +129,11 @@ class LSDCatchmentModel: public LSDRaster
/// @return Returns a vector of vector<float>. (A 2D-like vector).
std::vector< std::vector<float> > read_rainfalldata(std::string FILENAME);

/// Reads the stage date directly into the stage_inputs_vector
void read_stagedata(std::string FILENAME);
void read_tide_data(std::string FILENAME);


/// @brief Reads in the grain data file, note, that this is not a raster and in
/// a special format like the rainfall file.
/// @author DAV
Expand Down Expand Up @@ -344,6 +356,10 @@ class LSDCatchmentModel: public LSDRaster
/// @brief Calculates the hydrological inputs using just reach mode
void reach_water_and_sediment_input();

void stage_input();
void tide_input();

void read_tide_data();
std::vector<std::vector<float> > read_reachfile(std::string REACHINPUTFILE);

/// @brief Gets the number of catchment cells that have water input to them
Expand Down Expand Up @@ -401,6 +417,8 @@ class LSDCatchmentModel: public LSDRaster
/// during periods of low water flow. (e.g. inter-storm periods.)
void set_inputoutput_diff();

void stage_tidal_input(double local_time_factor);

// =-=-=-=-=-=-=-=-=-=-=
// VEGETATION
// =-=-=-=-=-=-=-=-=-=-=
Expand Down Expand Up @@ -446,8 +464,15 @@ class LSDCatchmentModel: public LSDRaster
const std::array<int, 9> deltaY = {{0, -1, -1, 0, 1, 1, 1, 0, -1}};

double water_depth_erosion_threshold = 0.01;

// Reach inputs
int reach_input_data_timestep = 60;
int stage_reach_input_data_timestep = 60;






int number_of_points = 0;
double globalsediq = 0;
double time_1 = 1;
Expand Down Expand Up @@ -607,6 +632,7 @@ class LSDCatchmentModel: public LSDRaster
TNT::Array2D<double> qy;
TNT::Array2D<double> qxs;
TNT::Array2D<double> qys;

// TODO - these are for the dune model which is as of yet unimplemented
TNT::Array2D<double> area_depth;
TNT::Array2D<double> sand;
Expand All @@ -629,6 +655,47 @@ class LSDCatchmentModel: public LSDRaster
std::string reach2_input_file;
std::string reach3_input_file;

// Stage and tide inputs

// OLD - singular file vars for stage
//std::string stage_inputfile;
//int stage_reach_input_data_timestep = 60;
//int fromx = 0, tox = 0, fromy = 0, toy = 0;
//std::vector<double> stage_inputs_vector;

// Vars for the multiple stage inputs
// NOT USED YET - USE THE OLD METHOD VARS BELOW
int number_of_stage_points = 1;

// TODO - Implement more generic multi-stage options
std::vector< std::vector<double> > stage_inputs_vectors; // 2D "Table" of all the input stages for each stage.
std::vector<string> stage_input_filenames;
std::vector<int> stage_input_timesteps;
std::vector<int> fromxs;
std::vector<int> toxs;
std::vector<int> fromys;
std::vector<int> toys;

// Multiple stage and tide inputs - you could do it this way but its not very scalable.
std::string stage_inputfile;
std::string stage_datum_type;
int stage_reach_input_data_timestep = 60;
int stage_fromx = 0, stage_tox = 0, stage_fromy = 0, stage_toy = 0; // Bounding box to set stage and tide inputs

std::string tide_inputfile;
std::string tide_datum_type;
int tide_input_data_timestep = 60;
int tide_fromx = 0, tide_tox = 0, tide_fromy = 0, tide_toy = 0; // Bounding box to set stage and tide inputs

// Stage / tide inputfile
std::vector<double> stage_inputs_vector;
std::vector<double> tide_inputs_vector;

// Arrays for stage/tidal mode input points
TNT::Array2D<int> stagepoints;
TNT::Array2D<bool> stagepointsarray;

// TODO, careful these are actually row cols and need clarifying in the docs or chaning internally.
int reach1_x;
int reach1_y;
int reach2_x;
Expand All @@ -643,11 +710,8 @@ class LSDCatchmentModel: public LSDRaster
std::vector< std::vector<float> > hourly_rain_data;
std::vector<std::vector<std::vector<float> > > inputfile;
//TNT::Array3D<double> inputfile;
std::vector<double> stage_inputfile;
// TODO above these all need initialising from read ins.

double stage_input_time_step = 1;

// TODO above these all need initialising from read ins.
std::vector<int> catchment_input_x_coord;
std::vector<int> catchment_input_y_coord;

Expand Down Expand Up @@ -700,6 +764,8 @@ class LSDCatchmentModel: public LSDRaster
// (Dear god I've been working on this code for 9 years nearly...)
bool recirculate_opt = false;
bool reach_mode_opt = false;
bool stage_mode_input = false;
bool tide_mode_input = false;
bool dunes_opt = false;
bool bedrock_lower_opt = false;
bool physical_weather_opt = false;
Expand Down
Loading