diff --git a/applications/solvers/stressAnalysis/solidDisplacementFoam/readMechanicalProperties.H b/applications/solvers/stressAnalysis/solidDisplacementFoam/readMechanicalProperties.H index 9f256bd6891346da0be3844abc2882fb2079bb46..c8e3ccba5611cd6eced4965bad4ffaf3e79e8041 100644 --- a/applications/solvers/stressAnalysis/solidDisplacementFoam/readMechanicalProperties.H +++ b/applications/solvers/stressAnalysis/solidDisplacementFoam/readMechanicalProperties.H @@ -12,18 +12,80 @@ ) ); - dimensionedScalar rho(mechanicalProperties.lookup("rho")); - dimensionedScalar rhoE(mechanicalProperties.lookup("E")); - dimensionedScalar nu(mechanicalProperties.lookup("nu")); + const dictionary& rhoDict(mechanicalProperties.subDict("rho")); + word rhoType(rhoDict.lookup("rho")); + + volScalarField rho + ( + IOobject + ( + "rho", + runTime.timeName(), + mesh, + IOobject::READ_IF_PRESENT, + IOobject::NO_WRITE + ), + mesh, + dimensionedScalar("zero", dimMass/dimVolume, 0.0) + ); + + if (rhoType == "rhoInf") + { + rho = rhoDict.lookup("rhoInf"); + } + + volScalarField rhoE + ( + IOobject + ( + "E", + runTime.timeName(0), + mesh, + IOobject::READ_IF_PRESENT, + IOobject::NO_WRITE + ), + mesh, + dimensionedScalar("0", dimMass/dimLength/sqr(dimTime), 0.0) + ); + + const dictionary& EDict(mechanicalProperties.subDict("E")); + word EType(EDict.lookup("E")); + if (EType == "EInf") + { + rhoE = EDict.lookup("EInf"); + } + + + volScalarField nu + ( + IOobject + ( + "nu", + runTime.timeName(0), + mesh, + IOobject::READ_IF_PRESENT, + IOobject::NO_WRITE + ), + mesh, + dimensionedScalar("0", dimless, 0.0) + ); + + const dictionary& nuDict(mechanicalProperties.subDict("nu")); + word nuType(nuDict.lookup("nu")); + + if (nuType == "nuInf") + { + nu = nuDict.lookup("nuInf"); + } Info<< "Normalising E : E/rho\n" << endl; - dimensionedScalar E = rhoE/rho; + volScalarField E = rhoE/rho; Info<< "Calculating Lame's coefficients\n" << endl; - dimensionedScalar mu = E/(2.0*(1.0 + nu)); - dimensionedScalar lambda = nu*E/((1.0 + nu)*(1.0 - 2.0*nu)); - dimensionedScalar threeK = E/(1.0 - 2.0*nu); + volScalarField mu = E/(2.0*(1.0 + nu)); + volScalarField lambda = nu*E/((1.0 + nu)*(1.0 - 2.0*nu)); + volScalarField threeK = E/(1.0 - 2.0*nu); Switch planeStress(mechanicalProperties.lookup("planeStress")); @@ -38,7 +100,3 @@ { Info<< "Plane Strain\n" << endl; } - - Info<< "mu = " << mu.value() << " Pa/rho\n"; - Info<< "lambda = " << lambda.value() << " Pa/rho\n"; - Info<< "threeK = " << threeK.value() << " Pa/rho\n"; diff --git a/applications/solvers/stressAnalysis/solidDisplacementFoam/readThermalProperties.H b/applications/solvers/stressAnalysis/solidDisplacementFoam/readThermalProperties.H index 12e10a607b4dc4effa5e04a0f1b59697df48e7d7..4d7bb43fc95905006ce40a9f6350601784f6b7ef 100644 --- a/applications/solvers/stressAnalysis/solidDisplacementFoam/readThermalProperties.H +++ b/applications/solvers/stressAnalysis/solidDisplacementFoam/readThermalProperties.H @@ -1,46 +1,122 @@ - Info<< "Reading thermal properties\n" << endl; +Info<< "Reading thermal properties\n" << endl; - IOdictionary thermalProperties +IOdictionary thermalProperties +( + IOobject + ( + "thermalProperties", + runTime.constant(), + mesh, + IOobject::MUST_READ_IF_MODIFIED, + IOobject::NO_WRITE + ) +); + +Switch thermalStress(thermalProperties.lookup("thermalStress")); + +volScalarField threeKalpha +( + IOobject + ( + "threeKalpha", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh, + dimensionedScalar("0", dimensionSet(0, 2, -2 , -1, 0), 0.0) +); + + +volScalarField DT +( + IOobject + ( + "DT", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh, + dimensionedScalar("0", dimensionSet(0, 2, -1 , 0, 0), 0.0) +); + + +if (thermalStress) +{ + volScalarField C ( IOobject ( - "thermalProperties", - runTime.constant(), + "C", + runTime.timeName(0), mesh, - IOobject::MUST_READ_IF_MODIFIED, + IOobject::READ_IF_PRESENT, IOobject::NO_WRITE - ) + ), + mesh, + dimensionedScalar("0", dimensionSet(0, 2, -2 , -1, 0), 0.0) ); - Switch thermalStress(thermalProperties.lookup("thermalStress")); + const dictionary& CDict(thermalProperties.subDict("C")); + word CType(CDict.lookup("C")); + if (CType == "CInf") + { + C = CDict.lookup("CInf"); + } + - dimensionedScalar threeKalpha + volScalarField rhoK ( - "threeKalpha", - dimensionSet(0, 2, -2 , -1, 0), - 0 + IOobject + ( + "k", + runTime.timeName(0), + mesh, + IOobject::READ_IF_PRESENT, + IOobject::NO_WRITE + ), + mesh, + dimensionedScalar("0", dimensionSet(1, 1, -3 , -1, 0), 0.0) ); - dimensionedScalar DT + const dictionary& kDict(thermalProperties.subDict("k")); + word kType(kDict.lookup("k")); + if (kType == "kInf") + { + rhoK = kDict.lookup("kInf"); + } + + volScalarField alpha ( - "DT", - dimensionSet(0, 2, -1 , 0, 0), - 0 + IOobject + ( + "alpha", + runTime.timeName(0), + mesh, + IOobject::READ_IF_PRESENT, + IOobject::NO_WRITE + ), + mesh, + dimensionedScalar("0", dimensionSet(0, 0, 0 , -1, 0), 0.0) ); - if (thermalStress) + const dictionary& alphaDict(thermalProperties.subDict("alpha")); + word alphaType(alphaDict.lookup("alpha")); + + if (alphaType == "alphaInf") { - dimensionedScalar C(thermalProperties.lookup("C")); - dimensionedScalar rhoK(thermalProperties.lookup("k")); - dimensionedScalar alpha(thermalProperties.lookup("alpha")); + alpha = alphaDict.lookup("alphaInf"); + } - Info<< "Normalising k : k/rho\n" << endl; - dimensionedScalar k = rhoK/rho; + Info<< "Normalising k : k/rho\n" << endl; + volScalarField k = rhoK/rho; - Info<< "Calculating thermal coefficients\n" << endl; + Info<< "Calculating thermal coefficients\n" << endl; - threeKalpha = threeK*alpha; - DT.value() = (k/C).value(); + threeKalpha = threeK*alpha; + DT = k/C; - Info<< "threeKalpha = " << threeKalpha.value() << " Pa/rho\n"; - } +} diff --git a/applications/solvers/stressAnalysis/solidDisplacementFoam/tractionDisplacement/tractionDisplacementFvPatchVectorField.C b/applications/solvers/stressAnalysis/solidDisplacementFoam/tractionDisplacement/tractionDisplacementFvPatchVectorField.C index 85f3c67b38e49e6a702a61cee1f4ac1747dba722..b24239c0f8b212615f752f0220dacbe16ae97773 100644 --- a/applications/solvers/stressAnalysis/solidDisplacementFoam/tractionDisplacement/tractionDisplacementFvPatchVectorField.C +++ b/applications/solvers/stressAnalysis/solidDisplacementFoam/tractionDisplacement/tractionDisplacementFvPatchVectorField.C @@ -149,14 +149,20 @@ void tractionDisplacementFvPatchVectorField::updateCoeffs() const dictionary& thermalProperties = db().lookupObject<IOdictionary>("thermalProperties"); - dimensionedScalar rho(mechanicalProperties.lookup("rho")); - dimensionedScalar rhoE(mechanicalProperties.lookup("E")); - dimensionedScalar nu(mechanicalProperties.lookup("nu")); - dimensionedScalar E = rhoE/rho; - dimensionedScalar mu = E/(2.0*(1.0 + nu)); - dimensionedScalar lambda = nu*E/((1.0 + nu)*(1.0 - 2.0*nu)); - dimensionedScalar threeK = E/(1.0 - 2.0*nu); + const fvPatchField<scalar>& rho = + patch().lookupPatchField<volScalarField, scalar>("rho"); + + const fvPatchField<scalar>& rhoE = + patch().lookupPatchField<volScalarField, scalar>("E"); + + const fvPatchField<scalar>& nu = + patch().lookupPatchField<volScalarField, scalar>("nu"); + + scalarField E = rhoE/rho; + scalarField mu = E/(2.0*(1.0 + nu)); + scalarField lambda = nu*E/((1.0 + nu)*(1.0 - 2.0*nu)); + scalarField threeK = E/(1.0 - 2.0*nu); Switch planeStress(mechanicalProperties.lookup("planeStress")); @@ -166,7 +172,7 @@ void tractionDisplacementFvPatchVectorField::updateCoeffs() threeK = E/(1.0 - nu); } - scalar twoMuLambda = (2*mu + lambda).value(); + scalarField twoMuLambda = (2*mu + lambda); vectorField n(patch().nf()); @@ -175,7 +181,7 @@ void tractionDisplacementFvPatchVectorField::updateCoeffs() gradient() = ( - (traction_ + pressure_*n)/rho.value() + (traction_ + pressure_*n)/rho + twoMuLambda*fvPatchField<vector>::snGrad() - (n & sigmaD) )/twoMuLambda; @@ -183,13 +189,13 @@ void tractionDisplacementFvPatchVectorField::updateCoeffs() if (thermalStress) { - dimensionedScalar alpha(thermalProperties.lookup("alpha")); - dimensionedScalar threeKalpha = threeK*alpha; + const fvPatchField<scalar>& threeKalpha= + patch().lookupPatchField<volScalarField, scalar>("threeKalpha"); const fvPatchField<scalar>& T = patch().lookupPatchField<volScalarField, scalar>("T"); - gradient() += n*threeKalpha.value()*T/twoMuLambda; + gradient() += n*threeKalpha*T/twoMuLambda; } fixedGradientFvPatchVectorField::updateCoeffs(); diff --git a/applications/utilities/mesh/generation/extrude2DMesh/extrude2DMesh.C b/applications/utilities/mesh/generation/extrude2DMesh/extrude2DMesh.C index e56267b0b15c7dfddedb9b5ef8dbedae58528b00..69dc8d66ba4d22a2e9afad83cad279405b5602b7 100644 --- a/applications/utilities/mesh/generation/extrude2DMesh/extrude2DMesh.C +++ b/applications/utilities/mesh/generation/extrude2DMesh/extrude2DMesh.C @@ -89,7 +89,7 @@ void Foam::extrude2DMesh::setRefinement forAll(mesh_.points(), pointI) { point newPoint(mesh_.points()[pointI]); - newPoint[extrudeDir] = thickness; + newPoint[extrudeDir] += thickness; meshMod.addPoint ( diff --git a/tutorials/stressAnalysis/solidDisplacementFoam/plateHole/constant/mechanicalProperties b/tutorials/stressAnalysis/solidDisplacementFoam/plateHole/constant/mechanicalProperties index 9ae921391c681c7f0f0087232e9095ad295e62a6..c92d02a0f7d43d03d8a7a03776cb74b317baaa3a 100644 --- a/tutorials/stressAnalysis/solidDisplacementFoam/plateHole/constant/mechanicalProperties +++ b/tutorials/stressAnalysis/solidDisplacementFoam/plateHole/constant/mechanicalProperties @@ -15,11 +15,23 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -rho rho [ 1 -3 0 0 0 0 0 ] 7854; +rho +{ + rho rhoInf; + rhoInf rhoInf [ 1 -3 0 0 0 0 0 ] 7854; +} -nu nu [ 0 0 0 0 0 0 0 ] 0.3; +nu +{ + nu nuInf; + nuInf nuInf [ 0 0 0 0 0 0 0 ] 0.3; +} -E E [ 1 -1 -2 0 0 0 0 ] 2e+11; +E +{ + E EInf; + EInf EInf [ 1 -1 -2 0 0 0 0 ] 2e+11; +} planeStress yes; diff --git a/tutorials/stressAnalysis/solidDisplacementFoam/plateHole/constant/thermalProperties b/tutorials/stressAnalysis/solidDisplacementFoam/plateHole/constant/thermalProperties index 9d09fa79015d53d74ddd4f78ce3837f80eb55bc6..f68549dbba9a3c552ce22a71ee8fb3336c4fedbe 100644 --- a/tutorials/stressAnalysis/solidDisplacementFoam/plateHole/constant/thermalProperties +++ b/tutorials/stressAnalysis/solidDisplacementFoam/plateHole/constant/thermalProperties @@ -15,11 +15,23 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -C C [ 0 2 -2 -1 0 0 0 ] 434; +C +{ + C CInf; + CInf CInf [ 0 2 -2 -1 0 0 0 ] 434; +} -k k [ 1 1 -3 -1 0 0 0 ] 60.5; +k +{ + k kInf; + kInf kInf [ 1 1 -3 -1 0 0 0 ] 60.5; +} -alpha alpha [ 0 0 0 -1 0 0 0 ] 1.1e-05; +alpha +{ + alpha alphaInf; + alphaInf alphaInf [ 0 0 0 -1 0 0 0 ] 1.1e-05; +} thermalStress no; diff --git a/tutorials/stressAnalysis/solidDisplacementFoam/plateHole/system/fvSchemes b/tutorials/stressAnalysis/solidDisplacementFoam/plateHole/system/fvSchemes index 0f667a4132194c9ab934c08a69d6082be2d2832a..a7c9b4c8d280067e885263f954fb6f113acc9ea1 100644 --- a/tutorials/stressAnalysis/solidDisplacementFoam/plateHole/system/fvSchemes +++ b/tutorials/stressAnalysis/solidDisplacementFoam/plateHole/system/fvSchemes @@ -20,6 +20,11 @@ d2dt2Schemes default steadyState; } +ddtSchemes +{ + default Euler; +} + gradSchemes { default leastSquares;