39    typename gsPde<T>::Ptr pde( 
new gsBasePde<T>(patches,bconditions,rightHandSides) );
 
   42    for (
short_t d = 0; d < m_dim; ++d)
 
   43        m_bases.push_back(basisVel);
 
   44    m_bases.push_back(basisPres);
 
   46    Base::initialize(pde, m_bases, defaultOptions());
 
 
   53    opt.
addReal(
"Viscosity",
"Kinematic viscosity of the fluid",0.001);
 
   54    opt.
addReal(
"Density",
"Density of the fluid",1.);
 
   55    opt.
addReal(
"ForceScaling",
"Force scaling parameter",1.);
 
 
   64    const T bdA       = m_options.getReal(
"bdA");
 
   65    const index_t bdB = m_options.getInt(
"bdB");
 
   66    const T bdO       = m_options.getReal(
"bdO");
 
   69    for (
index_t d = 0; d < m_bases[0][0].dim(); ++d )
 
   70        if (m_bases[0][0].degree(d) > deg)
 
   71            deg = m_bases[0][0].degree(d);
 
   74    index_t numElPerColumn = pow((bdA*deg+bdB),m_dim)*m_dim + pow((2*bdA*deg+bdB),m_dim);
 
   76    m_system.reserve(numElPerColumn*(1+bdO),1);
 
 
   82    GISMO_ENSURE(m_dim == m_pde_ptr->domain().parDim(), 
"The RHS dimension and the domain dimension don't match!");
 
   83    GISMO_ENSURE(m_dim == 2 || m_dim == 3, 
"Only two- and three-dimenstion domains are supported!");
 
   85    std::vector<gsDofMapper> m_dofMappers(m_bases.size());
 
   86    for (
unsigned d = 0; d < m_bases.size(); d++)
 
   87        m_bases[d].getMapper((dirichlet::strategy)m_options.getInt(
"DirichletStrategy"),
 
   88                             iFace::glue,m_pde_ptr->bc(),m_dofMappers[d],d,
true);
 
   93    for (
unsigned d = 0; d < m_bases.size(); ++d)
 
   94        Base::computeDirichletDofs(d);
 
 
  103    m_system.matrix().setZero();
 
  105    m_system.rhs().setZero();
 
  107    gsVisitorStokes<T> visitor(*m_pde_ptr);
 
  108    Base::template push<gsVisitorStokes<T> >(visitor);
 
  110    m_system.matrix().makeCompressed();
 
 
  118    constructSolution(solutionVector,fixedDoFs,velocity,pressure);
 
  119    assemble(velocity,pressure);
 
 
  128    m_system.matrix().setZero();
 
  130    m_system.rhs().setZero();
 
  132    gsVisitorNavierStokes<T> visitor(*m_pde_ptr,velocity,pressure);
 
  133    Base::template push<gsVisitorNavierStokes<T> >(visitor);
 
  135    m_system.matrix().makeCompressed();
 
 
  146    for (
short_t d = 0; d < m_dim; ++d)
 
  148    Base::constructSolution(solVector,fixedDoFs,velocity,unknowns);
 
 
  157    constructSolution(solVector,fixedDoFs,velocity);
 
  159    constructPressure(solVector,fixedDoFs,pressure);
 
 
  169    unknowns.
at(0) = m_dim;
 
  170    Base::constructSolution(solVector,m_ddof,pressure,unknowns);
 
 
  177                                           const std::vector<std::pair<index_t,boxSide> > & bdrySides, 
bool split)
 const 
  180    gsMatrix<T> quNodes, pressureValues, physGradJac, sigma;
 
  189    force.setZero(m_dim, 2);
 
  190    const T viscosity = m_options.getReal(
"Viscosity");
 
  191    const T density = m_options.getReal(
"Density");
 
  194    for (std::vector<std::pair<index_t,boxSide> >::const_iterator it = bdrySides.begin();
 
  195         it != bdrySides.end(); ++it)
 
  198        const gsBasis<T> & basis = m_bases[0][it->first];
 
  202        typename gsBasis<T>::domainIter elem = basis.makeDomainIterator(it->second);
 
  203        for (; elem->good(); elem->next())
 
  206            bdQuRule.
mapTo(elem->lowerCorner(),elem->upperCorner(),quNodes,quWeights);
 
  209            m_pde_ptr->patches().patch(it->first).computeMap(mdGeo);
 
  212            velocity.
patch(it->first).computeMap(mdVel);
 
  214            pressure.
patch(it->first).eval_into(quNodes,pressureValues);
 
  217            for (
index_t q = 0; q < quWeights.rows(); ++q)
 
  220                physGradJac = mdVel.jacobian(q)*(mdGeo.jacobian(q).cramerInverse());
 
  222                outerNormal(mdGeo,q,it->second,normal);
 
  225                force.col(0) += quWeights[q] * sigma * normal;
 
  226                sigma = -1*density*viscosity*(physGradJac + physGradJac.transpose());
 
  227                force.col(1) += quWeights[q] * sigma * normal;
 
  234        return force.col(0) + force.col(1);
 
 
A basis represents a family of scalar basis functions defined over a common parameter domain.
Definition gsBasis.h:79
 
