Skip to content

Commit

Permalink
add gf_checkpoint_every_nmins parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas-Ulrich committed Sep 15, 2023
1 parent 8459461 commit e2da797
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 6 deletions.
4 changes: 4 additions & 0 deletions app/form/SeasQDDiscreteGreenOperator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,17 @@ SeasQDDiscreteGreenOperator::SeasQDDiscreteGreenOperator(
std::unique_ptr<AbstractFrictionOperator> friction,
LocalSimplexMesh<DomainDimension> const& mesh,
std::optional<std::string> prefix,
double gf_checkpoint_every_nmins,
bool matrix_free, MGConfig const& mg_config)
: base(std::move(dgop), std::move(adapter), std::move(friction), matrix_free, mg_config) {

int rank;

MPI_Comm_rank(base::comm(),&rank);
// if prefix is not empty, set filenames and mark checkpoint_enabled_ = true

checkpoint_every_nmins_ = gf_checkpoint_every_nmins;

if (prefix.has_value()) {
std::string sprefix = prefix.value_or("");
if (rank == 0) { std::cout << "Using GF checkpoint path: " << sprefix << std::endl; }
Expand Down
6 changes: 4 additions & 2 deletions app/form/SeasQDDiscreteGreenOperator.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ class SeasQDDiscreteGreenOperator : public SeasQDOperator {
SeasQDDiscreteGreenOperator(std::unique_ptr<typename base::dg_t> dgop,
std::unique_ptr<AbstractAdapterOperator> adapter,
std::unique_ptr<AbstractFrictionOperator> friction,
LocalSimplexMesh<DomainDimension> const& mesh, std::optional<std::string> prefix,
LocalSimplexMesh<DomainDimension> const& mesh,
std::optional<std::string> prefix,
double gf_checkpoint_every_nmins,
bool matrix_free = false, MGConfig const& mg_config = MGConfig());
~SeasQDDiscreteGreenOperator();

Expand Down Expand Up @@ -54,7 +56,7 @@ LocalSimplexMesh<DomainDimension> const& mesh, std::optional<std::string> prefix
std::string gf_operator_filename_ = "gf_mat.bin";
std::string gf_traction_filename_ = "gf_vec.bin";
std::string gf_facet_filename_ = "gf_facet_labels.bin";
double checkpoint_every_nmins_ = 30.0;
double checkpoint_every_nmins_;

void update_traction(double time, BlockVector const& state);

Expand Down
2 changes: 1 addition & 1 deletion app/tandem/SEAS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ template <> struct operator_specifics<SeasQDDiscreteGreenOperator> : public qd_o

static auto make(LocalSimplexMesh<DomainDimension> const& mesh, Config const& cfg, seas::ContextBase& ctx) {
auto seasop = std::make_shared<SeasQDDiscreteGreenOperator>(std::move(ctx.dg()), std::move(ctx.adapter()),
std::move(ctx.friction()), mesh, cfg.gf_checkpoint_prefix, cfg.matrix_free,
std::move(ctx.friction()), mesh, cfg.gf_checkpoint_prefix, cfg.gf_checkpoint_every_nmins, cfg.matrix_free,
MGConfig(cfg.mg_coarse_level, cfg.mg_strategy));
ctx.setup_seasop(*seasop);
seasop->warmup();
Expand Down
7 changes: 4 additions & 3 deletions app/tandem/SeasConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,12 @@ void setConfigSchema(TableSchema<Config>& schema,
.default_value(false)
.help("Assert that boundary is a linear function of time (i.e. boundary(x, t) = f(x) t).");


schema.add_value("gf_checkpoint_prefix", &Config::gf_checkpoint_prefix)
.help("Path where Green's function operator and RHS will be checkpointed");


schema.add_value("gf_checkpoint_every_nmins", &Config::gf_checkpoint_every_nmins)
.default_value(30.0)
.help("time interval, in minutes, at which the Green's function operator data is saved to disk");

schema.add_value("matrix_free", &Config::matrix_free)
.default_value(false)
.help("Use matrix-free operators");
Expand Down
1 change: 1 addition & 0 deletions app/tandem/SeasConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ struct Config {
unsigned mg_coarse_level;

std::optional<std::string> gf_checkpoint_prefix;
double gf_checkpoint_every_nmins;

std::optional<GenMeshConfig<DomainDimension>> generate_mesh;
std::optional<OutputConfig> fault_output;
Expand Down

0 comments on commit e2da797

Please sign in to comment.