Theseus
Compressible flow solver
Loading...
Searching...
No Matches
Simulation.hpp
Go to the documentation of this file.
1// Copyright (c) 2025-2026 Board of Trustees of the University of Illinois
2//
3// This file is part of Theseus.
4//
5// SPDX-License-Identifier: BSD-3-Clause
6#pragma once
7
8#include "Theseus.hpp"
10#include "RHSOperator.hpp"
11#include "RunControl.hpp"
13
14namespace Theseus
15{
16
18 {
19 private:
20 int numProcs, myRank;
21 int order;
22 int dim;
23 int num_equations;
24 int ref_levels;
25 int vis_steps;
26 int nancheck_steps;
27 int precision;
28 int num_dofs_scalar;
29 int num_dofs_system;
30 int print_interval;
31 int ti;
32 int nsteps_max;
33
34 bool done = false;
35 bool variable_dt = false;
36 bool clock_simulation = true;
37 bool nancheck = false;
38 bool visualize = true;
39 bool visit = false;
40 bool paraview = true;
41 CheckpointConfig checkpoint_config;
42 VisualizationConfig visualization_config;
43
44 std::string output_file_path;
45 std::string paraview_folder;
46
47 mfem::real_t t, t_final, dt, dt_real;
48 mfem::real_t cfl;
49 mfem::real_t hmin;
50 mfem::real_t Re, Ma;
51 mfem::real_t next_save_t;
52 mfem::real_t save_dt1;
53 mfem::real_t save_dt2;
54 mfem::real_t trigger_t;
55 mfem::real_t save_dt;
56 mfem::real_t next_checkpoint_t;
57
58 mfem::real_t V_sq;
59
60 mfem::real_t alpha_max;
61
62 mfem::Array<int> mesh_ordering;
63 std::shared_ptr<mfem::ParMesh> pmesh;
64
65 int btype = mfem::BasisType::GaussLobatto;
66 int ordering = mfem::Ordering::byNODES;
67
68 std::shared_ptr<mfem::DG_FECollection> fec;
69 std::shared_ptr<mfem::DG_FECollection> fec0;
70 std::shared_ptr<mfem::ParFiniteElementSpace> vfes;
71 std::shared_ptr<mfem::ParFiniteElementSpace> fes0;
72 std::unique_ptr<mfem::ParFiniteElementSpace> fes;
73 std::unique_ptr<mfem::ParFiniteElementSpace> dfes;
74
75 std::unique_ptr<mfem::VectorFunctionCoefficient> u0;
76 std::unique_ptr<mfem::VectorFunctionCoefficient> exact_solution;
77
78 std::shared_ptr<mfem::ParGridFunction> sol;
79 std::shared_ptr<mfem::ParGridFunction> dudx;
80 std::shared_ptr<mfem::ParGridFunction> dudy;
81 std::shared_ptr<mfem::ParGridFunction> dudz;
82
83 // Subcell blending : nullptr if OFF
84 std::shared_ptr<mfem::ParGridFunction> eta;
85 std::shared_ptr<mfem::ParGridFunction> alpha;
86 std::shared_ptr<Prandtl::PerssonPeraireIndicator> indicator;
87
88 std::vector<std::shared_ptr<mfem::VectorFunctionCoefficient>> BC_coeff;
89
90 mfem::ParGridFunction rho, mom, energy;
91
92 std::unique_ptr<mfem::ParGridFunction> velocity;
93 std::unique_ptr<mfem::ParGridFunction> p;
94
95 std::unique_ptr<mfem::ParaViewDataCollection> pd;
96 std::unique_ptr<mfem::VisItDataCollection> vd;
97
98 std::shared_ptr<mfem::ODESolver> ode_solver;
99 std::unique_ptr<Theseus::RHSOperatorBase> rhsOp;
100
101 int signature;
102
103 std::vector<mfem::Array<int>> bdr_marker_vector;
104 mfem::Array<int> set_marker;
105 int max_bdr_attr;
106 void InitDevice(std::string);
107 std::unique_ptr<mfem::Device> device_;
108
109 void UpdateVisualizationFields();
110 void SaveVisualization();
111 CheckpointCompatibility CurrentCheckpointCompatibility() const;
112 void LoadCheckpoint();
113 void SaveCheckpoint();
114
115 Simulation(std::string);
116
117 public:
118 static Simulation& SimulationCreate(std::string);
119 int LoadConfig(const std::string &config_file_path);
120
121 ~Simulation();
122
123 void Run();
124
125 Simulation(const Simulation&) = delete;
127 };
128
129}
Definition CheckpointConfig.hpp:32
Definition Simulation.hpp:18
~Simulation()
Definition Simulation.cpp:88
Simulation(const Simulation &)=delete
static Simulation & SimulationCreate(std::string)
Definition Simulation.cpp:39
int LoadConfig(const std::string &config_file_path)
Definition Simulation.cpp:100
void Run()
Definition Simulation.cpp:1082
Simulation & operator=(const Simulation &)=delete
Definition VisualizationConfig.hpp:40
Definition AxisymmetricGeometry.hpp:15
Definition CheckpointConfig.hpp:20