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 / createFields.H
blob52b1f820a52483806c09b7ac7a02cefb854552a1
1     mesh.weights();
3     Info<< "Reading field U\n" << endl;
4     volVectorField U
5     (
6         IOobject
7         (
8             "U",
9             runTime.timeName(),
10             mesh,
11             IOobject::MUST_READ,
12             IOobject::AUTO_WRITE
13         ),
14         mesh
15     );
17     Info<< "Reading material properties\n" << endl;
19     IOdictionary mechanicalProperties
20     (
21         IOobject
22         (
23             "mechanicalProperties",
24             "constant",
25             mesh,
26             IOobject::MUST_READ,
27             IOobject::NO_WRITE
28         )
29     );
31     dimensionedScalar rho
32     (
33         mechanicalProperties.lookup("rho")
34     );
36     dimensionedScalar rhoE
37     (
38         mechanicalProperties.lookup("E")
39     );
41     dimensionedScalar nu
42     (
43         mechanicalProperties.lookup("nu")
44     );
46     Info<< "Normalising E : E/rho\n" << endl;
47     dimensionedScalar E = rhoE/rho;
49     Info<< "Reading boundary conditions\n" << endl;
51     IOdictionary boundaryConditions
52     (
53         IOobject
54         (
55             "boundaryConditions",
56             "constant",
57             mesh,
58             IOobject::MUST_READ,
59             IOobject::NO_WRITE
60         )
61     );
63     Info<< "Reading patchPressure\n" << endl;
64     scalarField rhoPatchPressure
65     (
66         boundaryConditions.lookup("patchPressure")
67     );
69     Info<< "Normalising patchPressure : patchPressure/rho\n" << endl;
70     scalarField patchPressure = rhoPatchPressure/rho.value();
72     Info<< "Reading patchTraction\n" << endl;
73     vectorField rhoPatchTraction
74     (
75         boundaryConditions.lookup("patchTraction")
76     );
78     Info<< "Normalising patchTraction : patchTraction/rho\n" << endl;
79     vectorField patchTraction = rhoPatchTraction/rho.value();
81     Info<< "Calculating Lame's coefficients\n" << endl;
83     dimensionedScalar mu = E/(2.0*(1.0 + nu));
84     dimensionedScalar lambda = nu*E/((1.0 + nu)*(1.0 - 2.0*nu));
85     dimensionedScalar threeK = E/(1.0 - 2.0*nu);
87     Switch planeStress
88     (
89         mechanicalProperties.lookup("planeStress")
90     );
92     if (planeStress)
93     {
94         Info<< "Plane Stress\n" << endl;
96         //- change lambda and threeK for plane stress
97         lambda = nu*E/((1.0 + nu)*(1.0 - nu));
98     }
99     else
100     {
101         Info<< "Plane Strain\n" << endl;
102     }
104     Info<< "mu = " << mu.value() << " Pa/rho\n";
105     Info<< "lambda = " << lambda.value() << " Pa/rho\n";
107 #   include "calculatePatchTraction.H"
109     Info<< "Reading contact patch IDs etc.\n" << endl;
110     const dictionary& contactPatchDict
111     (
112      mesh.solutionDict().subDict("contactPatch")
113     );
114     label gradPatch(readLabel(contactPatchDict.lookup("gradPatchID")));
115     label dirPatch(readLabel(contactPatchDict.lookup("dirPatchID")));
116     scalar urf(readScalar(contactPatchDict.lookup("contactUnderrelaxation")));
117     scalar touchTolerance
118     (
119         readScalar(contactPatchDict.lookup("touchTolerance"))
120     );
122     Info << "Creating contact pairs" << endl;
123     contactPatchPair contactPair(mesh, gradPatch, dirPatch, touchTolerance);
125     contactPatchPair reversePair(mesh, dirPatch, gradPatch, touchTolerance);
127     volScalarField contactArea
128     (
129         IOobject
130         (
131             "contactArea",
132             runTime.timeName(),
133             mesh,
134             IOobject::NO_READ,
135             IOobject::AUTO_WRITE
136         ),
137         mesh,
138         dimensionedScalar(0)
139     );