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

#include <distance_function.h>

Public Member Functions

 ComputeDistanceJacobian ()
 
 ~ComputeDistanceJacobian ()
 
template<class f >
void operator() (const libMesh::DenseVector< libMesh::Real > &U, const libMesh::DenseVector< libMesh::Real > &F0, f &F, libMesh::DenseMatrix< libMesh::Real > &dFdU)
 

Private Attributes

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 finite difference Jacobians required when computing the distance function

Definition at line 118 of file distance_function.h.

Constructor & Destructor Documentation

GRINS::ComputeDistanceJacobian::ComputeDistanceJacobian ( )
inline

Definition at line 123 of file distance_function.h.

123 {}
GRINS::ComputeDistanceJacobian::~ComputeDistanceJacobian ( )
inline

Definition at line 126 of file distance_function.h.

126 {}

Member Function Documentation

template<class f >
void GRINS::ComputeDistanceJacobian::operator() ( const libMesh::DenseVector< libMesh::Real > &  U,
const libMesh::DenseVector< libMesh::Real > &  F0,
f &  F,
libMesh::DenseMatrix< libMesh::Real > &  dFdU 
)
inline

Finite-differenced Jacobian approximation.

Definition at line 132 of file distance_function.h.

References Fp, and Up.

136  {
137 
138  Up = U;
139  Fp.resize(U.size());
140 
141  dFdU.resize(U.size(),U.size());
142 
143  // compute dF_i/dU_j.
144  for (unsigned int j=0; j<U.size(); j++)
145  {
146  // tell the user's function which component we are perturbing
147  // at this iteration. this information may be used to avoid
148  // repeated calculations of values which are known to be
149  // unaffected for this perturbation.
150  //F.set_perturbed_component(j);
151 
152  // define the pertubation for this component
153  const libMesh::Real
154  pert = 4.e-8*(std::max (std::abs(U(j)), 1.e-3)); // U can be 0, pertubation cannot
155 
156  Up(j) += pert;
157 
158  const libMesh::Real // note this difference may not strictly be pert
159  invpert = 1./(Up(j) - U(j)); // due to truncation error in the preceeding sum.
160 
161  // evaluate F at the perturbed state
162  F(Up,Fp);
163 
164  // remove perturbation for next evaluation
165  Up(j) = U(j);
166 
167  for (unsigned int i=0; i<U.size(); i++)
168  dFdU(i,j) = (Fp(i) - F0(i))*invpert;
169  }
170  }
libMesh::DenseVector< libMesh::Real > Up
libMesh::DenseVector< libMesh::Real > Fp

Member Data Documentation

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

Definition at line 175 of file distance_function.h.

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

Definition at line 175 of file distance_function.h.

Referenced by operator()().

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

Definition at line 175 of file distance_function.h.

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

Definition at line 175 of file distance_function.h.

Referenced by operator()().


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