#endif
#include <cmath>
+#include <filesystem>
#include <fstream>
#include <iostream>
#include <memory>
// In the constructor, we create the mpi_communicator as well as
// the triangulations and dof_handler for both the fluid and the solid.
- // Using the mpi_communicator, both the ConditionalOStream and TimerOutput
+ // Using the `mpi_communicator`, both the ConditionalOStream and TimerOutput
// object are constructed.
+ //
+ // In the constructor, we also check whether the output directory
+ // specified in the input file exists and, if not, create it.
template <int dim, int spacedim>
StokesImmersedProblem<dim, spacedim>::StokesImmersedProblem(
const StokesImmersedProblemParameters<dim, spacedim> &par)
Triangulation<dim, spacedim>::smoothing_on_coarsening))
, fluid_dh(fluid_tria)
, solid_dh(solid_tria)
- {}
+ {
+ if (std::filesystem::exists(par.output_directory))
+ {
+ Assert(std::filesystem::is_directory(par.output_directory),
+ ExcMessage("You specified <" + par.output_directory +
+ "> as the output directory in the input file, "
+ "but this is not in fact a directory."));
+ }
+ else
+ std::filesystem::create_directory(par.output_directory);
+ }
// In order to generate the grid, we first try to use the functions in the