mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-12-28 03:37:59 +00:00
Creation of OpenFOAM-dev repository 15/04/2008
This commit is contained in:
@ -0,0 +1,34 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: 1.4 |
|
||||
| \\ / A nd | Web: http://www.openfoam.org |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
|
||||
root "";
|
||||
case "";
|
||||
instance "";
|
||||
local "";
|
||||
|
||||
class dictionary;
|
||||
object mechanicalProperties;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
rho rho [1 -3 0 0 0 0 0] 7854;
|
||||
|
||||
nu nu [0 0 0 0 0 0 0] 0.3;
|
||||
|
||||
E E [1 -1 -2 0 0 0 0] 2e+11;
|
||||
|
||||
planeStress yes;
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,34 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: 1.4 |
|
||||
| \\ / A nd | Web: http://www.openfoam.org |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
|
||||
root "";
|
||||
case "";
|
||||
instance "";
|
||||
local "";
|
||||
|
||||
class dictionary;
|
||||
object thermalProperties;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
C C [0 2 -2 -1 0 0 0] 434;
|
||||
|
||||
k k [1 1 -3 -1 0 0 0] 60.5;
|
||||
|
||||
alpha alpha [0 0 0 -1 0 0 0] 1.1e-05;
|
||||
|
||||
thermalStress no;
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,68 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: 1.4 |
|
||||
| \\ / A nd | Web: http://www.openfoam.org |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
|
||||
root "";
|
||||
case "";
|
||||
instance "";
|
||||
local "";
|
||||
|
||||
class dictionary;
|
||||
object fvSchemes;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
d2dt2Schemes
|
||||
{
|
||||
default Euler;
|
||||
}
|
||||
|
||||
gradSchemes
|
||||
{
|
||||
default Gauss linear;
|
||||
grad(D) leastSquares;
|
||||
grad(T) leastSquares;
|
||||
}
|
||||
|
||||
divSchemes
|
||||
{
|
||||
default none;
|
||||
div(sigmaD) Gauss linear;
|
||||
}
|
||||
|
||||
laplacianSchemes
|
||||
{
|
||||
default none;
|
||||
laplacian(DD,D) Gauss linear corrected;
|
||||
laplacian(DT,T) Gauss linear corrected;
|
||||
}
|
||||
|
||||
interpolationSchemes
|
||||
{
|
||||
default linear;
|
||||
}
|
||||
|
||||
snGradSchemes
|
||||
{
|
||||
default corrected;
|
||||
}
|
||||
|
||||
fluxRequired
|
||||
{
|
||||
default no;
|
||||
D yes;
|
||||
T yes;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,39 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: 1.4 |
|
||||
| \\ / A nd | Web: http://www.openfoam.org |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
|
||||
root "";
|
||||
case "";
|
||||
instance "";
|
||||
local "";
|
||||
|
||||
class dictionary;
|
||||
object fvSolution;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
solvers
|
||||
{
|
||||
D ICCG 1e-06 0.01;
|
||||
T ICCG 1e-06 0.01;
|
||||
}
|
||||
|
||||
stressAnalysis
|
||||
{
|
||||
compactNormalStress yes;
|
||||
nCorrectors 1;
|
||||
U 1e-06;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,27 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: 1.4 |
|
||||
| \\ / A nd | Web: http://www.openfoam.org |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
include "$FOAMX_CONFIG/dictionaries/fvSchemes/fvSchemes.cfg";
|
||||
|
||||
entries
|
||||
{
|
||||
include "$FOAMX_CONFIG/dictionaries/fvSchemes/d2dt2/allSchemes.cfg";
|
||||
include "fvSchemes/gradSchemes.cfg";
|
||||
include "fvSchemes/divSchemes.cfg";
|
||||
include "fvSchemes/laplacianSchemes.cfg";
|
||||
include "$FOAMX_CONFIG/dictionaries/fvSchemes/interpolation/defaultOnly.cfg";
|
||||
include "$FOAMX_CONFIG/dictionaries/fvSchemes/snGrad/defaultOnly.cfg";
|
||||
include "$FOAMX_CONFIG/dictionaries/fvSchemes/flux/DT.cfg";
|
||||
}
|
||||
|
||||
default
|
||||
{
|
||||
include "defaults/system/fvSchemes";
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,19 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: 1.4 |
|
||||
| \\ / A nd | Web: http://www.openfoam.org |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
divSchemes
|
||||
{
|
||||
include "$FOAMX_CONFIG/dictionaries/fvSchemes/div/schemes.cfg";
|
||||
entries
|
||||
{
|
||||
include "$FOAMX_CONFIG/dictionaries/fvSchemes/div/default.cfg";
|
||||
include "$FOAMX_CONFIG/dictionaries/fvSchemes/div/sigmaD.cfg";
|
||||
}
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,21 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: 1.4 |
|
||||
| \\ / A nd | Web: http://www.openfoam.org |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
gradSchemes
|
||||
{
|
||||
include "$FOAMX_CONFIG/dictionaries/fvSchemes/grad/schemes.cfg";
|
||||
entries
|
||||
{
|
||||
include "$FOAMX_CONFIG/dictionaries/fvSchemes/grad/default.cfg";
|
||||
include "$FOAMX_CONFIG/dictionaries/fvSchemes/grad/D.cfg";
|
||||
include "$FOAMX_CONFIG/dictionaries/fvSchemes/grad/T.cfg";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,20 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: 1.4 |
|
||||
| \\ / A nd | Web: http://www.openfoam.org |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
laplacianSchemes
|
||||
{
|
||||
include "$FOAMX_CONFIG/dictionaries/fvSchemes/laplacian/schemes.cfg";
|
||||
entries
|
||||
{
|
||||
include "$FOAMX_CONFIG/dictionaries/fvSchemes/laplacian/default.cfg";
|
||||
include "$FOAMX_CONFIG/dictionaries/fvSchemes/laplacian/DDD.cfg";
|
||||
include "$FOAMX_CONFIG/dictionaries/fvSchemes/laplacian/DTT.cfg";
|
||||
}
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,36 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: 1.4 |
|
||||
| \\ / A nd | Web: http://www.openfoam.org |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
include "$FOAMX_CONFIG/dictionaries/fvSolution/fvSolution.cfg";
|
||||
|
||||
entries
|
||||
{
|
||||
solvers
|
||||
{
|
||||
type dictionary;
|
||||
entries
|
||||
{
|
||||
D
|
||||
{
|
||||
include "$FOAMX_CONFIG/dictionaries/fvSolution/solvers/symmetricSparse.cfg";
|
||||
description "Solver for the D equation";
|
||||
iconURL "/FoamX/icons/small/maths/D.gif";
|
||||
}
|
||||
|
||||
include "$FOAMX_CONFIG/dictionaries/fvSolution/solvers/T.cfg";
|
||||
}
|
||||
}
|
||||
include "$FOAMX_CONFIG/dictionaries/fvSolution/stressAnalysis.cfg";
|
||||
}
|
||||
|
||||
defaults
|
||||
{
|
||||
include "defaults/system/fvSolution";
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,26 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: 1.4 |
|
||||
| \\ / A nd | Web: http://www.openfoam.org |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
type dictionary;
|
||||
description "Dictionary of mechanical properties";
|
||||
dictionaryPath "constant";
|
||||
|
||||
entries
|
||||
{
|
||||
include "$FOAMX_CONFIG/entries/dimensionedScalar/rho.cfg";
|
||||
include "$FOAMX_CONFIG/entries/dimensionedScalar/stress/nu.cfg";
|
||||
include "$FOAMX_CONFIG/entries/dimensionedScalar/stress/E.cfg";
|
||||
include "$FOAMX_CONFIG/entries/Switch/planeStress.cfg";
|
||||
}
|
||||
|
||||
defaulst
|
||||
{
|
||||
include "defaults/constant/mechanicalProperties";
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,85 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: 1.4 |
|
||||
| \\ / A nd | Web: http://www.openfoam.org |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
tractionDisplacement
|
||||
{
|
||||
displayName "tractionDisplacement";
|
||||
description "Traction boundary condition";
|
||||
type patchField;
|
||||
options
|
||||
{
|
||||
type
|
||||
{
|
||||
default tractionDisplacement;
|
||||
}
|
||||
}
|
||||
|
||||
entries
|
||||
{
|
||||
traction
|
||||
{
|
||||
type vectorField;
|
||||
displayName "traction";
|
||||
description "Boundary traction";
|
||||
}
|
||||
|
||||
pressure
|
||||
{
|
||||
type scalarField;
|
||||
displayName "pressure";
|
||||
description "Boundary Pressure";
|
||||
}
|
||||
|
||||
value
|
||||
{
|
||||
type field;
|
||||
displayName "value";
|
||||
description "Field Value";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
traction
|
||||
{
|
||||
displayName "traction";
|
||||
description "Traction boundary condition";
|
||||
type patchField;
|
||||
options
|
||||
{
|
||||
type
|
||||
{
|
||||
default traction;
|
||||
}
|
||||
}
|
||||
|
||||
entries
|
||||
{
|
||||
traction
|
||||
{
|
||||
type vectorField;
|
||||
displayName "traction";
|
||||
description "Boundary traction";
|
||||
}
|
||||
|
||||
pressure
|
||||
{
|
||||
type scalarField;
|
||||
displayName "pressure";
|
||||
description "Boundary Pressure";
|
||||
}
|
||||
|
||||
value
|
||||
{
|
||||
type field;
|
||||
displayName "value";
|
||||
description "Field Value";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,81 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: 1.4 |
|
||||
| \\ / A nd | Web: http://www.openfoam.org |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
description "Basic linear elastic stress analysis code.";
|
||||
|
||||
dictionaries
|
||||
{
|
||||
include "$FOAMX_CONFIG/dictionaries/controlDict/controlDictSteady.cfg";
|
||||
fvSchemes;
|
||||
fvSolution;
|
||||
mechanicalProperties;
|
||||
thermalProperties;
|
||||
}
|
||||
|
||||
fields
|
||||
{
|
||||
include "$FOAMX_CONFIG/entries/geometricFields/displacement.cfg";
|
||||
include "$FOAMX_CONFIG/entries/geometricFields/T.cfg";
|
||||
}
|
||||
|
||||
patchPhysicalTypes
|
||||
{
|
||||
slip
|
||||
{
|
||||
description "Slip";
|
||||
}
|
||||
|
||||
tractionAdiabatic
|
||||
{
|
||||
description "Traction and adiabatic";
|
||||
}
|
||||
|
||||
tractionFixedTemp
|
||||
{
|
||||
description "Traction and fixed temperature";
|
||||
}
|
||||
|
||||
constrainedAdiabatic
|
||||
{
|
||||
description "Constrained displacement, adiabatic";
|
||||
}
|
||||
|
||||
constrainedFixedTemp
|
||||
{
|
||||
description "Constrained displacement, fixed temp";
|
||||
}
|
||||
}
|
||||
|
||||
patchFieldTypes
|
||||
{
|
||||
include "patchFieldTypes.cfg";
|
||||
}
|
||||
|
||||
patchFieldsPhysicalTypes
|
||||
{
|
||||
D
|
||||
{
|
||||
slip slip;
|
||||
tractionAdiabatic tractionDisplacement;
|
||||
tractionFixedTemp tractionDisplacement;
|
||||
constrainedAdiabatic fixedValue;
|
||||
constrainedFixedTemp fixedValue;
|
||||
}
|
||||
|
||||
T
|
||||
{
|
||||
slip slip;
|
||||
tractionAdiabatic zeroGradient;
|
||||
tractionFixedTemp fixedValue;
|
||||
constrainedAdiabatic zeroGradient;
|
||||
constrainedFixedTemp fixedValue;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,26 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: 1.4 |
|
||||
| \\ / A nd | Web: http://www.openfoam.org |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
type dictionary;
|
||||
description "Dictionary of thermal properties";
|
||||
dictionaryPath "constant";
|
||||
|
||||
entries
|
||||
{
|
||||
include "$FOAMX_CONFIG/entries/dimensionedScalar/stress/C.cfg";
|
||||
include "$FOAMX_CONFIG/entries/dimensionedScalar/stress/k.cfg";
|
||||
include "$FOAMX_CONFIG/entries/dimensionedScalar/stress/alpha.cfg";
|
||||
include "$FOAMX_CONFIG/entries/Switch/thermalStress.cfg";
|
||||
}
|
||||
|
||||
defaults
|
||||
{
|
||||
include "defaults/constant/thermalProperties";
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,4 @@
|
||||
tractionDisplacement/tractionDisplacementFvPatchVectorField.C
|
||||
solidDisplacementFoam.C
|
||||
|
||||
EXE = $(FOAM_APPBIN)/solidDisplacementFoam
|
||||
@ -0,0 +1,5 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-ItractionDisplacement/lnInclude
|
||||
|
||||
EXE_LIBS = -lfiniteVolume
|
||||
@ -0,0 +1,39 @@
|
||||
if (runTime.outputTime())
|
||||
{
|
||||
volSymmTensorField sigma
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"sigma",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
rho*sigmaD
|
||||
);
|
||||
|
||||
if (thermalStress)
|
||||
{
|
||||
const volScalarField& T = Tptr();
|
||||
sigma = sigma - I*(rho*threeKalpha*T);
|
||||
}
|
||||
|
||||
volScalarField sigmaEq
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"sigmaEq",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
sqrt((3.0/2.0)*magSqr(dev(sigma)))
|
||||
);
|
||||
|
||||
Info<< "Max sigmaEq = " << max(sigmaEq).value()
|
||||
<< endl;
|
||||
|
||||
runTime.write();
|
||||
}
|
||||
@ -0,0 +1,74 @@
|
||||
Info<< "Reading field D\n" << endl;
|
||||
volVectorField D
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"D",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh
|
||||
);
|
||||
|
||||
|
||||
autoPtr<volScalarField> Tptr(NULL);
|
||||
|
||||
if (thermalStress)
|
||||
{
|
||||
Info<< "Reading field T\n" << endl;
|
||||
Tptr.reset
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"T",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Info<< "Calculating stress field sigmaD\n" << endl;
|
||||
volSymmTensorField sigmaD
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"sigmaD",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mu*twoSymm(fvc::grad(D)) + lambda*(I*tr(fvc::grad(D)))
|
||||
);
|
||||
|
||||
Info<< "Calculating explicit part of div(sigma) divSigmaExp\n" << endl;
|
||||
volVectorField divSigmaExp
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"divSigmaExp",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
fvc::div(sigmaD)
|
||||
);
|
||||
|
||||
if (compactNormalStress)
|
||||
{
|
||||
divSigmaExp -= fvc::laplacian(2*mu + lambda, D, "laplacian(DD,D)");
|
||||
}
|
||||
else
|
||||
{
|
||||
divSigmaExp -= fvc::div((2*mu + lambda)*fvc::grad(D), "div(sigmaD)");
|
||||
}
|
||||
@ -0,0 +1,44 @@
|
||||
Info<< "Reading mechanical properties\n" << endl;
|
||||
|
||||
IOdictionary mechanicalProperties
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"mechanicalProperties",
|
||||
runTime.constant(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
);
|
||||
|
||||
dimensionedScalar rho(mechanicalProperties.lookup("rho"));
|
||||
dimensionedScalar rhoE(mechanicalProperties.lookup("E"));
|
||||
dimensionedScalar nu(mechanicalProperties.lookup("nu"));
|
||||
|
||||
Info<< "Normalising E : E/rho\n" << endl;
|
||||
dimensionedScalar 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);
|
||||
|
||||
Switch planeStress(mechanicalProperties.lookup("planeStress"));
|
||||
|
||||
if (planeStress)
|
||||
{
|
||||
Info<< "Plane Stress\n" << endl;
|
||||
|
||||
lambda = nu*E/((1.0 + nu)*(1.0 - nu));
|
||||
threeK = E/(1.0 - nu);
|
||||
}
|
||||
else
|
||||
{
|
||||
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";
|
||||
@ -0,0 +1,5 @@
|
||||
const dictionary& stressControl = mesh.solutionDict().subDict("stressAnalysis");
|
||||
|
||||
int nCorr(readInt(stressControl.lookup("nCorrectors")));
|
||||
scalar convergenceTolerance(readScalar(stressControl.lookup("D")));
|
||||
Switch compactNormalStress(stressControl.lookup("compactNormalStress"));
|
||||
@ -0,0 +1,46 @@
|
||||
Info<< "Reading thermal properties\n" << endl;
|
||||
|
||||
IOdictionary thermalProperties
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"thermalProperties",
|
||||
runTime.constant(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
);
|
||||
|
||||
Switch thermalStress(thermalProperties.lookup("thermalStress"));
|
||||
|
||||
dimensionedScalar threeKalpha
|
||||
(
|
||||
"threeKalpha",
|
||||
dimensionSet(0, 2, -2 , -1, 0),
|
||||
0
|
||||
);
|
||||
|
||||
dimensionedScalar DT
|
||||
(
|
||||
"DT",
|
||||
dimensionSet(0, 2, -1 , 0, 0),
|
||||
0
|
||||
);
|
||||
|
||||
if (thermalStress)
|
||||
{
|
||||
dimensionedScalar C(thermalProperties.lookup("C"));
|
||||
dimensionedScalar rhoK(thermalProperties.lookup("k"));
|
||||
dimensionedScalar alpha(thermalProperties.lookup("alpha"));
|
||||
|
||||
Info<< "Normalising k : k/rho\n" << endl;
|
||||
dimensionedScalar k = rhoK/rho;
|
||||
|
||||
Info<< "Calculating thermal coefficients\n" << endl;
|
||||
|
||||
threeKalpha = threeK*alpha;
|
||||
DT.value() = (k/C).value();
|
||||
|
||||
Info<< "threeKalpha = " << threeKalpha.value() << " Pa/rho\n";
|
||||
}
|
||||
@ -0,0 +1,139 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Application
|
||||
solidDisplacementFoam
|
||||
|
||||
Description
|
||||
Transient segregated finite-volume solver of linear-elastic,
|
||||
small-strain deformation of a solid body, with optional thermal
|
||||
diffusion and thermal stresses.
|
||||
|
||||
Simple linear elasticity structural analysis code.
|
||||
Solves for the displacement vector field D, also generating the
|
||||
stress tensor field sigma.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "fvCFD.H"
|
||||
#include "Switch.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
|
||||
# include "setRootCase.H"
|
||||
|
||||
# include "createTime.H"
|
||||
# include "createMesh.H"
|
||||
# include "readMechanicalProperties.H"
|
||||
# include "readThermalProperties.H"
|
||||
# include "readSolidDisplacementFoamControls.H"
|
||||
# include "createFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Info<< "\nCalculating displacement field\n" << endl;
|
||||
|
||||
for (runTime++; !runTime.end(); runTime++)
|
||||
{
|
||||
Info<< "Iteration: " << runTime.value() << nl << endl;
|
||||
|
||||
# include "readSolidDisplacementFoamControls.H"
|
||||
|
||||
int iCorr = 0;
|
||||
scalar initialResidual = 0;
|
||||
|
||||
do
|
||||
{
|
||||
if (thermalStress)
|
||||
{
|
||||
volScalarField& T = Tptr();
|
||||
solve
|
||||
(
|
||||
fvm::ddt(T) == fvm::laplacian(DT, T)
|
||||
);
|
||||
}
|
||||
|
||||
{
|
||||
fvVectorMatrix DEqn
|
||||
(
|
||||
fvm::d2dt2(D)
|
||||
==
|
||||
fvm::laplacian(2*mu + lambda, D, "laplacian(DD,D)")
|
||||
+ divSigmaExp
|
||||
);
|
||||
|
||||
if (thermalStress)
|
||||
{
|
||||
const volScalarField& T = Tptr();
|
||||
DEqn += fvc::grad(threeKalpha*T);
|
||||
}
|
||||
|
||||
//DEqn.setComponentReference(1, 0, vector::X, 0);
|
||||
//DEqn.setComponentReference(1, 0, vector::Z, 0);
|
||||
|
||||
initialResidual = DEqn.solve().initialResidual();
|
||||
|
||||
if (!compactNormalStress)
|
||||
{
|
||||
divSigmaExp = fvc::div(DEqn.flux());
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
volTensorField gradD = fvc::grad(D);
|
||||
sigmaD = mu*twoSymm(gradD) + (lambda*I)*tr(gradD);
|
||||
|
||||
if (compactNormalStress)
|
||||
{
|
||||
divSigmaExp = fvc::div
|
||||
(
|
||||
sigmaD - (2*mu + lambda)*gradD,
|
||||
"div(sigmaD)"
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
divSigmaExp += fvc::div(sigmaD);
|
||||
}
|
||||
}
|
||||
|
||||
} while (initialResidual > convergenceTolerance && ++iCorr < nCorr);
|
||||
|
||||
# include "calculateStress.H"
|
||||
|
||||
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
|
||||
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
|
||||
<< nl << endl;
|
||||
}
|
||||
|
||||
Info<< "End\n" << endl;
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,217 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "tractionDisplacementFvPatchVectorField.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "volFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
tractionDisplacementFvPatchVectorField::
|
||||
tractionDisplacementFvPatchVectorField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<vector, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedGradientFvPatchVectorField(p, iF),
|
||||
traction_(p.size(), vector::zero),
|
||||
pressure_(p.size(), 0.0)
|
||||
{
|
||||
fvPatchVectorField::operator=(patchInternalField());
|
||||
gradient() = vector::zero;
|
||||
}
|
||||
|
||||
|
||||
tractionDisplacementFvPatchVectorField::
|
||||
tractionDisplacementFvPatchVectorField
|
||||
(
|
||||
const tractionDisplacementFvPatchVectorField& tdpvf,
|
||||
const fvPatch& p,
|
||||
const DimensionedField<vector, volMesh>& iF,
|
||||
const fvPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
fixedGradientFvPatchVectorField(tdpvf, p, iF, mapper),
|
||||
traction_(tdpvf.traction_, mapper),
|
||||
pressure_(tdpvf.pressure_, mapper)
|
||||
{}
|
||||
|
||||
|
||||
tractionDisplacementFvPatchVectorField::
|
||||
tractionDisplacementFvPatchVectorField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<vector, volMesh>& iF,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
fixedGradientFvPatchVectorField(p, iF),
|
||||
traction_("traction", dict, p.size()),
|
||||
pressure_("pressure", dict, p.size())
|
||||
{
|
||||
fvPatchVectorField::operator=(patchInternalField());
|
||||
gradient() = vector::zero;
|
||||
}
|
||||
|
||||
|
||||
tractionDisplacementFvPatchVectorField::
|
||||
tractionDisplacementFvPatchVectorField
|
||||
(
|
||||
const tractionDisplacementFvPatchVectorField& tdpvf
|
||||
)
|
||||
:
|
||||
fixedGradientFvPatchVectorField(tdpvf),
|
||||
traction_(tdpvf.traction_),
|
||||
pressure_(tdpvf.pressure_)
|
||||
{}
|
||||
|
||||
|
||||
tractionDisplacementFvPatchVectorField::
|
||||
tractionDisplacementFvPatchVectorField
|
||||
(
|
||||
const tractionDisplacementFvPatchVectorField& tdpvf,
|
||||
const DimensionedField<vector, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedGradientFvPatchVectorField(tdpvf, iF),
|
||||
traction_(tdpvf.traction_),
|
||||
pressure_(tdpvf.pressure_)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void tractionDisplacementFvPatchVectorField::autoMap
|
||||
(
|
||||
const fvPatchFieldMapper& m
|
||||
)
|
||||
{
|
||||
fixedGradientFvPatchVectorField::autoMap(m);
|
||||
traction_.autoMap(m);
|
||||
pressure_.autoMap(m);
|
||||
}
|
||||
|
||||
|
||||
void tractionDisplacementFvPatchVectorField::rmap
|
||||
(
|
||||
const fvPatchVectorField& ptf,
|
||||
const labelList& addr
|
||||
)
|
||||
{
|
||||
fixedGradientFvPatchVectorField::rmap(ptf, addr);
|
||||
|
||||
const tractionDisplacementFvPatchVectorField& dmptf =
|
||||
refCast<const tractionDisplacementFvPatchVectorField>(ptf);
|
||||
|
||||
traction_.rmap(dmptf.traction_, addr);
|
||||
pressure_.rmap(dmptf.pressure_, addr);
|
||||
}
|
||||
|
||||
|
||||
void tractionDisplacementFvPatchVectorField::updateCoeffs()
|
||||
{
|
||||
if (updated())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const dictionary& mechanicalProperties =
|
||||
db().lookupObject<IOdictionary>("mechanicalProperties");
|
||||
|
||||
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);
|
||||
|
||||
Switch planeStress(mechanicalProperties.lookup("planeStress"));
|
||||
|
||||
if (planeStress)
|
||||
{
|
||||
lambda = nu*E/((1.0 + nu)*(1.0 - nu));
|
||||
threeK = E/(1.0 - nu);
|
||||
}
|
||||
|
||||
scalar twoMuLambda = (2*mu + lambda).value();
|
||||
|
||||
vectorField n = patch().nf();
|
||||
|
||||
const fvPatchField<symmTensor>& sigmaD =
|
||||
patch().lookupPatchField<volSymmTensorField, symmTensor>("sigmaD");
|
||||
|
||||
gradient() =
|
||||
(
|
||||
(traction_ + pressure_*n)/rho.value()
|
||||
+ twoMuLambda*fvPatchField<vector>::snGrad() - (n & sigmaD)
|
||||
)/twoMuLambda;
|
||||
|
||||
Switch thermalStress(thermalProperties.lookup("thermalStress"));
|
||||
|
||||
if (thermalStress)
|
||||
{
|
||||
dimensionedScalar alpha(thermalProperties.lookup("alpha"));
|
||||
dimensionedScalar threeKalpha = threeK*alpha;
|
||||
|
||||
const fvPatchField<scalar>& T =
|
||||
patch().lookupPatchField<volScalarField, scalar>("T");
|
||||
|
||||
gradient() += n*threeKalpha.value()*T/twoMuLambda;
|
||||
}
|
||||
|
||||
fixedGradientFvPatchVectorField::updateCoeffs();
|
||||
}
|
||||
|
||||
|
||||
void tractionDisplacementFvPatchVectorField::write(Ostream& os) const
|
||||
{
|
||||
fvPatchVectorField::write(os);
|
||||
traction_.writeEntry("traction", os);
|
||||
pressure_.writeEntry("pressure", os);
|
||||
writeEntry("value", os);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
makePatchTypeField(fvPatchVectorField, tractionDisplacementFvPatchVectorField);
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,188 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
Foam::tractionDisplacementFvPatchVectorField
|
||||
|
||||
Description
|
||||
Fixed traction boundary condition for the standard linear elastic, fixed
|
||||
coefficient displacement equation.
|
||||
|
||||
SourceFiles
|
||||
tractionDisplacementFvPatchVectorField.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef tractionDisplacementFvPatchVectorField_H
|
||||
#define tractionDisplacementFvPatchVectorField_H
|
||||
|
||||
#include "fvPatchFields.H"
|
||||
#include "fixedGradientFvPatchFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class tractionDisplacementFvPatch Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class tractionDisplacementFvPatchVectorField
|
||||
:
|
||||
public fixedGradientFvPatchVectorField
|
||||
{
|
||||
|
||||
// Private Data
|
||||
|
||||
vectorField traction_;
|
||||
scalarField pressure_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("tractionDisplacement");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from patch and internal field
|
||||
tractionDisplacementFvPatchVectorField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<vector, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct from patch, internal field and dictionary
|
||||
tractionDisplacementFvPatchVectorField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<vector, volMesh>&,
|
||||
const dictionary&
|
||||
);
|
||||
|
||||
//- Construct by mapping given
|
||||
// tractionDisplacementFvPatchVectorField onto a new patch
|
||||
tractionDisplacementFvPatchVectorField
|
||||
(
|
||||
const tractionDisplacementFvPatchVectorField&,
|
||||
const fvPatch&,
|
||||
const DimensionedField<vector, volMesh>&,
|
||||
const fvPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Construct as copy
|
||||
tractionDisplacementFvPatchVectorField
|
||||
(
|
||||
const tractionDisplacementFvPatchVectorField&
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual tmp<fvPatchVectorField> clone() const
|
||||
{
|
||||
return tmp<fvPatchVectorField>
|
||||
(
|
||||
new tractionDisplacementFvPatchVectorField(*this)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
tractionDisplacementFvPatchVectorField
|
||||
(
|
||||
const tractionDisplacementFvPatchVectorField&,
|
||||
const DimensionedField<vector, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct and return a clone setting internal field reference
|
||||
virtual tmp<fvPatchVectorField> clone
|
||||
(
|
||||
const DimensionedField<vector, volMesh>& iF
|
||||
) const
|
||||
{
|
||||
return tmp<fvPatchVectorField>
|
||||
(
|
||||
new tractionDisplacementFvPatchVectorField(*this, iF)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
// Access
|
||||
|
||||
virtual const vectorField& traction() const
|
||||
{
|
||||
return traction_;
|
||||
}
|
||||
|
||||
virtual vectorField& traction()
|
||||
{
|
||||
return traction_;
|
||||
}
|
||||
|
||||
virtual const scalarField& pressure() const
|
||||
{
|
||||
return pressure_;
|
||||
}
|
||||
|
||||
virtual scalarField& pressure()
|
||||
{
|
||||
return pressure_;
|
||||
}
|
||||
|
||||
|
||||
// Mapping functions
|
||||
|
||||
//- Map (and resize as needed) from self given a mapping object
|
||||
virtual void autoMap
|
||||
(
|
||||
const fvPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Reverse map the given fvPatchField onto this fvPatchField
|
||||
virtual void rmap
|
||||
(
|
||||
const fvPatchVectorField&,
|
||||
const labelList&
|
||||
);
|
||||
|
||||
|
||||
//- Update the coefficients associated with the patch field
|
||||
virtual void updateCoeffs();
|
||||
|
||||
//- Write
|
||||
virtual void write(Ostream&) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
Reference in New Issue
Block a user