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