00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #include "tractionDisplacementFvPatchVectorField.H"
00028 #include "addToRunTimeSelectionTable.H"
00029 #include "volFields.H"
00030
00031
00032
00033 namespace Foam
00034 {
00035
00036
00037
00038 tractionDisplacementFvPatchVectorField::
00039 tractionDisplacementFvPatchVectorField
00040 (
00041 const fvPatch& p,
00042 const DimensionedField<vector, volMesh>& iF
00043 )
00044 :
00045 fixedGradientFvPatchVectorField(p, iF),
00046 traction_(p.size(), vector::zero),
00047 pressure_(p.size(), 0.0)
00048 {
00049 fvPatchVectorField::operator=(patchInternalField());
00050 gradient() = vector::zero;
00051 }
00052
00053
00054 tractionDisplacementFvPatchVectorField::
00055 tractionDisplacementFvPatchVectorField
00056 (
00057 const tractionDisplacementFvPatchVectorField& tdpvf,
00058 const fvPatch& p,
00059 const DimensionedField<vector, volMesh>& iF,
00060 const fvPatchFieldMapper& mapper
00061 )
00062 :
00063 fixedGradientFvPatchVectorField(tdpvf, p, iF, mapper),
00064 traction_(tdpvf.traction_, mapper),
00065 pressure_(tdpvf.pressure_, mapper)
00066 {}
00067
00068
00069 tractionDisplacementFvPatchVectorField::
00070 tractionDisplacementFvPatchVectorField
00071 (
00072 const fvPatch& p,
00073 const DimensionedField<vector, volMesh>& iF,
00074 const dictionary& dict
00075 )
00076 :
00077 fixedGradientFvPatchVectorField(p, iF),
00078 traction_("traction", dict, p.size()),
00079 pressure_("pressure", dict, p.size())
00080 {
00081 fvPatchVectorField::operator=(patchInternalField());
00082 gradient() = vector::zero;
00083 }
00084
00085
00086 tractionDisplacementFvPatchVectorField::
00087 tractionDisplacementFvPatchVectorField
00088 (
00089 const tractionDisplacementFvPatchVectorField& tdpvf
00090 )
00091 :
00092 fixedGradientFvPatchVectorField(tdpvf),
00093 traction_(tdpvf.traction_),
00094 pressure_(tdpvf.pressure_)
00095 {}
00096
00097
00098 tractionDisplacementFvPatchVectorField::
00099 tractionDisplacementFvPatchVectorField
00100 (
00101 const tractionDisplacementFvPatchVectorField& tdpvf,
00102 const DimensionedField<vector, volMesh>& iF
00103 )
00104 :
00105 fixedGradientFvPatchVectorField(tdpvf, iF),
00106 traction_(tdpvf.traction_),
00107 pressure_(tdpvf.pressure_)
00108 {}
00109
00110
00111
00112
00113 void tractionDisplacementFvPatchVectorField::autoMap
00114 (
00115 const fvPatchFieldMapper& m
00116 )
00117 {
00118 fixedGradientFvPatchVectorField::autoMap(m);
00119 traction_.autoMap(m);
00120 pressure_.autoMap(m);
00121 }
00122
00123
00124 void tractionDisplacementFvPatchVectorField::rmap
00125 (
00126 const fvPatchVectorField& ptf,
00127 const labelList& addr
00128 )
00129 {
00130 fixedGradientFvPatchVectorField::rmap(ptf, addr);
00131
00132 const tractionDisplacementFvPatchVectorField& dmptf =
00133 refCast<const tractionDisplacementFvPatchVectorField>(ptf);
00134
00135 traction_.rmap(dmptf.traction_, addr);
00136 pressure_.rmap(dmptf.pressure_, addr);
00137 }
00138
00139
00140 void tractionDisplacementFvPatchVectorField::updateCoeffs()
00141 {
00142 if (updated())
00143 {
00144 return;
00145 }
00146
00147 const dictionary& mechanicalProperties =
00148 db().lookupObject<IOdictionary>("mechanicalProperties");
00149
00150 const dictionary& thermalProperties =
00151 db().lookupObject<IOdictionary>("thermalProperties");
00152
00153 dimensionedScalar rho(mechanicalProperties.lookup("rho"));
00154 dimensionedScalar rhoE(mechanicalProperties.lookup("E"));
00155 dimensionedScalar nu(mechanicalProperties.lookup("nu"));
00156
00157 dimensionedScalar E = rhoE/rho;
00158 dimensionedScalar mu = E/(2.0*(1.0 + nu));
00159 dimensionedScalar lambda = nu*E/((1.0 + nu)*(1.0 - 2.0*nu));
00160 dimensionedScalar threeK = E/(1.0 - 2.0*nu);
00161
00162 Switch planeStress(mechanicalProperties.lookup("planeStress"));
00163
00164 if (planeStress)
00165 {
00166 lambda = nu*E/((1.0 + nu)*(1.0 - nu));
00167 threeK = E/(1.0 - nu);
00168 }
00169
00170 scalar twoMuLambda = (2*mu + lambda).value();
00171
00172 vectorField n = patch().nf();
00173
00174 const fvPatchField<symmTensor>& sigmaD =
00175 patch().lookupPatchField<volSymmTensorField, symmTensor>("sigmaD");
00176
00177 gradient() =
00178 (
00179 (traction_ + pressure_*n)/rho.value()
00180 + twoMuLambda*fvPatchField<vector>::snGrad() - (n & sigmaD)
00181 )/twoMuLambda;
00182
00183 Switch thermalStress(thermalProperties.lookup("thermalStress"));
00184
00185 if (thermalStress)
00186 {
00187 dimensionedScalar alpha(thermalProperties.lookup("alpha"));
00188 dimensionedScalar threeKalpha = threeK*alpha;
00189
00190 const fvPatchField<scalar>& T =
00191 patch().lookupPatchField<volScalarField, scalar>("T");
00192
00193 gradient() += n*threeKalpha.value()*T/twoMuLambda;
00194 }
00195
00196 fixedGradientFvPatchVectorField::updateCoeffs();
00197 }
00198
00199
00200 void tractionDisplacementFvPatchVectorField::write(Ostream& os) const
00201 {
00202 fvPatchVectorField::write(os);
00203 traction_.writeEntry("traction", os);
00204 pressure_.writeEntry("pressure", os);
00205 writeEntry("value", os);
00206 }
00207
00208
00209
00210
00211 makePatchTypeField(fvPatchVectorField, tractionDisplacementFvPatchVectorField);
00212
00213
00214
00215 }
00216
00217