readMechanicalPropertiesSolidDisplacement.H
Go to the documentation of this file.
1 Info << "Reading mechanical properties\n"
2  << endl;
3 
4 IOdictionary mechanicalProperties(
5  IOobject(
6  "mechanicalProperties",
7  runTime.constant(),
8  mesh,
9  IOobject::MUST_READ,
10  IOobject::NO_WRITE));
11 
12 const dictionary& rhoDict(mechanicalProperties.subDict("rho"));
13 word rhoType(rhoDict.lookup("type"));
14 
15 IOobject rhoIO(
16  "solid:rho",
17  runTime.timeName(0),
18  mesh,
19  IOobject::NO_READ,
20  IOobject::NO_WRITE);
21 
22 if (rhoType == "uniform")
23 {
24  scalar rhoValue(readScalar(rhoDict.lookup("value")));
25 
26  rhoPtr_.reset(
27  new volScalarField(
28  rhoIO,
29  mesh,
30  dimensionedScalar(
31  "solid:rho",
32  dimMass / dimVolume,
33  rhoValue)));
34 }
35 else if (rhoType == "field")
36 {
37  rhoIO.readOpt() = IOobject::MUST_READ;
38 
39  rhoPtr_.reset(
40  new volScalarField(
41  rhoIO,
42  mesh));
43 }
44 else
45 {
46  FatalErrorInFunction
47  << "Valid type entries are uniform or field for rho"
48  << abort(FatalError);
49 }
50 
51 volScalarField& rho = rhoPtr_();
52 
53 const dictionary& EDict(mechanicalProperties.subDict("E"));
54 word EType(EDict.lookup("type"));
55 
56 IOobject EHeader(
57  "E",
58  runTime.timeName(0),
59  mesh,
60  IOobject::NO_READ,
61  IOobject::NO_WRITE);
62 
63 if (EType == "uniform")
64 {
65  scalar rhoEValue(readScalar(EDict.lookup("value")));
66 
67  EPtr_.reset(
68  new volScalarField(
69  EHeader,
70  mesh,
71  dimensionedScalar(
72  "Erho",
73  dimMass / dimLength / sqr(dimTime),
74  rhoEValue)));
75 }
76 else if (EType == "field")
77 {
78  EHeader.readOpt() = IOobject::MUST_READ;
79 
80  EPtr_.reset(
81  new volScalarField(
82  EHeader,
83  mesh));
84 }
85 else
86 {
87  FatalErrorInFunction
88  << "Valid type entries are uniform or field for E"
89  << abort(FatalError);
90 }
91 
92 volScalarField& rhoE = EPtr_();
93 
94 IOobject nuIO(
95  "solid:nu",
96  runTime.timeName(0),
97  mesh,
98  IOobject::NO_READ,
99  IOobject::NO_WRITE);
100 
101 const dictionary& nuDict(mechanicalProperties.subDict("nu"));
102 word nuType(nuDict.lookup("type"));
103 
104 if (nuType == "uniform")
105 {
106  scalar nuValue(readScalar(nuDict.lookup("value")));
107  nuPtr_.reset(
108  new volScalarField(
109  nuIO,
110  mesh,
111  dimensionedScalar(
112  "solid:nu",
113  dimless,
114  nuValue)));
115 }
116 else if (nuType == "field")
117 {
118  nuIO.readOpt() = IOobject::MUST_READ;
119  nuPtr_.reset(
120  new volScalarField(
121  nuIO,
122  mesh));
123 }
124 else
125 {
126  FatalErrorInFunction
127  << "Valid type entries are uniform or field for nu"
128  << abort(FatalError);
129 }
130 
131 volScalarField& nu = nuPtr_();
132 
133 Info << "Normalising E : E/rho\n"
134  << endl;
135 volScalarField E(rhoE / rho);
136 
137 Info << "Calculating Lame's coefficients\n"
138  << endl;
139 
140 muPtr_.reset(
141  new volScalarField(
142  "solid:mu",
143  E / (2.0 * (1.0 + nu))));
144 lambdaPtr_.reset(new volScalarField(
145  "solid:lambda",
146  nu* E / ((1.0 + nu) * (1.0 - 2.0 * nu))));
147 
148 Switch planeStress(mechanicalProperties.lookup("planeStress"));
149 
150 if (planeStress)
151 {
152  Info << "Plane Stress\n"
153  << endl;
154 
155  lambdaPtr_() = nu * E / ((1.0 + nu) * (1.0 - nu));
156 }
157 else
158 {
159  Info << "Plane Strain\n"
160  << endl;
161 }
mesh
fvMesh & mesh
Definition: createRefsHeatTransfer.H:4
rho
volScalarField & rho
Definition: createRefsRhoPimple.H:8
runTime
Time & runTime
Definition: createRefsHeatTransfer.H:1