27#ifndef OOMPH_GEOMETRIC_MULTIGRID_HEADER
28#define OOMPH_GEOMETRIC_MULTIGRID_HEADER
32#include <oomph-lib-config.h>
86 template<
unsigned DIM>
92 typedef Smoother* (*PreSmootherFactoryFctPt)();
96 typedef Smoother* (*PostSmootherFactoryFctPt)();
153 for (
unsigned i = 0;
i <
Nlevel - 1;
i++)
175 for (
unsigned i = 0;
i < Nlevel - 1;
i++)
309 for (
unsigned i = 0;
i <
Nlevel - 1;
i++)
322 ->disable_doc_time();
436 "Setup of interpolation matrix distribution ";
440 if (
dist_pt->communicator_pt()->nproc() > 1)
465 for (
unsigned i = 0;
i <
Nlevel - 1;
i++)
517 throw OomphLibError(
"Input problem must be of type MGProblem.",
531 <<
" per node. This problem has " <<
n_value
532 <<
" dofs per node." << std::endl;
555 <<
"Multigrid Solve Complete"
556 <<
"=================\n"
573 oomph_info <<
"Total number of V-cycles required for solve: "
731 template<
unsigned DIM>
760 OomphLibWarning(
"Can't guarantee the MG solver will work in parallel!",
784 throw OomphLibError(
"Matrix and RHS vector sizes incompatible.",
801 <<
"\n==========Multigrid Preconditioner Solve Complete========="
822 template<
unsigned DIM>
829 if (!Suppress_all_output)
836 <<
"\n===============Starting Multigrid Full Setup=============="
840 oomph_info <<
"\nStarting the full setup of the multigrid solver."
847 if (
dynamic_cast<FiniteElement*
>(Mg_problem_pt->mesh_pt()->element_pt(0))
850 std::string
err_strng =
"The dimension of the elements used in the mesh ";
851 err_strng +=
"does not match the dimension of the solver.";
858 if (Mg_problem_pt->mg_bulk_mesh_pt() != 0)
861 unsigned n_elements = Mg_problem_pt->mg_bulk_mesh_pt()->nelement();
869 Mg_problem_pt->mg_bulk_mesh_pt()->element_pt(
el_counter));
876 "Element in global mesh could not be upcast to a refineable "
877 "element. We cannot deal with elements that are not refineable.",
886 "The provided bulk mesh pointer is set to be a null pointer. "
887 "The multigrid solver operates on the bulk mesh thus a pointer "
888 "to the correct mesh must be given.",
899 Mg_hierarchy.resize(1, 0);
902 Mg_hierarchy[0] = Mg_problem_pt;
905 setup_mg_hierarchy();
908 setup_transfer_matrices();
912 setup_mg_structures();
922 for (
unsigned i = 1;
i < Nlevel;
i++)
925 delete Mg_hierarchy[
i];
939 Has_been_setup =
true;
942 if (!Suppress_all_output)
954 <<
"\n===============Multigrid Full Setup Complete=============="
964 template<
unsigned DIM>
971 if (!Suppress_all_output)
975 <<
"\n===============Creating Multigrid Hierarchy==============="
1008 ->refine_base_mesh_as_in_reference_mesh_minus_one(
1009 Mg_hierarchy[level]->mg_bulk_mesh_pt());
1020 if (!Suppress_all_output)
1023 oomph_info <<
"\nSuccess! Level " << level <<
" has been created."
1048 Nlevel = Mg_hierarchy.
size();
1052 if (!Suppress_all_output)
1055 oomph_info <<
"\n Reached the coarsest level! "
1056 <<
"Number of levels: " << Nlevel << std::endl;
1064 Mg_matrices_storage_pt.resize(Nlevel, 0);
1067 X_mg_vectors_storage.resize(Nlevel);
1070 Rhs_mg_vectors_storage.resize(Nlevel);
1073 Residual_mg_vectors_storage.resize(Nlevel);
1077 Pre_smoothers_storage_pt.resize(Nlevel - 1, 0);
1081 Post_smoothers_storage_pt.resize(Nlevel - 1, 0);
1084 Interpolation_matrices_storage_pt.resize(Nlevel - 1, 0);
1087 Restriction_matrices_storage_pt.resize(Nlevel - 1, 0);
1089 if (!Suppress_all_output)
1095 <<
"\nCPU time for creation of hierarchy of MG problems [sec]: "
1100 <<
"\n===============Hierarchy Creation Complete================"
1113 template<
unsigned DIM>
1120 if (!Suppress_all_output)
1123 oomph_info <<
"Creating the transfer matrices ";
1130 if (!Suppress_all_output)
1133 oomph_info <<
"using full weighting (recommended).\n" << std::endl;
1140 Mg_problem_pt->mg_bulk_mesh_pt()))
1142 setup_interpolation_matrices();
1148 setup_interpolation_matrices_unstructured();
1152 set_restriction_matrices_as_interpolation_transposes();
1155 if (!Suppress_all_output)
1160 oomph_info <<
"CPU time for transfer matrices setup [sec]: "
1165 <<
"\n============Transfer Matrices Setup Complete=============="
1176 template<
unsigned DIM>
1183 if (!Suppress_all_output)
1190 for (
unsigned i = 0;
i < Nlevel;
i++)
1198 for (
unsigned i = 0;
i < Nlevel;
i++)
1201 if (!Suppress_all_output)
1204 oomph_info <<
"Setting up MG structures on level: " <<
i <<
"\n"
1211 Mg_hierarchy[
i]->communicator_pt(),
n_dof,
false);
1220 if (
dist_pt->communicator_pt()->nproc() > 1)
1230 X_mg_vectors_storage[
i].clear();
1231 X_mg_vectors_storage[
i].build(
dist_pt);
1234 Rhs_mg_vectors_storage[
i].clear();
1235 Rhs_mg_vectors_storage[
i].build(
dist_pt);
1238 Residual_mg_vectors_storage[
i].clear();
1239 Residual_mg_vectors_storage[
i].build(
dist_pt);
1248 Mg_matrices_storage_pt[
i]->clear();
1249 Mg_matrices_storage_pt[
i]->distribution_pt()->build(
1250 Mg_hierarchy[
i]->communicator_pt(),
n_dof,
false);
1265 if (!Suppress_all_output)
1273 Mg_hierarchy[0]->get_jacobian(Rhs_mg_vectors_storage[0],
1274 *Mg_matrices_storage_pt[0]);
1276 if (!Suppress_all_output)
1281 oomph_info <<
" - Time for setup of Jacobian [sec]: "
1282 << jacobian_setup_time <<
"\n"
1292 if (!Suppress_all_output)
1306 Mg_matrices_storage_pt[
i - 1]->multiply(
1307 *Interpolation_matrices_storage_pt[
i - 1],
1308 *Mg_matrices_storage_pt[
i]);
1313 Restriction_matrices_storage_pt[
i - 1]->multiply(
1314 *Mg_matrices_storage_pt[
i], *Mg_matrices_storage_pt[
i]);
1317 if (!Suppress_all_output)
1327 <<
" - Time for system matrix formation using the Galerkin "
1336 if (!Suppress_all_output)
1341 oomph_info <<
"Total CPU time for setup of MG structures [sec]: "
1346 <<
"Multigrid Structures Setup Complete"
1355 template<
unsigned DIM>
1362 if (!Suppress_all_output)
1365 oomph_info <<
"Starting the setup of all smoothers.\n" << std::endl;
1372 for (
unsigned i = 0;
i < Nlevel - 1;
i++)
1377 if (0 == Pre_smoother_factory_function_pt)
1386 Pre_smoothers_storage_pt[
i] = (*Pre_smoother_factory_function_pt)();
1392 if (0 == Post_smoother_factory_function_pt)
1401 Post_smoothers_storage_pt[
i] = (*Post_smoother_factory_function_pt)();
1410 for (
unsigned i = 0;
i < Nlevel - 1;
i++)
1413 Pre_smoothers_storage_pt[
i]->tolerance() = 1.0e-16;
1416 Post_smoothers_storage_pt[
i]->tolerance() = 1.0e-16;
1421 for (
unsigned i = 0;
i < Nlevel - 1;
i++)
1424 Pre_smoothers_storage_pt[
i]->max_iter() = Npre_smooth;
1427 Post_smoothers_storage_pt[
i]->max_iter() = Npost_smooth;
1431 for (
unsigned i = 0;
i < Nlevel - 1;
i++)
1435 Pre_smoothers_storage_pt[
i]->smoother_setup(Mg_matrices_storage_pt[
i]);
1439 Post_smoothers_storage_pt[
i]->smoother_setup(Mg_matrices_storage_pt[
i]);
1443 for (
unsigned i = 0;
i < Nlevel - 1;
i++)
1448 unsigned n_dof = X_mg_vectors_storage[
i].nrow();
1453 Mg_hierarchy[
i]->communicator_pt(),
n_dof,
false);
1459 "Setup of pre- and post-smoother distribution ";
1463 if (
dist.communicator_pt()->nproc() > 1)
1473 Pre_smoothers_storage_pt[
i]->build_distribution(
dist);
1476 Post_smoothers_storage_pt[
i]->build_distribution(
dist);
1482 disable_smoother_and_superlu_doc_time();
1486 if (!Suppress_all_output)
1491 oomph_info <<
"CPU time for setup of smoothers on all levels [sec]: "
1496 <<
"\n==================Smoother Setup Complete================="
1504 template<
unsigned DIM>
1534 for (
unsigned level = 0; level < Nlevel - 1; level++)
1543 Mg_hierarchy[
fine_level]->mg_bulk_mesh_pt());
1672 son_type =
el_fine_pt->tree_pt()->son_type();
1704 row_start[index] = value.
size();
1712 level_up_local_coord_of_node(son_type,
s);
1752 Node* master_node_pt =
1787 for (std::map<unsigned, double>::iterator
it =
1792 if (
it->second != 0)
1794 column_index.push_back(
it->first);
1795 value.push_back(
it->second);
1818 interpolation_matrix_set(
1819 level, value, column_index, row_start,
n_cols,
n_rows);
1826 template<
unsigned DIM>
1835 for (
unsigned level = 0; level < Nlevel - 1; level++)
1980 for (std::map<unsigned, double>::iterator
it =
contribution.begin();
1984 if (
it->second != 0)
1986 value.push_back(
it->second);
1987 column_index.push_back(
it->first);
1999 interpolation_matrix_set(level,
2014 template<
unsigned DIM>
2019 if (!(level < Nlevel - 1))
2021 throw OomphLibError(
"Input exceeds the possible parameter choice.",
2029 Restriction_matrices_storage_pt[level]->multiply(
2030 Residual_mg_vectors_storage[level], Rhs_mg_vectors_storage[level + 1]);
2037 template<
unsigned DIM>
2044 throw OomphLibError(
"Input level exceeds the possible parameter choice.",
2054 Interpolation_matrices_storage_pt[level - 1]->multiply(
2055 X_mg_vectors_storage[level],
temp_soln);
2058 X_mg_vectors_storage[level - 1] +=
temp_soln;
2064 template<
unsigned DIM>
2071 for (
unsigned level = 0; level < Nlevel - 1; level++)
2094 for (
unsigned i = 0;
i <
n_row;
i++)
2129 template<
unsigned DIM>
2136 oomph_info <<
"\nStarting the multigrid solver self-test." << std::endl;
2139 Restriction_self_test_vectors_storage.resize(Nlevel);
2142 Interpolation_self_test_vectors_storage.resize(Nlevel);
2145 unsigned n_dof = X_mg_vectors_storage[0].nrow();
2149 Mg_problem_pt->communicator_pt(),
n_dof,
false);
2158 if (
dist_pt->communicator_pt()->nproc() > 1)
2168 Restriction_self_test_vectors_storage[0].build(
dist_pt);
2178 set_self_test_vector();
2181 restriction_self_test();
2186 Interpolation_self_test_vectors_storage[Nlevel - 1] =
2187 Restriction_self_test_vectors_storage[Nlevel - 1];
2190 interpolation_self_test();
2193 Restriction_self_test_vectors_storage.resize(0);
2196 Interpolation_self_test_vectors_storage.resize(0);
2205 oomph_info <<
"\n====================Self-Test Complete===================="
2213 template<
unsigned DIM>
2218 Mg_problem_pt->mg_bulk_mesh_pt();
2231 for (
unsigned e = 0;
e <
n_el;
e++)
2237 for (
unsigned j = 0;
j <
nnod;
j++)
2243 if (
nod_pt->nvalue() != 1)
2249 error_stream <<
"Sorry, not sure what to do here! I can't deal with "
2250 <<
nod_pt->nvalue() <<
" values!" << std::endl;
2269 for (
unsigned i = 0;
i <
n_dim;
i++)
2279 Restriction_self_test_vectors_storage[0][
eqn_num] =
2301 template<
unsigned DIM>
2306 std::string
outputfile =
"RESLT/restriction_self_test";
2309 for (
unsigned level = 0; level < Nlevel - 1; level++)
2312 Restriction_matrices_storage_pt[level]->multiply(
2313 Restriction_self_test_vectors_storage[level],
2314 Restriction_self_test_vectors_storage[level + 1]);
2318 for (
unsigned level = 0; level < Nlevel; level++)
2322 std::stringstream string;
2328 plot(level, Restriction_self_test_vectors_storage[level],
filename);
2338 template<
unsigned DIM>
2343 std::string
outputfile =
"RESLT/interpolation_self_test";
2346 for (
unsigned level = Nlevel - 1; level > 0; level--)
2349 Interpolation_matrices_storage_pt[level - 1]->multiply(
2350 Interpolation_self_test_vectors_storage[level],
2351 Interpolation_self_test_vectors_storage[level - 1]);
2354 for (
unsigned level = 0; level < Nlevel; level++)
2358 std::stringstream string;
2364 plot(level, Interpolation_self_test_vectors_storage[level],
filename);
2373 template<
unsigned DIM>
2400 for (
unsigned e = 0;
e <
n_el;
e++)
2410 for (
unsigned j = 0;
j <
nnod;
j++)
2416 if (
nod_pt->nvalue() != 1)
2427 for (
unsigned i = 0;
i <
n_dim;
i++)
2443 for (
unsigned i = 0;
i <
n_dim;
i++)
2458 if (
nod_pt->is_on_boundary())
2473 else if (
nod_pt->is_hanging())
2519 template<
unsigned DIM>
2524 if (!Suppress_v_cycle_output)
2534 V_cycle_counter = 0;
2538 if (!Suppress_v_cycle_output)
2540 oomph_info <<
"\nResidual on finest level for V-cycle: "
2549 (V_cycle_counter != Nvcycle))
2551 if (!Suppress_v_cycle_output)
2554 oomph_info <<
"\nStarting V-cycle: " << V_cycle_counter << std::endl;
2559 for (
unsigned i = 0;
i < Nlevel - 1;
i++)
2567 X_mg_vectors_storage[
i].initialise(0.0);
2568 Residual_mg_vectors_storage[
i].initialise(0.0);
2577 restrict_residual(
i);
2588 for (
unsigned i = Nlevel - 1;
i > 0;
i--)
2592 interpolate_and_correct(
i);
2605 if (Doc_convergence_history)
2607 if (!Output_file_stream.is_open())
2614 Output_file_stream << V_cycle_counter <<
" "
2623 if (!Suppress_v_cycle_output)
2625 oomph_info <<
"Residual on finest level of V-cycle: "
2634 if (!Suppress_v_cycle_output)
2640 if (!Suppress_all_output)
2646 Has_been_solved =
true;
2651 if (!Suppress_v_cycle_output)
unsigned self_test()
Self-test: Return 0 for OK.
A class for compressed row matrices. This is a distributable object.
unsigned nvalue() const
Return number of values stored in data object (incl pinned ones).
long & eqn_number(const unsigned &i)
Return the equation number of the i-th stored variable.
unsigned nrow() const
access function to the number of global rows.
A vector in the mathematical sense, initially developed for linear algebra type applications....
A general Finite Element class.
void position(const Vector< double > &zeta, Vector< double > &r) const
Return the parametrised position of the FiniteElement in its incarnation as a GeomObject,...
virtual void local_coordinate_of_node(const unsigned &j, Vector< double > &s) const
Get local coordinates of node j in the element; vector sets its own size (broken virtual)
virtual std::string tecplot_zone_string(const unsigned &nplot) const
Return string for tecplot zone header (when plotting nplot points in each "coordinate direction")
double size() const
Calculate the size of the element (length, area, volume,...) in Eulerian computational coordinates....
void locate_zeta(const Vector< double > &zeta, GeomObject *&geom_object_pt, Vector< double > &s, const bool &use_coordinate_as_initial_guess=false)
For a given value of zeta, the "global" intrinsic coordinate of a mesh of FiniteElements represented ...
virtual void shape(const Vector< double > &s, Shape &psi) const =0
Calculate the geometric shape functions at local coordinate s. This function must be overloaded for e...
unsigned dim() const
Return the spatial dimension of the element, i.e. the number of local coordinates required to paramet...
unsigned nnode() const
Return the number of nodes.
Node *& node_pt(const unsigned &n)
Return a pointer to the local node n.
virtual unsigned nnode_1d() const
Return the number of nodes along one edge of the element Default is to return zero — must be overload...
unsigned ndof() const
Return the number of equations/dofs in the element.
unsigned long eqn_number(const unsigned &ieqn_local) const
Return the global equation number corresponding to the ieqn_local-th local equation number.
A geometric object is an object that provides a parametrised description of its shape via the functio...
Class that contains data for hanging nodes.
Base class for all linear iterative solvers. This merely defines standard interfaces for linear itera...
double Tolerance
Convergence tolerance.
Describes the distribution of a distributable linear algebra type object. Typically this is a contain...
bool Doc_time
Boolean flag that indicates whether the time taken.
An interface to allow scalar MG to be used as a Preconditioner.
MGPreconditioner(const MGPreconditioner &)=delete
Broken copy constructor.
void setup()
Function to set up a preconditioner for the linear system.
MGPreconditioner(MGProblem *mg_problem_pt)
Constructor.
void operator=(const MGPreconditioner &)=delete
Broken assignment operator.
void clean_up_memory()
Clean up memory.
~MGPreconditioner()
Destructor (empty)
virtual void preconditioner_solve(const DoubleVector &rhs, DoubleVector &z)
Function applies MG to the vector r for a full solve.
MGProblem class; subclass of Problem.
virtual TreeBasedRefineableMeshBase * mg_bulk_mesh_pt()=0
Function to get a pointer to the mesh we will be working with. If there are flux elements present in ...
MGProblem()
Constructor. Initialise pointers to coarser and finer levels.
virtual MGProblem * make_new_problem()=0
This function needs to be implemented in the derived problem: Returns a pointer to a new object of th...
virtual ~MGProblem()
Destructor (empty)
void set_self_test_vector()
Makes a vector which will be used in the self-test. Is currently set to make the entries of the vecto...
Smoother *(* PostSmootherFactoryFctPt)()
typedef for a function that returns a pointer to an object of the class Smoother to be used as the po...
void set_pre_smoother_factory_function(PreSmootherFactoryFctPt pre_smoother_fn)
Access function to set the pre-smoother creation function.
bool Suppress_all_output
If this is set to true then all output from the solver is suppressed. This is protected member data s...
void full_setup()
Do a full setup (assumes everything will be setup around the MGProblem pointer given in the construct...
Vector< DoubleVector > Rhs_mg_vectors_storage
Vector to store the RHS vectors (Rhs_mg). This is protected to allow the multigrid preconditioner to ...
void setup_mg_structures()
Function to set up the hierachy of levels. Creates a vector of pointers to each MG level.
void interpolation_self_test()
Make a self-test to make sure that the interpolation matrices are doing the same thing to interpolate...
void level_up_local_coord_of_node(const int &son_type, Vector< double > &s)
Given the son_type of an element and a local node number j in that element with nnode_1d nodes per co...
unsigned V_cycle_counter
Pointer to counter for V-cycles.
Vector< Smoother * > Post_smoothers_storage_pt
Vector to store the post-smoothers.
PostSmootherFactoryFctPt Post_smoother_factory_function_pt
Function to create post-smoothers.
Vector< DoubleVector > Residual_mg_vectors_storage
Vector to store the residual vectors.
bool Doc_everything
If this is set to true we document everything. In addition to outputting the information of the setup...
void setup_transfer_matrices()
Setup the transfer matrices on each level.
void enable_v_cycle_output()
Enable the output of the V-cycle timings and other output.
void setup_interpolation_matrices()
Setup the interpolation matrix on each level.
void post_smooth(const unsigned &level)
Post-smoother: Perform max_iter smoothing steps on the linear system Ax=b with current RHS vector,...
void set_post_smoother_factory_function(PostSmootherFactoryFctPt post_smoother_fn)
Access function to set the post-smoother creation function.
unsigned Nlevel
The number of levels in the multigrid heirachy.
void plot(const unsigned &hierarchy_level, const DoubleVector &input_vector, const std::string &filename)
Given a level in the hierarchy, an input vector and a filename this function will document the given ...
unsigned & npost_smooth()
Return the number of post-smoothing iterations (lvalue)
Vector< Smoother * > Pre_smoothers_storage_pt
Vector to store the pre-smoothers.
std::ostream * Stream_pt
Pointer to the output stream – defaults to std::cout. This is protected member data to allow the prec...
void set_restriction_matrices_as_interpolation_transposes()
Builds a CRDoubleMatrix on each level that is used to restrict the residual between levels....
Smoother *(* PreSmootherFactoryFctPt)()
typedef for a function that returns a pointer to an object of the class Smoother to be used as the pr...
MGSolver(MGProblem *mg_problem_pt)
Constructor: Set up default values for number of V-cycles and pre- and post-smoothing steps.
void solve(Problem *const &problem_pt, DoubleVector &result)
Virtual function in the base class that needs to be implemented later but for now just leave it empty...
void mg_solve(DoubleVector &result)
Do the actual solve – this is called through the pure virtual solve function in the LinearSolver base...
void disable_output()
Suppress anything that can be suppressed, i.e. any timings. Things like mesh adaptation can not howev...
void restrict_residual(const unsigned &level)
Restrict residual (computed on level-th MG level) to the next coarser mesh and stick it into the coar...
Vector< DoubleVector > Restriction_self_test_vectors_storage
Vector to store the result of restriction on each level (only required if the user wishes to document...
void interpolation_matrix_set(const unsigned &level, Vector< double > &value, Vector< int > &col_index, Vector< int > &row_st, unsigned &ncol, unsigned &nrow)
Builds a CRDoubleMatrix that is used to interpolate the residual between levels. The transpose can be...
void disable_smoother_and_superlu_doc_time()
Suppress the output of both smoothers and SuperLU.
void clean_up_memory()
Clean up anything that needs to be cleaned up.
void self_test()
Makes a vector, restricts it down the levels of the hierarchy and documents it at each level....
Vector< CRDoubleMatrix * > Restriction_matrices_storage_pt
Vector to store the restriction matrices.
void setup_mg_hierarchy()
Function to set up the hierachy of levels. Creates a vector of pointers to each MG level.
Vector< CRDoubleMatrix * > Mg_matrices_storage_pt
Vector to store the system matrices.
void setup_interpolation_matrices_unstructured()
Setup the interpolation matrix on each level (used for unstructured meshes)
void direct_solve()
Call the direct solver (SuperLU) to solve the problem exactly.
void setup_smoothers()
Function to set up all of the smoothers once the system matrices have been set up.
unsigned Npost_smooth
Number of post-smoothing steps.
void disable_v_cycle_output()
Disable all output from mg_solve apart from the number of V-cycles used to solve the problem.
~MGSolver()
Delete any dynamically allocated data.
unsigned Nvcycle
Maximum number of V-cycles (this is set as a protected variable so.
Vector< MGProblem * > Mg_hierarchy
Vector containing pointers to problems in hierarchy.
Vector< DoubleVector > Interpolation_self_test_vectors_storage
Vector to store the result of interpolation on each level (only required if the user wishes to docume...
Vector< CRDoubleMatrix * > Interpolation_matrices_storage_pt
Vector to store the interpolation matrices.
void enable_output()
Enable the output from anything that could have been suppressed.
void enable_doc_everything()
Enable the output from anything that could have been suppressed.
void pre_smooth(const unsigned &level)
Pre-smoother: Perform 'max_iter' smoothing steps on the linear system Ax=b with current RHS vector,...
bool Suppress_v_cycle_output
Indicates whether or not the V-cycle output should be suppressed. Needs to be protected member data f...
unsigned Npre_smooth
Number of pre-smoothing steps.
unsigned & npre_smooth()
Return the number of pre-smoothing iterations (lvalue)
unsigned iterations() const
Number of iterations.
void restriction_self_test()
Make a self-test to make sure that the interpolation matrices are doing the same thing to restrict th...
Vector< DoubleVector > X_mg_vectors_storage
Vector to store the solution vectors (X_mg)
void modify_restriction_matrices()
Normalise the rows of the restriction matrices to avoid amplifications when projecting to the coarser...
void interpolation_matrix_set(const unsigned &level, double *value, int *col_index, int *row_st, unsigned &ncol, unsigned &nnz)
Builds a CRDoubleMatrix that is used to interpolate the residual between levels. The transpose can be...
void interpolate_and_correct(const unsigned &level)
Interpolate solution at current level onto next finer mesh and correct the solution x at that level.
double residual_norm(const unsigned &level)
Return norm of residual r=b-Ax and the residual vector itself on the level-th level.
bool Has_been_setup
Boolean variable to indicate whether or not the solver has been setup.
MGProblem * Mg_problem_pt
Pointer to the MG problem (deep copy). This is protected to provide access to the MG preconditioner.
bool Has_been_solved
Boolean variable to indicate whether or not the problem was successfully solved.
PreSmootherFactoryFctPt Pre_smoother_factory_function_pt
Function to create pre-smoothers.
unsigned & max_iter()
Number of iterations.
static OomphCommunicator * communicator_pt()
access to global communicator. This is the oomph-lib equivalent of MPI_COMM_WORLD
This class provides a GeomObject representation of a given finite element mesh. The Lagrangian coordi...
Node *& node_pt(const unsigned long &n)
Return pointer to global node n.
Nodes are derived from Data, but, in addition, have a definite (Eulerian) position in a space of a gi...
unsigned ndim() const
Return (Eulerian) spatial dimension of the node.
bool is_hanging() const
Test whether the node is geometrically hanging.
HangInfo *const & hanging_pt() const
Return pointer to hanging node data (this refers to the geometric hanging node status) (const version...
std::ostream *& stream_pt()
Access function for the stream pointer.
An OomphLibError object which should be thrown when an run-time error is encountered....
An OomphLibWarning object which should be created as a temporary object to issue a warning....
Preconditioner base class. Gives an interface to call all other preconditioners through and stores th...
////////////////////////////////////////////////////////////////// //////////////////////////////////...
unsigned long ndof() const
Return the number of dofs.
Mesh *& mesh_pt()
Return a pointer to the global mesh.
RefineableElements are FiniteElements that may be subdivided into children to provide a better local ...
Base class for refineable meshes. Provides standardised interfaces for the following standard mesh ad...
A Class for shape functions. In simple cases, the shape functions have only one index that can be tho...
Smoother class: The smoother class is designed for to be used in conjunction with multigrid....
TAdvectionDiffusionReactionElement<NREAGENT,DIM,NNODE_1D> elements are isoparametric triangular DIM-d...
TAdvectionDiffusionReactionElement()
Constructor: Call constructors for TElement and AdvectionDiffusionReaction equations.
Base class for tree-based refineable meshes.
static const int OMEGA
Default value for an unassigned neighbour.
const double Pi
50 digits from maple
double timer()
returns the time in seconds after some point in past
DRAIG: Change all instances of (SPATIAL_DIM) to (DIM-1).
Nullstream oomph_nullstream
Single (global) instantiation of the Nullstream.
OomphInfo oomph_info
Single (global) instantiation of the OomphInfo object – this is used throughout the library as a "rep...