Class containing a set of boundary conditions.
Definition gsBoundaryConditions.h:342
 
A function  from a n-dimensional domain to an m-dimensional image.
Definition gsFunction.h:60
 
virtual short_t targetDim() const
Dimension of the target space.
Definition gsFunctionSet.h:595
 
Class that represents the (tensor) Gauss-Legendre quadrature rule.
Definition gsGaussRule.h:28
 
the gsMapData is a cache of pre-computed function (map) values.
Definition gsFuncData.h:349
 
gsMatrix< T > points
input (parametric) points
Definition gsFuncData.h:372
 
A matrix with arbitrary coefficient type and fixed or dynamic size.
Definition gsMatrix.h:41
 
T at(index_t i) const
Returns the i-th element of the vectorization of the matrix.
Definition gsMatrix.h:211
 
Holds a set of patch-wise bases and their topology information.
Definition gsMultiBasis.h:37
 
Container class for a set of geometry patches and their topology, that is, the interface connections ...
Definition gsMultiPatch.h:100
 
gsGeometry< T > & patch(size_t i) const
Return the i-th patch.
Definition gsMultiPatch.h:292
 
virtual gsMatrix< T > computeForce(const gsMultiPatch< T > &velocity, const gsMultiPatch< T > &pressure, const std::vector< std::pair< index_t, boxSide > > &bdrySides, bool split=false) const
Definition gsNsAssembler.hpp:176
 
virtual void reserve()
a custom reserve function to allocate memory for the sparse matrix
Definition gsNsAssembler.hpp:61
 
virtual void assemble()
Main assemble routine, to be implemented in derived classes.
Definition gsNsAssembler.h:53
 
virtual void constructSolution(const gsMatrix< T > &solVector, const std::vector< gsMatrix< T > > &fixedDoFs, gsMultiPatch< T > &velocity) const
Construct velocity from computed solution vector and fixed degrees of freedom.
Definition gsNsAssembler.hpp:141
 
virtual void refresh()
Refresh routine to set dof-mappers.
Definition gsNsAssembler.hpp:80
 
gsNsAssembler(const gsMultiPatch< T > &patches, const gsMultiBasis< T > &basisVel, const gsMultiBasis< T > &basisPres, const gsBoundaryConditions< T > &bconditions, const gsFunction< T > &body_force)
Constructor.
Definition gsNsAssembler.hpp:30
 
virtual void constructPressure(const gsMatrix< T > &solVector, const std::vector< gsMatrix< T > > &fixedDoFs, gsMultiPatch< T > &pressure) const
@ brief Construct pressure from computed solution vector
Definition gsNsAssembler.hpp:163
 
static gsOptionList defaultOptions()
Returns the list of default options for assembly.
Definition gsNsAssembler.hpp:50
 
Class which holds a list of parameters/options, and provides easy access to them.
Definition gsOptionList.h:33
 
void addInt(const std::string &label, const std::string &desc, const index_t &value)
Adds a option named label, with description desc and value value.
Definition gsOptionList.cpp:201
 
void addReal(const std::string &label, const std::string &desc, const Real &value)
Adds a option named label, with description desc and value value.
Definition gsOptionList.cpp:211
 
A function depending on an index i, typically referring to a patch/sub-domain. On each patch a differ...
Definition gsPiecewiseFunction.h:29
 
void addPiece(const gsFunction< T > &func)
Add a piece.
Definition gsPiecewiseFunction.h:113
 
virtual void mapTo(const gsVector< T > &lower, const gsVector< T > &upper, gsMatrix< T > &nodes, gsVector< T > &weights) const
Maps quadrature rule (i.e., points and weights) from the reference domain to an element.
Definition gsQuadRule.h:177
 
A sparse linear system indexed by sets of degrees of freedom.
Definition gsSparseSystem.h:30
 
A vector with arbitrary coefficient type and fixed or dynamic size.
Definition gsVector.h:37
 
T at(index_t i) const
Returns the i-th element of the vector.
Definition gsVector.h:177
 
IMHO, a useless class, but it is necessary to use the gsAssembler class. Contains proper information ...
 
#define short_t
Definition gsConfig.h:35
 
#define index_t
Definition gsConfig.h:32
 
#define GISMO_UNUSED(x)
Definition gsDebug.h:112
 
#define GISMO_ENSURE(cond, message)
Definition gsDebug.h:102
 
Provides matrix and rhs assebmly for stationary and transient incompressible Stokes and Navier-Stokes...
 
Provides functions to generate structured point data.
 
Visitor class for volumetric integration of thetangential Navier-Stokes system.
 
Visitor class for volumetric integration of the Stokes system.
 
The G+Smo namespace, containing all definitions for the library.
 
@ NEED_DERIV
Gradient of the object.
Definition gsForwardDeclarations.h:73
 
@ NEED_GRAD_TRANSFORM
Gradient transformation matrix.
Definition gsForwardDeclarations.h:77
 
@ NEED_MEASURE
The density of the measure pull back.
Definition gsForwardDeclarations.h:76
 
@ newton_update
stationary point iteration, 1st order, yields a new solution at each iteration
Definition gsBaseUtils.h:47