tractionDisplacementFvPatchVectorFieldTemplates.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2020 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
28 
29 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
30 
31 template<class Type>
33 (
34  const Type& pressure
35 )
36 {
37  const label patchi = patch().index();
38 
39  const solidDisplacementThermo& thermo =
40  db().lookupObject<solidDisplacementThermo>
41  (
43  );
44 
45  const scalarField& E = thermo.E(patchi);
46  const scalarField& nu = thermo.nu(patchi);
47 
48  const scalarField mu(E/(2.0*(1.0 + nu)));
49  const scalarField lambda
50  (
51  thermo.planeStress()
52  ? nu*E/((1 + nu)*(1 - nu))
53  : nu*E/((1 + nu)*(1 - 2*nu))
54  );
55  const scalarField threeK
56  (
57  thermo.planeStress()
58  ? E/(1 - nu)
59  : E/(1 - 2*nu)
60  );
61 
62  const scalarField twoMuLambda(2*mu + lambda);
63 
64  const vectorField n(patch().nf());
65 
66  const fvPatchField<symmTensor>& sigmaD =
67  patch().lookupPatchField<volSymmTensorField, symmTensor>("sigmaD");
68 
69  gradient() =
70  (
71  (traction_ - pressure*n)
72  + twoMuLambda*fvPatchField<vector>::snGrad() - (n & sigmaD)
73  )/twoMuLambda;
74 
75  if (thermo.thermalStress())
76  {
77  const scalarField& alphav = thermo.alphav(patchi);
78 
79  gradient() +=
80  n*threeK*alphav*thermo.T().boundaryField()[patchi]/twoMuLambda;
81  }
82 
83  fixedGradientFvPatchVectorField::updateCoeffs();
84 }
85 
86 
87 // ************************************************************************* //
GeometricField< symmTensor, fvPatchField, volMesh > volSymmTensorField
Definition: volFieldsFwd.H:61
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
virtual tmp< Field< Type > > snGrad() const
Return patch-normal gradient.
Definition: fvPatchField.C:186
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
const word dictName() const
Return the local dictionary name (final part of scoped name)
Definition: dictionary.H:123
SymmTensor< scalar > symmTensor
SymmTensor of scalars.
Definition: symmTensor.H:48
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
label patchi
const dimensionedScalar & mu
Atomic mass unit.
dimensionedScalar lambda(laminarTransport.lookup("lambda"))
label n
Field< vector > vectorField
Specialisation of Field<T> for vector.