2012-09-11 15:42:55 +00:00
|
|
|
/*---------------------------------------------------------------------------*\
|
|
|
|
========= |
|
|
|
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
|
|
\\ / O peration |
|
|
|
|
\\ / A nd | Copyright (C) 2004-6 H. Jasak All rights reserved
|
|
|
|
\\/ 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
|
|
|
|
Application
|
|
|
|
viscoElasticStressedFoam
|
|
|
|
|
|
|
|
Description
|
|
|
|
Transient/steady-state segregated finite-volume solver for small strain
|
|
|
|
visco elastic solid bodies.
|
|
|
|
|
|
|
|
Displacement increment field DU is solved for using a total Lagrangian
|
|
|
|
approach, also generating the strain tensor field epsilon and stress
|
|
|
|
tensor field sigma.
|
|
|
|
|
|
|
|
|
|
|
|
\*---------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
#include "fvCFD.H"
|
|
|
|
#include "rheologyModel.H"
|
|
|
|
#include "OFstream.H"
|
|
|
|
|
|
|
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
|
|
|
|
|
|
int main(int argc, char *argv[])
|
|
|
|
{
|
2013-07-18 01:43:15 +00:00
|
|
|
# include "setRootCase.H"
|
2012-09-11 15:42:55 +00:00
|
|
|
|
2013-07-18 01:43:15 +00:00
|
|
|
# include "createTime.H"
|
2012-09-11 15:42:55 +00:00
|
|
|
|
2013-07-18 01:43:15 +00:00
|
|
|
# include "createMesh.H"
|
2012-09-11 15:42:55 +00:00
|
|
|
|
2013-07-18 01:43:15 +00:00
|
|
|
# include "createFields.H"
|
2012-09-11 15:42:55 +00:00
|
|
|
|
|
|
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
|
|
|
2013-07-18 01:43:15 +00:00
|
|
|
Info<< "\nCalculating displacement field\n" << endl;
|
2012-09-11 15:42:55 +00:00
|
|
|
|
2013-07-18 01:43:15 +00:00
|
|
|
lduMatrix::debug = 0;
|
2013-07-18 01:02:34 +00:00
|
|
|
|
2013-07-18 01:43:15 +00:00
|
|
|
scalar m = 0.5;
|
2013-07-18 01:02:34 +00:00
|
|
|
|
2013-07-18 01:43:15 +00:00
|
|
|
for (runTime++; !runTime.end(); runTime++)
|
2012-09-11 15:42:55 +00:00
|
|
|
{
|
2013-07-18 01:43:15 +00:00
|
|
|
Info<< "Time: " << runTime.timeName() << nl << endl;
|
2013-07-18 01:02:34 +00:00
|
|
|
|
2013-07-18 01:43:15 +00:00
|
|
|
# include "readStressedFoamControls.H"
|
2012-09-11 15:42:55 +00:00
|
|
|
|
2013-07-18 01:43:15 +00:00
|
|
|
volScalarField mu =
|
|
|
|
rheology.mu(m*runTime.deltaT().value());
|
|
|
|
volScalarField lambda =
|
|
|
|
rheology.lambda(m*runTime.deltaT().value());
|
2013-07-18 01:02:34 +00:00
|
|
|
|
2013-07-18 01:43:15 +00:00
|
|
|
Info << "mu = " << average(mu.internalField()) << endl;
|
|
|
|
Info << "lambda = " << average(lambda.internalField()) << endl;
|
2013-07-18 01:02:34 +00:00
|
|
|
|
2013-07-18 01:43:15 +00:00
|
|
|
int iCorr = 0;
|
|
|
|
lduMatrix::solverPerformance solverPerf;
|
|
|
|
scalar initialResidual = 0;
|
|
|
|
scalar residual = GREAT;
|
2013-07-18 01:02:34 +00:00
|
|
|
|
2013-07-18 01:43:15 +00:00
|
|
|
do
|
2012-09-11 15:42:55 +00:00
|
|
|
{
|
2013-07-18 01:43:15 +00:00
|
|
|
DU.storePrevIter();
|
2013-07-18 01:02:34 +00:00
|
|
|
|
2013-07-18 01:43:15 +00:00
|
|
|
fvVectorMatrix DUEqn
|
2012-09-11 15:42:55 +00:00
|
|
|
(
|
2013-07-18 01:43:15 +00:00
|
|
|
fvm::d2dt2(rho,DU)
|
|
|
|
==
|
|
|
|
fvm::laplacian(2*mu+lambda, DU, "laplacian(DDU,DU)")
|
|
|
|
+ fvc::div
|
|
|
|
(
|
|
|
|
mu*gradDU.T()
|
|
|
|
+ lambda*(I*tr(gradDU))
|
|
|
|
- (mu + lambda)*gradDU
|
|
|
|
+ DSigmaCorr,
|
|
|
|
"div(sigma)"
|
|
|
|
)
|
|
|
|
);
|
|
|
|
|
|
|
|
solverPerf = DUEqn.solve();
|
|
|
|
|
|
|
|
DU.relax();
|
|
|
|
|
|
|
|
if(iCorr == 0)
|
2012-09-11 15:42:55 +00:00
|
|
|
{
|
2013-07-18 01:43:15 +00:00
|
|
|
initialResidual = solverPerf.initialResidual();
|
2012-09-11 15:42:55 +00:00
|
|
|
}
|
2013-07-18 01:02:34 +00:00
|
|
|
|
2013-07-18 01:43:15 +00:00
|
|
|
gradDU = fvc::grad(DU);
|
2013-07-18 01:02:34 +00:00
|
|
|
|
2013-07-18 01:43:15 +00:00
|
|
|
# include "calculateDEpsilonDSigma.H"
|
2012-09-11 15:42:55 +00:00
|
|
|
}
|
2013-07-18 01:43:15 +00:00
|
|
|
while
|
2012-09-11 15:42:55 +00:00
|
|
|
(
|
2013-07-18 01:43:15 +00:00
|
|
|
solverPerf.initialResidual() > convergenceTolerance
|
|
|
|
&& ++iCorr < nCorr
|
|
|
|
);
|
2013-07-18 01:02:34 +00:00
|
|
|
|
2013-07-18 01:43:15 +00:00
|
|
|
Info << "Solving for " << DU.name() << " using "
|
|
|
|
<< solverPerf.solverName() << " solver"
|
|
|
|
<< ", Initial residual = " << initialResidual
|
|
|
|
<< ", Final residual = " << solverPerf.initialResidual()
|
|
|
|
<< ", No outer iterations " << iCorr
|
|
|
|
<< ", Relative error: " << residual << endl;
|
2013-07-18 01:02:34 +00:00
|
|
|
|
2013-07-18 01:43:15 +00:00
|
|
|
U += DU;
|
2012-09-11 15:42:55 +00:00
|
|
|
|
2013-07-18 01:43:15 +00:00
|
|
|
epsilon += DEpsilon;
|
2013-07-18 01:02:34 +00:00
|
|
|
|
2013-07-18 01:43:15 +00:00
|
|
|
# include "calculateSigmaDSigmaCorr.H"
|
2012-09-11 15:42:55 +00:00
|
|
|
|
2013-07-18 01:43:15 +00:00
|
|
|
# include "writeFields.H"
|
2012-09-11 15:42:55 +00:00
|
|
|
|
2013-07-18 01:43:15 +00:00
|
|
|
Info<< "ExecutionTime = "
|
|
|
|
<< runTime.elapsedCpuTime()
|
|
|
|
<< " s\n\n" << endl;
|
2012-09-11 15:42:55 +00:00
|
|
|
}
|
|
|
|
|
2013-07-18 01:43:15 +00:00
|
|
|
Info<< "End\n" << endl;
|
2013-07-18 01:02:34 +00:00
|
|
|
|
2013-07-18 01:43:15 +00:00
|
|
|
return(0);
|
2012-09-11 15:42:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ************************************************************************* //
|