Merge branch 'master' of ssh://git.code.sf.net/p/foam-extend/foam-extend-3.2
[foam-extend-3.2.git] / applications / solvers / solidMechanics / deprecatedSolvers / contactStressFoam / contactBoundaries.H
blobe34e51f357ee1f2040346a4f382126c13dfe0e89
2     volVectorField::GeometricBoundaryField& Upatches = U.boundaryField();
4     const volTensorField::GeometricBoundaryField& gradUpatches =
5         gradU.boundaryField();
7     const surfaceVectorField::GeometricBoundaryField& Apatches =
8         mesh.Sf().boundaryField();
9     const surfaceScalarField::GeometricBoundaryField& magApatches =
10         mesh.magSf().boundaryField();
12     vectorField nGradPatch = Apatches[gradPatch]/magApatches[gradPatch];
14     vectorField nDirPatch = Apatches[dirPatch]/magApatches[dirPatch];
16     // Update contact
17     contactPair.updateContact(U);
18     reversePair.updateContact(U);
20     const scalarField& touchFraction = contactPair.touchFraction();
22     const scalarField& reverseFraction = reversePair.touchFraction();
24 //Info << "touchFraction: " << touchFraction << endl;
26     // Mark contact surfaces
27     contactArea.boundaryField()[dirPatch] = touchFraction;
28     contactArea.boundaryField()[gradPatch] = reverseFraction;
30     // Cast will fall over in incorrect
31     directionMixedFvPatchVectorField& UpatchDir =
32         refCast<directionMixedFvPatchVectorField>(Upatches[dirPatch]);
34     // set the traction and value for directionMixed patch
35     UpatchDir.valueFraction() =
36         (1.0 - urf)*UpatchDir.valueFraction()
37       + I*urf*touchFraction;
39 //     UpatchDir.value() = contactPair.slaveDisplacement();
41     UpatchDir.refValue() =
42         nDirPatch*
43         min
44         (
45             (nDirPatch & UpatchDir) + urf*touchFraction*touchTolerance,
46             (nDirPatch & contactPair.slaveDisplacement())
47         );
49     // traction[dirPatch] = 0 because there's no friction!!
51     // set the traction for the gradient patch (using the new valueFraction!)
53     vectorField newTraction =
54         nGradPatch*
55         (
56             reversePair.slavePressure
57             (
58                 nDirPatch &
59                 (
60                     mu.value()*
61                     (
62                         gradUpatches[dirPatch]
63                       + gradUpatches[dirPatch].T()
64                     )
65                   + I*(lambda.value()*tr(gradUpatches[dirPatch]))
66                 ) & nDirPatch
67             )
68         );
70 //     Info<< "contact: "
71 //         <<
72 //             (nDirPatch &
73 //                 (
74 //                     mu.value()*
75 //                     (
76 //                         gradUpatches[dirPatch]
77 //                       + gradUpatches[dirPatch].T()
78 //                     )
79 //                   + I*(lambda.value()*tr(gradUpatches[dirPatch]))
80 //                 ) & nDirPatch)*rho.value()
81 //         << endl;
83     traction[gradPatch] =
84         (1.0 - urf)*traction[gradPatch]
85       + urf*newTraction*reverseFraction;