version 3.11-dev
solidmechanics/plate/kirchhoff_love/localresidual.hh
Go to the documentation of this file.
1// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2// vi: set et ts=4 sw=4 sts=4:
3//
4// SPDX-FileCopyrightText: Copyright © DuMux Project contributors, see AUTHORS.md in root folder
5// SPDX-License-Identifier: GPL-3.0-or-later
6//
12#ifndef DUMUX_KIRCHHOFF_LOVE_PLATE_LOCAL_RESIDUAL_HH
13#define DUMUX_KIRCHHOFF_LOVE_PLATE_LOCAL_RESIDUAL_HH
14
15#include <dune/common/fvector.hh>
16#include <dune/common/fmatrix.hh>
17
18#include <dumux/common/math.hh>
21
23
24namespace Dumux {
25
30template<class TypeTag>
33{
39 using ElementVolumeVariables = typename GetPropType<TypeTag, Properties::GridVolumeVariables>::LocalView;
40 using ElementFluxVariablesCache = typename GetPropType<TypeTag, Properties::GridFluxVariablesCache>::LocalView;
42 using FVElementGeometry = typename GridGeometry::LocalView;
43 using SubControlVolume = typename GridGeometry::SubControlVolume;
44 using SubControlVolumeFace = typename GridGeometry::SubControlVolumeFace;
45 using GridView = typename GridGeometry::GridView;
46 using Element = typename GridView::template Codim<0>::Entity;
48 using Indices = typename ModelTraits::Indices;
49 static constexpr int dimWorld = GridView::dimensionworld;
50public:
51 using ParentType::ParentType;
52 using ElementResidualVector = typename ParentType::ElementResidualVector;
53
57 NumEqVector computeStorage(const Problem& problem,
58 const SubControlVolume& scv,
59 const VolumeVariables& volVars) const
60 {
61 // so far we only implement the equilibrium equation
62 return NumEqVector(0.0);
63 }
64
68 NumEqVector computeFlux(const Problem& problem,
69 const Element& element,
70 const FVElementGeometry& fvGeometry,
71 const ElementVolumeVariables& elemVolVars,
72 const SubControlVolumeFace& scvf,
73 const ElementFluxVariablesCache& elemFluxVarsCache) const
74 {
75 if (scvf.boundary())
76 DUNE_THROW(Dune::InvalidStateException, "Calling computeFlux for boundary scvf");
77
78 const auto& fluxVarCache = elemFluxVarsCache[scvf];
79 Dune::FieldVector<Scalar, dimWorld> gradShearGradPotential(0.0);
80 Dune::FieldVector<Scalar, dimWorld> gradDeformation(0.0);
81 for (const auto& localDof : localDofs(fvGeometry))
82 {
83 const auto& volVars = elemVolVars[localDof];
84 const auto& gradN = fluxVarCache.gradN(localDof.index());
85 gradShearGradPotential.axpy(volVars.shearGradPotential(), gradN);
86 gradDeformation.axpy(volVars.verticalDeformation(), gradN);
87 }
88
89 const auto rotation = problem.couplingManager().rotation(fvGeometry, scvf);
90
91 // rotate with J = [0 1, -1 0]
92 const auto tangent = [&](){
93 auto tangent = scvf.unitOuterNormal();
94 std::swap(tangent[0], tangent[1]);
95 tangent[1] = -tangent[1];
96 return tangent;
97 }();
98
99 NumEqVector flux(0.0);
100 flux[Indices::shearGradPotentialEqIdx] = vtmv(scvf.unitOuterNormal(), 1.0, gradShearGradPotential)*scvf.area();
101 flux[Indices::deformationEqIdx] = -vtmv(scvf.unitOuterNormal(), 1.0, (gradDeformation-rotation))*scvf.area();
102 flux[Indices::shearCurlPotentialEqIdx] = -vtmv(tangent, 1.0, rotation)*scvf.area();
103 return flux;
104 }
105};
106
111template<class TypeTag>
114{
120 using ElementVolumeVariables = typename GetPropType<TypeTag, Properties::GridVolumeVariables>::LocalView;
121 using ElementFluxVariablesCache = typename GetPropType<TypeTag, Properties::GridFluxVariablesCache>::LocalView;
123 using FVElementGeometry = typename GridGeometry::LocalView;
124 using SubControlVolume = typename GridGeometry::SubControlVolume;
125 using SubControlVolumeFace = typename GridGeometry::SubControlVolumeFace;
126 using GridView = typename GridGeometry::GridView;
127 using Element = typename GridView::template Codim<0>::Entity;
129 using Indices = typename ModelTraits::Indices;
130 static constexpr int dimWorld = GridView::dimensionworld;
131public:
132 using ParentType::ParentType;
133 using ElementResidualVector = typename ParentType::ElementResidualVector;
134
138 NumEqVector computeStorage(const Problem& problem,
139 const SubControlVolume& scv,
140 const VolumeVariables& volVars) const
141 {
142 return NumEqVector(0.0);
143 }
144
148 NumEqVector computeFlux(const Problem& problem,
149 const Element& element,
150 const FVElementGeometry& fvGeometry,
151 const ElementVolumeVariables& elemVolVars,
152 const SubControlVolumeFace& scvf,
153 const ElementFluxVariablesCache& elemFluxVarsCache) const
154 {
155 if (scvf.boundary())
156 DUNE_THROW(Dune::InvalidStateException, "Calling computeFlux for boundary scvf");
157
158 const auto& cm = problem.couplingManager();
159 const auto vars = cm.deformationAndPotentials(fvGeometry, scvf);
160 const auto psi = vars[cm.shearCurlPotentialIdx()];
161 const auto phi = vars[cm.shearGradPotentialIdx()];
162
163 Dune::FieldMatrix<Scalar, dimWorld, dimWorld> Q(0.0);
164 Q[0][0] = phi; Q[0][1] = psi;
165 Q[1][0] = -psi;
166 Q[1][1] = phi;
167
168 const auto& fluxVarCache = elemFluxVarsCache[scvf];
169 Dune::FieldMatrix<Scalar, dimWorld, dimWorld> gradRotations(0.0);
170 for (const auto& localDof : localDofs(fvGeometry))
171 {
172 const auto& volVars = elemVolVars[localDof];
173 const auto& gradN = fluxVarCache.gradN(localDof.index());
174 for (int dir = 0; dir < dimWorld; ++dir)
175 gradRotations[dir].axpy(volVars.rotation(dir), gradN);
176 }
177
178 const auto& globalPos = scvf.ipGlobal();
179 const auto poissonRatio = problem.poissonRatio(globalPos);
180 const auto D = problem.D(globalPos);
181 Dune::FieldMatrix<Scalar, dimWorld, dimWorld> M(0.0);
182 M[0][0] = -D*(gradRotations[0][0] + poissonRatio*gradRotations[1][1]);
183 M[1][1] = -D*(gradRotations[1][1] + poissonRatio*gradRotations[0][0]);
184 M[0][1] = -D*(1.0-poissonRatio)*0.5*(gradRotations[0][1] + gradRotations[1][0]);
185 M[1][0] = M[0][1];
186 M -= Q;
187
188 NumEqVector flux(0.0);
189 M.mv(scvf.unitOuterNormal(), flux);
190 flux *= -scvf.area();
191 return flux;
192 }
193};
194
195} // end namespace Dumux
196
197#endif
Local residual for the Kirchhoff-Love model (deformation and potentials)
Definition: solidmechanics/plate/kirchhoff_love/localresidual.hh:33
NumEqVector computeFlux(const Problem &problem, const Element &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars, const SubControlVolumeFace &scvf, const ElementFluxVariablesCache &elemFluxVarsCache) const
Evaluate the fluxes over a face of a sub control volume.
Definition: solidmechanics/plate/kirchhoff_love/localresidual.hh:68
NumEqVector computeStorage(const Problem &problem, const SubControlVolume &scv, const VolumeVariables &volVars) const
Evaluate the rate of change of all conserved quantities.
Definition: solidmechanics/plate/kirchhoff_love/localresidual.hh:57
typename ParentType::ElementResidualVector ElementResidualVector
Definition: solidmechanics/plate/kirchhoff_love/localresidual.hh:52
Local residual for the Kirchhoff-Love model (rotations)
Definition: solidmechanics/plate/kirchhoff_love/localresidual.hh:114
typename ParentType::ElementResidualVector ElementResidualVector
Definition: solidmechanics/plate/kirchhoff_love/localresidual.hh:133
NumEqVector computeStorage(const Problem &problem, const SubControlVolume &scv, const VolumeVariables &volVars) const
Evaluate the rate of change of all conserved quantities.
Definition: solidmechanics/plate/kirchhoff_love/localresidual.hh:138
NumEqVector computeFlux(const Problem &problem, const Element &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars, const SubControlVolumeFace &scvf, const ElementFluxVariablesCache &elemFluxVarsCache) const
Evaluate the fluxes over a face of a sub control volume.
Definition: solidmechanics/plate/kirchhoff_love/localresidual.hh:148
Defines all properties used in Dumux.
The default local operator than can be specialized for each discretization scheme.
Dune::DenseMatrix< MAT >::value_type vtmv(const Dune::DenseVector< V1 > &v1, const Dune::DenseMatrix< MAT > &M, const Dune::DenseVector< V2 > &v2)
Evaluates the scalar product of a vector v2, projected by a matrix M, with a vector v1.
Definition: math.hh:880
typename NumEqVectorTraits< PrimaryVariables >::type NumEqVector
A vector with the same size as numbers of equations This is the default implementation and has to be ...
Definition: numeqvector.hh:34
typename GetProp< TypeTag, Property >::type GetPropType
get the type alias defined in the property
Definition: propertysystem.hh:296
Define some often used mathematical functions.
Definition: adapt.hh:17
typename Detail::DiscretizationDefaultLocalOperator< TypeTag >::type DiscretizationDefaultLocalOperator
Definition: defaultlocaloperator.hh:27
auto localDofs(const FVElementGeometry &fvGeometry)
range over local dofs
Definition: localdof.hh:50
A helper to deduce a vector with the same size as numbers of equations.