CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

Read fvSolution every timestep

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 24, 2014, 04:02
Default Read fvSolution every timestep
  #1
New Member
 
Join Date: Mar 2014
Posts: 5
Rep Power: 12
S2.Mike is on a distinguished road
Hello FOAMers,

I asked the same question in Running and Solving forum but I'm not sure if it was the right forum for my thread. I'm new in OpenFoam and i have a big problem.
I'm writing my bachelor thesis in a company which want to use OpenFOAM instead of Fluent in future. It works fine, but OpenFoam is much slower than Fluent to find the solution. The calculation is running on a 64 core cluster and I'm using chtMultiRegionSimpleFoam.

So i decided to implement a fuzzy algorithm control for the relaxation factors to get faster convergence and more stability. For the fuzzy algorithm it is necessary to write every timestep new relaxationfactors. But now I've a problems. The problem is that OpenFoam don't read the fvSolution every timestep which is necessary for my relax control algorithm. In the global controlDict i use timeStepMaster for fileModificationChecking.

How can I ensure that OpenFoam reads the fvSolution every timestep? Please can anybody help me with my problem?

thanks and best regards, Mike
S2.Mike is offline   Reply With Quote

Old   June 24, 2014, 04:49
Default
  #2
Senior Member
 
Olivier
Join Date: Jun 2009
Location: France, grenoble
Posts: 272
Rep Power: 17
olivierG is on a distinguished road
hello,

In order to have run time modifiable fvSolution, just put "runTimeModifiable yes;" in your controlDict.

However, if you want to speed up your case with chtMultiRegionSimpleFoam, you might try also to change solver for T (try GAMG if it work), and run first thermoFoam for a good initial T field. And this is weak coupling here, so for faster convergence, try congugateHeatSimpleFoam (from foam-extend) instead.

regards,
olivier
olivierG is offline   Reply With Quote

Old   June 24, 2014, 06:26
Default
  #3
New Member
 
Join Date: Mar 2014
Posts: 5
Rep Power: 12
S2.Mike is on a distinguished road
Quote:
Originally Posted by olivierG View Post
hello,

In order to have run time modifiable fvSolution, just put "runTimeModifiable yes;" in your controlDict.

However, if you want to speed up your case with chtMultiRegionSimpleFoam, you might try also to change solver for T (try GAMG if it work), and run first thermoFoam for a good initial T field. And this is weak coupling here, so for faster convergence, try congugateHeatSimpleFoam (from foam-extend) instead.

regards,
olivier

hello oliver,

thanks for your fast reply. I already have runtimeModifiable yes in my controlDict. OF reads the fvSolutions at runtime, but i think not before every timestep.

My logFile looks like:

Code:
Time = 1258


Solving for fluid region Air
DILUPBiCG:  Solving for Ux, Initial residual = 0.001473127, Final residual = 6.388003e-06, No Iterations 1
DILUPBiCG:  Solving for Uy, Initial residual = 0.001077828, Final residual = 4.460612e-06, No Iterations 1
DILUPBiCG:  Solving for Uz, Initial residual = 0.0007397743, Final residual = 3.149015e-06, No Iterations 1
DILUPBiCG:  Solving for h, Initial residual = 0.00128943, Final residual = 8.301581e-05, No Iterations 14
Min/max T:362.9948 649.5947
DICPCG:  Solving for p_rgh, Initial residual = 0.002547044, Final residual = 9.128748e-05, No Iterations 6
time step continuity errors : sum local = 0.0002680669, global = -3.173526e-05, cumulative = -0.01920438
Min/max rho:0.7 0.9575195

Solving for solid region LED_osram108_1b
GAMG:  Solving for h, Initial residual = 0.0002935136, Final residual = 1.034723e-11, No Iterations 1
Min/max T:min(T) [0 0 0 1 0 0 0] 406.7548 max(T) [0 0 0 1 0 0 0] 422.999

Solving for solid region Print
GAMG:  Solving for h, Initial residual = 0.0002210894, Final residual = 8.670698e-11, No Iterations 1
Min/max T:min(T) [0 0 0 1 0 0 0] 402.9372 max(T) [0 0 0 1 0 0 0] 407.0176

