From: David Schneider Date: Fri, 9 Feb 2024 18:14:59 +0000 (+0100) Subject: Use correct time-stamps of fancy boundary condition X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=db52e5244780bb4fc4e6f921589ac1599b4adf7c;p=code-gallery.git Use correct time-stamps of fancy boundary condition --- 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";