Skip to content
Snippets Groups Projects
Commit eb84ac8d authored by Elias Pipping's avatar Elias Pipping Committed by Elias Pipping
Browse files

Write damping to a file

parent 41392bd2
No related branches found
No related tags found
No related merge requests found
...@@ -332,6 +332,8 @@ int main(int argc, char *argv[]) { ...@@ -332,6 +332,8 @@ int main(int argc, char *argv[]) {
; ;
std::fstream iteration_writer("iterations", std::fstream::out); std::fstream iteration_writer("iterations", std::fstream::out);
; ;
std::fstream damping_writer("damping", std::fstream::out);
;
auto timeSteppingScheme = auto timeSteppingScheme =
initTimeStepper(parset.get<Config::scheme>("timeSteppingScheme"), initTimeStepper(parset.get<Config::scheme>("timeSteppingScheme"),
...@@ -411,11 +413,13 @@ int main(int argc, char *argv[]) { ...@@ -411,11 +413,13 @@ int main(int argc, char *argv[]) {
stateUpdater->extractState(computed_state); stateUpdater->extractState(computed_state);
double const correction = diff_two_norm(computed_state, alpha); double const correction = diff_two_norm(computed_state, alpha);
if (state_fpi <= 2 // Let the first two steps pass through unchanged if (state_fpi <= 2 // Let the first two steps pass through unchanged
|| correction < minimalCorrectionReduction * lastCorrection) || correction < minimalCorrectionReduction * lastCorrection) {
alpha = computed_state; alpha = computed_state;
else { damping_writer << "N ";
} else {
alpha *= damping; alpha *= damping;
alpha.axpy(1.0 - damping, computed_state); alpha.axpy(1.0 - damping, computed_state);
damping_writer << "Y ";
} }
lastCorrection = correction; lastCorrection = correction;
} }
...@@ -463,6 +467,7 @@ int main(int argc, char *argv[]) { ...@@ -463,6 +467,7 @@ int main(int argc, char *argv[]) {
velocity_writer << std::endl; velocity_writer << std::endl;
coefficient_writer << std::endl; coefficient_writer << std::endl;
iteration_writer << std::endl; iteration_writer << std::endl;
damping_writer << std::endl;
if (parset.get<bool>("writeVTK")) { if (parset.get<bool>("writeVTK")) {
SingletonVectorType vonMisesStress; SingletonVectorType vonMisesStress;
...@@ -488,6 +493,7 @@ int main(int argc, char *argv[]) { ...@@ -488,6 +493,7 @@ int main(int argc, char *argv[]) {
velocity_writer.close(); velocity_writer.close();
coefficient_writer.close(); coefficient_writer.close();
iteration_writer.close(); iteration_writer.close();
damping_writer.close();
Python::stop(); Python::stop();
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment