Solid models update: clean-up

This commit is contained in:
Hrvoje Jasak 2014-02-23 10:54:20 +00:00
parent 3810b29f37
commit bb03a935fa
11 changed files with 224 additions and 211 deletions

View file

@ -16,7 +16,6 @@
(
DU.internalField()
- DU.prevIter().internalField()
)
/magDU
)/magDU
);
}

View file

@ -79,7 +79,7 @@ int main(int argc, char *argv[])
# include "calculateDivDSigmaExp.H"
//- linear momentum equation
// Linear momentum equation
fvVectorMatrix DUEqn
(
fvm::d2dt2(rho, DU)
@ -127,7 +127,8 @@ int main(int argc, char *argv[])
&& ++iCorr < nCorr
);
Info<< nl << "Time " << runTime.value() << ", Solving for " << DU.name()
Info<< nl << "Time " << runTime.value()
<< ", Solving for " << DU.name()
<< ", Initial residual = " << initialResidual
<< ", Final residual = " << solverPerf.initialResidual()
<< ", Relative residual = " << relativeResidual

View file

@ -1,9 +1,22 @@
//- how explicit component of sigma is to be calculated
word divDSigmaExpMethod(mesh.solutionDict().subDict("solidMechanics").lookup("divSigmaExp"));
Info << "Selecting divSigmaExp calculation method " << divDSigmaExpMethod << endl;
if(divDSigmaExpMethod != "standard" && divDSigmaExpMethod != "surface" && divDSigmaExpMethod != "decompose" && divDSigmaExpMethod != "laplacian")
const dictionary& stressControl =
mesh.solutionDict().subDict("solidMechanics");
// Read how explicit component of sigma is to be calculated
word divDSigmaExpMethod(stressControl.lookup("divSigmaExp"));
Info<< "Selecting divSigmaExp calculation method: "
<< divDSigmaExpMethod << endl;
if
(
divDSigmaExpMethod != "standard"
&& divDSigmaExpMethod != "surface"
&& divDSigmaExpMethod != "decompose"
&& divDSigmaExpMethod != "laplacian"
)
{
FatalError << "divSigmaExp method " << divDSigmaExpMethod << " not found!" << nl
FatalErrorIn(args.executable())
<< "divSigmaExp method " << divDSigmaExpMethod << " not found! "
<< "valid methods are:\nstandard\nsurface\ndecompose\nlaplacian"
<< exit(FatalError);
}

View file

@ -1,5 +1,5 @@
if (runTime.outputTime())
{
{
volScalarField epsilonEq
(
IOobject
@ -13,8 +13,7 @@ if (runTime.outputTime())
sqrt((2.0/3.0)*magSqr(dev(epsilon)))
);
Info<< "Max epsilonEq = " << max(epsilonEq).value()
<< endl;
Info<< "Max epsilonEq = " << max(epsilonEq).value() << endl;
volScalarField sigmaEq
(
@ -29,8 +28,7 @@ if (runTime.outputTime())
sqrt((3.0/2.0)*magSqr(dev(sigma)))
);
Info<< "Max sigmaEq = " << max(sigmaEq).value()
<< endl;
Info<< "Max sigmaEq = " << max(sigmaEq).value() << endl;
runTime.write();
}
}

View file

@ -29,7 +29,7 @@
dimensionedSymmTensor("zero", dimless, symmTensor::zero)
);
//- second Piola-Kirchhoff stress tensor
//- Second Piola-Kirchhoff stress tensor
volSymmTensorField sigma
(
IOobject

View file

@ -70,33 +70,37 @@ int main(int argc, char *argv[])
{
U.storePrevIter();
surfaceTensorField shearGradU =
((I - n*n)&fvc::interpolate(gradU));
surfaceTensorField shearGradU
(
"shearGradU",
(I - sqr(n)) & fvc::interpolate(gradU)
);
fvVectorMatrix UEqn
(
fvm::d2dt2(rho, U)
==
fvm::laplacian(2*muf + lambdaf, U, "laplacian(DU,U)")
// + fvc::div(
// -( (mu + lambda) * gradU )
// + ( mu * gradU.T() )
// + ( mu * (gradU & gradU.T()) )
// + ( lambda * tr(gradU) * I )
// + ( 0.5 * lambda * tr(gradU & gradU.T()) * I )
// + ( sigma & gradU ),
// "div(sigma)"
// )
+ fvc::div(
mesh.magSf()
*(
- (muf + lambdaf)*(fvc::snGrad(U)&(I - n*n))
+ lambdaf*tr(shearGradU&(I - n*n))*n
+ muf*(shearGradU&n)
+ muf * (n & fvc::interpolate(gradU & gradU.T()))
+ 0.5*lambdaf
*(n * tr(fvc::interpolate(gradU & gradU.T())))
+ (n & fvc::interpolate( sigma & gradU ))
// + fvc::div
// (
// -(mu + lambda)*gradU
// + mu*gradU.T()
// + mu*(gradU & gradU.T())
// + lambda*tr(gradU)*I
// + 0.5*lambda*tr(gradU & gradU.T())*I
// + (sigma & gradU),
// "div(sigma)"
// )
+ fvc::div
(
mesh.magSf()*
(
- (muf + lambdaf)*(fvc::snGrad(U) & (I - n*n))
+ lambdaf*tr(shearGradU & (I - n*n))*n
+ muf*(shearGradU & n)
+ muf*(n & fvc::interpolate(gradU & gradU.T()))
+ 0.5*lambdaf*(n*tr(fvc::interpolate(gradU & gradU.T())))
+ (n & fvc::interpolate(sigma & gradU))
)
)
);

View file

@ -1,15 +1,16 @@
if(moveMeshMethod == "inverseDistance")
{
{
# include "moveMeshInverseDistance.H"
}
else if(moveMeshMethod == "leastSquares")
{
}
else if(moveMeshMethod == "leastSquares")
{
# include "moveMeshLeastSquares.H"
}
else
{
FatalError << "move mesh method " << moveMeshMethod << " not recognised" << nl
}
else
{
FatalErrorIn(args.executable())
<< "move mesh method " << moveMeshMethod << " not recognised" << nl
<< "available methods are:" << nl
<< "inverseDistance" << nl
<< "leastSquares" << exit(FatalError);
}
}

View file

@ -7,13 +7,14 @@ aitkenDelta = (U - U.prevIter()) / aitkenInitialRes;
// update relaxation factor
if(iCorr == 0)
{
{
aitkenTheta = 0.1;
}
else
{
vectorField b = aitkenDelta.internalField() - aitkenDelta.prevIter().internalField();
// scalar sumMagB = gSum(mag(b));
}
else
{
vectorField b = aitkenDelta.internalField()
- aitkenDelta.prevIter().internalField();
scalar sumMagB = gSum(magSqr(b));
if(sumMagB < SMALL)
{
@ -23,10 +24,9 @@ if(iCorr == 0)
}
aitkenTheta = -aitkenTheta*
gSum(aitkenDelta.prevIter().internalField() & b)
/
gSum(aitkenDelta.prevIter().internalField() & b)/
sumMagB;
}
}
// correction to the latest U
U += aitkenTheta*aitkenDelta*aitkenInitialRes;

View file

@ -12,7 +12,6 @@
mesh
);
// volTensorField gradU = fvc::grad(U);
volTensorField gradU
(
IOobject
@ -26,7 +25,7 @@
mesh,
dimensionedTensor("zero", dimless, tensor::zero)
);
//surfaceVectorField snGradU = fvc::snGrad(U);
surfaceVectorField snGradU
(
IOobject
@ -139,6 +138,8 @@
mesh,
dimensionedVector("zero", dimLength, vector::zero)
);
// aitken relaxation factor
scalar aitkenInitialRes = 1.0;
scalar aitkenTheta = 0.1;

View file

@ -75,7 +75,7 @@ int main(int argc, char *argv[])
if (predictor)
{
Info << "\nPredicting U, gradU and snGradU based on V,"
Info<< "\nPredicting U, gradU and snGradU based on V,"
<< "gradV and snGradV\n" << endl;
U += V*runTime.deltaT();
gradU += gradV*runTime.deltaT();
@ -102,11 +102,6 @@ int main(int argc, char *argv[])
solidInterfacePtr->correct(UEqn);
}
// if (relaxEqn)
// {
// UEqn.relax();
// }
solverPerf = UEqn.solve();
if (iCorr == 0)
@ -136,6 +131,7 @@ int main(int argc, char *argv[])
<< " using " << solverPerf.solverName()
<< ", res = " << solverPerf.initialResidual()
<< ", rel res = " << relativeResidual;
if (aitkenRelax)
{
Info<< ", aitken = " << aitkenTheta;
@ -146,11 +142,11 @@ int main(int argc, char *argv[])
while
(
iCorr++ == 0
||
(solverPerf.initialResidual() > convergenceTolerance
|| (
solverPerf.initialResidual() > convergenceTolerance
//relativeResidual > convergenceTolerance
&&
iCorr < nCorr)
&& iCorr < nCorr
)
);
Info<< nl << "Time " << runTime.value() << ", Solving for " << U.name()