Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

maxAlphaCo added #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions applications/solvers/multiphase/openInjMoldSim/alphaCourantNo.H
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.

Global
alphaCourantNo

Description
Calculates and outputs the mean and maximum Courant Numbers.

\*---------------------------------------------------------------------------*/

scalar maxAlphaCo
(
readScalar(runTime.controlDict().lookup("maxAlphaCo"))
);

scalar alphaCoNum = 0.0;
scalar meanAlphaCoNum = 0.0;

if (mesh.nInternalFaces())
{
scalarField sumPhi
(
pos0(alpha1 - 0.01)*pos0(0.99 - alpha1)
*fvc::surfaceSum(mag(phi))().primitiveField()
);

alphaCoNum = 0.5*gMax(sumPhi/mesh.V().field())*runTime.deltaTValue();

meanAlphaCoNum =
0.5*(gSum(sumPhi)/gSum(mesh.V().field()))*runTime.deltaTValue();
}

Info<< "Interface Courant Number mean: " << meanAlphaCoNum
<< " max: " << alphaCoNum << endl;

// ************************************************************************* //
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Description

if (adjustTimeStep)
{
scalar maxDeltaTFact = min(maxCo/(CoNum + small), maxSolidCo/(solidCoNum + small));
scalar maxDeltaTFact = min(maxCo/(CoNum + small), min( maxSolidCo/(solidCoNum + small), maxAlphaCo/(alphaCoNum + small) ) ); //Andrea - add maxAlphaCo/(alphaCoNum + small)
scalar deltaTFact = min(min(maxDeltaTFact, 1.0 + 0.1*maxDeltaTFact), 1.2);

runTime.setDeltaT
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ int main(int argc, char *argv[])
{
#include "mojCreateTimeControls.H"
#include "mojCourantNo.H"
#include "alphaCourantNo.H" //Andrea
#include "mojSetDeltaT.H"

runTime++;
Expand Down