70 options.
addReal (
"Nitsche.Alpha",
71 "Parameter alpha for Nitsche scheme.", 1);
72 options.
addReal (
"Nitsche.Beta",
73 "Parameter beta for Nitsche scheme.", 1);
74 options.
addReal (
"Nitsche.Penalty",
75 "Penalty parameter penalty for Nitsche scheme; if negative, default 2.5(p+d)(p+1) is used.",-1);
76 options.
addSwitch(
"Nitsche.ParameterGridSize",
77 "Use grid size on parameter domain for the penalty term.",
false);
94 const index_t deg = basis.maxDegree();
95 m_penalty = (T)(2.5) * (T)(deg + basis.dim()) * (T)(deg + 1);
101 if (options.
getSwitch(
"Nitsche.ParameterGridSize"))
103 m_h = basis.getMinCellLength();
129 basis.active_into(md.points.col(0) , actives);
130 const index_t numActive = actives.rows();
133 basis.evalAllDers_into( md.points, 1, basisData,
true);
142 localMat.setZero(numActive, numActive);
151 const index_t numActive = actives.rows();
153 for (
index_t k = 0; k < quWeights.rows(); ++k)
156 const typename gsMatrix<T>::Block bVals =
157 basisData[0].block(0,k,numActive,1);
160 outerNormal(md, k,
m_side, unormal);
163 const T weight = quWeights[k] * unormal.norm();
169 transformGradients(md, k, bGrads, pGrads);
175 localRhs.noalias() -= weight * ( (
m_beta * pGrads.transpose() * unormal - mu * bVals ) * dirData.col(k).transpose() );
177 localMat.noalias() -= weight * (
178 m_alpha * bVals * unormal.transpose() * pGrads
179 +
m_beta * (bVals * unormal.transpose() * pGrads).transpose()
180 - mu * bVals * bVals.transpose()
194 system.
pushAllFree(localMat, localRhs, actives, 0);
206 const index_t numActive = actives.rows();
209 for (
index_t j=0; j!=numActive; ++j)
211 const unsigned jj = actives(j);
212 rhsMatrix.row(jj) += localRhs.row(j);
213 for (
index_t i=0; i!=numActive; ++i)
215 const unsigned ii = actives(i);
217 sysMatrix( ii, jj ) += localMat(i,j);
246 std::vector<gsMatrix<T> > basisData;
short_t direction() const
Returns the parametric direction orthogonal to this side.
Definition gsBoundary.h:113
A basis represents a family of scalar basis functions defined over a common parameter domain.
Definition gsBasis.h:79
Maintains a mapping from patch-local dofs to global dof indices and allows the elimination of individ...
Definition gsDofMapper.h:69
void localToGlobal(const gsMatrix< index_t > &locals, index_t patchIndex, gsMatrix< index_t > &globals, index_t comp=0) const
Computes the global indices of the input local indices.
Definition gsDofMapper.cpp:25
Class which enables iteration over all elements of a parameter domain.
Definition gsDomainIterator.h:68
Interface for the set of functions defined on a domain (the total number of functions in the set equa...
Definition gsFunctionSet.h:219
virtual void computeMap(gsMapData< T > &InOut) const
Computes map function data.
Definition gsFunction.hpp:817
Abstract base class representing a geometry map.
Definition gsGeometry.h:93
the gsMapData is a cache of pre-computed function (map) values.
Definition gsFuncData.h:349
A matrix with arbitrary coefficient type and fixed or dynamic size.
Definition gsMatrix.h:41
Class which holds a list of parameters/options, and provides easy access to them.
Definition gsOptionList.h:33
Real askReal(const std::string &label, const Real &value=0) const
Reads value for option label from options.
Definition gsOptionList.cpp:139
bool getSwitch(const std::string &label) const
Reads value for option label from options.
Definition gsOptionList.cpp:51
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
void addSwitch(const std::string &label, const std::string &desc, const bool &value)
Adds a option named label, with description desc and value value.
Definition gsOptionList.cpp:235
Abstract class representing a PDE (partial differential equation).
Definition gsPde.h:44
Class representing a reference quadrature rule.
Definition gsQuadRule.h:29
Sparse matrix class, based on gsEigen::SparseMatrix.
Definition gsSparseMatrix.h:139
A sparse linear system indexed by sets of degrees of freedom.
Definition gsSparseSystem.h:30
void pushAllFree(const gsMatrix< T > &localMat, const gsMatrix< T > &localRhs, const gsMatrix< index_t > &actives, const size_t r=0, const size_t c=0)
pushAllFree pushes the local system matrix and rhs for an element to the global system,
Definition gsSparseSystem.h:1082
void mapColIndices(const gsMatrix< index_t > &actives, const index_t patchIndex, gsMatrix< index_t > &result, const index_t c=0) const
mapColIndices Maps a set of basis indices by the corresponding dofMapper.
Definition gsSparseSystem.h:584
A vector with arbitrary coefficient type and fixed or dynamic size.
Definition gsVector.h:37
static T estimateSmallestPerpendicularCellSize(const gsBasis< T > &basis, const gsGeometry< T > &geo, patchSide side)
Estimates the gird size perpendicular to the given side on the physical domain, as required for SIPG ...
Definition gsVisitorDg.h:232
Visitor for adding the terms associated to weak (Nitsche-type) imposition of the Dirichlet boundary c...
Definition gsVisitorNitsche.h:55
void initialize(const gsBasis< T > &basis, const index_t, const gsOptionList &options, gsQuadRule< T > &rule)
Initialize.
Definition gsVisitorNitsche.h:82
void assemble(gsDomainIterator< T > &, const gsVector< T > &quWeights)
Assemble on element.
Definition gsVisitorNitsche.h:147
const gsFunctionSet< T > * m_dirdata_ptr
Dirichlet function.
Definition gsVisitorNitsche.h:229
T m_penalty
Parameter for the linear form.
Definition gsVisitorNitsche.h:238
const gsPde< T > * m_pde
The underlying PDE.
Definition gsVisitorNitsche.h:226
T m_beta
Parameter for the linear form.
Definition gsVisitorNitsche.h:235
void localToGlobal(const index_t patchIndex, const std::vector< gsMatrix< T > > &, gsSparseSystem< T > &system)
Adds the contributions to the sparse system.
Definition gsVisitorNitsche.h:186
patchSide m_side
Patch side.
Definition gsVisitorNitsche.h:241
void localToGlobal(const gsDofMapper &mapper, const gsMatrix< T > &eliminatedDofs, const index_t patchIndex, gsSparseMatrix< T > &sysMatrix, gsMatrix< T > &rhsMatrix)
Adds the contributions to the sparse system.
Definition gsVisitorNitsche.h:198
static gsOptionList defaultOptions()
Default options.
Definition gsVisitorNitsche.h:67
T m_alpha
Parameter for the linear form.
Definition gsVisitorNitsche.h:232
gsVisitorNitsche(const gsPde< T > &pde, const boundary_condition< T > &bc)
Constructor.
Definition gsVisitorNitsche.h:62
void evaluate(const gsBasis< T > &basis, const gsGeometry< T > &geo, const gsMatrix< T > &quNodes)
Evaluate on element.
Definition gsVisitorNitsche.h:121
#define index_t
Definition gsConfig.h:32
#define GISMO_ENSURE(cond, message)
Definition gsDebug.h:102
Visitor for adding the interface conditions for the interior penalty methods of the Poisson problem.
The G+Smo namespace, containing all definitions for the library.
@ NEED_VALUE
Value of the object.
Definition gsForwardDeclarations.h:72
@ NEED_GRAD_TRANSFORM
Gradient transformation matrix.
Definition gsForwardDeclarations.h:77
@ NEED_MEASURE
The density of the measure pull back.
Definition gsForwardDeclarations.h:76
Class that defines a boundary condition for a side of a patch for some unknown variable of a PDE.
Definition gsBoundaryConditions.h:107
static gsQuadRule< T > get(const gsBasis< T > &basis, const gsOptionList &options, short_t fixDir=-1)
Constructs a quadrature rule based on input options.
Definition gsQuadrature.h:51
Struct which represents a certain side of a patch.
Definition gsBoundary.h:232
index_t patch
The index of the patch.
Definition gsBoundary.h:234