Skip to content

Commit 82b807e

Browse files
committed
L2 errors calculation
1 parent 09e7268 commit 82b807e

File tree

1 file changed

+51
-22
lines changed

1 file changed

+51
-22
lines changed

rom/laghos.cpp

Lines changed: 51 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2129,28 +2129,28 @@ int main(int argc, char *argv[])
21292129
cout << "Window " << romOptions.window << ": initial romS norm " << romS.Norml2() << endl;
21302130
}
21312131

2132-
// Recompute and print the energy information after the
2133-
// change of basis, before any more timestepping takes
2134-
// place.
2135-
if (romOptions.hyperreductionSamplingType == eqp_energy)
2136-
{
2137-
timeLoopTimer.Stop();
2138-
basis[romOptions.window]->LiftROMtoFOM(romS, *S);
2139-
2140-
double energy_total, energy_diff;
2141-
energy_total = oper->InternalEnergy(*e_gf) +
2142-
oper->KineticEnergy(*v_gf);
2143-
energy_diff = energy_total - energy_init;
2144-
2145-
if (mpi.Root())
2146-
{
2147-
cout << "\tE_tot = " << scientific << setprecision(5)
2148-
<< energy_total
2149-
<< ",\tE_diff = " << scientific << setprecision(5)
2150-
<< energy_diff << endl;
2151-
}
2152-
timeLoopTimer.Start();
2153-
}
2132+
//if (romOptions.hyperreductionSamplingType == eqp_energy)
2133+
//{
2134+
// // Recompute and print the energy information after the
2135+
// // change of basis, before any more timestepping takes
2136+
// // place.
2137+
// timeLoopTimer.Stop();
2138+
// basis[romOptions.window]->LiftROMtoFOM(romS, *S);
2139+
2140+
// double energy_total, energy_diff;
2141+
// energy_total = oper->InternalEnergy(*e_gf) +
2142+
// oper->KineticEnergy(*v_gf);
2143+
// energy_diff = energy_total - energy_init;
2144+
2145+
// if (mpi.Root())
2146+
// {
2147+
// cout << "\tE_tot = " << scientific << setprecision(5)
2148+
// << energy_total
2149+
// << ",\tE_diff = " << scientific << setprecision(5)
2150+
// << energy_diff << endl;
2151+
// }
2152+
// timeLoopTimer.Start();
2153+
//}
21542154

21552155
delete romOper[romOptions.window-1];
21562156

@@ -2297,6 +2297,35 @@ int main(int argc, char *argv[])
22972297
outfile_tw_steps.close();
22982298
}
22992299

2300+
if (rom_online && romOptions.hyperreductionSamplingType == eqp_energy)
2301+
{
2302+
if (myid == 0) cout << endl;
2303+
if (myid == 0) cout << "Final energy calculation." << endl;
2304+
2305+
double energy_total, energy_diff;
2306+
energy_total = oper->InternalEnergy(*e_gf) +
2307+
oper->KineticEnergy(*v_gf);
2308+
energy_diff = energy_total - energy_init;
2309+
2310+
if (mpi.Root())
2311+
{
2312+
cout << "\tE_tot = " << scientific << setprecision(5)
2313+
<< energy_total
2314+
<< ",\tE_diff = " << scientific << setprecision(5)
2315+
<< energy_diff << endl;
2316+
}
2317+
2318+
if (myid == 0) cout << endl;
2319+
if (myid == 0) cout << "Solution errors calculation." << endl;
2320+
2321+
PrintDiffParGridFunction(normtype, myid, testing_parameter_outputPath
2322+
+ "/Sol_Position" + romOptions.basisIdentifier, x_gf);
2323+
PrintDiffParGridFunction(normtype, myid, testing_parameter_outputPath
2324+
+ "/Sol_Velocity" + romOptions.basisIdentifier, v_gf);
2325+
PrintDiffParGridFunction(normtype, myid, testing_parameter_outputPath
2326+
+ "/Sol_Energy" + romOptions.basisIdentifier, e_gf);
2327+
}
2328+
23002329
if (romOptions.use_sample_mesh)
23012330
{
23022331
if (romOptions.GramSchmidt && !spaceTime)

0 commit comments

Comments
 (0)