Skip to content

Commit

Permalink
bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
cval26 committed Jul 17, 2023
1 parent 684a039 commit 2c735c8
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 16 deletions.
26 changes: 13 additions & 13 deletions rom/laghos.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ int main(int argc, char *argv[])

romOptions.hyperreductionSamplingType = getHyperreductionSamplingType(hyperreductionSamplingType);
romOptions.use_sample_mesh = romOptions.hyperreduce && (romOptions.hyperreductionSamplingType != eqp
|| romOptions.hyperreductionSamplingType != eqp_energy);
&& romOptions.hyperreductionSamplingType != eqp_energy);

MFEM_VERIFY(!(romOptions.SNS) || (romOptions.hyperreductionSamplingType != eqp &&
romOptions.hyperreductionSamplingType != eqp_energy),
Expand Down Expand Up @@ -1004,14 +1004,14 @@ int main(int argc, char *argv[])
LagrangianHydroOperator* oper = NULL;
if (fom_data)
{
const bool noMassSolve = rom_online && (romOptions.hyperreductionSamplingType == eqp);
const bool noMassSolve = rom_online && (romOptions.hyperreductionSamplingType == eqp || romOptions.hyperreductionSamplingType == eqp_energy);
oper = new LagrangianHydroOperator(S->Size(), *H1FESpace, *L2FESpace,
ess_tdofs, *rho, source, cfl,
mat_gf_coeff, visc, vort, p_assembly,
cg_tol, cg_max_iter, ftz_tol,
H1FEC.GetBasisType(), noMassSolve,
noMassSolve,
rom_online && (romOptions.hyperreductionSamplingType == eqp));
rom_online && (romOptions.hyperreductionSamplingType == eqp || romOptions.hyperreductionSamplingType == eqp_energy));
}

socketstream* vis_rho = NULL;
Expand Down Expand Up @@ -1581,11 +1581,11 @@ int main(int argc, char *argv[])
romOper[0]->ApplyHyperreduction(romS);
}

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

double windowEndpoint = 0.0;
double windowOverlapMidpoint = 0.0;
Expand Down Expand Up @@ -2058,10 +2058,10 @@ int main(int argc, char *argv[])
romOper[romOptions.window]->ApplyHyperreduction(romS);
}

if (romOptions.hyperreduce && romOptions.hyperreductionSamplingType == eqp_energy)
{
romOper[romOptions.window]->ApplyHyperreduction(romS);
}
//if (romOptions.hyperreduce && romOptions.hyperreductionSamplingType == eqp_energy)
//{
// romOper[romOptions.window]->ApplyHyperreduction(romS);
//}

if (problem == 7 && romOptions.indicatorType == penetrationDistance)
{
Expand Down Expand Up @@ -2109,7 +2109,7 @@ int main(int argc, char *argv[])
<< sqrt(tot_norm) << endl;
}

if (romOptions.hyperreduce && romOptions.hyperreductionSamplingType == eqp_energy)
if (romOptions.hyperreductionSamplingType == eqp_energy)
{
double energy_total, energy_diff;
energy_total = oper->InternalEnergy(*e_gf) +
Expand Down
11 changes: 8 additions & 3 deletions rom/laghos_rom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2808,7 +2808,12 @@ ROM_Operator::ROM_Operator(ROM_Options const& input, ROM_Basis *b,
ComputeReducedMv();
ComputeReducedMe();

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

Expand Down Expand Up @@ -3286,10 +3291,10 @@ void ROM_Operator::ComputeReducedMe()
{
basis->GetBasisVectorE(false, i, ei);

invMvROM(i,j) = ei * Mej;
invMeROM(i,j) = ei * Mej;
}
}
invMvROM.Invert();
invMeROM.Invert();
}
else if (!hyperreduce)
{
Expand Down Expand Up @@ -4907,7 +4912,7 @@ void ROM_Operator::ForceIntegratorEQP_E_FOM(Vector const& v, Vector & rhs,
{
Vector res(basis->GetDimE());

ForceIntegratorEQP_E(v, res);
ForceIntegratorEQP_E(v, res, energy_conserve);
basis->LiftROMtoFOM_dEdt(res, rhs);
}

Expand Down

0 comments on commit 2c735c8

Please sign in to comment.