pseudo_elastic_preconditioner.h
Go to the documentation of this file.
1 //LIC// ====================================================================
2 //LIC// This file forms part of oomph-lib, the object-oriented,
3 //LIC// multi-physics finite-element library, available
4 //LIC// at http://www.oomph-lib.org.
5 //LIC//
6 //LIC// Version 1.0; svn revision $LastChangedRevision$
7 //LIC//
8 //LIC// $LastChangedDate$
9 //LIC//
10 //LIC// Copyright (C) 2006-2016 Matthias Heil and Andrew Hazel
11 //LIC//
12 //LIC// This library is free software; you can redistribute it and/or
13 //LIC// modify it under the terms of the GNU Lesser General Public
14 //LIC// License as published by the Free Software Foundation; either
15 //LIC// version 2.1 of the License, or (at your option) any later version.
16 //LIC//
17 //LIC// This library is distributed in the hope that it will be useful,
18 //LIC// but WITHOUT ANY WARRANTY; without even the implied warranty of
19 //LIC// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 //LIC// Lesser General Public License for more details.
21 //LIC//
22 //LIC// You should have received a copy of the GNU Lesser General Public
23 //LIC// License along with this library; if not, write to the Free Software
24 //LIC// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
25 //LIC// 02110-1301 USA.
26 //LIC//
27 //LIC// The authors may be contacted at oomph-lib@maths.man.ac.uk.
28 //LIC//
29 //LIC//====================================================================
30 #ifndef OOMPH_PSEUDO_ELASTIC_SUBSIDIARY_PRECONDITIONER
31 #define OOMPH_PSEUDO_ELASTIC_SUBSIDIARY_PRECONDITIONER
32 
33 // includes
34 #include "../generic/problem.h"
35 #include "../generic/block_preconditioner.h"
36 #include "../generic/preconditioner.h"
37 #include "../generic/SuperLU_preconditioner.h"
38 #include "../generic/matrix_vector_product.h"
39 #include "../generic/general_purpose_preconditioners.h"
40 #include "../generic/general_purpose_block_preconditioners.h"
41 #ifdef OOMPH_HAS_HYPRE
42 #include "../generic/hypre_solver.h"
43 #endif
44 #ifdef OOMPH_HAS_TRILINOS
45 #include "../generic/trilinos_solver.h"
46 #endif
47 namespace oomph
48 {
49  //=============================================================================
50  /// \short Functions to create instances of optimal subsidiary operators for
51  /// the PseudoElasticPreconditioner. By default we use hypre for the
52  /// the elastic blocks but can use Trilinos ML too.
53  //=============================================================================
54  namespace Pseudo_Elastic_Preconditioner_Subsidiary_Operator_Helper
55  {
56 
57 
58 #ifdef OOMPH_HAS_HYPRE
59 
60  /// \short Hypre AMG w/ GS smoothing for the augmented elastic
61  /// subsidiary linear systems
62  Preconditioner* get_elastic_preconditioner_hypre();
63 
64  /// \short AMG w/ GS smoothing for the augmented elastic subsidiary linear
65  /// systems -- calls Hypre version to stay consistent with previous default
66  Preconditioner* get_elastic_preconditioner();
67 
68 #endif
69 
70 #ifdef OOMPH_HAS_TRILINOS
71 
72  /// \short TrilinosML smoothing for the augmented elastic
73  /// subsidiary linear systems
75 
76  /// \short CG with diagonal preconditioner for the lagrange multiplier
77  /// subsidiary linear systems.
79 #endif
80  }
81 
82 
83 
84  ///////////////////////////////////////////////////////////////////////////////
85  ///////////////////////////////////////////////////////////////////////////////
86  ///////////////////////////////////////////////////////////////////////////////
87 
88 
89 
90 //=============================================================================
91 /// \short A subsidiary preconditioner for the pseudo-elastic FSI
92 /// preconditioner. Also a stand-alone preconditioner for the problem of
93 /// non-linear elasticity subject to prescribed displacement by Lagrange
94 /// multiplier.
95 /// \b Enumeration of Elastic DOF types in the Pseudo-Elastic Elements
96 /// The method get_dof_types_for_unknowns() must be implemented such that
97 /// DOFs subject be Lagrange multiplier and DOFs NOT subject to Lagrange
98 /// multiplier have different labels. For example in a 3D problem there are
99 /// 6 DOF types and the following labelling must be implemented:
100 /// 0 - x displacement (without lagr mult traction)
101 /// 1 - y displacement (without lagr mult traction)
102 /// 2 - z displacement (without lagr mult traction)
103 /// 4 - x displacement (with lagr mult traction)
104 /// 5 - y displacement (with lagr mult traction)
105 /// 6 - z displacement (with lagr mult traction)
106 //=============================================================================
108  : public BlockPreconditioner<CRDoubleMatrix>
109  {
110  /// \short PseudoElasticFSIPreconditioner is a friend to access the private
111  /// *_preconditioner_solve(...) method
113 
114  public:
115 
116  /// \short This preconditioner includes the option to use subsidiary
117  /// operators other than SuperLUPreconditioner for this problem.
118  /// This is the typedef of a function that should return an instance
119  /// of a subsidiary preconditioning operator. This preconditioner is
120  /// responsible for the destruction of the subsidiary preconditioners.
121  typedef Preconditioner* (*SubsidiaryPreconditionerFctPt)();
122 
123  /// \short The augmented elasticity system can be preconditioned in one
124  /// of four ways.
125  /// 0 - Exact preconditioner
126  /// 1 - Block diagonal preconditioning
127  /// 2 - Block upper triangular preconditioner
128  /// 3 - Block lower triangular preconditioner
129  /// We group together the different components of the displacement vector
130  /// field for the block decomposition.
134  Block_upper_triangular_preconditioner };
135 
136  /// \short Default (and only) constructor.
138  {
139  // null pointers
140  Lagrange_multiplier_subsidiary_preconditioner_function_pt = 0;
141  Elastic_subsidiary_preconditioner_function_pt = 0;
142  Elastic_preconditioner_pt = 0;
143 
144  // set defaults
145  Use_inf_norm_of_s_scaling = true;
146  E_preconditioner_type = Exact_block_preconditioner;
147 
148  // resize the Mesh_pt
149  Lagrange_multiplier_mesh_pt = 0;
150  Elastic_mesh_pt = 0;
151  }
152 
153  /// destructor
155  {
156  this->clean_up_memory();
157  }
158 
159  /// Broken copy constructor
162  {
163  BrokenCopy::broken_copy("PseudoElasticPreconditioner");
164  }
165 
166  /// Broken assignment operator
167 //Commented out broken assignment operator because this can lead to a conflict warning
168 //when used in the virtual inheritence hierarchy. Essentially the compiler doesn't
169 //realise that two separate implementations of the broken function are the same and so,
170 //quite rightly, it shouts.
171  /*void operator=
172  (const PseudoElasticPreconditioner&)
173  {
174  BrokenCopy::broken_assign(" PseudoElasticPreconditioner");
175  }*/
176 
177  /// Setup method for the PseudoElasticPreconditioner.
178  void setup();
179 
180  /// \short Apply the preconditioner. Method implemented in two
181  /// other methods (elastic and lagrange multiplier subsidiary
182  /// preocnditioner) for the PseudoElasticFSIPreconditioner
184  {
185  this->elastic_preconditioner_solve(r,z);
186  this->lagrange_multiplier_preconditioner_solve(r,z);
187  }
188 
189  /// \short Access function to mesh containing the block-preconditionable
190  /// elastic elements
191  void set_elastic_mesh(Mesh* mesh_pt)
192  {
193  Elastic_mesh_pt = mesh_pt;
194  }
195 
196  /// \short Access function to mesh containing the block-preconditionable
197  /// lagrange multiplier elements
199  {
200  Lagrange_multiplier_mesh_pt = mesh_pt;
201  }
202 
203  /// \short Call to use the inf norm of S as scaling
205  {Use_inf_norm_of_s_scaling=true;}
206 
207  /// \short Call to use no scaling
209  {Use_inf_norm_of_s_scaling=false;}
210 
211  /// \short By default the Lagrange multiplier subsidiary systems are
212  /// preconditioner with SuperLUPreconditioner. For a different
213  /// preconditioner, pass a function to this
214  /// method returning a different subsidiary operator.
215  void set_lagrange_multiplier_subsidiary_preconditioner
216  (SubsidiaryPreconditionerFctPt prec_fn)
217  {
218  Lagrange_multiplier_subsidiary_preconditioner_function_pt = prec_fn;
219  }
220 
221  /// \short By default the elastic subsidiary systems are
222  /// preconditioner with SuperLUPreconditioner. For a different
223  /// preconditioner, pass a function to this
224  /// method returning a different subsidiary operator.
225  void set_elastic_subsidiary_preconditioner
226  (SubsidiaryPreconditionerFctPt prec_fn)
227  {
228  Elastic_subsidiary_preconditioner_function_pt = prec_fn;
229  }
230 
231  /// \short Set the type of preconditioner applied to the elastic:
232  /// 0 - Exact preconditioner
233  /// 1 - Block diagonal preconditioning
234  /// 2 - Block upper triangular preconditioner
235  /// 3 - Block lower triangular preconditioner
236  /// We group together the different components of the displacement vector
237  /// field for the block decomposition.
239  {
240  return E_preconditioner_type;
241  }
242 
243  /// \short Clears the memory.
244  void clean_up_memory();
245 
246  private:
247 
248  /// \short Apply the elastic subsidiary preconditioner.
249  void elastic_preconditioner_solve(const DoubleVector& r, DoubleVector& z);
250 
251  /// \short Apply the lagrange multiplier subsidiary preconditioner.
252  void lagrange_multiplier_preconditioner_solve(const DoubleVector& r,
253  DoubleVector& z);
254 
255  /// The scaling. Defaults to infinity norm of S.
256  double Scaling;
257 
258  /// \short boolean indicating whether the inf-norm of S should be used as
259  /// scaling. Default = true;
261 
262  /// \short An unsigned indicating which method should be used for
263  /// preconditioning the solid component.
265 
266  /// \short the dimension of the problem
267  unsigned Dim;
268 
269  /// \short storage for the preconditioner for the solid system
271 
272  /// \short lagrange multiplier preconditioner pt
274 
275  /// The Lagrange multiplier subsidiary preconditioner function pointer
276  SubsidiaryPreconditionerFctPt
278 
279  /// The solid subsidiary preconditioner function pointer
280  SubsidiaryPreconditionerFctPt Elastic_subsidiary_preconditioner_function_pt;
281 
282  /// Pointer to the mesh containing the solid elements
284 
285  /// Pointer to the mesh containing the Lagrange multiplier elements
287  };
288 
289  ///////////////////////////////////////////////////////////////////////////////
290  ///////////////////////////////////////////////////////////////////////////////
291  ///////////////////////////////////////////////////////////////////////////////
292 
293 
294 
295 //=============================================================================
296 /// \short A subsidiary preconditioner for the pseudo-elastic FSI
297 /// preconditioner. Also a stand-alone preconditioner for the problem of
298 /// non-linear elasticity subject to prescribed displacement by Lagrange
299 /// multiplier..
300 /// \b Enumeration of Elastic DOF types in the Pseudo-Elastic Elements
301 /// The method get_dof_types_for_unknowns() must be implemented such that
302 /// DOFs subject be Lagrange multiplier and DOFs NOT subject to Lagrange
303 /// multiplier have different labels. For example in a 3D problem there are
304 /// 6 DOF types and the following labelling must be implemented:
305 /// 0 - x displacement (without lagr mult traction)
306 /// 1 - y displacement (without lagr mult traction)
307 /// 2 - z displacement (without lagr mult traction)
308 /// 4 - x displacement (with lagr mult traction)
309 /// 5 - y displacement (with lagr mult traction)
310 /// 6 - z displacement (with lagr mult traction)
311 //=============================================================================
313  : public BlockPreconditioner<CRDoubleMatrix>
314  {
315  /// \short PseudoElasticFSIPreconditioner is a friend to access the private
316  /// *_preconditioner_solve(...) method
318 
319  public:
320 
321  /// \short This preconditioner includes the option to use subsidiary
322  /// operators other than SuperLUPreconditioner for this problem.
323  /// This is the typedef of a function that should return an instance
324  /// of a subsidiary preconditioning operator. This preconditioner is
325  /// responsible for the destruction of the subsidiary preconditioners.
326  typedef Preconditioner* (*SubsidiaryPreconditionerFctPt)();
327 
328  /// \short The augmented elasticity system can be preconditioned in one
329  /// of four ways.
330  /// 0 - Exact preconditioner
331  /// 1 - Block diagonal preconditioning
332  /// 2 - Block upper triangular preconditioner
333  /// 3 - Block lower triangular preconditioner
334  /// We group together the different components of the displacement vector
335  /// field for the block decomposition.
339  Block_upper_triangular_preconditioner };
340 
341  /// \short Default (and only) constructor.
343  {
344  // null pointers
345  Lagrange_multiplier_subsidiary_preconditioner_function_pt = 0;
346  Elastic_subsidiary_preconditioner_function_pt = 0;
347  Elastic_preconditioner_pt = 0;
348 
349  // set defaults
350  Use_inf_norm_of_s_scaling = true;
351  E_preconditioner_type = Exact_block_preconditioner;
352 
353  // resize the Mesh_pt
354  Lagrange_multiplier_mesh_pt = 0;
355  Elastic_mesh_pt = 0;
356  }
357 
358  /// destructor
360  {
361  this->clean_up_memory();
362  }
363 
364  /// Broken copy constructor
367  {
368  BrokenCopy::broken_copy("PseudoElasticPreconditionerOld");
369  }
370 
371  /// Broken assignment operator
372  /*void operator=
373  (const PseudoElasticPreconditionerOld&)
374  {
375  BrokenCopy::broken_assign(" PseudoElasticPreconditionerOld");
376  }*/
377 
378  /// Setup method for the PseudoElasticPreconditionerOld.
379  void setup();
380 
381  /// \short Apply the preconditioner. Method implemented in two
382  /// other methods (elastic and lagrange multiplier subsidiary
383  /// preocnditioner) for the PseudoElasticFSIPreconditioner
385  {
386  this->elastic_preconditioner_solve(r,z);
387  this->lagrange_multiplier_preconditioner_solve(r,z);
388  }
389 
390  /// \short Access function to mesh containing the block-preconditionable
391  /// elastic elements
392  void set_elastic_mesh(Mesh* mesh_pt)
393  {
394  Elastic_mesh_pt = mesh_pt;
395  }
396 
397  /// \short Access function to mesh containing the block-preconditionable
398  /// lagrange multiplier elements
400  {
401  Lagrange_multiplier_mesh_pt = mesh_pt;
402  }
403 
404  /// \short Call to use the inf norm of S as scaling
406  {Use_inf_norm_of_s_scaling=true;}
407 
408  /// \short Call to use no scaling
410  {Use_inf_norm_of_s_scaling=false;}
411 
412  /// \short By default the Lagrange multiplier subsidiary systems are
413  /// preconditioner with SuperLUPreconditioner. For a different
414  /// preconditioner, pass a function to this
415  /// method returning a different subsidiary operator.
416  void set_lagrange_multiplier_subsidiary_preconditioner
417  (SubsidiaryPreconditionerFctPt prec_fn)
418  {
419  Lagrange_multiplier_subsidiary_preconditioner_function_pt = prec_fn;
420  }
421 
422  /// \short By default the elastic subsidiary systems are
423  /// preconditioner with SuperLUPreconditioner. For a different
424  /// preconditioner, pass a function to this
425  /// method returning a different subsidiary operator.
426  void set_elastic_subsidiary_preconditioner
427  (SubsidiaryPreconditionerFctPt prec_fn)
428  {
429  Elastic_subsidiary_preconditioner_function_pt = prec_fn;
430  }
431 
432  /// \short Set the type of preconditioner applied to the elastic:
433  /// 0 - Exact preconditioner
434  /// 1 - Block diagonal preconditioning
435  /// 2 - Block upper triangular preconditioner
436  /// 3 - Block lower triangular preconditioner
437  /// We group together the different components of the displacement vector
438  /// field for the block decomposition.
440  {
441  return E_preconditioner_type;
442  }
443 
444  /// \short Clears the memory.
445  void clean_up_memory();
446 
447  private:
448 
449  /// \short Apply the elastic subsidiary preconditioner.
450  void elastic_preconditioner_solve(const DoubleVector& r, DoubleVector& z);
451 
452  /// \short Apply the lagrange multiplier subsidiary preconditioner.
453  void lagrange_multiplier_preconditioner_solve(const DoubleVector& r,
454  DoubleVector& z);
455 
456  /// The scaling. Defaults to infinity norm of S.
457  double Scaling;
458 
459  /// \short boolean indicating whether the inf-norm of S should be used as
460  /// scaling. Default = true;
462 
463  /// \short An unsigned indicating which method should be used for
464  /// preconditioning the solid component.
466 
467  /// \short the dimension of the problem
468  unsigned Dim;
469 
470  /// \short storage for the preconditioner for the solid system
472 
473  /// \short lagrange multiplier preconditioner pt
475 
476  /// The Lagrange multiplier subsidary preconditioner function pointer
477  SubsidiaryPreconditionerFctPt
479 
480  /// The solid subsidiary preconditioner function pointer
481  SubsidiaryPreconditionerFctPt Elastic_subsidiary_preconditioner_function_pt;
482 
483  /// Pointer to the mesh containing the solid elements
485 
486  /// Pointer to the mesh containing the Lagrange multiplier elements
488  };
489 
490 
491 ////////////////////////////////////////////////////////////////////////////////
492 ////////////////////////////////////////////////////////////////////////////////
493 ////////////////////////////////////////////////////////////////////////////////
494 
495 
496 
497 //=============================================================================
498 /// Subsidiary helper preconditioner for the PseudoElasticPreconditioner.
499 /// Required to construct the augmented elastic system prior to
500 /// preconditioning.
501 /// NOTE:
502 /// 1. This is only intended to be used as a subsidiary preconditioner within
503 /// the PseudoElasticPreconditioner.
504 /// 2. If this preconditioner has N DOF types then the first N/2 are assumed to
505 /// be ordinary solid DOF types, and the second N/2 are the solid DOF types
506 /// with lagrange multiplier tractions applied.
507 /// 3. By default this preconditioner uses a superlu preconditioner.
508 //=============================================================================
510  : public BlockPreconditioner<CRDoubleMatrix>
511  {
512 
513  public:
514 
515  /// \short typedef for a function that allows other preconditioners to be
516  /// emplyed to solve the subsidiary linear systems.
517  /// The function should return a pointer to the requred subsidiary
518  /// preconditioner generated using new. This preconditioner is responsible
519  /// for the destruction of the subsidiary preconditioners.
520  typedef Preconditioner* (*SubsidiaryPreconditionerFctPt)();
521 
522  /// Constructor
524  {
525  Scaling = 1.0;
526  Preconditioner_pt = 0;
527  Subsidiary_preconditioner_function_pt = 0;
528  }
529 
530  /// Destructor
532  {
533  this->clean_up_memory();
534  }
535 
536  /// Broken copy constructor
539  {
541  ("PseudoElasticPreconditionerSubsidiaryPreconditionerOld ");
542  }
543 
544  /// Broken assignment operator
545  /*void operator=(const PseudoElasticPreconditionerSubsidiaryPreconditionerOld&)
546  {
547  BrokenCopy::broken_assign
548  (" PseudoElasticPreconditionerSubsidiaryPreconditionerOld");
549  }*/
550 
551  // Setup the preconditioner
552  void setup();
553 
554  // Apply the preconditioner
555  void preconditioner_solve(const DoubleVector& r, DoubleVector& z);
556 
557  /// \short Specify the scaling. Default is 1.0 Must be called before
558  /// setup(...).
559  double& scaling()
560  {
561  return Scaling;
562  }
563 
564  /// access function to set the subsidiary preconditioner function.
565  void set_subsidiary_preconditioner_function
566  (SubsidiaryPreconditionerFctPt sub_prec_fn)
567  {
568  Subsidiary_preconditioner_function_pt = sub_prec_fn;
569  }
570 
571  private:
572 
573  /// clears the memory
575  {
576  delete Preconditioner_pt;
577  Preconditioner_pt = 0;
578  }
579 
580  // the augmentation scaling
581  double Scaling;
582 
583  /// the preconditioner pt
585 
586  /// the SubisidaryPreconditionerFctPt
587  SubsidiaryPreconditionerFctPt Subsidiary_preconditioner_function_pt;
588  }; // end of PseudoElasticPreconditionerSubsidiaryPreconditionerOld
589 
590 
591 
592 ////////////////////////////////////////////////////////////////////////////////
593 ////////////////////////////////////////////////////////////////////////////////
594 ////////////////////////////////////////////////////////////////////////////////
595 
596 
597 
598 //=============================================================================
599 /// Subsidiary helper preconditioner for the PseudoElasticPreconditioner.
600 /// Required for block preconditioner of the augmented elastic subsidiary
601 /// problem.
602 /// NOTE:
603 /// 1. This is only intended to be used as a subsidiary preconditioner within
604 /// the PseudoElasticPreconditioner.
605 /// 2. If this preconditioner has N DOF types then the first N/2 are assumed to
606 /// be ordinary solid DOF types, and the second N/2 are the solid DOF types
607 /// with lagrange multiplier tractions applied.
608 /// 3. By default this preconditioner uses a superlu preconditioner.
609 //=============================================================================
611  : public BlockPreconditioner<CRDoubleMatrix>
612  {
613  public :
614 
615  /// \short This preconditioner includes the option to use subsidiary
616  /// operators other than SuperLUPreconditioner for this problem.
617  /// This is the typedef of a function that should return an instance
618  /// of a subsidiary preconditioning operator. This preconditioner is
619  /// responsible for the destruction of the subsidiary preconditioners.
620  typedef Preconditioner* (*SubsidiaryPreconditionerFctPt)();
621 
622  /// Constructor. (By default this preconditioner is upper triangular).
625  {
626  // null the subsidiary preconditioner function pointer
627  Subsidiary_preconditioner_function_pt = 0;
628 
629  // default to block diagonal
630  Method = 0;
631 
632  // default scaling = 1.0
633  Scaling = 1.0;
634  };
635 
636  /// Destructor
638  {
639  this->clean_up_memory();
640  }
641 
642  /// Broken copy constructor
645  {
647  ("PseudoElasticPreconditionerSubsidiaryBlockPreconditionerOld ");
648  }
649 
650  /// Broken assignment operator
651  /*void operator=
652  (const PseudoElasticPreconditionerSubsidiaryBlockPreconditionerOld&)
653  {
654  BrokenCopy::broken_assign
655  (" PseudoElasticPreconditionerSubsidiaryBlockPreconditionerOld");
656  }*/
657 
658  /// clean up the memory
659  void clean_up_memory();
660 
661  /// \short Setup the preconditioner
662  void setup();
663 
664  /// Apply preconditioner to r
665  void preconditioner_solve(const DoubleVector &res, DoubleVector &z);
666 
667  /// access function to set the subsidiary preconditioner function.
668  void set_subsidiary_preconditioner_function
669  (SubsidiaryPreconditionerFctPt sub_prec_fn)
670  {
671  Subsidiary_preconditioner_function_pt = sub_prec_fn;
672  };
673 
674  /// use as a block diagonal preconditioner
676  {
677  Method = 0;
678  }
679 
680  /// Use as an upper triangular preconditioner
682  {
683  Method = 1;
684  }
685 
686  /// Use as a lower triangular preconditioner
688  {
689  Method = 2;
690  }
691 
692  /// \short Specify the scaling. Default is 1.0 Must be set before
693  /// setup(...).
694  double& scaling()
695  {
696  return Scaling;
697  }
698 
699  private:
700 
701  /// \short Vector of SuperLU preconditioner pointers for storing the
702  /// preconditioners for each diagonal block
705 
706  /// Matrix of matrix vector product operators for the off diagonals
708 
709  /// the preconditioning method.
710  /// 0 - block diagonal
711  /// 1 - upper triangular
712  /// 2 - lower triangular
713  unsigned Method;
714 
715  /// The SubisidaryPreconditionerFctPt
716  SubsidiaryPreconditionerFctPt Subsidiary_preconditioner_function_pt;
717 
718  /// The scaling. default 1.0.
719  double Scaling;
720  };
721 
722 
723 
724 ///////////////////////////////////////////////////////////////////////////////
725 ///////////////////////////////////////////////////////////////////////////////
726 ///////////////////////////////////////////////////////////////////////////////
727 
728 
729 // /*
730 //=============================================================================
731 /// \short A helper class for PseudoElasticPreconditioner.
732 /// Note that this is NOT actually a functioning preconditioner.
733 /// We simply derive from this class to get access to the blocks.
734 //=============================================================================
736  : public BlockPreconditioner<CRDoubleMatrix>
737  {
738 
739  public:
740 
741  /// The constructor.
742  /// NOTE:
743  /// 1. master_prec_pt should point to the
744  /// PseudoElasticPreconditioner.
745  /// 2. matrix_pt should point to the jacobian.
746  /// 3. The vector dof_list should contain the full list of
747  /// DOFS associated with the solid subsidiary system.
748  /// 4. "solid_mesh_pt" should be a pointer to the solid mesh used in the
749  /// master preconditioner.
752  CRDoubleMatrix* matrix_pt, Vector<unsigned>& dof_list,
753  const Mesh* const solid_mesh_pt,
754  const OomphCommunicator* comm_pt)
755  {
756  // turn into a subisiary preconditioner
757  this->turn_into_subsidiary_block_preconditioner(master_prec_pt,dof_list);
758 
759  // all dofs are of the same block type
760  Vector<unsigned> dof_to_block_map(dof_list.size(),0);
761 
762  // store the matrix_pt
763  set_matrix_pt(matrix_pt);
764 
765  // set the mesh
766  this->set_nmesh(1);
767  this->set_mesh(0,solid_mesh_pt);
768 
769  // set the communicator pointer
770  this->set_comm_pt(comm_pt);
771 
772  // call block_setup(...)
773  this->block_setup(dof_to_block_map);
774 
775  }
776 
777  /// Destructor.
779  {
780  this->clear_block_preconditioner_base();
781  }
782 
783  /// Broken copy constructor
786  {
788  broken_copy("PseudoElasticPreconditionerScalingHelper");
789  }
790 
791  /// Broken assignment operator
792  /*void operator=(const PseudoElasticPreconditionerScalingHelperOld&)
793  {
794  BrokenCopy::
795  broken_assign("PseudoElasticPreconditionerScalingHelper");
796  }*/
797 
798  /// returns the infinite norm of S
799  double s_inf_norm()
800  {
801  CRDoubleMatrix* m_pt = new CRDoubleMatrix;
802  this->get_block(0,0,*m_pt);
803  double s_inf_norm = m_pt->inf_norm();
804  delete m_pt;
805  return s_inf_norm;
806  }
807 
808  // broken preconditioner setup
809  void setup()
810  {
811  std::ostringstream error_message;
812  error_message
813  << "This method is intentionally broken. This class is not a functioning "
814  << "preconditioner.";
815  throw OomphLibError(
816  error_message.str(),
817  OOMPH_CURRENT_FUNCTION,
818  OOMPH_EXCEPTION_LOCATION);
819  }
820 
821  // broken preconditioner solve
823  {
824  std::ostringstream error_message;
825  error_message
826  << "This method is intentionally broken. This class is not a functioning "
827  << "preconditioner.";
828  throw OomphLibError(
829  error_message.str(),
830  OOMPH_CURRENT_FUNCTION,
831  OOMPH_EXCEPTION_LOCATION);
832  }
833 
834 
835  }; // end of PseudoElasticPreconditionerScalingHelperOld
836 // */
837 
838 }
839 #endif
Preconditioner * Elastic_preconditioner_pt
storage for the preconditioner for the solid system
Elastic_preconditioner_type E_preconditioner_type
An unsigned indicating which method should be used for preconditioning the solid component.
Preconditioner * Elastic_preconditioner_pt
storage for the preconditioner for the solid system
void enable_inf_norm_of_s_scaling()
Call to use the inf norm of S as scaling.
void broken_copy(const std::string &class_name)
Issue error message and terminate execution.
A helper class for PseudoElasticPreconditioner. Note that this is NOT actually a functioning precondi...
bool Use_inf_norm_of_s_scaling
boolean indicating whether the inf-norm of S should be used as scaling. Default = true; ...
void preconditioner_solve(const DoubleVector &r, DoubleVector &z)
Apply the preconditioner. Method implemented in two other methods (elastic and lagrange multiplier su...
void set_lagrange_multiplier_mesh(Mesh *mesh_pt)
Access function to mesh containing the block-preconditionable lagrange multiplier elements...
double inf_norm() const
returns the inf-norm of this matrix
Definition: matrices.cc:3392
bool Use_inf_norm_of_s_scaling
boolean indicating whether the inf-norm of S should be used as scaling. Default = true; ...
void disable_inf_norm_of_s_scaling()
Call to use no scaling.
void setup()
Setup the preconditioner. Pure virtual generic interface function.
Mesh * Elastic_mesh_pt
Pointer to the mesh containing the solid elements.
PseudoElasticPreconditionerSubsidiaryBlockPreconditionerOld()
Constructor. (By default this preconditioner is upper triangular).
Mesh * Elastic_mesh_pt
Pointer to the mesh containing the solid elements.
void set_elastic_mesh(Mesh *mesh_pt)
Access function to mesh containing the block-preconditionable elastic elements.
Preconditioner for FSI problems with pseudo-elastic fluid node updates. Note: NavierStokesSchurComple...
SubsidiaryPreconditionerFctPt Lagrange_multiplier_subsidiary_preconditioner_function_pt
The Lagrange multiplier subsidary preconditioner function pointer.
void preconditioner_solve(const DoubleVector &r, DoubleVector &z)
Apply the preconditioner. Method implemented in two other methods (elastic and lagrange multiplier su...
SubsidiaryPreconditionerFctPt Elastic_subsidiary_preconditioner_function_pt
The solid subsidiary preconditioner function pointer.
A subsidiary preconditioner for the pseudo-elastic FSI preconditioner. Also a stand-alone preconditio...
unsigned Dim
the dimension of the problem
void enable_inf_norm_of_s_scaling()
Call to use the inf norm of S as scaling.
Elastic_preconditioner_type & elastic_preconditioner_type()
Set the type of preconditioner applied to the elastic: 0 - Exact preconditioner 1 - Block diagonal pr...
double Scaling
The scaling. Defaults to infinity norm of S.
void setup()
Setup terminate helper.
Vector< Preconditioner * > Lagrange_multiplier_preconditioner_pt
lagrange multiplier preconditioner pt
Preconditioner * get_elastic_preconditioner_hypre()
AMG w/ GS smoothing for the augmented elastic subsidiary linear systems.
void preconditioner_solve(const DoubleVector &r, DoubleVector &z)
Apply the preconditioner. Pure virtual generic interface function. This method should apply the preco...
Mesh * Lagrange_multiplier_mesh_pt
Pointer to the mesh containing the Lagrange multiplier elements.
Preconditioner * get_elastic_preconditioner()
AMG w/ GS smoothing for the augmented elastic subsidiary linear systems – calls Hypre version to sta...
SubsidiaryPreconditionerFctPt Elastic_subsidiary_preconditioner_function_pt
The solid subsidiary preconditioner function pointer.
Elastic_preconditioner_type & elastic_preconditioner_type()
Set the type of preconditioner applied to the elastic: 0 - Exact preconditioner 1 - Block diagonal pr...
double & scaling()
Specify the scaling. Default is 1.0 Must be set before setup(...).
Elastic_preconditioner_type
The augmented elasticity system can be preconditioned in one of four ways. 0 - Exact preconditioner 1...
Vector< Preconditioner * > Lagrange_multiplier_preconditioner_pt
lagrange multiplier preconditioner pt
DenseMatrix< MatrixVectorProduct * > Off_diagonal_matrix_vector_products
Matrix of matrix vector product operators for the off diagonals.
SubsidiaryPreconditionerFctPt Subsidiary_preconditioner_function_pt
the SubisidaryPreconditionerFctPt
void use_lower_triangular_approximation()
Use as a lower triangular preconditioner.
Preconditioner base class. Gives an interface to call all other preconditioners through and stores th...
void set_elastic_mesh(Mesh *mesh_pt)
Access function to mesh containing the block-preconditionable elastic elements.
double & scaling()
Specify the scaling. Default is 1.0 Must be called before setup(...).
void use_upper_triangular_approximation()
Use as an upper triangular preconditioner.
unsigned Dim
the dimension of the problem
Preconditioner * get_elastic_preconditioner_trilinos_ml()
TrilinosML smoothing for the augmented elastic subsidiary linear systems.
double Scaling
The scaling. Defaults to infinity norm of S.
SubsidiaryPreconditionerFctPt Subsidiary_preconditioner_function_pt
The SubisidaryPreconditionerFctPt.
void set_lagrange_multiplier_mesh(Mesh *mesh_pt)
Access function to mesh containing the block-preconditionable lagrange multiplier elements...
Class for dense matrices, storing all the values of the matrix as a pointer to a pointer with assorte...
Definition: communicator.h:50
A vector in the mathematical sense, initially developed for linear algebra type applications. If MPI then this vector can be distributed - its distribution is described by the LinearAlgebraDistribution object at Distribution_pt. Data is stored in a C-style pointer vector (double*)
Definition: double_vector.h:61
void disable_inf_norm_of_s_scaling()
Call to use no scaling.
Elastic_preconditioner_type E_preconditioner_type
An unsigned indicating which method should be used for preconditioning the solid component.
A subsidiary preconditioner for the pseudo-elastic FSI preconditioner. Also a stand-alone preconditio...
Mesh * Lagrange_multiplier_mesh_pt
Pointer to the mesh containing the Lagrange multiplier elements.
PseudoElasticPreconditionerOld()
Default (and only) constructor.
A class for compressed row matrices. This is a distributable object.
Definition: matrices.h:872
PseudoElasticPreconditioner()
Default (and only) constructor.
A general mesh class.
Definition: mesh.h:74
SubsidiaryPreconditionerFctPt Lagrange_multiplier_subsidiary_preconditioner_function_pt
The Lagrange multiplier subsidiary preconditioner function pointer.
Preconditioner * get_lagrange_multiplier_preconditioner()
CG with diagonal preconditioner for the lagrange multiplier subsidiary linear systems.
Vector< PseudoElasticPreconditionerSubsidiaryPreconditionerOld * > Diagonal_block_preconditioner_pt
Vector of SuperLU preconditioner pointers for storing the preconditioners for each diagonal block...
Elastic_preconditioner_type
The augmented elasticity system can be preconditioned in one of four ways. 0 - Exact preconditioner 1...
void use_block_diagonal_approximation()
use as a block diagonal preconditioner
An oomph-lib wrapper to the MPI_Comm communicator object. Just contains an MPI_Comm object (which is ...
Definition: communicator.h:57