Fix BSSN-EM runtime crash

This commit is contained in:
2026-05-07 16:47:55 +08:00
parent 5525465cad
commit fea2dcc0d5
7 changed files with 103 additions and 98 deletions

View File

@@ -9665,11 +9665,12 @@ void bssn_class::Interp_Constraint(bool infg)
if (myrank == 0)
{
ofstream outfile;
char filename[50];
sprintf(filename, "%s/interp_constraint_%05d.dat", ErrorMonitor->out_dir.c_str(), int(PhysTime / dT + 0.5));
char suffix[64];
sprintf(suffix, "/interp_constraint_%05d.dat", int(PhysTime / dT + 0.5));
string filename = ErrorMonitor->out_dir + suffix;
// 0.5 for round off
outfile.open(filename);
outfile.open(filename.c_str());
outfile << "# corrdinate, H_Res, Px_Res, Py_Res, Pz_Res, Gx_Res, Gy_Res, Gz_Res, ...." << endl;
for (int i = 0; i < n; i++)
{