This repository has been archived on 2023-11-20. You can view files and clone it, but cannot push or open issues or pull requests.
foam-extend4.1-coherent-io/applications/solvers/stressAnalysis/solidEquilibriumDisplacementFoam/kineticEnergyLimiter.H

19 lines
714 B
C

if (!(runTime.timeIndex() % 5))
{
volScalarField kineticEnergy = magSqr(Dcorr);
dimensionedScalar intKineticEnergy = fvc::domainIntegrate(kineticEnergy);
Info<< "kineticEnergy = " << intKineticEnergy.value() << endl;
volScalarField kineticPower = (Dcorr - Dcorr.oldTime()) & Dcorr;
dimensionedScalar intKineticPower = fvc::domainIntegrate(kineticPower);
Info<< "kineticPower = " << intKineticPower.value() << endl;
scalar smi = intKineticPower.value()/(intKineticEnergy.value() + VSMALL);
Info<< "smi = " << smi << endl;
if (smi < -SMALL)
{
Info<< "Resetting Dcorr to 0" << endl;
Dcorr == dimensionedVector("0", Dcorr.dimensions(), vector::zero);
}
}