Skip to content
Merged
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
1 change: 1 addition & 0 deletions src/configuration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ void CConfiguration::InitializeDefaults()
// m_dFinalWaterLevel = 0.0;
m_bHasFinalWaterLevel = false;

m_strWaveInputMode = "fixed";
m_strWaveHeightTimeSeries = "";
m_strWaveStationDataFile = "";
m_dDeepWaterWaveHeight = 1.0;
Expand Down
11 changes: 11 additions & 0 deletions src/configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ class CConfiguration
bool m_bHasFinalWaterLevel;

// Waves
string m_strWaveInputMode;
string m_strWaveHeightTimeSeries;
string m_strWaveStationDataFile;
double m_dDeepWaterWaveHeight;
Expand Down Expand Up @@ -354,6 +355,12 @@ class CConfiguration
}

// Wave height Data
// Wave height Data
void SetWaveInputMode(string const &str)
{
m_strWaveInputMode = str;
}

void SetWaveHeightTimeSeries(string const &str)
{
m_strWaveHeightTimeSeries = str;
Expand Down Expand Up @@ -764,6 +771,10 @@ class CConfiguration
{
return m_bHasFinalWaterLevel;
}
string GetWaveInputMode() const
{
return m_strWaveInputMode;
}

// Wave data configuration getters (Cases 37-40)
string GetWaveHeightTimeSeries() const
Expand Down
64 changes: 46 additions & 18 deletions src/read_input.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4223,8 +4223,14 @@ bool CSimulation::bConfigureFromYamlFile(CConfiguration &config)
if (gis.HasChild("raster_files"))
{
CYamlNode rasterFiles = gis.GetChild("raster_files");
if (rasterFiles.IsSequence())
if (rasterFiles.IsSequence()){
config.SetRasterFiles(rasterFiles.GetStringSequence());
}
else {
//Allow the user to supply single entries not in list form
std::vector<std::string> tempVec{rasterFiles.GetValue()};
config.SetRasterFiles(tempVec);
}
}
if (gis.HasChild("vector_files"))
{
Expand Down Expand Up @@ -4262,22 +4268,43 @@ bool CSimulation::bConfigureFromYamlFile(CConfiguration &config)
config.SetFinalWaterLevel(
hydro.GetChild("final_water_level").GetDoubleValue());

// Wave data configuration
if (hydro.HasChild("wave_height_time_series"))
config.SetWaveHeightTimeSeries(
hydro.GetChild("wave_height_time_series").GetValue());
if (hydro.HasChild("wave_height_shape_file"))
config.SetWaveStationDataFile(
hydro.GetChild("wave_height_shape_file").GetValue());
if (hydro.HasChild("wave_height"))
config.SetDeepWaterWaveHeight(
hydro.GetChild("wave_height").GetDoubleValue());
if (hydro.HasChild("wave_orientation"))
config.SetDeepWaterWaveOrientation(
hydro.GetChild("wave_orientation").GetDoubleValue());
if (hydro.HasChild("wave_period"))
config.SetWavePeriod(hydro.GetChild("wave_period").GetDoubleValue());
// Wave data configuration - read wave_input_mode first
string strWaveInputMode = "fixed"; // default
if (hydro.HasChild("wave_input_mode"))
{
strWaveInputMode = hydro.GetChild("wave_input_mode").GetValue();
config.SetWaveInputMode(strWaveInputMode);
}

// Conditionally read wave parameters based on input mode
if (strWaveInputMode == "time_series")
{
// Read time series wave inputs
if (hydro.HasChild("wave_height_time_series"))
config.SetWaveHeightTimeSeries(
processFilePath(hydro.GetChild("wave_height_time_series").GetValue()));
if (hydro.HasChild("wave_height_shape_file"))
config.SetWaveStationDataFile(
processFilePath(hydro.GetChild("wave_height_shape_file").GetValue()));
}
else if (strWaveInputMode == "fixed")
{
// Read fixed wave condition inputs
if (hydro.HasChild("wave_height"))
config.SetDeepWaterWaveHeight(
hydro.GetChild("wave_height").GetDoubleValue());
if (hydro.HasChild("wave_orientation"))
config.SetDeepWaterWaveOrientation(
hydro.GetChild("wave_orientation").GetDoubleValue());
if (hydro.HasChild("wave_period"))
config.SetWavePeriod(hydro.GetChild("wave_period").GetDoubleValue());
}
else
{
cerr << ERR << "Unknown wave_input_mode '" << strWaveInputMode
<< "'. Must be 'fixed' or 'time_series'" << endl;
return false;
}
// Tide data configuration
if (hydro.HasChild("tide_data_file"))
config.SetTideDataFile(processFilePath(hydro.GetChild("tide_data_file").GetValue()));
Expand Down Expand Up @@ -5278,7 +5305,8 @@ bool CSimulation::bApplyConfiguration(CConfiguration const &config)
{
m_bHaveWaveStationData = true;
m_strDeepWaterWaveStationsShapefile = config.GetWaveStationDataFile();
m_dAllCellsDeepWaterWaveHeight = config.GetDeepWaterWaveHeight();
// m_dAllCellsDeepWaterWaveHeight = config.GetDeepWaterWaveHeight();
m_strDeepWaterWavesInputFile = config.GetWaveHeightTimeSeries();
}

// Case 41: Tide data file (can be blank). This is the change (m) from still
Expand Down Expand Up @@ -5351,7 +5379,7 @@ bool CSimulation::bApplyConfiguration(CConfiguration const &config)
m_dDeanProfileStartAboveSWL = config.GetBermHeight();

// Case 59: Simulate cliff collapse?
m_dDeanProfileStartAboveSWL = config.GetCliffCollapse();
m_bDoCliffCollapse = config.GetCliffCollapse();

// Case 60: Cliff resistance to erosion
if (m_bHaveConsolidatedSediment && m_bDoCliffCollapse)
Expand Down