GRINS-0.8.0
List of all members | Public Member Functions | Private Attributes
GRINS::ComputeDistanceResidual Class Reference

#include <distance_function.h>

Public Member Functions

 ComputeDistanceResidual (const libMesh::Elem *belem, const libMesh::Point *point)
 
 ~ComputeDistanceResidual ()
 
void operator() (const libMesh::DenseVector< libMesh::Real > &U, libMesh::DenseVector< libMesh::Real > &F)
 

Private Attributes

const libMesh::Elem & _belem
 
const unsigned int _dim
 
const libMesh::Point & _p
 
libMesh::UniquePtr< libMesh::FEBase > _fe
 
libMesh::FEBase * fe
 
libMesh::DenseVector< libMesh::Real > Up
 
libMesh::DenseVector< libMesh::Real > Fp
 
libMesh::DenseVector< libMesh::Real > Um
 
libMesh::DenseVector< libMesh::Real > Fm
 

Detailed Description

This class provides the functionality to compute the residual required when computing the distance function. The residual here corresponds to the derivative of the distance between the field point and the boundary point wrt the boundary parameterization. When this residual is zero, the distance is minimized, and we have found the point we're looking for.

Definition at line 188 of file distance_function.h.

Constructor & Destructor Documentation

GRINS::ComputeDistanceResidual::ComputeDistanceResidual ( const libMesh::Elem *  belem,
const libMesh::Point *  point 
)
inline

Definition at line 193 of file distance_function.h.

References _belem.

193  :
194  _belem(*belem),
195  _dim(_belem.dim()+1),
196  _p(*point),
197  _fe (libMesh::FEBase::build(_belem.dim(), libMesh::FEType(libMesh::FIRST, libMesh::LAGRANGE))),
198  fe (_fe.get())
199  {
200  // only supporting QUAD4 this way for now
201  libmesh_assert(_belem.type()==libMesh::QUAD4);
202  }
libMesh::UniquePtr< libMesh::FEBase > _fe
GRINS::ComputeDistanceResidual::~ComputeDistanceResidual ( )
inline

Definition at line 205 of file distance_function.h.

205 {}

Member Function Documentation

void GRINS::ComputeDistanceResidual::operator() ( const libMesh::DenseVector< libMesh::Real > &  U,
libMesh::DenseVector< libMesh::Real > &  F 
)
inline

Definition at line 208 of file distance_function.h.

References _belem, _dim, _p, and fe.

210  {
211 
212  libmesh_assert(U.size()==_dim-1);
213  libmesh_assert(F.size()==_dim-1);
214 
215  libMesh::DenseVector<libMesh::Real> xx(_dim);
216  xx.zero();
217 
218  libMesh::DenseMatrix<libMesh::Real> xx_U(_dim, _dim-1);
219  xx_U.zero();
220 
221  std::vector<libMesh::Point> xi(1);
222 
223  xi[0](0) = U(0);
224  xi[0](1) = U(1);
225 
226  // grab basis functions (evaluated at qpts)
227  const std::vector<std::vector<libMesh::Real> > &basis = fe->get_phi();
228  const std::vector<std::vector<libMesh::RealGradient> > &dbasis = fe->get_dphi();
229 
230  // reinitialize finite element data at xi
231  fe->reinit(&_belem, &xi);
232 
233  // interpolate location and derivatives
234  for (unsigned int inode=0; inode<_belem.n_nodes(); ++inode)
235  for (unsigned int idim=0; idim<_dim; ++idim)
236  {
237  xx(idim) += _belem.point(inode)(idim) * basis[inode][0];
238 
239  for (unsigned int jdim=0; jdim<_dim-1; ++jdim)
240  xx_U(idim, jdim) += _belem.point(inode)(idim) * dbasis[inode][0](jdim);
241  }
242 
243 
244  // form the residual
245  F.zero();
246  for (unsigned int ires=0; ires<_dim-1; ++ires)
247  for (unsigned int idim=0; idim<_dim; ++idim)
248  F(ires) += ( xx(idim) - _p(idim) ) * xx_U(idim, ires);
249 
250 
251  }

Member Data Documentation

const libMesh::Elem& GRINS::ComputeDistanceResidual::_belem
private

Definition at line 256 of file distance_function.h.

Referenced by ComputeDistanceResidual(), and operator()().

const unsigned int GRINS::ComputeDistanceResidual::_dim
private

Definition at line 257 of file distance_function.h.

Referenced by operator()().

libMesh::UniquePtr<libMesh::FEBase> GRINS::ComputeDistanceResidual::_fe
private

Definition at line 260 of file distance_function.h.

const libMesh::Point& GRINS::ComputeDistanceResidual::_p
private

Definition at line 258 of file distance_function.h.

Referenced by operator()().

libMesh::FEBase* GRINS::ComputeDistanceResidual::fe
private

Definition at line 261 of file distance_function.h.

Referenced by operator()().

libMesh::DenseVector<libMesh::Real> GRINS::ComputeDistanceResidual::Fm
private

Definition at line 264 of file distance_function.h.

libMesh::DenseVector<libMesh::Real> GRINS::ComputeDistanceResidual::Fp
private

Definition at line 264 of file distance_function.h.

libMesh::DenseVector<libMesh::Real> GRINS::ComputeDistanceResidual::Um
private

Definition at line 264 of file distance_function.h.

libMesh::DenseVector<libMesh::Real> GRINS::ComputeDistanceResidual::Up
private

Definition at line 264 of file distance_function.h.


The documentation for this class was generated from the following file:

Generated on Tue Dec 19 2017 12:47:30 for GRINS-0.8.0 by  doxygen 1.8.9.1