Skip to content

Commit 7cac132

Browse files
committed
bug fixes & minor changes
1 parent 684a039 commit 7cac132

File tree

2 files changed

+22
-26
lines changed

2 files changed

+22
-26
lines changed

rom/laghos.cpp

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -395,13 +395,13 @@ int main(int argc, char *argv[])
395395

396396
romOptions.hyperreductionSamplingType = getHyperreductionSamplingType(hyperreductionSamplingType);
397397
romOptions.use_sample_mesh = romOptions.hyperreduce && (romOptions.hyperreductionSamplingType != eqp
398-
|| romOptions.hyperreductionSamplingType != eqp_energy);
398+
&& romOptions.hyperreductionSamplingType != eqp_energy);
399399

400400
MFEM_VERIFY(!(romOptions.SNS) || (romOptions.hyperreductionSamplingType != eqp &&
401401
romOptions.hyperreductionSamplingType != eqp_energy),
402402
"Using SNS with EQP is prohibited");
403403

404-
if (romOptions.hyperreduce && romOptions.hyperreductionSamplingType == eqp_energy)
404+
if (romOptions.hyperreductionSamplingType == eqp_energy)
405405
romOptions.GramSchmidt = false;
406406

407407
romOptions.spaceTimeMethod = getSpaceTimeMethod(spaceTimeMethod);
@@ -1004,14 +1004,14 @@ int main(int argc, char *argv[])
10041004
LagrangianHydroOperator* oper = NULL;
10051005
if (fom_data)
10061006
{
1007-
const bool noMassSolve = rom_online && (romOptions.hyperreductionSamplingType == eqp);
1007+
const bool noMassSolve = rom_online && (romOptions.hyperreductionSamplingType == eqp || romOptions.hyperreductionSamplingType == eqp_energy);
10081008
oper = new LagrangianHydroOperator(S->Size(), *H1FESpace, *L2FESpace,
10091009
ess_tdofs, *rho, source, cfl,
10101010
mat_gf_coeff, visc, vort, p_assembly,
10111011
cg_tol, cg_max_iter, ftz_tol,
10121012
H1FEC.GetBasisType(), noMassSolve,
10131013
noMassSolve,
1014-
rom_online && (romOptions.hyperreductionSamplingType == eqp));
1014+
rom_online && (romOptions.hyperreductionSamplingType == eqp || romOptions.hyperreductionSamplingType == eqp_energy));
10151015
}
10161016

10171017
socketstream* vis_rho = NULL;
@@ -1581,11 +1581,11 @@ int main(int argc, char *argv[])
15811581
romOper[0]->ApplyHyperreduction(romS);
15821582
}
15831583

1584-
// TODO: do we want that for the energy-conserving EQP?
1585-
if (rom_online && romOptions.hyperreduce && romOptions.hyperreductionSamplingType == eqp_energy)
1586-
{
1587-
romOper[0]->ApplyHyperreduction(romS);
1588-
}
1584+
// // TODO: do we want that for the energy-conserving EQP?
1585+
// if (rom_online && romOptions.hyperreduce && romOptions.hyperreductionSamplingType == eqp_energy)
1586+
// {
1587+
// romOper[0]->ApplyHyperreduction(romS);
1588+
// }
15891589

15901590
double windowEndpoint = 0.0;
15911591
double windowOverlapMidpoint = 0.0;
@@ -2058,10 +2058,10 @@ int main(int argc, char *argv[])
20582058
romOper[romOptions.window]->ApplyHyperreduction(romS);
20592059
}
20602060

2061-
if (romOptions.hyperreduce && romOptions.hyperreductionSamplingType == eqp_energy)
2062-
{
2063-
romOper[romOptions.window]->ApplyHyperreduction(romS);
2064-
}
2061+
//if (romOptions.hyperreduce && romOptions.hyperreductionSamplingType == eqp_energy)
2062+
//{
2063+
// romOper[romOptions.window]->ApplyHyperreduction(romS);
2064+
//}
20652065

20662066
if (problem == 7 && romOptions.indicatorType == penetrationDistance)
20672067
{
@@ -2109,7 +2109,7 @@ int main(int argc, char *argv[])
21092109
<< sqrt(tot_norm) << endl;
21102110
}
21112111

2112-
if (romOptions.hyperreduce && romOptions.hyperreductionSamplingType == eqp_energy)
2112+
if (romOptions.hyperreductionSamplingType == eqp_energy)
21132113
{
21142114
double energy_total, energy_diff;
21152115
energy_total = oper->InternalEnergy(*e_gf) +

rom/laghos_rom.cpp

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1119,16 +1119,10 @@ void ROM_Sampler::Finalize(Array<int> &cutoff, ROM_Options& input)
11191119
// Form the energy identity and replace the last basis vector by it.
11201120
Vector unitE(tL2size);
11211121

1122-
// TODO: my understanding is that the "=" opetaror is overloaded, so
1123-
// that, by setting unitE = 1.0, the vector unitE contains the coeffs
1124-
// that result in the summed function being 1.0 on the grid points.
1125-
// Is that correct?
11261122
unitE = 1.0;
11271123

11281124
for (int i = 0; i < tL2size; i++)
11291125
{
1130-
// TODO: I believe I can access the last column in this way,
1131-
// without having to use pointer arithmetic, right?
11321126
(*tBasisE)(i, cutoff[2]-1) = unitE[i];
11331127
}
11341128

@@ -2808,7 +2802,12 @@ ROM_Operator::ROM_Operator(ROM_Options const& input, ROM_Basis *b,
28082802
ComputeReducedMv();
28092803
ComputeReducedMe();
28102804

2805+
// Read the same data twice, because different variables are used
2806+
// when solving the velocity and energy problems (due to the way this
2807+
// is done for basic EQP). In this way, minimal changes to the code
2808+
// are needed.
28112809
ReadSolutionNNLS(input, "run/nnlsEC", eqpI, eqpW);
2810+
ReadSolutionNNLS(input, "run/nnlsEC", eqpI_E, eqpW_E);
28122811
}
28132812
}
28142813

@@ -3286,10 +3285,10 @@ void ROM_Operator::ComputeReducedMe()
32863285
{
32873286
basis->GetBasisVectorE(false, i, ei);
32883287

3289-
invMvROM(i,j) = ei * Mej;
3288+
invMeROM(i,j) = ei * Mej;
32903289
}
32913290
}
3292-
invMvROM.Invert();
3291+
invMeROM.Invert();
32933292
}
32943293
else if (!hyperreduce)
32953294
{
@@ -4691,9 +4690,6 @@ void ROM_Operator::ForceIntegratorEQP(Vector & res,
46914690
if (energy_conserve)
46924691
{
46934692
// Multiply by the reduced Mv inverse
4694-
4695-
// TODO: does that copy the data of res to res_tmp, or is it just
4696-
// a reference?
46974693
Vector res_tmp = res;
46984694

46994695
invMvROM.Mult(res_tmp, res);
@@ -4907,7 +4903,7 @@ void ROM_Operator::ForceIntegratorEQP_E_FOM(Vector const& v, Vector & rhs,
49074903
{
49084904
Vector res(basis->GetDimE());
49094905

4910-
ForceIntegratorEQP_E(v, res);
4906+
ForceIntegratorEQP_E(v, res, energy_conserve);
49114907
basis->LiftROMtoFOM_dEdt(res, rhs);
49124908
}
49134909

0 commit comments

Comments
 (0)