Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions examples/prom/mixed_nonlinear_diffusion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,8 @@ class RomOperator : public TimeDependentOperator
const double newton_rel_tol, const double newton_abs_tol, const int newton_iter,
std::shared_ptr<CAROM::Matrix> S_,
const std::shared_ptr<CAROM::Matrix> & Ssinv_,
const int myid, const bool hyperreduce_source_, const bool oversampling_,
const int myid, const bool hyperreduce_,
const bool hyperreduce_source_, const bool oversampling_,
const bool use_eqp, const CAROM::Vector & eqpSol,
const CAROM::Vector & eqpSol_S, const IntegrationRule *ir_eqp_);

Expand Down Expand Up @@ -469,6 +470,7 @@ int main(int argc, char *argv[])
bool online = false;
const char *samplingType = "deim";
bool use_eqp = false;
bool hyperreduce = true;
bool writeSampleMesh = false;
int num_samples_req = -1;
bool squareSV = true;
Expand Down Expand Up @@ -545,6 +547,8 @@ int main(int argc, char *argv[])
"Number of samples for the sampling algorithm to select.");
args.AddOption(&use_eqp, "-eqp", "--eqp", "-no-eqp", "--no-eqp",
"Use EQP instead of DEIM for the hyperreduction.");
args.AddOption(&hyperreduce, "-hyp", "--hyperreduce", "-no-hyp",
"--no-hyperreduce", "Hyper reduce nonlinear term");
args.AddOption(&writeSampleMesh, "-smesh", "--sample-mesh", "-no-smesh",
"--no-sample-mesh", "Write the sample mesh to file.");
args.AddOption(&preconditionNNLS, "-preceqp", "--preceqp", "-no-preceqp",
Expand Down Expand Up @@ -1071,7 +1075,7 @@ int main(int argc, char *argv[])
romop = new RomOperator(&oper, soper.get(), rrdim, rwdim, nldim, smm,
BR_librom, FR_librom, BW_librom,
Bsinv, newton_rel_tol, newton_abs_tol, newton_iter,
S_librom, Ssinv, myid, hyperreduce_source,
S_librom, Ssinv, myid, hyperreduce, hyperreduce_source,
num_samples_req != -1, use_eqp, *eqpSol, *eqpSol_S, ir0);

ode_solver.Init(*romop);
Expand Down Expand Up @@ -1653,7 +1657,8 @@ RomOperator::RomOperator(NonlinearDiffusionOperator *fom_,
const double newton_abs_tol, const int newton_iter,
std::shared_ptr<CAROM::Matrix> S_,
const shared_ptr<CAROM::Matrix> & Ssinv_,
const int myid, const bool hyperreduce_source_,
const int myid, const bool hyperreduce_,
const bool hyperreduce_source_,
const bool oversampling_, const bool use_eqp,
const CAROM::Vector & eqpSol, const CAROM::Vector & eqpSol_S,
const IntegrationRule *ir_eqp_)
Expand All @@ -1667,7 +1672,8 @@ RomOperator::RomOperator(NonlinearDiffusionOperator *fom_,
zN(std::max(nsamp_R, 1), false), J(height),
zS(std::max(nsamp_S, 1), false), zT(std::max(nsamp_S, 1), false), Ssinv(Ssinv_),
VTCS_W(rwdim, std::max(nsamp_S, 1), false), S(S_),
VtzR(rrdim_, false), hyperreduce_source(hyperreduce_source_),
VtzR(rrdim_, false), hyperreduce(hyperreduce_),
hyperreduce_source(hyperreduce_source_),
oversampling(oversampling_), eqp(use_eqp),
ir_eqp(ir_eqp_), p_gf(&(fom_->fespace_W)), rhs_gf(&(fom_->fespace_W)),
p_coeff(&p_gf), a_coeff(&p_coeff, NonlinearCoefficient),
Expand Down Expand Up @@ -1744,7 +1750,6 @@ RomOperator::RomOperator(NonlinearDiffusionOperator *fom_,
}
}

hyperreduce = true;
sourceFOM = false;

if (!hyperreduce || sourceFOM)
Expand All @@ -1764,7 +1769,7 @@ RomOperator::RomOperator(NonlinearDiffusionOperator *fom_,
true, false));

zfomR.SetSize(fom->zR.Size());
zfomR_librom.reset(new CAROM::Vector(zfomR.GetData(), zfomR.Size(), false,
zfomR_librom.reset(new CAROM::Vector(zfomR.GetData(), zfomR.Size(), true,
false));

zfomW.SetSize(fom->zW.Size());
Expand Down
7 changes: 6 additions & 1 deletion examples/prom/nonlinear_elasticity_global_rom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -859,13 +859,15 @@ int main(int argc, char *argv[])
{
hdim = H_librom->numColumns();
}
if (!hyperreduce) // Set hdim to 1 to reduce loading time for basis
hdim = 1;
CAROM::Matrix *Hsinv = new CAROM::Matrix(hdim, hdim, false);
MFEM_VERIFY(H_librom->numColumns() >= hdim, "");

if (H_librom->numColumns() > hdim)
H_librom = H_librom->getFirstNColumns(hdim);

if (myid == 0)
if (myid == 0 && hyperreduce)
printf("reduced H dim = %d\n", hdim);

// Setup hyperreduction, using either EQP or sampled DOFs and a sample mesh.
Expand Down Expand Up @@ -901,6 +903,9 @@ int main(int argc, char *argv[])
}
else
{
if (!hyperreduce) // Enforce full size of sampling mesh (crashes otherwise)
num_samples_req = static_cast<int>(glob_size);

vector<int> num_sample_dofs_per_proc(num_procs);

if (num_samples_req != -1)
Expand Down
Loading