20 #ifdef compute_rhs_operators
47 for (
int ns = 0; ns < nsims; ns++) {
48 if (sim[ns].is_barebones == 1) {
49 fprintf(stderr,
"Error in Solve(): simulation object %d on rank %d is barebones!\n",
56 for (
int ns = 0; ns < nsims; ns++) {
57 if (sim[ns].solver.flag_ib) {
63 strcat(fname_root,
"_");
64 strcat(fname_root, index);
81 if (!rank) printf(
"Setting up libROM interface.\n");
82 libROMInterface rom_interface( sim, nsims, rank, nproc, sim[0].solver.dt );
83 const std::string& rom_mode( rom_interface.
mode() );
84 std::vector<double> op_times_arr(0);
92 if (!rank) printf(
"Setting up time integration.\n");
94 double ti_runtime = 0.0;
96 if (!rank) printf(
"Solving in time (from %d to %d iterations)\n",TS.
restart_iter,TS.
n_iter);
101 for (
int ns = 0; ns < nsims; ns++) {
102 if (sim[ns].solver.PhysicsOutput) {
110 op_times_arr.push_back(TS.
waqt);
122 #ifdef compute_rhs_operators
142 for (
int ns = 0; ns < nsims; ns++) {
143 if (sim[ns].solver.PhysicsOutput) {
151 op_times_arr.push_back(TS.
waqt);
157 double t_final = TS.
waqt;
161 printf(
"Completed time integration (Final time: %f), total wctime: %f (seconds).\n",
162 t_final, ti_runtime );
163 if (nsims > 1) printf(
"\n");
167 for (
int ns = 0; ns < nsims; ns++) {
173 for (
int ns = 0; ns < nsims; ns++) {
174 if (sim[ns].solver.PhysicsOutput) {
183 op_times_arr.push_back(TS.
waqt);
185 for (
int ns = 0; ns < nsims; ns++) {
192 rom_interface.
train();
193 if (!rank) printf(
"libROM: total training wallclock time: %f (seconds).\n",
196 double total_rom_predict_time = 0;
197 for (
int iter = 0; iter < op_times_arr.size(); iter++) {
199 double waqt = op_times_arr[iter];
201 rom_interface.
predict(sim, waqt);
202 if (!rank) printf(
"libROM: Predicted solution at time %1.4e using ROM, wallclock time: %f.\n",
207 if (iter == (op_times_arr.size()-1)) {
208 if (!rank) printf(
"libROM: Calculating diff between PDE and ROM solutions.\n");
209 for (
int ns = 0; ns < nsims; ns++) {
220 printf(
"libROM: total prediction/query wallclock time: %f (seconds).\n",
221 total_rom_predict_time );
228 for (
int ns = 0; ns < nsims; ns++) {
239 for (
int ns = 0; ns < nsims; ns++) {
244 strcpy(sim[ns].solver.ConservationCheck,
"no");
255 double cur_time = start_iter * dt;
256 op_times_arr.push_back(cur_time);
258 for (
int iter = start_iter; iter < n_iter; iter++) {
260 if ( ( (iter+1)%sim[0].solver.file_op_iter == 0)
261 && ( (iter+1) < n_iter) ) {
262 op_times_arr.push_back(cur_time);
266 double t_final = n_iter*dt;
267 op_times_arr.push_back(t_final);
270 double total_rom_predict_time = 0;
271 for (
int iter = 0; iter < op_times_arr.size(); iter++) {
273 double waqt = op_times_arr[iter];
275 rom_interface.
predict(sim, waqt);
276 if (!rank) printf(
"libROM: Predicted solution at time %1.4e using ROM, wallclock time: %f.\n",
281 for (
int ns = 0; ns < nsims; ns++) {
282 if (sim[ns].solver.PhysicsOutput) {
293 for (
int ns = 0; ns < nsims; ns++) {
299 printf(
"libROM: total prediction/query wallclock time: %f (seconds).\n",
300 total_rom_predict_time );
int CalculateError(void *s, void *m)
Function declarations for file I/O functions.
void GetStringFromInteger(int, char *, int)
void projectInitialSolution(void *a_s)
void saveROM(const std::string &a_fname_root="") const
Structure of variables/parameters and function pointers for time integration.
int(* PhysicsOutput)(void *, void *, double)
void loadROM(const std::string &a_fname_root="")
int OutputROMSolution(void *s, int nsims, double a_time)
Contains C++ function declarations for time integration.
void ResetFilenameIndex(char *f, int len)
int WriteArray(int, int, int *, int *, int, double *, double *, void *, void *, char *)
#define _MAX_STRING_SIZE_
int samplingFrequency() const
double predictWallclockTime() const
Class implementing interface with libROM.
int CalculateROMDiff(void *s, void *m)
Some common functions used here and there (C++ declarations)
int Solve(void *, int, int, int)
int OutputSolution(void *, int, double)
#define _ROM_MODE_PREDICT_
double trainWallclockTime() const
void predict(void *a_s, const double a_t) const
void takeSample(void *a_s, const double a_t)
Structure defining a simulation.
const std::string & mode() const
int TimePrintStep(void *)
C++ declarations for MPI-related functions.
int TimeInitialize(void *, int, int, int, void *)
int ComputeRHSOperators(void *s, void *m, double t)