39 namespace PressureAdvectionDiffusionValidation
52 wind[0] =
sin(6.0 * x[1]);
53 wind[1] =
cos(6.0 * x[0]);
69 u[2] = x[0] * x[0] *
pow(1.0 - x[0], 2.0) * x[1] * x[1] *
74 u[2] = 0.1E1 -
Peclet * x[0] * (0.1E1 - 0.5 * x[0]);
83 u = x[0] * x[0] *
pow(1.0 - x[0], 2.0) * x[1] * x[1] *
88 u = 0.1E1 -
Peclet * x[0] * (0.1E1 - 0.5 * x[0]);
106 (
sin(0.6E1 * x[1]) * (2.0 * x[0] *
pow(1.0 - x[0], 2.0) * x[1] *
107 x[1] *
pow(1.0 - x[1], 2.0) -
108 2.0 * x[0] * x[0] * (1.0 - x[0]) * x[1] *
109 x[1] *
pow(1.0 - x[1], 2.0)) +
110 cos(0.6E1 * x[0]) * (2.0 * x[0] * x[0] *
pow(1.0 - x[0], 2.0) *
111 x[1] *
pow(1.0 - x[1], 2.0) -
112 2.0 * x[0] * x[0] *
pow(1.0 - x[0], 2.0) *
113 x[1] * x[1] * (1.0 - x[1]))) -
114 2.0 *
pow(1.0 - x[0], 2.0) * x[1] * x[1] *
pow(1.0 - x[1], 2.0) +
115 8.0 * x[0] * (1.0 - x[0]) * x[1] * x[1] *
pow(1.0 - x[1], 2.0) -
116 2.0 * x[0] * x[0] * x[1] * x[1] *
pow(1.0 - x[1], 2.0) -
117 2.0 * x[0] * x[0] *
pow(1.0 - x[0], 2.0) *
pow(1.0 - x[1], 2.0) +
118 8.0 * x[0] * x[0] *
pow(1.0 - x[0], 2.0) * x[1] * (1.0 - x[1]) -
119 2.0 * x[0] * x[0] *
pow(1.0 - x[0], 2.0) * x[1] * x[1];
123 source =
Peclet * (-0.1E1 *
Peclet * (0.1E1 - 0.5 * x[0]) +
178 std::ostringstream error_message;
179 error_message <<
"The navier stokes elements mesh pointer must be set.\n"
180 <<
"Use method set_navier_stokes_mesh(...)";
204 std::ostringstream error_message;
206 <<
"NavierStokesSchurComplementPreconditioner only works with "
207 <<
"CRDoubleMatrix matrices" << std::endl;
216 std::stringstream
junk;
217 junk <<
"j_matrix" <<
comm_pt()->my_rank() <<
".dat";
293 std::stringstream
junk;
294 junk <<
"b_matrix" <<
comm_pt()->my_rank() <<
".dat";
295 b_pt->sparse_indexed_output_with_offset(
junk.str());
323 oomph_info <<
"Time to assemble inverse diagonal velocity and pressure"
335 std::stringstream
junk;
336 junk <<
"inv_v_mass_matrix" <<
comm_pt()->my_rank() <<
".dat";
360 std::stringstream
junk;
361 junk <<
"bt_matrix" <<
comm_pt()->my_rank() <<
".dat";
362 bt_pt->sparse_indexed_output_with_offset(
junk.str());
425 oomph_info <<
"Time to build QBt matrix vector operator [sec]: "
471 oomph_info <<
"Time to build Fp Qp^{-1} matrix vector operator [sec]: "
508 oomph_info <<
"Time to build F Matrix Vector Operator [sec]: "
579 std::stringstream
junk;
580 junk <<
"p_matrix" <<
comm_pt()->my_rank() <<
".dat";
666 std::ostringstream error_message;
667 error_message <<
"setup must be called before using preconditioner_solve";
673 if (z.
nrow() !=
r.nrow())
675 std::ostringstream error_message;
676 error_message <<
"The vectors z and r must have the same number of "
688 z.
build(
r.distribution_pt(), 0.0);
714 std::ostringstream error_message;
715 error_message <<
"P_preconditioner_pt has not been set.";
762 std::ostringstream error_message;
763 error_message <<
"P_preconditioner_pt has not been set.";
816 std::ostringstream error_message;
817 error_message <<
"F_preconditioner_pt has not been set.";
963 for (
unsigned e = 0;
e <
n_el;
e++)
989 cast_el_pt->get_pressure_and_velocity_mass_matrix_diagonal(
1010 for (
unsigned p = 0;
p <
nproc;
p++)
1093 for (
unsigned p = 0;
p <
nproc;
p++)
1126 for (
unsigned p = 0;
p <
nproc;
p++)
1302 for (
unsigned p = 0;
p <
nproc;
p++)
1331 for (
unsigned p = 0;
p <
nproc;
p++)
1516 for (
unsigned e = 0;
e <
n_el;
e++)
1536 cast_el_pt->get_pressure_and_velocity_mass_matrix_diagonal(
1542 std::ostringstream error_message;
1544 <<
"Navier-Stokes mesh contains element that is not of type \n"
1545 <<
"NavierStokesElementWithDiagonalMassMatrices. \n"
1546 <<
"The element is in fact of type " <<
typeid(*el_pt).name()
1547 <<
"\nWe'll assume that it does not make a used contribution \n"
1548 <<
"to the inverse diagonal mass matrix used in the "
1550 <<
"and (to avoid divisions by zero) fill in dummy unit entries.\n"
1551 <<
"[This case currently arises with flux control problems\n"
1552 <<
"where for simplicity the NetFluxControlElement has been added "
1554 <<
"to the Navier Stokes mesh -- this should probably be changed "
1556 <<
"some point -- if you get this warning in any other context\n"
1557 <<
"you should check your code very carefully]\n";
1559 "NavierStokesSchurComplementPreconditioner::assemble_"
1560 "inv_press_and_veloc_mass_matrix_diagonal()",
1619 std::ostringstream error_message;
1620 error_message <<
"Zero entry in diagonal of velocity mass matrix\n"
1621 <<
"Index: " <<
i << std::endl;
1649 std::ostringstream error_message;
1650 error_message <<
"Zero entry in diagonal of pressure mass matrix\n"
1651 <<
"Index: " <<
i << std::endl;
void return_block_vector(const unsigned &n, const DoubleVector &b, DoubleVector &v) const
Takes the n-th block ordered vector, b, and copies its entries to the appropriate entries in the natu...
unsigned ndof_types_in_mesh(const unsigned &i) const
Return the number of DOF types in mesh i. WARNING: This should only be used by the upper-most master ...
const LinearAlgebraDistribution * master_distribution_pt() const
Access function to the distribution of the master preconditioner. If this preconditioner does not hav...
void get_block(const unsigned &i, const unsigned &j, CRDoubleMatrix &output_matrix, const bool &ignore_replacement_block=false) const
Put block (i,j) into output_matrix. This block accounts for any coarsening of dof types and any repla...
int index_in_block(const unsigned &i_dof) const
Given a global dof number, returns the index in the block it belongs to. This is the overall index,...
void get_block_vector(const unsigned &n, const DoubleVector &v, DoubleVector &b) const
Takes the naturally ordered vector, v and returns the n-th block vector, b. Here n is the block numbe...
int block_number(const unsigned &i_dof) const
Return the block number corresponding to a global index i_dof.
bool is_subsidiary_block_preconditioner() const
Return true if this preconditioner is a subsidiary preconditioner.
void get_block_other_matrix(const unsigned &i, const unsigned &j, CRDoubleMatrix *in_matrix_pt, CRDoubleMatrix &output_matrix)
Get a block from a different matrix using the blocking scheme that has already been set up.
unsigned ndof_types() const
Return the total number of DOF types.
void setup_matrix_vector_product(MatrixVectorProduct *matvec_prod_pt, CRDoubleMatrix *block_pt, const Vector< unsigned > &block_col_indices)
Setup a matrix vector product. matvec_prod_pt is a pointer to the MatrixVectorProduct,...
void set_nmesh(const unsigned &n)
Specify the number of meshes required by this block preconditioner. Note: elements in different meshe...
CRDoubleMatrix * matrix_pt() const
Access function to matrix_pt. If this is the master then cast the matrix pointer to MATRIX*,...
const LinearAlgebraDistribution * block_distribution_pt(const unsigned &b) const
Access function to the block distributions (const version).
virtual void block_setup()
Determine the size of the matrix blocks and setup the lookup schemes relating the global degrees of f...
void set_mesh(const unsigned &i, const Mesh *const mesh_pt, const bool &allow_multiple_element_type_in_mesh=false)
Set the i-th mesh for this block preconditioner. Note: The method set_nmesh(...) must be called befor...
A class for compressed row matrices. This is a distributable object.
void build_without_copy(const unsigned &ncol, const unsigned &nnz, double *value, int *column_index, int *row_start)
keeps the existing distribution and just matrix that is stored without copying the matrix data
bool distributed() const
distribution is serial or distributed
unsigned nrow() const
access function to the number of global rows.
LinearAlgebraDistribution * distribution_pt() const
access to the LinearAlgebraDistribution
A vector in the mathematical sense, initially developed for linear algebra type applications....
void build(const DoubleVector &old_vector)
Just copys the argument DoubleVector.
double size() const
Calculate the size of the element (length, area, volume,...) in Eulerian computational coordinates....
unsigned dim() const
Return the spatial dimension of the element, i.e. the number of local coordinates required to paramet...
A Generalised Element class.
bool is_halo() const
Is this element a halo?
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.
Describes the distribution of a distributable linear algebra type object. Typically this is a contain...
bool built() const
if the communicator_pt is null then the distribution is not setup then false is returned,...
Matrix vector product helper class - primarily a wrapper to Trilinos's Epetra matrix vector product m...
void multiply_transpose(const DoubleVector &x, DoubleVector &y) const
Apply the transpose of the operator to the vector x and return the result in the vector y.
void multiply(const DoubleVector &x, DoubleVector &y) const
Apply the operator to the vector x and return the result in the vector y.
FiniteElement * finite_element_pt(const unsigned &e) const
Upcast (downcast?) to FiniteElement (needed to access FiniteElement member functions).
GeneralisedElement *& element_pt(const unsigned long &e)
Return pointer to element e.
unsigned long nelement() const
Return number of elements in the mesh.
Pure virtual base class for elements that can be used with Navier-Stokes Schur complement preconditio...
void setup()
Setup the preconditioner.
bool Doc_time
Set Doc_time to true for outputting results of timings.
Preconditioner * F_preconditioner_pt
Pointer to the 'preconditioner' for the F matrix.
bool Preconditioner_has_been_setup
Control flag is true if the preconditioner has been setup (used so we can wipe the data when the prec...
void clean_up_memory()
Helper function to delete preconditioner data.
Mesh * Navier_stokes_mesh_pt
the pointer to the mesh of block preconditionable Navier Stokes elements.
MatrixVectorProduct * F_mat_vec_pt
MatrixVectorProduct operator for F.
MatrixVectorProduct * E_mat_vec_pt
MatrixVectorProduct operator for E = Fp Qp^{-1} (only for Fp variant)
bool Use_LSC
Boolean to indicate use of LSC (true) or Fp (false) variant.
bool Using_default_p_preconditioner
flag indicating whether the default P preconditioner is used
MatrixVectorProduct * QBt_mat_vec_pt
MatrixVectorProduct operator for Qv^{-1} Bt.
bool Using_default_f_preconditioner
flag indicating whether the default F preconditioner is used
bool Allow_multiple_element_type_in_navier_stokes_mesh
Flag to indicate if there are multiple element types in the Navier-Stokes mesh.
Preconditioner * P_preconditioner_pt
Pointer to the 'preconditioner' for the pressure matrix.
Problem * problem_pt() const
void assemble_inv_press_and_veloc_mass_matrix_diagonal(CRDoubleMatrix *&inv_p_mass_pt, CRDoubleMatrix *&inv_v_mass_pt, const bool &do_both)
Helper function to assemble the inverse diagonals of the pressure and velocity mass matrices from the...
void get_pressure_advection_diffusion_matrix(CRDoubleMatrix &fp_matrix)
Get the pressure advection diffusion matrix.
bool F_preconditioner_is_block_preconditioner
Boolean indicating whether the momentum system preconditioner is a block preconditioner.
MatrixVectorProduct * Bt_mat_vec_pt
MatrixVectorProduct operator for Bt.
void preconditioner_solve(const DoubleVector &r, DoubleVector &z)
Apply preconditioner to Vector r.
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....
virtual const OomphCommunicator * comm_pt() const
Get function for comm pointer.
virtual void setup(DoubleMatrixBase *matrix_pt)
Setup the preconditioner: store the matrix pointer and the communicator pointer then call preconditio...
virtual void preconditioner_solve(const DoubleVector &r, DoubleVector &z)=0
Apply the preconditioner. Pure virtual generic interface function. This method should apply the preco...
TAdvectionDiffusionReactionElement<NREAGENT,DIM,NNODE_1D> elements are isoparametric triangular DIM-d...
Preconditioner * create_exact_preconditioner()
Factory function to create suitable exact preconditioner.
void get_exact_u(const Vector< double > &x, Vector< double > &u)
Exact solution as a Vector.
double source_function(const Vector< double > &x_vect)
Source function required to make the solution above an exact solution.
void wind_function(const Vector< double > &x, Vector< double > &wind)
Wind.
unsigned Flag
Flag for solution.
double Peclet
Peclet number – overwrite with actual Reynolds number.
double timer()
returns the time in seconds after some point in past
DRAIG: Change all instances of (SPATIAL_DIM) to (DIM-1).
OomphInfo oomph_info
Single (global) instantiation of the OomphInfo object – this is used throughout the library as a "rep...