version 3.11-dev
solidmechanics/plate/mindlin_reissner/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_MINDLIN_REISSNER_PLATE_LOCAL_RESIDUAL_HH
13#define DUMUX_MINDLIN_REISSNER_PLATE_LOCAL_RESIDUAL_HH
14
15#include <dune/common/fvector.hh>
16#include <dune/common/fmatrix.hh>
17
18#include <dumux/common/math.hh>
22
23namespace Dumux {
24
29template<class TypeTag>
32{
38 using ElementVolumeVariables = typename GetPropType<TypeTag, Properties::GridVolumeVariables>::LocalView;
39 using ElementFluxVariablesCache = typename GetPropType<TypeTag, Properties::GridFluxVariablesCache>::LocalView;
41 using FVElementGeometry = typename GridGeometry::LocalView;
42 using SubControlVolume = typename GridGeometry::SubControlVolume;
43 using SubControlVolumeFace = typename GridGeometry::SubControlVolumeFace;
44 using GridView = typename GridGeometry::GridView;
45 using Element = typename GridView::template Codim<0>::Entity;
47 using Indices = typename ModelTraits::Indices;
48 static constexpr int dimWorld = GridView::dimensionworld;
49public:
50 using ParentType::ParentType;
51 using ElementResidualVector = typename ParentType::ElementResidualVector;
52
56 NumEqVector computeStorage(const Problem& problem,
57 const SubControlVolume& scv,
58 const VolumeVariables& volVars) const
59 {
60 // so far we only implement the equilibrium model
61 return NumEqVector(0.0);
62 }
63
67 NumEqVector computeFlux(const Problem& problem,
68 const Element& element,
69 const FVElementGeometry& fvGeometry,
70 const ElementVolumeVariables& elemVolVars,
71 const SubControlVolumeFace& scvf,
72 const ElementFluxVariablesCache& elemFluxVarsCache) const
73 {
74 if (scvf.boundary())
75 DUNE_THROW(Dune::InvalidStateException, "Calling computeFlux for boundary scvf");
76
77 const auto& fluxVarCache = elemFluxVarsCache[scvf];
78 Dune::FieldVector<Scalar, dimWorld> gradShearGradPotential(0.0);
79 Dune::FieldVector<Scalar, dimWorld> gradShearCurlPotential(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 gradShearCurlPotential.axpy(volVars.shearCurlPotential(), gradN);
87 gradDeformation.axpy(volVars.verticalDeformation(), gradN);
88 }
89
90 const auto rotation = problem.couplingManager().rotation(fvGeometry, scvf);
91
92 // rotate with J = [0 1, -1 0]
93 const auto tangent = [&](){
94 auto tangent = scvf.unitOuterNormal();
95 std::swap(tangent[0], tangent[1]);
96 tangent[1] = -tangent[1];
97 return tangent;
98 }();
99
100 const auto thickness = problem.thickness();
101 const auto shearCorrectionFactor = problem.shearCorrectionFactor();
102 const auto shearModulus = problem.shearModulus();
103 std::swap(gradShearCurlPotential[0], gradShearCurlPotential[1]);
104 gradShearCurlPotential[1] = -gradShearCurlPotential[1];
105 gradShearCurlPotential /= shearModulus*thickness*shearCorrectionFactor;
106
107 NumEqVector flux(0.0);
108 flux[Indices::shearGradPotentialEqIdx] = 1.0*vtmv(scvf.unitOuterNormal(), 1.0, gradShearGradPotential)*scvf.area();
109 gradShearGradPotential /= shearModulus*thickness*shearCorrectionFactor;
110
111 flux[Indices::deformationEqIdx] = -1.0*vtmv(scvf.unitOuterNormal(), 1.0, gradDeformation-rotation-gradShearGradPotential)*scvf.area();
112 flux[Indices::shearCurlPotentialEqIdx] = -1.0*vtmv(tangent, 1.0, rotation+gradShearCurlPotential)*scvf.area();
113 return flux;
114 }
115};
116
121template<class TypeTag>
124{
130 using ElementVolumeVariables = typename GetPropType<TypeTag, Properties::GridVolumeVariables>::LocalView;
131 using ElementFluxVariablesCache = typename GetPropType<TypeTag, Properties::GridFluxVariablesCache>::LocalView;
133 using FVElementGeometry = typename GridGeometry::LocalView;
134 using SubControlVolume = typename GridGeometry::SubControlVolume;
135 using SubControlVolumeFace = typename GridGeometry::SubControlVolumeFace;
136 using GridView = typename GridGeometry::GridView;
137 using Element = typename GridView::template Codim<0>::Entity;
138
140 using Indices = typename ModelTraits::Indices;
141 static constexpr int dimWorld = GridView::dimensionworld;
142public:
143 using ParentType::ParentType;
144 using ElementResidualVector = typename ParentType::ElementResidualVector;
145
149 NumEqVector computeStorage(const Problem& problem,
150 const SubControlVolume& scv,
151 const VolumeVariables& volVars) const
152 {
153 // so far we only implement the equilibrium equation
154 return NumEqVector(0.0);
155 }
156
160 NumEqVector computeFlux(const Problem& problem,
161 const Element& element,
162 const FVElementGeometry& fvGeometry,
163 const ElementVolumeVariables& elemVolVars,
164 const SubControlVolumeFace& scvf,
165 const ElementFluxVariablesCache& elemFluxVarsCache) const
166 {
167 if (scvf.boundary())
168 DUNE_THROW(Dune::InvalidStateException, "Calling computeFlux for boundary scvf");
169
170 const auto& cm = problem.couplingManager();
171 const auto vars = cm.deformationAndPotentials(fvGeometry, scvf);
172 const auto psi = vars[cm.shearCurlPotentialIdx()];
173 const auto phi = vars[cm.shearGradPotentialIdx()];
174
175 Dune::FieldMatrix<Scalar, dimWorld, dimWorld> Q(0.0);
176 Q[0][0] = phi; Q[0][1] = psi;
177 Q[1][0] = -psi;
178 Q[1][1] = phi;
179
180 const auto& fluxVarCache = elemFluxVarsCache[scvf];
181 Dune::FieldMatrix<Scalar, dimWorld, dimWorld> gradRotations(0.0);
182 for (const auto& localDof : localDofs(fvGeometry))
183 {
184 const auto& volVars = elemVolVars[localDof];
185 const auto& gradN = fluxVarCache.gradN(localDof.index());
186 for (int dir = 0; dir < dimWorld; ++dir)
187 gradRotations[dir].axpy(volVars.rotation(dir), gradN);
188 }
189
190 const auto& globalPos = scvf.ipGlobal();
191 const auto poissonRatio = problem.poissonRatio(globalPos);
192 const auto D = problem.D(globalPos);
193 Dune::FieldMatrix<Scalar, dimWorld, dimWorld> M(0.0);
194 M[0][0] = -D*(gradRotations[0][0] + poissonRatio*gradRotations[1][1]);
195 M[1][1] = -D*(gradRotations[1][1] + poissonRatio*gradRotations[0][0]);
196 M[0][1] = -D*(1.0-poissonRatio)*0.5*(gradRotations[0][1] + gradRotations[1][0]);
197 M[1][0] = M[0][1];
198 M -= Q;
199
200 NumEqVector flux(0.0);
201 M.mv(scvf.unitOuterNormal(), flux);
202 flux *= -scvf.area();
203 return flux;
204 }
205};
206
207} // end namespace Dumux
208
209#endif
Local residual for the Mindlin-Reissner model (deformation and potentials)
Definition: solidmechanics/plate/mindlin_reissner/localresidual.hh:32
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/mindlin_reissner/localresidual.hh:67
NumEqVector computeStorage(const Problem &problem, const SubControlVolume &scv, const VolumeVariables &volVars) const
Evaluate the rate of change of all conserved quantities.
Definition: solidmechanics/plate/mindlin_reissner/localresidual.hh:56
typename ParentType::ElementResidualVector ElementResidualVector
Definition: solidmechanics/plate/mindlin_reissner/localresidual.hh:51
Local residual for the Mindlin-Reissner model (rotations)
Definition: solidmechanics/plate/mindlin_reissner/localresidual.hh:124
typename ParentType::ElementResidualVector ElementResidualVector
Definition: solidmechanics/plate/mindlin_reissner/localresidual.hh:144
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/mindlin_reissner/localresidual.hh:160
NumEqVector computeStorage(const Problem &problem, const SubControlVolume &scv, const VolumeVariables &volVars) const
Evaluate the rate of change of all conserved quantities.
Definition: solidmechanics/plate/mindlin_reissner/localresidual.hh:149
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.