CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   Manually change boundary conditions during runs (https://www.cfd-online.com/Forums/openfoam-solving/168559-manually-change-boundary-conditions-during-runs.html)

Rojj March 24, 2016 08:47

Manually change boundary conditions during runs
 
Hi,

I am running a few cases based on the incompressible/simpleFoam/turbineSiting tutorial.

I need to run the simulation for several wind speed and same direction. The approach I am using is the following:

1 - Set Uref (reference velocity) to my first windspeed
2 - Run until convergence
3 - Change Uref to the next windspeed
4 - Run until convergence
5 - .....

The idea is that convergence should be faster for windspeeds after the first as I start from a flow that is already developed.

The issue I am having is that when I replace the Uref nothing seems to change. It seems that the first boundary condition is still being used and I have verified this by looking at the results in Paraview.

I am sure I am doing something wrong, but can't understand what.

Any suggestion? Thanks

Kina March 25, 2016 04:01

Well, the problem is the results folder structure in OF. If you start your calculation, OF uses the U data given in the /0 folder. When OF writes out the results, it creates a separate folder /1000 (for example) with the intermediate field value results of the calculation. If you now continue the calculation, OF will use this data to calculate the solution - still the same low velocity.
In short: you can't use your solution of the 5m/s calculation to speed up the 10m/s calculation. What you can do: change the line in controlDict from:
Code:

startFrom      latestTime;
to
Code:

startFrom      startTime;
This way, OF will use the /0 data (that you can modify during the runs) for each new simulation.

Cheers,
Alex

Rojj March 26, 2016 06:49

Thanks Alex.

Of course this means that the solution will be reinitialised?

Cheers

Kina March 26, 2016 11:51

Hi Ruggiero,

I guess you will have to start every calculation of yours from the initial conditions. I'd choose the following way:
- create a sample folder with all conditions set
- make x copies (for x number of runs) of the folder and name them folder1,folder2 etc. (for example)
- write a bash script that changes the directories in a loop and starts the calculation with potentialFoam / decompose / start.

This way you can leave the computer alone for some days and eventually just read out the results.
Your first idea, initialize higher velocity results with converged lower velocity solutions isn't gonna work as OpenFOAM then reads the lower velocity U field and tries to converge to this velocity instead of reading the new values.

Cheers
Alex

Rojj March 26, 2016 17:22

Thanks Kina for your advice.

lebc August 4, 2017 22:33

Hi Ruggiero,

I want to do exactly the same thing you want. Did you solve the problem, or just did what Alex suggested?

One way to do it is editing the U and other files from your latest time step, but there is one problem here... It probably is a huge file, and it would take a long time to edit it, so for me it seems unfeasible.

If you found another way please tell me!

Best Regards,
Luis

Rojj August 5, 2017 05:24

Hi Luis,

I ended up changing my whole workflow so I didn't have to run multiple simulations.

The last thing I was looking at though, was mapfields.

If you make it work, I would be very curious to know how you did it :-)


All times are GMT -4. The time now is 11:02.