2012-09-11 15:42:55 +00:00
|
|
|
/*---------------------------------------------------------------------------*\
|
|
|
|
========= |
|
|
|
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
|
|
\\ / O peration |
|
|
|
|
\\ / A nd | Copyright (C) 2004-2007 Hrvoje Jasak
|
|
|
|
\\/ 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
|
|
|
|
elasticContactIncrSolidFoam
|
|
|
|
|
|
|
|
Description
|
|
|
|
Transient/steady-state segregated finite-volume solver for small strain
|
|
|
|
elastic solid bodies in contact, using an incremental total Lagrangian
|
|
|
|
approach.
|
|
|
|
Works in parallel.
|
|
|
|
|
|
|
|
Solves for the displacement increment vector field DU, also generating the
|
|
|
|
stress tensor field sigma.
|
|
|
|
|
|
|
|
It is only for frictionless contact, friction not implemented yet.
|
|
|
|
|
|
|
|
Author
|
|
|
|
Philip Cardiff
|
|
|
|
|
|
|
|
\*---------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
#include "fvCFD.H"
|
|
|
|
#include "rheologyModel.H"
|
|
|
|
#include "contactProblem.H"
|
|
|
|
#include "solidInterface.H"
|
|
|
|
|
|
|
|
#include "volPointInterpolation.H"
|
|
|
|
#include "pointPatchInterpolation.H"
|
|
|
|
#include "primitivePatchInterpolation.H"
|
|
|
|
#include "fixedValuePointPatchFields.H"
|
|
|
|
#include "pointFields.H"
|
|
|
|
#include "pointMesh.H"
|
|
|
|
#include "pointBoundaryMesh.H"
|
|
|
|
#include "primitivePatchInterpolation.H"
|
|
|
|
#include "twoDPointCorrector.H"
|
|
|
|
//#include "leastSquaresVolPointInterpolation.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
|
|
|
# include "readDivDSigmaExpMethod.H"
|
2012-09-11 15:42:55 +00:00
|
|
|
|
2013-07-18 01:43:15 +00:00
|
|
|
# include "createGlobalToLocalFaceZonePointMap.H"
|
2012-09-11 15:42:55 +00:00
|
|
|
|
2013-07-18 01:43:15 +00:00
|
|
|
# include "createSolidInterface.H"
|
2012-09-11 15:42:55 +00:00
|
|
|
|
2013-07-18 01:43:15 +00:00
|
|
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
2013-07-18 01:02:34 +00:00
|
|
|
|
2012-09-11 15:42:55 +00:00
|
|
|
Info<< "\nStarting time loop\n" << endl;
|
2013-07-18 01:02:34 +00:00
|
|
|
|
2012-09-11 15:42:55 +00:00
|
|
|
for (runTime++; !runTime.end(); runTime++)
|
|
|
|
{
|
|
|
|
Info<< "Time: " << runTime.timeName() << endl;
|
2013-07-18 01:02:34 +00:00
|
|
|
|
2012-09-11 15:42:55 +00:00
|
|
|
# include "readContactControls.H"
|
|
|
|
|
|
|
|
# include "readStressedFoamControls.H"
|
2013-07-18 01:02:34 +00:00
|
|
|
|
2012-09-11 15:42:55 +00:00
|
|
|
//-- for moving the mesh and then back again
|
|
|
|
vectorField oldMeshPoints = mesh.allPoints();
|
2013-07-18 01:02:34 +00:00
|
|
|
|
2012-09-11 15:42:55 +00:00
|
|
|
int iCorr = 0;
|
|
|
|
lduMatrix::solverPerformance solverPerf;
|
|
|
|
word solverName;
|
|
|
|
lduMatrix::debug = 0;
|
|
|
|
scalar residual = GREAT;
|
|
|
|
scalar initialResidual = 0;
|
|
|
|
scalar relativeResidual = GREAT;
|
|
|
|
|
|
|
|
//- reset DU to zero at the start of the time-step if
|
|
|
|
//- a predictor is not required
|
|
|
|
if(!predictor)
|
2013-07-18 01:43:15 +00:00
|
|
|
{
|
|
|
|
DU = dimensionedVector("zero", dimLength, vector::zero);
|
|
|
|
}
|
2012-09-11 15:42:55 +00:00
|
|
|
|
|
|
|
do //- start of momentum loop
|
2013-07-18 01:43:15 +00:00
|
|
|
{
|
|
|
|
DU.storePrevIter();
|
|
|
|
|
|
|
|
//- correct the contact boundaries
|
|
|
|
if(iCorr % uEqnContactCorrFreq == 0)
|
|
|
|
{
|
|
|
|
Info << "\t\tCorrecting contact in the momentum loop "
|
|
|
|
<< "iteration: " << iCorr
|
|
|
|
<< ", residual: " << residual
|
|
|
|
<< endl;
|
|
|
|
//# include "moveMeshLeastSquares.H"
|
2012-09-11 15:42:55 +00:00
|
|
|
# include "moveSolidMesh.H"
|
2013-07-18 01:43:15 +00:00
|
|
|
contact.correct();
|
|
|
|
mesh.movePoints(oldMeshPoints);
|
|
|
|
}
|
2013-07-18 01:02:34 +00:00
|
|
|
|
2012-09-11 15:42:55 +00:00
|
|
|
# include "calculateDivDSigmaExp.H"
|
|
|
|
|
2013-07-18 01:43:15 +00:00
|
|
|
fvVectorMatrix DUEqn
|
|
|
|
(
|
|
|
|
fvm::d2dt2(rho, DU)
|
|
|
|
==
|
|
|
|
fvm::laplacian(2*mu + lambda, DU, "laplacian(DDU,DU)")
|
|
|
|
+ divDSigmaExp
|
|
|
|
);
|
2013-07-18 01:02:34 +00:00
|
|
|
|
2012-09-11 15:42:55 +00:00
|
|
|
if(solidInterfaceCorr)
|
2013-07-18 01:43:15 +00:00
|
|
|
{
|
2012-09-11 15:42:55 +00:00
|
|
|
solidInterfacePtr->correct(DUEqn);
|
2013-07-18 01:43:15 +00:00
|
|
|
}
|
2012-09-11 15:42:55 +00:00
|
|
|
|
2013-07-18 01:43:15 +00:00
|
|
|
solverPerf = DUEqn.solve();
|
2013-07-18 01:02:34 +00:00
|
|
|
|
2013-07-18 01:43:15 +00:00
|
|
|
DU.relax();
|
2013-07-18 01:02:34 +00:00
|
|
|
|
2013-07-18 01:43:15 +00:00
|
|
|
solverName = solverPerf.solverName();
|
2013-07-18 01:02:34 +00:00
|
|
|
|
2012-09-11 15:42:55 +00:00
|
|
|
if(solidInterfaceCorr)
|
2013-07-18 01:43:15 +00:00
|
|
|
{
|
2012-09-11 15:42:55 +00:00
|
|
|
gradDU = solidInterfacePtr->grad(DU);
|
2013-07-18 01:43:15 +00:00
|
|
|
}
|
2012-09-11 15:42:55 +00:00
|
|
|
else
|
2013-07-18 01:43:15 +00:00
|
|
|
{
|
2012-09-11 15:42:55 +00:00
|
|
|
gradDU = fvc::grad(DU);
|
2013-07-18 01:43:15 +00:00
|
|
|
}
|
2013-07-18 01:02:34 +00:00
|
|
|
|
2013-07-18 01:43:15 +00:00
|
|
|
U = U.oldTime() + DU;
|
2012-09-11 15:42:55 +00:00
|
|
|
|
2013-07-18 01:43:15 +00:00
|
|
|
residual = solverPerf.initialResidual();
|
2013-07-18 01:02:34 +00:00
|
|
|
|
2013-07-18 01:43:15 +00:00
|
|
|
//****************************************************//
|
|
|
|
// The contact residual is the initial residual for the
|
|
|
|
// first iteration of the momentum equation
|
|
|
|
//****************************************************//
|
|
|
|
if(iCorr == 0)
|
|
|
|
{
|
|
|
|
initialResidual = solverPerf.initialResidual();
|
|
|
|
}
|
2013-07-18 01:02:34 +00:00
|
|
|
|
|
|
|
# include "calculateRelativeResidual.H"
|
2012-09-11 15:42:55 +00:00
|
|
|
|
2013-07-18 01:43:15 +00:00
|
|
|
Info << "\tTime " << runTime.value()
|
|
|
|
<< ", Corrector " << iCorr
|
|
|
|
<< ", Solving for " << DU.name()
|
|
|
|
<< " using " << solverPerf.solverName()
|
|
|
|
<< ", residual = " << solverPerf.initialResidual()
|
|
|
|
<< ", relative residual = " << relativeResidual << endl;
|
|
|
|
} //- end of momentum loop
|
2012-09-11 15:42:55 +00:00
|
|
|
while
|
2013-07-18 01:43:15 +00:00
|
|
|
(
|
|
|
|
relativeResidual > convergenceTolerance
|
|
|
|
//residual > convergenceTolerance
|
|
|
|
&&
|
|
|
|
++iCorr < nCorr
|
|
|
|
);
|
2013-07-18 01:02:34 +00:00
|
|
|
|
2012-09-11 15:42:55 +00:00
|
|
|
// Print out info per contact iteration
|
|
|
|
Info << "\t\tSolving for " << DU.name()
|
2013-07-18 01:43:15 +00:00
|
|
|
<< " using " << solverName
|
|
|
|
<< ", Initial residual = " << initialResidual
|
|
|
|
<< ", Final residual = " << solverPerf.initialResidual()
|
|
|
|
<< ", No outer iterations " << iCorr << endl;
|
2013-07-18 01:02:34 +00:00
|
|
|
|
2012-09-11 15:42:55 +00:00
|
|
|
lduMatrix::debug = 1;
|
2013-07-18 01:02:34 +00:00
|
|
|
|
2012-09-11 15:42:55 +00:00
|
|
|
# include "calculateDEpsilonDSigma.H"
|
2013-07-18 01:02:34 +00:00
|
|
|
|
2012-09-11 15:42:55 +00:00
|
|
|
epsilon += DEpsilon;
|
2013-07-18 01:02:34 +00:00
|
|
|
|
2012-09-11 15:42:55 +00:00
|
|
|
sigma += DSigma;
|
|
|
|
|
|
|
|
# include "writeFields.H"
|
2013-07-18 01:02:34 +00:00
|
|
|
|
2012-09-11 15:42:55 +00:00
|
|
|
//# include "writeBoundaryNetForces.H"
|
2013-07-18 01:02:34 +00:00
|
|
|
|
2012-09-11 15:42:55 +00:00
|
|
|
//# include "moveMeshLeastSquares.H"
|
|
|
|
//# include "moveSolidMesh.H"
|
|
|
|
//# include "printContactResults.H"
|
|
|
|
//mesh.movePoints(oldMeshPoints);
|
2013-07-18 01:02:34 +00:00
|
|
|
|
2012-09-11 15:42:55 +00:00
|
|
|
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
|
2013-07-18 01:43:15 +00:00
|
|
|
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
|
|
|
|
<< endl << endl;
|
2012-09-11 15:42:55 +00:00
|
|
|
}
|
2013-07-18 01:02:34 +00:00
|
|
|
|
2012-09-11 15:42:55 +00:00
|
|
|
Info<< "End\n" << endl;
|
2013-07-18 01:02:34 +00:00
|
|
|
|
2012-09-11 15:42:55 +00:00
|
|
|
return(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ************************************************************************* //
|