Skip to content
Open
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
3 changes: 1 addition & 2 deletions hermes2d/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,7 @@ set(SRC
${HERMES_COMMON_DIR}/utils.cpp
${HERMES_COMMON_DIR}/matrix.cpp
${HERMES_COMMON_DIR}/tables.cpp
${HERMES_COMMON_DIR}/Teuchos_stacktrace.cpp
${HERMES_COMMON_DIR}/butcher_tables.cpp
${HERMES_COMMON_DIR}/Teuchos_stacktrace.cpp
${HERMES_COMMON_DIR}/solver/nox.cpp
${HERMES_COMMON_DIR}/solver/epetra.cpp
${HERMES_COMMON_DIR}/solver/aztecoo.cpp
Expand Down
5 changes: 2 additions & 3 deletions hermes2d/src/hermes2d.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,6 @@
// boundary conditions
#include "../hermes_common/bctypes.h"

// butcher tables
#include "../../hermes_common/butcher_tables.h"

#include "h2d_common.h"
#include "hermes_logging.h"

Expand Down Expand Up @@ -104,6 +101,8 @@
#include "ogprojection.h"

#include "numerical_flux.h"
#include "runge_kutta.h"
#include "tables.h"
/**

\mainpage
Expand Down
4 changes: 2 additions & 2 deletions hermes2d/src/runge_kutta.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,8 @@ void create_stage_wf(double current_time, double time_step, ButcherTable* bt,
bool HERMES_RESIDUAL_AS_VECTOR_RK = false;
bool rk_time_step(double current_time, double time_step, ButcherTable* const bt,
scalar* coeff_vec, DiscreteProblem* dp, MatrixSolverType matrix_solver,
double newton_tol, int newton_max_iter, bool verbose = false,
double newton_damping_coeff = 1.0, double newton_max_allowed_residual_norm = 1e6)
double newton_tol, int newton_max_iter, bool verbose,
double newton_damping_coeff, double newton_max_allowed_residual_norm)
{
// Matrix and vector for the time derivative part of
// the equation (left-hand side).
Expand Down
4 changes: 2 additions & 2 deletions hermes2d/src/runge_kutta.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
/// matrix, Y the coefficient vector, and F the (nonlinear) stationary residual.
/// Below, "stage_wf_left" and "stage_wf_right" refer to the left-hand side
/// and right-hand side of the equation, respectively.
void create_stage_wf(double current_time, double time_step, ButcherTable* bt,
void HERMES_API create_stage_wf(double current_time, double time_step, ButcherTable* bt,
DiscreteProblem* dp, WeakForm* stage_wf_right, WeakForm* stage_wf_left);

bool rk_time_step(double current_time, double time_step, ButcherTable* const bt,
bool HERMES_API rk_time_step(double current_time, double time_step, ButcherTable* const bt,
scalar* coeff_vec, DiscreteProblem* dp, MatrixSolverType matrix_solver,
double newton_tol, int newton_max_iter, bool verbose = false,
double newton_damping_coeff = 1.0, double newton_max_allowed_residual_norm = 1e6);
Expand Down
13 changes: 6 additions & 7 deletions hermes2d/tutorial/09-timedep/main.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#define HERMES_REPORT_ALL
#define HERMES_REPORT_FILE "application.log"
#include "hermes2d.h"
#include "runge_kutta.h"

// This example shows how to solve a time-dependent PDE discretized
// in time via the implicit Euler method. The St. Vitus Cathedral
Expand Down Expand Up @@ -36,7 +35,7 @@ MatrixSolverType matrix_solver = SOLVER_UMFPACK; // Possibilities: SOLVER_AMESO
// Explicit_RK_1, Implicit_RK_1, Explicit_RK_2, Implicit_Crank_Nicolson_2, Implicit_SDIRK_2,
// Implicit_Lobatto_IIIA_2, Implicit_Lobatto_IIIB_2, Implicit_Lobatto_IIIC_2, Explicit_RK_3, Explicit_RK_4,
// Implicit_Lobatto_IIIA_4, Implicit_Lobatto_IIIB_4, Implicit_Lobatto_IIIC_4.
ButcherTableType butcher_table = Implicit_RK_1;
ButcherTableType butcher_table_type = Implicit_RK_1;

// Boundary markers.
const std::string BDY_GROUND = "Boundary ground";
Expand All @@ -62,7 +61,7 @@ Real temp_ext(Real t) {
int main(int argc, char* argv[])
{
// Choose a Butcher's table.
ButcherTable *bt = init_butcher_table(butcher_table);
ButcherTable bt(butcher_table_type);

// Load the mesh.
Mesh mesh;
Expand All @@ -80,7 +79,7 @@ int main(int argc, char* argv[])

// Enter Dirichlet boundary values.
BCValues bc_values;
bc_values.add_const(BDY_GROUND, TEMP_INIT);
bc_values.add_const(BDY_GROUND, TEMP_BND);

// Initialize an H1 space with default shapeset.
H1Space space(&mesh, &bc_types, &bc_values, P_INIT);
Expand All @@ -90,6 +89,7 @@ int main(int argc, char* argv[])
// Initialize the solution.
Solution u_prev_time;


// Set the initial condition.
u_prev_time.set_const(&mesh, TEMP_INIT);

Expand Down Expand Up @@ -124,9 +124,9 @@ int main(int argc, char* argv[])
{
// Perform one Runge-Kutta time step according to the selected Butcher's table.
info("Runge-Kutta time step (t = %g, tau = %g, stages: %d).",
current_time, time_step, bt->get_size());
current_time, time_step, bt.get_size());
bool verbose = true;
if (!rk_time_step(current_time, time_step, bt, coeff_vec, &dp, matrix_solver,
if (!rk_time_step(current_time, time_step, &bt, coeff_vec, &dp, matrix_solver,
NEWTON_TOL, NEWTON_MAX_ITER, verbose)) {
error("Runge-Kutta time step failed, try to decrease time step size.");
}
Expand All @@ -149,7 +149,6 @@ int main(int argc, char* argv[])

// Cleanup.
delete [] coeff_vec;
delete bt;

// Wait for the view to be closed.
View::wait();
Expand Down
176 changes: 0 additions & 176 deletions hermes_common/butcher_tables.cpp

This file was deleted.

25 changes: 0 additions & 25 deletions hermes_common/butcher_tables.h

This file was deleted.

18 changes: 0 additions & 18 deletions hermes_common/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,24 +91,6 @@ enum MatrixSolverType
SOLVER_AZTECOO
};

// Butcher's tables.
enum ButcherTableType
{
Explicit_RK_1, // Explicit Runge-Kutta RK-1, or explicit Euler method.
Implicit_RK_1, // Implicit Runge-Kutta RK-1, or implicit Euler method.
Explicit_RK_2, // Explicit Runge-Kutta RK-2 method.
Implicit_Crank_Nicolson_2, // Implicit Crank_Nicolson method.
Implicit_SDIRK_2, // Implicit SDIRK-2 method.
Implicit_Lobatto_IIIA_2, // Implicit Lobatto IIIA-2 method.
Implicit_Lobatto_IIIB_2, // Implicit Lobatto IIIB-2 method.
Implicit_Lobatto_IIIC_2, // Implicit Lobatto IIIB-2 method.
Explicit_RK_3, // Explicit Runge-Kutta RK-3 method.
Explicit_RK_4, // Explicit Runge-Kutta RK-4 method.
Implicit_Lobatto_IIIA_4, // Implicit Lobatto IIIA-4 method.
Implicit_Lobatto_IIIB_4, // Implicit Lobatto IIIB-4 method.
Implicit_Lobatto_IIIC_4 // Implicit Lobatto IIIB-4 method.
};

// Should be in the same order as MatrixSolverTypes above, so that the
// names may be accessed by the same enumeration variable.
const std::string MatrixSolverNames[7] = {
Expand Down
Loading