Skip to content
Snippets Groups Projects
Commit 7dc455a5 authored by Elias Pipping's avatar Elias Pipping Committed by pipping
Browse files

Add viscosity assembler with variable coefficients

[[Imported from SVN: r12873]]
parent 88ace340
No related branches found
No related tags found
No related merge requests found
#ifndef VARIABLE_COEFFICIENT_VISCOSITY_ASSEMBLER_HH
#define VARIABLE_COEFFICIENT_VISCOSITY_ASSEMBLER_HH
#include "dune/fufem/assemblers/localassemblers/strainproductassembler.hh"
#include "dune/fufem/functions/analyticgridfunction.hh"
#include "dune/fufem/symmetrictensor.hh"
/** \brief Local assembler for the viscous part of the linear visco-elastic Kelvin-Voigt material. With variable coefficients. */
template <class GridType, class TrialLocalFE, class AnsatzLocalFE, class FunctionType>
class VariableCoefficientViscosityAssembler
: public StrainProductAssembler< GridType, TrialLocalFE, AnsatzLocalFE, VariableCoefficientViscosityAssembler<GridType,TrialLocalFE,AnsatzLocalFE,FunctionType> >
{
private:
typedef StrainProductAssembler< GridType, TrialLocalFE, AnsatzLocalFE, VariableCoefficientViscosityAssembler<GridType,TrialLocalFE,AnsatzLocalFE, FunctionType> > SPA;
using SPA::dim;
using typename SPA::ctype;
typedef typename FunctionType::RangeType RangeType;
typedef VirtualGridFunction<GridType, RangeType> GridFunction;
public:
using typename SPA::T;
using typename SPA::BoolMatrix;
using typename SPA::Element;
using typename SPA::LocalMatrix;
VariableCoefficientViscosityAssembler(const GridType& grid,
const FunctionType& muShear,
const FunctionType& muBulk,
const QuadratureRuleKey& muShearKey,
const QuadratureRuleKey& muBulkKey)
: SPA(muShearKey.sum(muBulkKey)),
muShearGridFunctionP_(makeGridFunction(grid, muShear)),
muBulkGridFunctionP_(makeGridFunction(grid, muBulk))
{}
SymmetricTensor<dim> strainToStress(const SymmetricTensor<dim>& strain,
const Element& element,
const Dune::FieldVector<ctype, dim>& position) const {
RangeType muBulk;
muBulkGridFunctionP_->evaluateLocal(element, position, muBulk);
RangeType muShear;
muShearGridFunctionP_->evaluateLocal(element, position, muShear);
SymmetricTensor<dim> stress = strain;
stress *= 2*muShear;
stress.addToDiag((muBulk-(2.0/3.0)*muShear) * strain.trace());
return stress;
}
protected:
Dune::shared_ptr<const GridFunction> muShearGridFunctionP_;
Dune::shared_ptr<const GridFunction> muBulkGridFunctionP_;
};
#endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment