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.lookup("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(readScalar(rhoDict.lookup("value")));
32 
33  rhoPtr.reset
34  (
35  new volScalarField
36  (
37  rhoIO,
38  mesh,
40  (
41  "rho",
43  rhoValue
44  ),
45  zeroGradientFvPatchField<scalar>::typeName
46  )
47  );
48  }
49  else if (rhoType == "field")
50  {
51  rhoIO.readOpt() = IOobject::MUST_READ;
52 
53  rhoPtr.reset
54  (
55  new volScalarField
56  (
57  rhoIO,
58  mesh
59  )
60  );
61  }
62  else
63  {
65  (
66  "readMechanicalProperties.H"
67  ) << "Valid type entries are uniform or field for rho"
68  << abort(FatalError);
69  }
70 
72 
73  const dictionary& EDict(mechanicalProperties.subDict("E"));
74  word EType(EDict.lookup("type"));
75 
76  autoPtr<volScalarField> EPtr;
77 
78  IOobject EHeader
79  (
80  "E",
81  runTime.timeName(0),
82  mesh,
83  IOobject::NO_READ,
84  IOobject::NO_WRITE
85  );
86 
87  if (EType == "uniform")
88  {
89  scalar rhoEValue(readScalar(EDict.lookup("value")));
90 
91  EPtr.reset
92  (
93  new volScalarField
94  (
95  EHeader,
96  mesh,
98  (
99  "Erho",
101  rhoEValue
102  ),
103  zeroGradientFvPatchField<scalar>::typeName
104  )
105  );
106  }
107  else if (EType == "field")
108  {
109  EHeader.readOpt() = IOobject::MUST_READ;
110 
111  EPtr.reset
112  (
113  new volScalarField
114  (
115  EHeader,
116  mesh
117  )
118  );
119  }
120  else
121  {
123  (
124  "readMechanicalProperties.H"
125  ) << "Valid type entries are uniform or field for E"
126  << abort(FatalError);
127  }
128 
129  volScalarField& rhoE = EPtr();
130 
131  autoPtr<volScalarField> nuPtr;
132 
133  IOobject nuIO
134  (
135  "nu",
136  runTime.timeName(0),
137  mesh,
138  IOobject::NO_READ,
139  IOobject::NO_WRITE
140  );
141 
142  const dictionary& nuDict(mechanicalProperties.subDict("nu"));
143  word nuType(nuDict.lookup("type"));
144 
145  if (nuType == "uniform")
146  {
147  scalar nuValue(readScalar(nuDict.lookup("value")));
148  nuPtr.reset
149  (
150  new volScalarField
151  (
152  nuIO,
153  mesh,
155  (
156  "nu",
157  dimless,
158  nuValue
159  ),
160  zeroGradientFvPatchField<scalar>::typeName
161  )
162  );
163  }
164  else if (nuType == "field")
165  {
166  nuIO.readOpt() = IOobject::MUST_READ;
167  nuPtr.reset
168  (
169  new volScalarField
170  (
171  nuIO,
172  mesh
173  )
174  );
175  }
176  else
177  {
179  (
180  "readMechanicalProperties.H"
181  ) << "Valid type entries are uniform or field for nu"
182  << abort(FatalError);
183  }
184 
186 
187  Info<< "Normalising E : E/rho\n" << endl;
188  volScalarField E(rhoE/rho);
189 
190  Info<< "Calculating Lame's coefficients\n" << endl;
191 
192  volScalarField mu(E/(2.0*(1.0 + nu)));
193  volScalarField lambda(nu*E/((1.0 + nu)*(1.0 - 2.0*nu)));
194  volScalarField threeK(E/(1.0 - 2.0*nu));
195 
196  Switch planeStress(mechanicalProperties.lookup("planeStress"));
197 
198  if (planeStress)
199  {
200  Info<< "Plane Stress\n" << endl;
201 
202  lambda = nu*E/((1.0 + nu)*(1.0 - nu));
203  threeK = E/(1.0 - nu);
204  }
205  else
206  {
207  Info<< "Plane Strain\n" << endl;
208  }
const dimensionedScalar mu
Atomic mass unit.
Definition: createFields.H:13
#define readScalar
Definition: doubleScalar.C:38
IOobject EHeader("E", runTime.timeName(0), mesh, IOobject::NO_READ, IOobject::NO_WRITE)
word nuType(nuDict.lookup("type"))
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
Definition: dimensionSets.H:51
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.lookup("type"));autoPtr< volScalarField > rhoPtr
messageStream Info
dynamicFvMesh & mesh
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
Definition: dimensionSets.H:50
autoPtr< volScalarField > nuPtr
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
autoPtr< volScalarField > EPtr
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:52
dimensionedScalar lambda(laminarTransport.lookup("lambda"))
const dimensionSet dimMass(1, 0, 0, 0, 0, 0, 0)
Definition: dimensionSets.H:49
IOobject rhoIO("rho", runTime.timeName(0), mesh, IOobject::NO_READ, IOobject::NO_WRITE)
errorManip< error > abort(error &err)
Definition: errorManip.H:131
#define FatalErrorIn(functionName)
Report an error message using Foam::FatalError.
Definition: error.H:314
word EType(EDict.lookup("type"))
const dictionary & nuDict(mechanicalProperties.subDict("nu"))
error FatalError
const dimensionSet dimVolume(pow3(dimLength))
Definition: dimensionSets.H:58
volScalarField & nu
const dimensionSet dimless(0, 0, 0, 0, 0, 0, 0)
Definition: dimensionSets.H:47
const dictionary & EDict(mechanicalProperties.subDict("E"))
dimensionedSymmTensor sqr(const dimensionedVector &dv)
IOobject nuIO("nu", runTime.timeName(0), mesh, IOobject::NO_READ, IOobject::NO_WRITE)
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.