Finite Element Domain Decomposition Library
FEDDLib
Loading...
Searching...
No Matches
FEDD::PowerLaw< SC, LO, GO, NO > Class Template Reference

This class is derived from the abstract class DifferentiableFuncClass and should provide functionality to evaluate the viscosity function specified by PowerLaw model (see [1]) More...

#include <PowerLaw_decl.hpp>

Inheritance diagram for FEDD::PowerLaw< SC, LO, GO, NO >:

Public Types

typedef MultiVector< SC, LO, GO, NO > MultiVector_Type
 
typedef Teuchos::RCP< MultiVector_TypeMultiVectorPtr_Type
 
typedef Teuchos::RCP< const MultiVector_TypeMultiVectorConstPtr_Type
 
typedef DifferentiableFuncClass< SC, LO, GO, NO > DifferentiableFuncClass_Type
 
- Public Types inherited from FEDD::DifferentiableFuncClass< default_sc, default_lo, default_go, default_no >
typedef MultiVector< default_sc, default_lo, default_go, default_no > MultiVector_Type
 
typedef Teuchos::RCP< MultiVector_TypeMultiVectorPtr_Type
 
typedef Teuchos::RCP< const MultiVector_TypeMultiVectorConstPtr_Type
 
- Public Types inherited from FEDD::InputToOutputMappingClass< default_sc, default_lo, default_go, default_no >
typedef MultiVector< default_sc, default_lo, default_go, default_no > MultiVector_Type
 
typedef Teuchos::RCP< MultiVector_TypeMultiVectorPtr_Type
 
typedef Teuchos::RCP< const MultiVector_TypeMultiVectorConstPtr_Type
 

Public Member Functions

void setParams (ParameterListPtr_Type params) override
 Each constitutive model includes different material parameters which will be specified in parametersProblem.xml This function should set the specififc needed parameters for each model to the defined values.
 
void evaluateMapping (ParameterListPtr_Type params, double shearRate, double &viscosity) override
 Update the viscosity according to a chosen shear thinning generalized newtonian constitutive equation. Viscosity depends on spatial coordinates due to its dependency on velocity gradients.
 
void evaluateDerivative (ParameterListPtr_Type params, double shearRate, double &res) override
 For Newton method and NOX we need additional term in Jacobian considering directional derivative of our functional formulation. IMPORTANT: Here we implement the contribution of this: d(eta)/ d(gamma_Dot) * d(gamma_Dot)*d(Pi_||). For each constitutive model the function looks different and will be defined inside this function.
 
void echoInformationMapping () override
 Print parameter values used in model at runtime.
 
double getViscosity ()
 
 PowerLaw (ParameterListPtr_Type parameters)
 Constructor for CarreauYasuda.
 
- Public Member Functions inherited from FEDD::DifferentiableFuncClass< default_sc, default_lo, default_go, default_no >
virtual void evaluateMapping (ParameterListPtr_Type params, MultiVectorConstPtr_Type input, MultiVectorPtr_Type &output) override
 Implement a mapping for evaluating output in dependence of given input and specified parameters for MultiVectorPtr_Type inputs/ outputs.
 
virtual void evaluateDerivative (ParameterListPtr_Type params, MultiVectorConstPtr_Type x, MultiVectorPtr_Type &res) override
 Computes value of derivative of defined function in evaluateMapping.
 
- Public Member Functions inherited from FEDD::InputToOutputMappingClass< default_sc, default_lo, default_go, default_no >
virtual void updateParams (ParameterListPtr_Type params)
 Set or update the parameters read from the ParameterList.
 

Additional Inherited Members

- Protected Member Functions inherited from FEDD::DifferentiableFuncClass< default_sc, default_lo, default_go, default_no >
 DifferentiableFuncClass (ParameterListPtr_Type parameters)
 Constructor.
 
- Protected Member Functions inherited from FEDD::InputToOutputMappingClass< default_sc, default_lo, default_go, default_no >
 InputToOutputMappingClass (ParameterListPtr_Type parameters)
 Constructor.
 
- Protected Attributes inherited from FEDD::DifferentiableFuncClass< default_sc, default_lo, default_go, default_no >
ParameterListPtr_Type params_
 
- Protected Attributes inherited from FEDD::InputToOutputMappingClass< default_sc, default_lo, default_go, default_no >
ParameterListPtr_Type params_
 

Detailed Description

template<class SC = default_sc, class LO = default_lo, class GO = default_go, class NO = default_no>
class FEDD::PowerLaw< SC, LO, GO, NO >

This class is derived from the abstract class DifferentiableFuncClass and should provide functionality to evaluate the viscosity function specified by PowerLaw model (see [1])

Template Parameters
SCThe scalar type. So far, this is always double, but having it as a template parameter would allow flexibily, e.g., for using complex instead
LOThe local ordinal type. The is the index type for local indices
GOThe global ordinal type. The is the index type for global indices
NOThe Kokkos Node type. This would allow for performance portibility when using Kokkos. Currently, this is not used.

In general, there are several equations used to describe the material behavior of blood. Here (in this folder), we implement generalized Newtonian constitutive equations that capture the shear-thinning behavior of blood. The chosen shear-thinning model, such as the Power-Law or Carreau-Yasuda model, provides a function to update viscosity, which is no longer constant but depends on the shear rate (and other fixed constant parameters).

In our FEM code, we need an update function for viscosity, depending on the chosen model. If we apply Newton's method or NOX, we also require the directional derivative of the viscosity function, which also depends on the chosen model. Additionally, we need functions to set the required parameters of the chosen model and a function to print the parameter values.