Solving for solid region Kuehlkoerper
GAMG:  Solving for h, Initial residual = 0.0004534505, Final residual = 1.119512e-10, No Iterations 1
Min/max T:min(T) [0 0 0 1 0 0 0] 402.3478 max(T) [0 0 0 1 0 0 0] 403.8735

Solving for solid region LED_osram108_1a
GAMG:  Solving for h, Initial residual = 0.0002873201, Final residual = 1.146439e-10, No Iterations 1
Min/max T:min(T) [0 0 0 1 0 0 0] 403.2385 max(T) [0 0 0 1 0 0 0] 418.1941
ExecutionTime = 647.37 s  ClockTime = 665 s

Time = 1259


Solving for fluid region Air
DILUPBiCG:  Solving for Ux, Initial residual = 0.001474693, Final residual = 6.37829e-06, No Iterations 1
DILUPBiCG:  Solving for Uy, Initial residual = 0.001076896, Final residual = 4.449169e-06, No Iterations 1
DILUPBiCG:  Solving for Uz, Initial residual = 0.0007395095, Final residual = 3.140754e-06, No Iterations 1
DILUPBiCG:  Solving for h, Initial residual = 0.001269364, Final residual = 8.975471e-05, No Iterations 19
Min/max T:362.9948 649.9584
DICPCG:  Solving for p_rgh, Initial residual = 0.002549795, Final residual = 8.721853e-05, No Iterations 12
time step continuity errors : sum local = 0.0002561782, global = -2.981797e-05, cumulative = -0.01923419
Min/max rho:0.7 0.9575195

Solving for solid region LED_osram108_1b
GAMG:  Solving for h, Initial residual = 0.0002932964, Final residual = 1.033519e-11, No Iterations 1
Min/max T:min(T) [0 0 0 1 0 0 0] 406.7556 max(T) [0 0 0 1 0 0 0] 422.9998

Solving for solid region Print
GAMG:  Solving for h, Initial residual = 0.0002209446, Final residual = 8.658666e-11, No Iterations 1
Min/max T:min(T) [0 0 0 1 0 0 0] 402.9372 max(T) [0 0 0 1 0 0 0] 407.0184

Solving for solid region Kuehlkoerper
GAMG:  Solving for h, Initial residual = 0.000453174, Final residual = 1.116956e-10, No Iterations 1
Min/max T:min(T) [0 0 0 1 0 0 0] 402.3475 max(T) [0 0 0 1 0 0 0] 403.874

Solving for solid region LED_osram108_1a
GAMG:  Solving for h, Initial residual = 0.0002870728, Final residual = 1.144746e-10, No Iterations 1
Min/max T:min(T) [0 0 0 1 0 0 0] 403.2387 max(T) [0 0 0 1 0 0 0] 418.196
ExecutionTime = 647.52 s  ClockTime = 665 s

regIOobject::readIfModified() : 
    Re-reading object fvSolution from file "/home/attrmi/Desktop/Simulation/processor0/../system/Air/fvSolution"
regIOobject::readIfModified() : 
    Re-reading object fvSolution from file "/home/attrmi/Desktop/Simulation/processor0/../system/LED_osram108_1a/fvSolution"
regIOobject::readIfModified() : 
    Re-reading object fvSolution from file "/home/attrmi/Desktop/Simulation/processor0/../system/Print/fvSolution"
regIOobject::readIfModified() : 
    Re-reading object fvSolution from file "/home/attrmi/Desktop/Simulation/processor0/../system/LED_osram108_1b/fvSolution"
regIOobject::readIfModified() : 
    Re-reading object fvSolution from file "/home/attrmi/Desktop/Simulation/processor0/../system/Kuehlkoerper/fvSolution"
Time = 1260
Before Time 1260 OF reads the fvSolutions. But not before Time 1259 for example. Do you know how I can ensure that before every timestep the fvSolutions has been read. I tried with fileModificationChecking inotifyMaster but i got an error.

best regards Mike
S2.Mike is offline   Reply With Quote

Old   June 28, 2014, 19:34
Default
  #4
Senior Member
 
Joachim Herb
Join Date: Sep 2010
Posts: 650
Rep Power: 21
jherb is on a distinguished road
If you are running the code on a cluster this might be a problem of the file system. Are you sure, that the fvSolution file has been written (modified) before the next time step started?
jherb is offline   Reply With Quote

Old   June 29, 2014, 03:48
Default
  #5
