G+Smo  24.08.0
Geometry + Simulation Modules
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
gsStokesPde.h
1 
2 #pragma once
3 
4 #include <gsPde/gsPde.h>
5 
6 namespace gismo
7 {
8 
9 
10 template <class T> class gsFunction;
11 
22 template<class T>
23 class gsStokesPde : public gsPde<T>
24 {
25 protected:
26  gsStokesPde( ) { }
27  gsStokesPde(const gsStokesPde & o) :
28  gsStokesPde(o.m_domain,o.m_boundary_conditions, o.m_force, o.m_source, o.m_viscosity)
29  { }
30 
31  using gsPde<T>::m_domain;
33 
34 public:
36  const gsMultiPatch<T> &domain,
37  const gsBoundaryConditions<T> &bc,
38  const gsFunction<T> *force,
39  const gsFunction<T> *source = NULL,
40  const T viscosity = 1
41  )
42  : gsPde<T>(domain,bc), m_viscosity(viscosity)
43  {
44  m_force = force ? force->clone().release() : NULL;
45  m_source = source ? source->clone().release() : NULL;
46 
47  m_unknownDim.resize(2);
48  m_unknownDim[0] = m_domain.dim();
49  m_unknownDim[1] = 1;
50  }
51 
52  ~gsStokesPde( )
53  {
54  delete m_force;
55  delete m_source;
56  }
57 
58  const gsFunction<T>* rhs() const
59  { return m_force; }
60  const gsFunction<T>* force() const
61  { return m_force; }
62  const gsFunction<T>* source() const
63  { return m_source; }
64 
65  T viscosity() const { return m_viscosity; }
66 
67 
69  std::ostream &print(std::ostream &os) const
70  {
71  os<<"Stokes's equation:\n"
72  <<"-\u0394u-\u2207p = f,\n"
73  <<" \u2207\u00B7u=0"
74  <<"with:\n";
75  if ( m_force )
76  os<<"Force function f= "<< *m_force <<".\n";
77  if ( m_source )
78  os<<"Source function g= "<< *m_source <<".\n";
79  return os;
80  }
82  bool check()
83  {
84  return true;
85  }
86 protected:
87  const gsFunction<T> * m_force;
88  const gsFunction<T> * m_source;
89 
90  T m_viscosity;
91 }; // class gsStokesPde
92 
93 } // namespace gismo
gsMultiPatch< T > & domain()
Returns a reference to the Pde domain.
Definition: gsPde.h:66
A stationary Stokes PDE.
Definition: gsStokesPde.h:23
Abstract class representing a PDE (partial differential equation).
Definition: gsPde.h:43
gsBoundaryConditions< T > m_boundary_conditions
Boundary conditions.
Definition: gsPde.h:167
A function from a n-dimensional domain to an m-dimensional image.
Definition: gsFunction.h:59
Base class of descriptions of a PDE problem.
Container class for a set of geometry patches and their topology, that is, the interface connections ...
Definition: gsMultiPatch.h:33
uPtr clone()
Clone methode. Produceds a deep copy inside a uPtr.
Class containing a set of boundary conditions.
Definition: gsBoundaryConditions.h:341
gsMultiPatch< T > m_domain
Computational domain.
Definition: gsPde.h:165
std::ostream & print(std::ostream &os) const
Prints the object as a string.
Definition: gsStokesPde.h:69
bool check()
Consistency check.
Definition: gsStokesPde.h:82
gsVector< unsigned > m_unknownDim
Description of the unknown fields: for each one the target dimension.
Definition: gsPde.h:162