Skip to content

Commit 7b64839

Browse files
committed
analyze timestep scaling issue
1 parent b575c34 commit 7b64839

File tree

3 files changed

+8
-12
lines changed

3 files changed

+8
-12
lines changed

configs/config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"nx":100,
88
"ny":100,
99
"setup":"CIRCULARDAMBREAK2D",
10-
"writingFrequency":100,
10+
"writingFrequency":50,
1111
"endTime":50,
1212
"stations":[
1313
{ "name":"station_1", "locX":0, "locY":10 },

src/Simulator.cpp

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ void tsunami_lab::Simulator::loadConfiguration()
8585
{
8686
std::cout << ">> Loading configuration from local json data" << std::endl;
8787

88-
std::cout<<m_configData<<std::endl;
8988
m_solver = m_configData.value("solver", "fwave");
9089
// read size config
9190
m_nx = m_configData.value("nx", 1);
@@ -98,12 +97,10 @@ void tsunami_lab::Simulator::loadConfiguration()
9897
m_offsetX = m_configData.value("offsetX", 0);
9998
m_offsetY = m_configData.value("offsetY", 0);
10099
m_endTime = m_configData.value("endTime", 20);
101-
m_height = m_configData.value("height",0);
102-
m_baseHeight = m_configData.value("baseHeight", 0);
103-
m_diameter = m_configData.value("diameter",0);
104-
m_timeStepScaling = m_configData.value("timeStepScaling",100);
105-
106-
m_timeStepScaling /=100; // without this step m_timespteps was set to 0 every time a json value is not 1
100+
m_height = m_configData.value("height",10);
101+
m_baseHeight = m_configData.value("baseHeight", 5);
102+
m_diameter = m_configData.value("diameter",10);
103+
m_timeStepScaling = m_configData.value("timeStepScaling",1.0);
107104

108105
// read boundary config
109106
std::string l_boundaryStringL = m_configData.value("boundaryL", "outflow");
@@ -510,7 +507,7 @@ void tsunami_lab::Simulator::deriveTimeStep()
510507
}
511508
else
512509
{
513-
m_dt = m_timeStepScaling * 0.45 * std::min(m_dx, m_dy) / l_speedMax; //TODO Add timestepScaling
510+
m_dt = m_timeStepScaling * 0.45 * std::min(m_dx, m_dy) / l_speedMax;
514511
}
515512

516513
// calculate max time steps

src/ui/GUI.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ json tsunami_lab::ui::GUI::createConfigJson()
127127
{"bathymetry", m_bathymetryFilePath},
128128
{"displacement", m_displacementFilePath},
129129
{"height", m_height},
130-
{"timeStepScaling", std::ceil(m_timeStepScaling * 100.0)},
130+
{"timeStepScaling", m_timeStepScaling},
131131
{"baseHeight", m_baseHeight},
132132
{"diameter", m_diameter}};
133133
// stations
@@ -1035,13 +1035,12 @@ int tsunami_lab::ui::GUI::launch()
10351035
ImGui::Text("Current time step scaling: %f", m_timeStepScaling);
10361036
ImGui::SliderFloat("Scaling (0-1)", &m_timeStepScaling, 0.1f, 1.0f, "%.2f");
10371037
ImGui::SameLine();
1038-
HelpMarker("The default value is 1. Smaller numbers lead to more timesteps and thus to a more detailed simulation");
1038+
HelpMarker("The default value is 1. Smaller numbers lead to more timesteps and thus to a more detailed simulation. However this also increases the computation time.");
10391039
ImGui::TreePop();
10401040
}
10411041

10421042
if (ImGui::Button("Update server with changes"))
10431043
{
1044-
std::cout<< "gui -"<<m_timeStepScaling<<std::endl;
10451044
xlpmg::Message saveConfigMsg = xlpmg::LOAD_CONFIG_JSON;
10461045
saveConfigMsg.args = createConfigJson();
10471046
m_communicator.sendToServer(xlpmg::messageToJsonString(saveConfigMsg));

0 commit comments

Comments
 (0)