Tutorial fix elasticThermalSolidFoam

This commit is contained in:
Hrvoje Jasak 2014-04-10 20:54:24 +01:00
parent 45576c2dea
commit e732980a53
8 changed files with 181 additions and 190 deletions

View file

@ -12,7 +12,6 @@
mesh mesh
); );
// volTensorField gradU = fvc::grad(U);
volTensorField gradU volTensorField gradU
( (
IOobject IOobject
@ -26,7 +25,7 @@
mesh, mesh,
dimensionedTensor("zero", dimless, tensor::zero) dimensionedTensor("zero", dimless, tensor::zero)
); );
//surfaceVectorField snGradU = fvc::snGrad(U);
surfaceVectorField snGradU surfaceVectorField snGradU
( (
IOobject IOobject
@ -115,15 +114,20 @@
thermalModel thermal(T); thermalModel thermal(T);
volScalarField C = thermal.C(); volScalarField C = thermal.C();
volScalarField k = thermal.k(); volScalarField k
(
"DT",
thermal.k()
);
volScalarField threeKalpha = rheology.threeK()*rho*thermal.alpha(); volScalarField threeKalpha = rheology.threeK()*rho*thermal.alpha();
surfaceScalarField threeKalphaf = fvc::interpolate(threeKalpha, "threeKalpha"); surfaceScalarField threeKalphaf =
fvc::interpolate(threeKalpha, "threeKalpha");
volScalarField T0 = thermal.T0(); volScalarField T0 = thermal.T0();
volScalarField rhoC = rho*C; volScalarField rhoC = rho*C;
// for aitken relaxation // for aitken relaxation
volVectorField aitkenDelta volVectorField aitkenDelta
( (
IOobject IOobject
( (
@ -136,10 +140,7 @@ volVectorField aitkenDelta
mesh, mesh,
dimensionedVector("zero", dimLength, vector::zero) dimensionedVector("zero", dimLength, vector::zero)
); );
// aitken relaxation factor
scalar aitkenInitialRes = 1.0; // aitken relaxation factor
scalar aitkenTheta = 0.01; scalar aitkenInitialRes = 1.0;
// if(mesh.relax(U.name())) scalar aitkenTheta = 0.01;
// {
// aitkenTheta = mesh.relaxationFactor(U.name());
// }

View file

@ -99,8 +99,7 @@ int main(int argc, char *argv[])
while while
( (
relResT > convergenceToleranceT relResT > convergenceToleranceT
&& && ++iCorr < nCorr
++iCorr < nCorr
); );
Info<< "Solved for " << T.name() Info<< "Solved for " << T.name()
@ -112,7 +111,7 @@ int main(int argc, char *argv[])
<< ", ClockTime = " << runTime.elapsedClockTime() << " s" << ", ClockTime = " << runTime.elapsedClockTime() << " s"
<< endl; << endl;
// solve momentum equation for displacement // Solve momentum equation for displacement
iCorr = 0; iCorr = 0;
volVectorField gradThreeKalphaDeltaT = volVectorField gradThreeKalphaDeltaT =
fvc::grad(threeKalpha*(T-T0), "grad(threeKalphaDeltaT)"); fvc::grad(threeKalpha*(T-T0), "grad(threeKalphaDeltaT)");
@ -160,6 +159,7 @@ int main(int argc, char *argv[])
Info<< "\tCorrector " << iCorr Info<< "\tCorrector " << iCorr
<< ", residual = " << solverPerfU.initialResidual() << ", residual = " << solverPerfU.initialResidual()
<< ", relative res = " << relResU; << ", relative res = " << relResU;
if (aitkenRelax) if (aitkenRelax)
{ {
Info << ", aitken = " << aitkenTheta; Info << ", aitken = " << aitkenTheta;
@ -170,11 +170,10 @@ int main(int argc, char *argv[])
while while
( (
iCorr++ == 0 iCorr++ == 0
|| || (
(//solverPerfU.initialResidual() > convergenceTolerance
relResU > convergenceToleranceU relResU > convergenceToleranceU
&& && iCorr < nCorr
iCorr < nCorr) )
); );
Info<< "Solved for " << U.name() Info<< "Solved for " << U.name()

View file

@ -35,24 +35,20 @@ boundaryField
type fixedValue; type fixedValue;
value uniform 100; value uniform 100;
} }
outside outside
{ {
type fixedValue; type fixedValue;
value uniform 100; value uniform 100;
} }
front front
{ {
type empty; type empty;
//type symmetryPlane;
} }
back back
{ {
type empty; type empty;
//type symmetryPlane;
} }
} }
// ************************************************************************* // // ************************************************************************* //

View file

@ -29,32 +29,31 @@ boundaryField
{ {
type symmetryPlane; type symmetryPlane;
} }
inside inside
{ {
type solidTraction; type solidTraction;
traction uniform ( 0 0 0 ); traction uniform ( 0 0 0 );
pressure uniform 50e6; pressure uniform 50e6;
DT k;
value uniform (0 0 0); value uniform (0 0 0);
} }
outside outside
{ {
type solidTraction; type solidTraction;
traction uniform ( 0 0 0 ); traction uniform ( 0 0 0 );
pressure uniform 0.1e6; pressure uniform 0.1e6;
DT k;
value uniform (0 0 0); value uniform (0 0 0);
} }
front front
{ {
type empty; type empty;
} }
back back
{ {
type empty; type empty;
} }
} }
// ************************************************************************* // // ************************************************************************* //

View file

@ -27,7 +27,6 @@ vertices
(0.5 0 0.1) (0.5 0 0.1)
(0.7 0 0.1) (0.7 0 0.1)
(0 0.7 0.1) (0 0.7 0.1)
); );
blocks blocks
@ -45,26 +44,14 @@ edges
patches patches
( (
empty back
(
(3 2 1 0)
)
empty front
(
(4 5 6 7)
)
symmetryPlane left symmetryPlane left
( (
(4 7 3 0) (4 7 3 0)
) )
symmetryPlane bottom symmetryPlane bottom
( (
(1 2 6 5) (1 2 6 5)
) )
patch inside patch inside
( (
(0 1 5 4) (0 1 5 4)
@ -73,6 +60,14 @@ patches
( (
(7 6 2 3) (7 6 2 3)
) )
empty back
(
(3 2 1 0)
)
empty front
(
(4 5 6 7)
)
); );
mergePatchPairs mergePatchPairs

View file

@ -17,41 +17,41 @@ FoamFile
6 6
( (
back
{
type empty;
nFaces 600;
startFace 1130;
}
front
{
type empty;
nFaces 600;
startFace 1730;
}
left left
{ {
type symmetryPlane; type symmetryPlane;
nFaces 10; nFaces 10;
startFace 2330; startFace 1130;
} }
bottom bottom
{ {
type symmetryPlane; type symmetryPlane;
nFaces 10; nFaces 10;
startFace 2340; startFace 1140;
} }
inside inside
{ {
type patch; type patch;
nFaces 60; nFaces 60;
startFace 2350; startFace 1150;
} }
outside outside
{ {
type patch; type patch;
nFaces 60; nFaces 60;
startFace 2410; startFace 1210;
}
back
{
type empty;
nFaces 600;
startFace 1270;
}
front
{
type empty;
nFaces 600;
startFace 1870;
} }
) )

View file

@ -23,4 +23,5 @@ thermal
T0 T0 [0 0 0 1 0 0 0] 0; T0 T0 [0 0 0 1 0 0 0] 0;
} }
// ************************************************************************* // // ************************************************************************* //