]> https://gitweb.dealii.org/ - code-gallery.git/commitdiff
Use correct time-stamps of fancy boundary condition
authorDavid Schneider <david.schneider@ipvs.uni-stuttgart.de>
Fri, 9 Feb 2024 18:14:59 +0000 (19:14 +0100)
committerDavid Schneider <david.schneider@ipvs.uni-stuttgart.de>
Fri, 9 Feb 2024 18:14:59 +0000 (19:14 +0100)
coupled_laplace_problem/fancy_boundary_condition.cc

index 60fab5689d8a0d8808368881c43a4c19f6f3f990..3deb6154fb338cf9a1dcf18a1c4bbb384750caec 100644 (file)
@@ -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";

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.