CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (http://www.cfd-online.com/Forums/openfoam-solving/)
-   -   PyFoam struggles with adopted solver (http://www.cfd-online.com/Forums/openfoam-solving/112278-pyfoam-struggles-adopted-solver.html)

AnjaMiehe January 25, 2013 05:03

PyFoam struggles with adopted solver
 
Hello everyone,

I would like to use PyFoam with my own adopted solver, especially pyFoamPlotWatcher.py.

The run of my solver put in run.log goes well and looks as follows for the beginning (first 3 steps):

Code:

/*---------------------------------------------------------------------------*\
| =========                |                                                |
| \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox          |
|  \\    /  O peration    | Version:  2.1.1                                |
|  \\  /    A nd          | Web:      www.OpenFOAM.org                      |
|    \\/    M anipulation  |                                                |
\*---------------------------------------------------------------------------*/
Build  : 2.1.1-221db2718bbb
Exec  : castFoam
Date  : Jan 25 2013
Time  : 09:43:48
Host  : "hugo163"
PID    : 8714
Case  : /home/anja/OpenFOAM/Zeitverhalten/galliumMelting/castFoam_Nikrityuk_2D_200x280_GAMG
nProcs : 1
sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster
allowSystemOperations : Disallowing user-supplied system call operations

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Create mesh for time = 0


Reading g
Reading field T

Reading field p_rgh

Reading field U

Reading field Us

Reading/calculating face flux field phi

Reading thermophysical properties

Calculating phase change properties

Calculating field g.h

Courant Number mean: 0 max: 0

PIMPLE: Operating solver in PISO mode


Starting time loop

Time = 0.0015

Fourier Number max: 0.151337
Courant Number mean: 0 max: 0
deltaT = 0.00151
DILUPBiCG:  Solving for T, Initial residual =  1, Final residual = 2.23561e-14, No Iterations 221 SUM
SUBCYCLE:  Solving for fl, Initial residual =  0.3, Final residual = 7.95519e-07, No Iterations 37
GAMG:  Solving for p_rgh, Initial residual = 0.999987, Final residual = 0.00292191, No Iterations 3
GAMG:  Solving for p_rgh, Initial residual = 0.00146465, Final residual = 1.44968e-05, No Iterations 4
time step continuity errors : sum local = 1.21777e-17, global = -1.65627e-28, cumulative = -1.65627e-28
GAMG:  Solving for p_rgh, Initial residual = 1.50414e-05, Final residual = 9.65508e-07, No Iterations 4
GAMG:  Solving for p_rgh, Initial residual = 1.05392e-06, Final residual = 9.84715e-09, No Iterations 14
time step continuity errors : sum local = 8.31164e-21, global = -1.65624e-28, cumulative = -3.31251e-28
ExecutionTime = 3.84 s  ClockTime = 4 s

Time = 0.00301

Fourier Number max: 0.152345
Courant Number mean: 5.34575e-15 max: 5.60951e-13
deltaT = 0.00151
DILUPBiCG:  Solving for T, Initial residual =  0.161344, Final residual = 3.27402e-13, No Iterations 6 SUM
SUBCYCLE:  Solving for fl, Initial residual =  5.56863e-07, Final residual = 5.56863e-07, No Iterations 1
GAMG:  Solving for p_rgh, Initial residual = 0.591175, Final residual = 0.000593465, No Iterations 1
GAMG:  Solving for p_rgh, Initial residual = 0.000388587, Final residual = 2.57464e-06, No Iterations 7
time step continuity errors : sum local = 8.24014e-12, global = -7.44436e-23, cumulative = -7.44439e-23
GAMG:  Solving for p_rgh, Initial residual = 2.73173e-06, Final residual = 5.12553e-07, No Iterations 2
GAMG:  Solving for p_rgh, Initial residual = 5.33079e-07, Final residual = 2.78747e-09, No Iterations 4
time step continuity errors : sum local = 8.4972e-15, global = -7.44374e-23, cumulative = -1.48881e-22
ExecutionTime = 4.32 s  ClockTime = 4 s

Time = 0.00452

Fourier Number max: 0.152345
Courant Number mean: 1.24449e-12 max: 1.6071e-10
deltaT = 0.00151
DILUPBiCG:  Solving for T, Initial residual =  0.07852, Final residual = 4.32404e-13, No Iterations 301 SUM
SUBCYCLE:  Solving for fl, Initial residual =  0.0908314, Final residual = 0.00767244, No Iterations 50
### WARNING: fl subcycle reached maximum iteration of 50 ###

GAMG:  Solving for p_rgh, Initial residual = 0.154253, Final residual = 0.000309045, No Iterations 1
GAMG:  Solving for p_rgh, Initial residual = 0.000270045, Final residual = 1.36153e-06, No Iterations 7
time step continuity errors : sum local = 6.01094e-12, global = -1.4204e-22, cumulative = -2.90922e-22
GAMG:  Solving for p_rgh, Initial residual = 1.4531e-06, Final residual = 6.57162e-07, No Iterations 1
GAMG:  Solving for p_rgh, Initial residual = 7.37195e-07, Final residual = 8.89573e-09, No Iterations 5
time step continuity errors : sum local = 3.74236e-14, global = -1.42041e-22, cumulative = -4.32963e-22
ExecutionTime = 8.43 s  ClockTime = 8 s

Starting "pyFoamPlotWatch.y run.log", it ends exactly here:
Code:

/*---------------------------------------------------------------------------*\
| =========                |                                                |
| \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox          |
|  \\    /  O peration    | Version:  2.1.1                                |
|  \\  /    A nd          | Web:      www.OpenFOAM.org                      |
|    \\/    M anipulation  |                                                |
\*---------------------------------------------------------------------------*/
Build  : 2.1.1-221db2718bbb
Exec  : castFoam
Date  : Jan 25 2013
Time  : 09:43:48
Host  : "hugo163"
PID    : 8714
Case  : /home/anja/OpenFOAM/Zeitverhalten/galliumMelting/castFoam_Nikrityuk_2D_200x280_GAMG
nProcs : 1
sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster
allowSystemOperations : Disallowing user-supplied system call operations

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Create mesh for time = 0


Reading g
Reading field T

Reading field p_rgh

Reading field U

Reading field Us

Reading/calculating face flux field phi

Reading thermophysical properties

Calculating phase change properties

Calculating field g.h

Courant Number mean: 0 max: 0

PIMPLE: Operating solver in PISO mode


Starting time loop

Time = 0.0015

Fourier Number max: 0.151337
Courant Number mean: 0 max: 0
deltaT = 0.00151
DILUPBiCG:  Solving for T, Initial residual =  1, Final residual = 2.23561e-14, No Iterations 221 SUM

no matter, whether the code still runs or not. It is quite obvious that PyFoam has a problem with the "SUBCYCLE" line what is surprising for me as foamLog does not have it, for example.

Can anyone help me with a work around? I would love to see the residuals of the SUBCYCLE as well, and I can change that line to a different pattern, if necessary. Or would costumRegexp help?

Thank you very much in advance
Regards, Anja

gschaider January 25, 2013 07:46

Quote:

Originally Posted by AnjaMiehe (Post 403958)
Hello everyone,

I would like to use PyFoam with my own adopted solver, especially pyFoamPlotWatcher.py.

The run of my solver put in run.log goes well and looks as follows for the beginning (first 3 steps):

Code:

/*---------------------------------------------------------------------------*\
| =========                |                                                |
| \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox          |
|  \\    /  O peration    | Version:  2.1.1                                |
|  \\  /    A nd          | Web:      www.OpenFOAM.org                      |
|    \\/    M anipulation  |                                                |
\*---------------------------------------------------------------------------*/
Build  : 2.1.1-221db2718bbb
Exec  : castFoam
Date  : Jan 25 2013
Time  : 09:43:48
Host  : "hugo163"
PID    : 8714
Case  : /home/anja/OpenFOAM/Zeitverhalten/galliumMelting/castFoam_Nikrityuk_2D_200x280_GAMG
nProcs : 1
sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster
allowSystemOperations : Disallowing user-supplied system call operations

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Create mesh for time = 0


Reading g
Reading field T

Reading field p_rgh

Reading field U

Reading field Us

Reading/calculating face flux field phi

Reading thermophysical properties

Calculating phase change properties

Calculating field g.h

Courant Number mean: 0 max: 0

PIMPLE: Operating solver in PISO mode


Starting time loop

Time = 0.0015

Fourier Number max: 0.151337
Courant Number mean: 0 max: 0
deltaT = 0.00151
DILUPBiCG:  Solving for T, Initial residual =  1, Final residual = 2.23561e-14, No Iterations 221 SUM
SUBCYCLE:  Solving for fl, Initial residual =  0.3, Final residual = 7.95519e-07, No Iterations 37
GAMG:  Solving for p_rgh, Initial residual = 0.999987, Final residual = 0.00292191, No Iterations 3
GAMG:  Solving for p_rgh, Initial residual = 0.00146465, Final residual = 1.44968e-05, No Iterations 4
time step continuity errors : sum local = 1.21777e-17, global = -1.65627e-28, cumulative = -1.65627e-28
GAMG:  Solving for p_rgh, Initial residual = 1.50414e-05, Final residual = 9.65508e-07, No Iterations 4
GAMG:  Solving for p_rgh, Initial residual = 1.05392e-06, Final residual = 9.84715e-09, No Iterations 14
time step continuity errors : sum local = 8.31164e-21, global = -1.65624e-28, cumulative = -3.31251e-28
ExecutionTime = 3.84 s  ClockTime = 4 s

Time = 0.00301

Fourier Number max: 0.152345
Courant Number mean: 5.34575e-15 max: 5.60951e-13
deltaT = 0.00151
DILUPBiCG:  Solving for T, Initial residual =  0.161344, Final residual = 3.27402e-13, No Iterations 6 SUM
SUBCYCLE:  Solving for fl, Initial residual =  5.56863e-07, Final residual = 5.56863e-07, No Iterations 1
GAMG:  Solving for p_rgh, Initial residual = 0.591175, Final residual = 0.000593465, No Iterations 1
GAMG:  Solving for p_rgh, Initial residual = 0.000388587, Final residual = 2.57464e-06, No Iterations 7
time step continuity errors : sum local = 8.24014e-12, global = -7.44436e-23, cumulative = -7.44439e-23
GAMG:  Solving for p_rgh, Initial residual = 2.73173e-06, Final residual = 5.12553e-07, No Iterations 2
GAMG:  Solving for p_rgh, Initial residual = 5.33079e-07, Final residual = 2.78747e-09, No Iterations 4
time step continuity errors : sum local = 8.4972e-15, global = -7.44374e-23, cumulative = -1.48881e-22
ExecutionTime = 4.32 s  ClockTime = 4 s

Time = 0.00452

Fourier Number max: 0.152345
Courant Number mean: 1.24449e-12 max: 1.6071e-10
deltaT = 0.00151
DILUPBiCG:  Solving for T, Initial residual =  0.07852, Final residual = 4.32404e-13, No Iterations 301 SUM
SUBCYCLE:  Solving for fl, Initial residual =  0.0908314, Final residual = 0.00767244, No Iterations 50
### WARNING: fl subcycle reached maximum iteration of 50 ###

GAMG:  Solving for p_rgh, Initial residual = 0.154253, Final residual = 0.000309045, No Iterations 1
GAMG:  Solving for p_rgh, Initial residual = 0.000270045, Final residual = 1.36153e-06, No Iterations 7
time step continuity errors : sum local = 6.01094e-12, global = -1.4204e-22, cumulative = -2.90922e-22
GAMG:  Solving for p_rgh, Initial residual = 1.4531e-06, Final residual = 6.57162e-07, No Iterations 1
GAMG:  Solving for p_rgh, Initial residual = 7.37195e-07, Final residual = 8.89573e-09, No Iterations 5
time step continuity errors : sum local = 3.74236e-14, global = -1.42041e-22, cumulative = -4.32963e-22
ExecutionTime = 8.43 s  ClockTime = 8 s

Starting "pyFoamPlotWatch.y run.log", it ends exactly here:
Code:

/*---------------------------------------------------------------------------*\
| =========                |                                                |
| \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox          |
|  \\    /  O peration    | Version:  2.1.1                                |
|  \\  /    A nd          | Web:      www.OpenFOAM.org                      |
|    \\/    M anipulation  |                                                |
\*---------------------------------------------------------------------------*/
Build  : 2.1.1-221db2718bbb
Exec  : castFoam
Date  : Jan 25 2013
Time  : 09:43:48
Host  : "hugo163"
PID    : 8714
Case  : /home/anja/OpenFOAM/Zeitverhalten/galliumMelting/castFoam_Nikrityuk_2D_200x280_GAMG
nProcs : 1
sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster
allowSystemOperations : Disallowing user-supplied system call operations

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Create mesh for time = 0


Reading g
Reading field T

Reading field p_rgh

Reading field U

Reading field Us

Reading/calculating face flux field phi

Reading thermophysical properties

Calculating phase change properties

Calculating field g.h

Courant Number mean: 0 max: 0

PIMPLE: Operating solver in PISO mode


Starting time loop

Time = 0.0015

Fourier Number max: 0.151337
Courant Number mean: 0 max: 0
deltaT = 0.00151
DILUPBiCG:  Solving for T, Initial residual =  1, Final residual = 2.23561e-14, No Iterations 221 SUM

no matter, whether the code still runs or not. It is quite obvious that PyFoam has a problem with the "SUBCYCLE" line what is surprising for me as foamLog does not have it, for example.

Can anyone help me with a work around? I would love to see the residuals of the SUBCYCLE as well, and I can change that line to a different pattern, if necessary. Or would costumRegexp help?

Thank you very much in advance
Regards, Anja

OK. What throws PyFoam off the wagon is the SUB at the end of the T-solver. It tries to treat it as part of a floating point number. I'm just surprised that it didn't throw an error for you. Try replacing the relevant line in PyFoam/LogAnalysis/LinearSolverLineAnalyzer.py with
Code:

linearRegExp="^(.+):  Solving for (.+), Initial residual = (.+), Final residual = (.+), No Iterations ([0-9]+).*$"
I put that change into my development version and it will be in the next release.

The SUBCYCLE is not found because your output has one space more before "Solving" than usual and regular expressions are a bit picky there. You could make it more tolerant with
Code:

linearRegExp="^(.+): +Solving for (.+), Initial residual = (.+), Final residual = (.+), No Iterations ([0-9]+).*$"
but I'm not sure whether I want to be that tolerant

AnjaMiehe January 26, 2013 07:50

Dear Mr. Gschaider,
Thank you very much for the reply.
I deleted the additional space before "Solving for fl" and changed the LinearSolverLineAnalyzer.py as you said.
It works perfectly.


All times are GMT -4. The time now is 18:04.