The material parameters can be provided through a Teuchos::ParameterList object, which contains all the parameters specified in the input file 'parametersProblem.xml'. The structure of the input file and, consequently, the resulting parameter list can be chosen freely. The FEDDLib will handle reading the parameters from the file and making them available.

IMPORTANT: Regard e.g. following paper for computation of derivative @article{article_he, author = {He, Xin and Neytcheva, Maya and Vuik, C.}, year = {2015}, month = {06}, pages = {33-58}, title = {On Preconditioning of Incompressible Non-Newtonian Flow Problems}, volume = {33}, journal = {Journal of Computational Mathematics}, doi = {10.4208/jcm.1407-m4486} }

In our Finite Element Method (FEM) assembly, we require the directional derivative of the shear stress term with respect to the velocity vector for Newton's method. Since our viscosity function depends nonlinearly on the shear rate, which in turn depends on velocity, we must account for this contribution. Thus, when assembling the directional derivative term (in AssembleFEGeneralizedNewtonian), we call the function "this->viscosityModel->computeDerivative." It's crucial to note that through the chain rule, we obtain different contributions when computing the directional derivative of eta(gamma_dot) with respect to velocity. The individual terms are, for instance, detailed in the literature paper above. In general one obtain:

d (eta( gamma_Dot(v + eps*delta_v) ) )/ d(eps) |eps=0 = d(eta)/ d(gamma_Dot) * d(gamma_Dot)*d(Pi_||) * d(Pi_||)/ d(D) : d (D(v+eps*delta_v))/d(eps) |eps=0 Here Pi_|| is the second invariant of the strain-rate tensor D(v). In total we get four contributions: IMPORTANT: Consider that the contraction operator : is used in the formula above

  1. d(eta)/ d(gamma_Dot) - Compute the derivative of eta with respect to gamma_Dot – For e.g. Carreau-Yasuda model just compute it analytically
  2. d(gamma_Dot)*d(Pi_||) - The shear rate can be defined in terms of the second invariant of D by means of gamma_Dot = 2 \sqrt( - Pi_||) – So the derivative is just d(gamma_Dot)*d(Pi_||) = - 1/ sqrt( - Pi_||) = -2/ gamma_Dot
  3. d(Pi_||)/ d(D) - Derivative of second invariant of D with respect to D – For incompressible fluids, the first invariant is zero, and the result can be found in the literature. However, as it depends on velocity, this contribution will be implemented in the assemblyFESpecific
  4. d (D(v+eps*delta_v))/d(eps) |eps=0 - Directional derivative of D with respect to v - also implemented in assemblyFESpecific

For our viscosity models we define our derivative function "computeDerivative" to return the result of d(eta)/ d(gamma_Dot) * d(gamma_Dot)*d(Pi_||), which encompasses the first two contributions dependent on the chosen viscosity model.

Constructor & Destructor Documentation

◆ PowerLaw()

template<class SC, class LO, class GO, class NO>
FEDD::PowerLaw< SC, LO, GO, NO >::PowerLaw ( ParameterListPtr_Type parameters)

Constructor for CarreauYasuda.

Parameters
[in]parametersParameterlist for current problem
Here is the call graph for this function:

Member Function Documentation

◆ echoInformationMapping()

template<class SC, class LO, class GO, class NO>
void FEDD::PowerLaw< SC, LO, GO, NO >::echoInformationMapping ( )
overridevirtual

Print parameter values used in model at runtime.

Implements FEDD::DifferentiableFuncClass< default_sc, default_lo, default_go, default_no >.

◆ evaluateDerivative()

template<class SC, class LO, class GO, class NO>
void FEDD::PowerLaw< SC, LO, GO, NO >::evaluateDerivative ( ParameterListPtr_Type params,
double shearRate,
double & res )
overridevirtual

For Newton method and NOX we need additional term in Jacobian considering directional derivative of our functional formulation. IMPORTANT: Here we implement the contribution of this: d(eta)/ d(gamma_Dot) * d(gamma_Dot)*d(Pi_||). For each constitutive model the function looks different and will be defined inside this function.

Parameters
[in]paramsas read from the xml file (maybe redundant)
[in]shearRatescalar value of computed shear rate
[in,out]resscalar value of d(eta)/ d(gamma_Dot) * d(gamma_Dot)*d(Pi_||)

Implements FEDD::DifferentiableFuncClass< default_sc, default_lo, default_go, default_no >.

◆ evaluateMapping()

template<class SC, class LO, class GO, class NO>
void FEDD::PowerLaw< SC, LO, GO, NO >::evaluateMapping ( ParameterListPtr_Type params,
double shearRate,
double & viscosity )
overridevirtual

Update the viscosity according to a chosen shear thinning generalized newtonian constitutive equation. Viscosity depends on spatial coordinates due to its dependency on velocity gradients.

Parameters
[in]paramsas read from the xml file (maybe redundant)
[in]shearRatescalar value of computed shear rate
[in,out]viscosityvalue of viscosity

Implements FEDD::DifferentiableFuncClass< default_sc, default_lo, default_go, default_no >.

◆ setParams()

template<class SC, class LO, class GO, class NO>
void FEDD::PowerLaw< SC, LO, GO, NO >::setParams ( ParameterListPtr_Type params)
overridevirtual

Each constitutive model includes different material parameters which will be specified in parametersProblem.xml This function should set the specififc needed parameters for each model to the defined values.

Parameters
[in]ParameterListas read from the xml file (maybe redundant)

Implements FEDD::DifferentiableFuncClass< default_sc, default_lo, default_go, default_no >.


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