View Issue Details

IDProjectCategoryView StatusLast Update
0002611OpenFOAMBugpublic2017-07-21 15:49
Reporterzli Assigned Tohenry  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionunable to reproduce 
Fixed in Versiondev 
Summary0002611: Inconsistance of Crank Nicolson shceme for alphaEqn and UEqn in interFoam
DescriptionThe different implementation of Crank Nicolson scheme in alphaEqn and the UEqn cause an overshoot/undershoot of velocity on the first time step even when the velocity field is initialised uniform in the domain.

The first time step of CrankNicolson in UEqn is implicit Euler.
The first time step of CrankNicolson in alphaEqn is Crank Nicolson but alphaphi(and then rhoPhi) is recalculated to the end of time step.

That makes
(rho1 - rho0)/dt + sum (rhoPhi) != 0

and thus when calculate HbyA it create an undershot of the velocity and then the correction by pressure creates undershot and overshot.
Steps To ReproduceUse interFoam

Creat a square domain
gravity( 0 0 -9.81)

with velocity uniform (0 0 1)

Make the lower part of the domain occupied by water.

Calculate one time step without momentum predictor.

See HbyA and U

TagsNo tags attached.

Activities

zli

2017-07-12 15:16

reporter  

HbyA_and_Prgh.png (54,431 bytes)   
HbyA_and_Prgh.png (54,431 bytes)   

henry

2017-07-12 15:36

manager   ~0008385

Which OpenFOAM version are you running?
Can you provide the case?
Can you provide a patch to correct the problem?

See also https://bugs.openfoam.org/rules.php

zli

2017-07-13 13:44

reporter   ~0008388

I am running with OF 2.4, I checked the code in 4-dev, the problem is still the same.

To fix this bug I added one condition sentence to do not reconstruct the end-of-time-step rho flux for the first time step. And it works fine.

In alphaEqn.H

195 if
196 (
197 word(mesh.ddtScheme("ddt(rho,U)"))
198 == fv::EulerDdtScheme<vector>::typeName
199 )
200 {
201 rhoPhi = phiAlpha*(rho1 - rho2) + phiCN*rho2;
202 }
203 else
204 {
205 if (ocCoeff > 0 && ! (runTime.timeIndex() == runTime.startTimeIndex()
206 || runTime.timeIndex() == runTime.startTimeIndex() + 1))
207 {
208 // Calculate the end-of-time-step alpha flux
209 phiAlpha = (phiAlpha - (1.0 - cnCoeff)*phiAlpha.oldTime())/cnCoeff;
210 }
211
212 else
213 {
214 Info << "First Time Step, the end-of-time-step is not reconstructed" << endl;
215 phiAlpha.oldTime();
216 }
217
218 // Calculate the end-of-time-step mass flux
219 rhoPhi = phiAlpha*(rho1 - rho2) + phi*rho2;
220 }

henry

2017-07-19 13:42

manager   ~0008416

> I checked the code in 4-dev

How recent is your OpenFOAM-dev intallation? I upgraded your case to OpenFOAM-dev, set

ddtSchemes
{
    default CrankNicolson 0.95;
}

and looked at the U field at the end of the first time-step and it looks the same as with running Euler. Could you provide details of how you reproduced the problem in the latest OpenFOAM-dev?

henry

2017-07-21 15:49

manager   ~0008429

I cannot reproduce this problem in OpenFOAM-dev and without further information from the reporter nothing can be done.

Issue History

Date Modified Username Field Change
2017-07-12 15:16 zli New Issue
2017-07-12 15:16 zli File Added: HbyA_and_Prgh.png
2017-07-12 15:36 henry Note Added: 0008385
2017-07-13 13:44 zli File Added: interFoam_bug_report.tar.gz
2017-07-13 13:44 zli Note Added: 0008388
2017-07-19 13:42 henry Note Added: 0008416
2017-07-21 15:49 henry Assigned To => henry
2017-07-21 15:49 henry Status new => closed
2017-07-21 15:49 henry Resolution open => unable to reproduce
2017-07-21 15:49 henry Fixed in Version => dev
2017-07-21 15:49 henry Note Added: 0008429