Forward compatibility: flex
[foam-extend-3.2.git] / src / solidModels / arbitraryCrack / solidCohesive / solidCohesiveFvPatchVectorField.H
blob20021a95772df6b03344bcf1ed7ba12771f1b159
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | foam-extend: Open Source CFD
4    \\    /   O peration     | Version:     3.2
5     \\  /    A nd           | Web:         http://www.foam-extend.org
6      \\/     M anipulation  | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
8 License
9     This file is part of foam-extend.
11     foam-extend is free software: you can redistribute it and/or modify it
12     under the terms of the GNU General Public License as published by the
13     Free Software Foundation, either version 3 of the License, or (at your
14     option) any later version.
16     foam-extend is distributed in the hope that it will be useful, but
17     WITHOUT ANY WARRANTY; without even the implied warranty of
18     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19     General Public License for more details.
21     You should have received a copy of the GNU General Public License
22     along with foam-extend.  If not, see <http://www.gnu.org/licenses/>.
24 Class
25     solidCohesiveFvPatchVectorField
27 Description
28     Cohesive law fv patch field for arbitrary crack procedure,
29     where the mode mixity is allowed to vary depending on how
30     the crack opens.
32     This procedure allows sigmaMax, tauMax, GIc, and GIIc
33     to be independently specified.
35     The cohesive law surface field is looked up from rheology.
37     The dissipated fracture energy is constantly monitored, by
38     integrating in time.
40 Author
41     Philip Cardiff UCD
42     based on original Tukovic cohesive law boundary condition.
44 SourceFiles
45     solidCohesiveFvPatchVectorField.C
47 \*---------------------------------------------------------------------------*/
49 #ifndef solidCohesiveFvPatchVectorField_H
50 #define solidCohesiveFvPatchVectorField_H
52 #include "fvPatchFields.H"
53 #include "directionMixedFvPatchFields.H"
54 #include "nonLinearGeometry.H"
55 #include "cohesiveFvPatch.H"
56 #include "Switch.H"
57 #include "tractionBoundaryGradient.H"
58 #include "NamedEnum.H"
60 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
62 namespace Foam
65 /*---------------------------------------------------------------------------*\
66                       Class solidCohesiveFvPatch Declaration
67 \*---------------------------------------------------------------------------*/
69 class solidCohesiveFvPatchVectorField
71     public directionMixedFvPatchVectorField
74     // Private Data
76         //- Name of the displacement field
77         const word fieldName_;
79         //- Cohesive law - now part of constitutiveModel
80         //cohesiveZoneModel* cohesiveZoneModelPtr_;
82         //- Under-relaxation factor
83         scalar relaxationFactor_;
85         //- Current traction
86         vectorField traction_;
88         //- Minimal unloading relative separation distance
89         //scalar minUnloadingSeparationDistance_;
91         //- If yes, contact procedure will be used to calculate
92         //  cohesive traction for the negative normal separation distance
93         Switch contact_;
95         //- if a face has cracked
96         //Field<bool> cracked_;
97         scalarField cracked_;
99         //- tractions
100         scalarField curTractionN_;
101         scalarField oldTractionN_;
102         scalarField curTractionS_;
103         scalarField oldTractionS_;
105         //- deltas
106         scalarField deltaN_;
107         scalarField oldDeltaN_;
108         scalarField deltaS_;
109         scalarField oldDeltaS_;
110         scalarField unloadingDeltaEff_;
112         //- energies
113         scalarField currentGI_;
114         scalarField oldGI_;
115         scalarField currentGII_;
116         scalarField oldGII_;
119         //- Current time index
120         label curTimeIndex_;
122         // Penalty factor and returning penalty factor
123         // for penalty contact
124         scalar* penaltyFactorPtr_;
125         scalar penaltyScale_;
126         scalar frictionCoeff_; // Coulomb friction coefficient
128         // If yes, cohesive traction will be calculated
129         // using old separation distance
130         Switch explicitSeparationDistance_;
131         scalarField curDeltaN_;
132         scalarField curDeltaS_;
134         // Global patch material field needed for multimaterial cohesive laws
135         bool updateGlobalPatchMaterials_;
136         scalarField globalPatchMaterials_;
138         //- Is it a non linear solver
139         nonLinearGeometry::nonLinearType nonLinear_;
141         //- if it is an orthropic solver
142         Switch orthotropic_;
145      // Private member functions
147         //- penalty factor
148         void calcPenaltyFactor();
149         virtual scalar penaltyFactor()
150         {
151             if (!penaltyFactorPtr_)
152             {
153                 calcPenaltyFactor();
154             }
156             return *penaltyFactorPtr_;
157         }
160 public:
162     //- Runtime type information
163     TypeName("solidCohesive");
166     // Constructors
168         //- Construct from patch and internal field
169         solidCohesiveFvPatchVectorField
170         (
171             const fvPatch&,
172             const DimensionedField<vector, volMesh>&
173         );
175         //- Construct from patch, internal field and dictionary
176         solidCohesiveFvPatchVectorField
177         (
178             const fvPatch&,
179             const DimensionedField<vector, volMesh>&,
180             const dictionary&
181         );
183         //- Construct by mapping given
184         //  solidCohesiveFvPatchVectorField onto a new patch
185         solidCohesiveFvPatchVectorField
186         (
187             const solidCohesiveFvPatchVectorField&,
188             const fvPatch&,
189             const DimensionedField<vector, volMesh>&,
190             const fvPatchFieldMapper&
191         );
193         //- Construct as copy
194         solidCohesiveFvPatchVectorField
195         (
196             const solidCohesiveFvPatchVectorField&
197         );
199         //- Construct and return a clone
200         virtual tmp<fvPatchVectorField> clone() const
201         {
202             return tmp<fvPatchVectorField>
203             (
204                 new solidCohesiveFvPatchVectorField(*this)
205             );
206         }
208         //- Construct as copy setting internal field reference
209         solidCohesiveFvPatchVectorField
210         (
211             const solidCohesiveFvPatchVectorField&,
212             const DimensionedField<vector, volMesh>&
213         );
215         //- Construct and return a clone setting internal field reference
216         virtual tmp<fvPatchVectorField> clone
217         (
218             const DimensionedField<vector, volMesh>& iF
219         ) const
220         {
221             return tmp<fvPatchVectorField>
222             (
223                 new solidCohesiveFvPatchVectorField(*this, iF)
224             );
225         }
228     // Member functions
230         // Access
232             //- Return true if this patch field fixes a value.
233             //  Needed to check if a level has to be specified while solving
234             //  Poissons equations.
235             virtual bool fixesValue() const
236             {
237                 return false;
238             }
240             //- Return cohesive law
241             //const cohesiveZoneModel& law() const;
243             //- Return current traction
244             // const vectorField& traction() const
245             vectorField& traction()
246             {
247                 return traction_;
248             }
250             //- Normal traction
251             //tmp<scalarField> normalTraction() const;
253             //- Relative separation distance
254             //tmp<scalarField> relativeSeparationDistance() const;
256             //- Effective traction
257             // tmp<scalarField> effectiveTraction
258             // (
259             //     const vectorField& traction,
260             //     const vectorField& normal
261             // ) const;
263             //- Effective traction
264             // scalar effectiveTraction
265             // (
266             //     const vector& traction,
267             //     const vector& normal
268             // ) const;
270             //- New faces
271             // const scalar& beta() const
272             // {
273             //     return beta_;
274             // }
276             //- crack and damage field for visualisation
277             //- cracked faces set to 2, damaged but not cracked set to 1
278             tmp<scalarField> crackingAndDamage() const;
280             //- G field for visualisation
281             tmp<scalarField> GI() const;
282             tmp<scalarField> GII() const;
284             //- print number of damaged and cracked faces
285             bool cracking();
287         // Mapping functions
289             //- Map (and resize as needed) from self given a mapping object
290             virtual void autoMap
291             (
292                 const fvPatchFieldMapper&
293             );
295             //- Reverse map the given fvPatchField onto this fvPatchField
296             virtual void rmap
297             (
298                 const fvPatchVectorField&,
299                 const labelList&
300             );
303         //- Update the coefficients associated with the patch field
304         virtual void updateCoeffs();
306         //- Write
307         virtual void write(Ostream&) const;
310     // Member operators
312         virtual void operator=(const fvPatchVectorField&) {}
316 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
318 } // End namespace Foam
320 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
322 #endif
324 // ************************************************************************* //