From db52e5244780bb4fc4e6f921589ac1599b4adf7c Mon Sep 17 00:00:00 2001 From: David Schneider Date: Fri, 9 Feb 2024 19:14:59 +0100 Subject: [PATCH] Use correct time-stamps of fancy boundary condition --- .../fancy_boundary_condition.cc | 30 ++++++++++++------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/coupled_laplace_problem/fancy_boundary_condition.cc b/coupled_laplace_problem/fancy_boundary_condition.cc index 60fab56..3deb615 100644 --- a/coupled_laplace_problem/fancy_boundary_condition.cc +++ b/coupled_laplace_problem/fancy_boundary_condition.cc @@ -78,27 +78,35 @@ main() // Pass the vertices to preCICE precice.setMeshVertices(meshName, vertices, vertexIDs); - // initialize the Solverinterface + // Variables for the time + const double end_time = 1; + double time = 0; + + // Not used in the configuration by default + if (precice.requiresInitialData()) + { + std::cout << "Boundary participant: writing initial data \n"; + define_boundary_values(writeData, time, end_time); + precice.writeData(meshName, dataWriteName, vertexIDs, writeData); + } + + // initialize the Participant precice.initialize(); - double dt = precice.getMaxTimeStepSize(); // Start time loop - const double end_time = 1; - double time = 0; while (precice.isCouplingOngoing()) { + double dt = precice.getMaxTimeStepSize(); + time += dt; + // Generate new boundary data define_boundary_values(writeData, time, end_time); - { - std::cout << "Boundary participant: writing coupling data \n"; - precice.writeData(meshName, dataWriteName, vertexIDs, writeData); - } + std::cout << "Boundary participant: writing coupling data \n"; + precice.writeData(meshName, dataWriteName, vertexIDs, writeData); - precice.advance(dt); std::cout << "Boundary participant: advancing in time\n"; - - time += dt; + precice.advance(dt); } std::cout << "Boundary participant: closing...\n"; -- 2.39.5