-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Description of the problem Only needed the last 30% of my simulations and they are quite heavy. Description of the solution Added a new parameter in the parameter file -> output_time_interval. If the user specifies an output time interval, the .vtu files are only written if the simulation time is within that time window. This has been implemented for output control = iteration and output control = time. How Has This Been Tested? new simulation_control_06.cc test. Makes sure information is written at the appropriated time steps. Documentation Modified the simulation_control.rst file to consider the new parameter.
- Loading branch information
Showing
10 changed files
with
156 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
/* --------------------------------------------------------------------- | ||
* | ||
* Copyright (C) 2020 - by the Lethe authors | ||
* | ||
* This file is part of the Lethe library | ||
* | ||
* The Lethe library is free software; you can use it, redistribute | ||
* it, and/or modify it under the terms of the GNU Lesser General | ||
* Public License as published by the Free Software Foundation; either | ||
* version 3.1 of the License, or (at your option) any later version. | ||
* The full text of the license can be found in the file LICENSE at | ||
* the top level of the Lethe distribution. | ||
* | ||
* --------------------------------------------------------------------- | ||
/** | ||
* @brief This test checks if files are only generated within the output time interval | ||
*/ | ||
|
||
// Lethe | ||
#include <core/parameters.h> | ||
#include <core/simulation_control.h> | ||
|
||
// Tests (with common definitions) | ||
#include <../tests/tests.h> | ||
|
||
void | ||
test() | ||
{ | ||
Parameters::SimulationControl simulationControlParameters; | ||
|
||
simulationControlParameters.dt = 0.01; | ||
simulationControlParameters.adapt = false; | ||
simulationControlParameters.maxCFL = 99; | ||
simulationControlParameters.method = | ||
Parameters::SimulationControl::TimeSteppingMethod::bdf1; | ||
|
||
simulationControlParameters.timeEnd = 999; | ||
simulationControlParameters.number_mesh_adaptation = 9; | ||
simulationControlParameters.output_name = "test"; | ||
simulationControlParameters.subdivision = 7; | ||
simulationControlParameters.output_folder = "canard"; | ||
simulationControlParameters.output_frequency = 1; | ||
simulationControlParameters.output_time_interval = {1, 2}; | ||
|
||
SimulationControlSteady simulation_control(simulationControlParameters); | ||
|
||
deallog << "Iteration : " << simulation_control.get_step_number() | ||
<< std::endl; | ||
|
||
while (simulation_control.integrate()) | ||
{ | ||
deallog << "Iteration : " << simulation_control.get_step_number() | ||
<< " Time : " << simulation_control.get_current_time() | ||
<< std::endl; | ||
if (simulation_control.is_at_start()) | ||
deallog << "This is the first iteration" << std::endl; | ||
|
||
if (simulation_control.is_output_iteration()) | ||
deallog << "This is an output iteration" << std::endl; | ||
} | ||
} | ||
|
||
int | ||
main() | ||
{ | ||
try | ||
{ | ||
initlog(); | ||
test(); | ||
} | ||
catch (std::exception &exc) | ||
{ | ||
std::cerr << std::endl | ||
<< std::endl | ||
<< "----------------------------------------------------" | ||
<< std::endl; | ||
std::cerr << "Exception on processing: " << std::endl | ||
<< exc.what() << std::endl | ||
<< "Aborting!" << std::endl | ||
<< "----------------------------------------------------" | ||
<< std::endl; | ||
return 1; | ||
} | ||
catch (...) | ||
{ | ||
std::cerr << std::endl | ||
<< std::endl | ||
<< "----------------------------------------------------" | ||
<< std::endl; | ||
std::cerr << "Unknown exception!" << std::endl | ||
<< "Aborting!" << std::endl | ||
<< "----------------------------------------------------" | ||
<< std::endl; | ||
return 1; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
|
||
DEAL::Iteration : 0 | ||
DEAL::Iteration : 1 Time : 1.00000 | ||
DEAL::This is the first iteration | ||
DEAL::This is an output iteration | ||
DEAL::Iteration : 2 Time : 2.00000 | ||
DEAL::This is an output iteration | ||
DEAL::Iteration : 3 Time : 3.00000 | ||
DEAL::Iteration : 4 Time : 4.00000 | ||
DEAL::Iteration : 5 Time : 5.00000 | ||
DEAL::Iteration : 6 Time : 6.00000 | ||
DEAL::Iteration : 7 Time : 7.00000 | ||
DEAL::Iteration : 8 Time : 8.00000 | ||
DEAL::Iteration : 9 Time : 9.00000 | ||
DEAL::Iteration : 10 Time : 10.0000 |