readMechanicalProperties.H
Go to the documentation of this file.
1  Info<< "Reading mechanical properties\n" << endl;
2 
3  IOdictionary mechanicalProperties
4  (
5  IOobject
6  (
7  "mechanicalProperties",
8  runTime.constant(),
9  mesh,
10  IOobject::MUST_READ_IF_MODIFIED,
11  IOobject::NO_WRITE
12  )
13  );
14 
15  const dictionary& rhoDict(mechanicalProperties.subDict("rho"));
16  word rhoType(rhoDict.get<word>("type"));
17 
18  autoPtr<volScalarField> rhoPtr;
19 
20  IOobject rhoIO
21  (
22  "rho",
23  runTime.timeName(0),
24  mesh,
25  IOobject::NO_READ,
26  IOobject::NO_WRITE
27  );
28 
29  if (rhoType == "uniform")
30  {
31  scalar rhoValue(rhoDict.get<scalar>("value"));
32 
33  rhoPtr.reset
34  (
35  new volScalarField
36  (
37  rhoIO,
38  mesh,
40  (
41  "rho",
43  rhoValue
44  )
45  )
46  );
47  }
48  else if (rhoType == "field")
49  {
50  rhoIO.readOpt(IOobject::MUST_READ);
51 
52  rhoPtr.reset
53  (
54  new volScalarField
55  (
56  rhoIO,
57  mesh
58  )
59  );
60  }
61  else
62  {
64  << "Valid type entries are uniform or field for rho"
65  << abort(FatalError);
66  }
67 
69 
70  const dictionary& EDict(mechanicalProperties.subDict("E"));
71  word EType(EDict.get<word>("type"));
72 
73  autoPtr<volScalarField> EPtr;
74 
75  IOobject EHeader
76  (
77  "E",
78  runTime.timeName(0),
79  mesh,
80  IOobject::NO_READ,
81  IOobject::NO_WRITE
82  );
83 
84  if (EType == "uniform")
85  {
86  scalar rhoEValue(EDict.get<scalar>("value"));
87 
88  EPtr.reset
89  (
90  new volScalarField
91  (
92  EHeader,
93  mesh,
95  (
96  "Erho",
98  rhoEValue
99  )
100  )
101  );
102  }
103  else if (EType == "field")
104  {
105  EHeader.readOpt(IOobject::MUST_READ);
106 
107  EPtr.reset
108  (
109  new volScalarField
110  (
111  EHeader,
112  mesh
113  )
114  );
115  }
116  else
117  {
119  << "Valid type entries are uniform or field for E"
120  << abort(FatalError);
121  }
122 
124 
125  autoPtr<volScalarField> nuPtr;
126 
127  IOobject nuIO
128  (
129  "nu",
130  runTime.timeName(0),
131  mesh,
132  IOobject::NO_READ,
133  IOobject::NO_WRITE
134  );
135 
136  const dictionary& nuDict(mechanicalProperties.subDict("nu"));
137  word nuType(nuDict.get<word>("type"));
138 
139  if (nuType == "uniform")
140  {
141  scalar nuValue(nuDict.get<scalar>("value"));
142  nuPtr.reset
143  (
144  new volScalarField
145  (
146  nuIO,
147  mesh,
149  (
150  "nu",
151  dimless,
152  nuValue
153  )
154  )
155  );
156  }
157  else if (nuType == "field")
158  {
159  nuIO.readOpt(IOobject::MUST_READ);
160  nuPtr.reset
161  (
162  new volScalarField
163  (
164  nuIO,
165  mesh
166  )
167  );
168  }
169  else
170  {
172  << "Valid type entries are uniform or field for nu"
173  << abort(FatalError);
174  }
175 
177 
178  Info<< "Normalising E : E/rho\n" << endl;
180 
181  Info<< "Calculating Lame's coefficients\n" << endl;
182 
183  volScalarField mu(E/(2.0*(1.0 + nu)));
184  volScalarField lambda(nu*E/((1.0 + nu)*(1.0 - 2.0*nu)));
185  volScalarField threeK(E/(1.0 - 2.0*nu));
186 
187  if (mechanicalProperties.get<bool>("planeStress"))
188  {
189  Info<< "Plane Stress\n" << endl;
190 
191  lambda = nu*E/((1.0 + nu)*(1.0 - nu));
192  threeK = E/(1.0 - nu);
193  }
194  else
195  {
196  Info<< "Plane Strain\n" << endl;
197  }
runTime
engineTime & runTime
Definition: createEngineTime.H:13
Foam::constant::physicoChemical::mu
const dimensionedScalar mu
Atomic mass unit.
Definition: createFieldRefs.H:4
Foam::dimLength
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
Definition: dimensionSets.H:52
rho
volScalarField & rho
Definition: readMechanicalProperties.H:68
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:369
rhoIO
IOobject rhoIO("rho", runTime.timeName(0), mesh, IOobject::NO_READ, IOobject::NO_WRITE)
nuPtr
autoPtr< volScalarField > nuPtr
Definition: readMechanicalProperties.H:125
EDict
const dictionary & EDict(mechanicalProperties.subDict("E"))
rhoPtr
Info<< "Reading mechanical properties\n"<< endl;IOdictionary mechanicalProperties(IOobject("mechanicalProperties", runTime.constant(), mesh, IOobject::MUST_READ_IF_MODIFIED, IOobject::NO_WRITE));const dictionary &rhoDict(mechanicalProperties.subDict("rho"));word rhoType(rhoDict.get< word >"type"));autoPtr< volScalarField > rhoPtr
Definition: readMechanicalProperties.H:18
nu
volScalarField & nu
Definition: readMechanicalProperties.H:176
Foam::dimTime
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
Definition: dimensionSets.H:53
EHeader
IOobject EHeader("E", runTime.timeName(0), mesh, IOobject::NO_READ, IOobject::NO_WRITE)
Foam::Info
messageStream Info
Information stream (stdout output on master, null elsewhere)
nuDict
const dictionary & nuDict(mechanicalProperties.subDict("nu"))
Foam::dimensionedScalar
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
Definition: dimensionedScalarFwd.H:42
Foam::volScalarField
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:57
rhoE
volScalarField & rhoE
Definition: readMechanicalProperties.H:123
Foam::FatalError
error FatalError
lambda
dimensionedScalar lambda("lambda", dimTime/sqr(dimLength), laminarTransport)
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam::dimMass
const dimensionSet dimMass(1, 0, 0, 0, 0, 0, 0)
Definition: dimensionSets.H:51
Foam::abort
errorManip< error > abort(error &err)
Definition: errorManip.H:144
FatalErrorInFunction
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:453
Foam::sqr
dimensionedSymmTensor sqr(const dimensionedVector &dv)
Definition: dimensionedSymmTensor.C:51
EType
word EType(EDict.get< word >("type"))
nuType
word nuType(nuDict.get< word >("type"))
Foam::dimVolume
const dimensionSet dimVolume(pow3(dimLength))
Definition: dimensionSets.H:60
EPtr
autoPtr< volScalarField > EPtr
Definition: readMechanicalProperties.H:73
nuIO
IOobject nuIO("nu", runTime.timeName(0), mesh, IOobject::NO_READ, IOobject::NO_WRITE)
Foam::dimless
const dimensionSet dimless
Dimensionless.
Definition: dimensionSets.C:189