Senior Member
 
Jens Höpken
Join Date: Apr 2009
Location: Duisburg, Germany
Posts: 159
Rep Power: 16
jhoepken is on a distinguished road
Send a message via Skype™ to jhoepken
I would suggest to write a function object that gets the fvSolution dictionary from the mesh (or runTime) and alters it there. Hence you don't have to take that detour over the filesystem.

An other option would be to change the datastructure that actually takes care of storing and returning these relaxation factors, which would be the more elegant way. Look for solutionControl and it's derivatives.

Jens
jhoepken is offline   Reply With Quote

Old   June 29, 2014, 14:14
Default
  #6
New Member
 
Join Date: Mar 2014
Posts: 5
Rep Power: 12
S2.Mike is on a distinguished road
Quote:
Originally Posted by jherb View Post
If you are running the code on a cluster this might be a problem of the file system. Are you sure, that the fvSolution file has been written (modified) before the next time step started?
I also tried to run on a 4 core desktop pc in parallel and it didnīt work. I read the fvSolution from a template and overwrite the old fvSolution using python. I checked the new fvSolutions by writing the new files every timestep to txt-files too. I think maybe OpenFOAM donīt get the signal the fvSolution is modified. I tried to change in source code of OF the file IOOutputFilter.H from "MUST_READ_IF_MODIFIED" to "MUST_READ" and it works, but i think thats not a "clean" solution for my problem.

regards, Mike
S2.Mike is offline   Reply With Quote

Old   June 30, 2014, 04:58
Default
  #7
New Member
 
Join Date: Mar 2014
Posts: 5
Rep Power: 12
S2.Mike is on a distinguished road
Quote:
Originally Posted by jhoepken View Post
I would suggest to write a function object that gets the fvSolution dictionary from the mesh (or runTime) and alters it there. Hence you don't have to take that detour over the filesystem.

An other option would be to change the datastructure that actually takes care of storing and returning these relaxation factors, which would be the more elegant way. Look for solutionControl and it's derivatives.

Jens

Hello Jens,

do you mean something like that http://foam.sourceforge.net/docs/cpp...0.html#details ? Do i have to write the new relaxFactors in the lib.so file?

The second option sounds better but I'm not sure if I have enought know how of the OF structure to do that. I think it takes too much time for me to until i know what's to do. I have to finish my thesis until august otherwise i can't start with my master in september.

regards,
Mike
S2.Mike is offline   Reply With Quote

Old   June 18, 2020, 13:20
Default
  #8
New Member
 
Suraj Pawar
Join Date: Sep 2013
Posts: 10
Rep Power: 12
sap_92 is on a distinguished road
Quote:
Originally Posted by S2.Mike View Post
I also tried to run on a 4 core desktop pc in parallel and it didnīt work. I read the fvSolution from a template and overwrite the old fvSolution using python. I checked the new fvSolutions by writing the new files every timestep to txt-files too. I think maybe OpenFOAM donīt get the signal the fvSolution is modified. I tried to change in source code of OF the file IOOutputFilter.H from "MUST_READ_IF_MODIFIED" to "MUST_READ" and it works, but i think thats not a "clean" solution for my problem.

regards, Mike
I am also doing the similar thing of altering fvSolution dictionary using Python. Currently, I am changing fvSolution dictionary after every 50 time steps. However, I would like to do it in real-time at every time step. How do your python scripts know that the OpenFoam simulation for one-time step has been completed? How are you communicating between Python and OpenFoam?
Thank you.
sap_92 is offline   Reply With Quote

Reply

Tags
fvsolution, relaxation factor, runtime modifiable, timestep

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Read fvSolution every timestep S2.Mike OpenFOAM Running, Solving & CFD 0 June 23, 2014 05:53
[Commercial meshers] fluentMeshToFoam multidomain mesh conversion problem Attesz OpenFOAM Meshing & Mesh Conversion 12 May 2, 2013 10:52
999999 (../../src/mpsystem.c@1123):mpt_read: failed:errno = 11 UDS_rambler FLUENT 2 November 22, 2011 09:46
Timestep selection Jindra Kosprdova CFX 9 April 28, 2005 06:41
timestep in transinet simulations caty CFX 1 April 18, 2005 19:54


All times are GMT -4. The time now is 12:50.