Use a steady state result as an initial condition to a transient simulation

A subforum specific to the development of the OpenFoam-based workbenches ( Cfd https://github.com/qingfengxia/Cfd and CfdOF https://github.com/jaheyns/CfdOF )

Moderator: oliveroxtoby

Post Reply
ReneSci
Posts: 23
Joined: Thu Aug 18, 2022 4:30 pm

Use a steady state result as an initial condition to a transient simulation

Post by ReneSci »

I have read that it sometimes would be a benefit to use the result obtained from a steady state calculation as an initial condition for a transient calculation.

This should be possible by using "latestTime" as startTime ?

However, if I change the setting from a "steady state" to some "transient" settings and press "write" under "case settings" all the steady state results are wiped away (which also normally makes sense).

Would it be possible to create some functionality which makes it "easy" to re-use a set of simulation results (i my case stored in 64 sub-folders - one for each processor ! ) either to continue a transient simulation or use the steady state result as a initial condition for a transient calculation ?

- Hopes it makes sense

/Rene'
User avatar
oliveroxtoby
Posts: 837
Joined: Fri Dec 23, 2016 9:43 am
Location: South Africa

Re: Use a steady state result as an initial condition to a transient simulation

Post by oliveroxtoby »

ReneSci wrote: Fri Apr 28, 2023 10:38 am Would it be possible to create some functionality which makes it "easy" to re-use a set of simulation results (i my case stored in 64 sub-folders - one for each processor ! ) either to continue a transient simulation or use the steady state result as a initial condition for a transient calculation ?
It would certainly be possible. Someone would just have to do it! ;-)
User avatar
Raedchen_im_System
Posts: 95
Joined: Sun Oct 27, 2019 5:22 pm
Location: In der Nähe von Stuttgart
Contact:

Re: Use a steady state result as an initial condition to a transient simulation

Post by Raedchen_im_System »

ReneSci wrote: Fri Apr 28, 2023 10:38 amThis should be possible by using "latestTime" as startTime ?
In my opinion this is an advanced feature and should not be included in "Basic Features" of CfdOf. If you want to do an analysis of this kind, you can easily edit the controlDict file. There are many video tutorials showing how to edit the input files for OpenFoam. Have fun with these tutorials and tell us about your success.
ReneSci
Posts: 23
Joined: Thu Aug 18, 2022 4:30 pm

Re: Use a steady state result as an initial condition to a transient simulation

Post by ReneSci »

I can't get it to work.

One of the problems is that when I change the set of parameters needed to get the transient simulation and press "save" all directories under "case" and "meshCase" are erased and re-written - and thereby also my steady-state result :-(
User avatar
Diplodok
Posts: 15
Joined: Wed May 24, 2023 6:36 am

Re: Use a steady state result as an initial condition to a transient simulation

Post by Diplodok »

oliveroxtoby wrote: Mon May 01, 2023 7:10 pm
ReneSci wrote: Fri Apr 28, 2023 10:38 am Would it be possible to create some functionality which makes it "easy" to re-use a set of simulation results (i my case stored in 64 sub-folders - one for each processor ! ) either to continue a transient simulation or use the steady state result as a initial condition for a transient calculation ?
It would certainly be possible. Someone would just have to do it! ;-)
Dear Sir,
Hello,
I have similar quiestion.

openFoam 2206
FreeCAD 0.20.2
CFDof - latest - do not know where the version can be found

I tried to continue transient simulation from the latestTime and this was unsuccessful.

Then I carried out some investigation.

1. I made simulation to the exact time, i.e. 0.0002 s
2. I changed the startFrom in the controlDict to latestTime
3. I clicked on Run button in the CFDof. (I do not use Write Case. Just Run)
Simulation started, however from Time=0
I checked this a few times - simulation starts from Time=0
This is shown in Report view window. Checking the first output of the simulation also confirms this - simulation starts from initial conditions.

Then I returned the value of startFrom in the controlDict to startTime keyword, while set startTime to 0.0002 s
In this case, Report view window shows Time=0.0002.
However, this simulation was not completed:
0.0: Solver started
100.1: OpenFOAM fatal error: [7] OpenFOAM fatal error: --> FOAM FATAL ERROR: OpenFOAM fatal error: OpenFOAM fatal error: [6] OpenFOAM fatal error: OpenFOAM fatal error: [7] OpenFOAM fatal error: [4] OpenFOAM fatal error: )
101.3: Simulation exited with error
In the Report view:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

11:01:21 Create mesh for time = 0.0002

11:01:21
PIMPLE: Operating solver in PISO mode

Reading thermophysical properties

Selecting thermodynamics package
{
type heRhoThermo;
mixture pureMixture;
specie specie;
equationOfState perfectGas;
thermo hConst;
transport sutherland;
energy sensibleEnthalpy;
}

11:01:24 [0]
[0]
[0] --> FOAM FATAL ERROR: (openfoam-2206)
[7]
[5]



[0]
[4]
[7]
[5]
cannot find file "R:/case/processor0/0.0002/p"
Then I have found in the Report view earlier:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time



Decomposing mesh

Removing 8 existing processor directories
11:00:36 Create mesh
So, solver deletes previous data.
By the way, this also happens when latestTime is used.

I am new in openFoam and CFDof.
Therefore, probably, I should do something else to make continuation of the simulation correlctly.
I would be very grateful if someone could help me to resolve this isue.
Thank you in advance.

Sincerely,
Andrey
Last edited by Diplodok on Wed May 24, 2023 9:37 am, edited 1 time in total.
User avatar
markinca
Posts: 56
Joined: Sun Apr 30, 2023 2:41 pm

Re: Use a steady state result as an initial condition to a transient simulation

Post by markinca »

I have not tried this but I don't see why it would not work:
  • Run the SS case first without parallelization (i.e. one output folder)
  • Change the "Input Case Name" in the solver parameters to something other than "case" (e.g. "case2")
  • Change the simulation type to Transient (plus any other relevant parameters)
  • Write the solver files to the new folder, the old results should remain in the old folder
  • Copy the SS results from the old final result case folder into the new case folder 0 for the transient run
  • Run the transient case (without rewriting files)

If I get a chance today, I will try this.
User avatar
Diplodok
Posts: 15
Joined: Wed May 24, 2023 6:36 am

Re: Use a steady state result as an initial condition to a transient simulation

Post by Diplodok »

markinca wrote: Wed May 24, 2023 2:50 pm I have not tried this but I don't see why it would not work:
  • Run the SS case first without parallelization (i.e. one output folder)
  • Change the "Input Case Name" in the solver parameters to something other than "case" (e.g. "case2")
  • Change the simulation type to Transient (plus any other relevant parameters)
  • Write the solver files to the new folder, the old results should remain in the old folder
  • Copy the SS results from the old final result case folder into the new case folder 0 for the transient run
  • Run the transient case (without rewriting files)

If I get a chance today, I will try this.
Hi,
Is it important to start first case unparallel for continuation? :shock:
In my case, this will lead to incredible long duration of the simulation...

Best regards,
Andrey
User avatar
markinca
Posts: 56
Joined: Sun Apr 30, 2023 2:41 pm

Re: Use a steady state result as an initial condition to a transient simulation

Post by markinca »

If the first run is in parallel, you will get N output file folders (processor0 to processor#). You would then need to combine them into one file for each field so they could go into the 0 folder for the new run. It should be possible to combine them, I just don't have the details on how to do that. You would need to look at the Openfoam output file format and see how they are organized.

Again, I have never done this but it should be possible with some work.
User avatar
Diplodok
Posts: 15
Joined: Wed May 24, 2023 6:36 am

Re: Use a steady state result as an initial condition to a transient simulation

Post by Diplodok »

markinca wrote: Wed May 24, 2023 3:27 pm If the first run is in parallel, you will get N output file folders (processor0 to processor#). You would then need to combine them into one file for each field so they could go into the 0 folder for the new run. It should be possible to combine them, I just don't have the details on how to do that. You would need to look at the openFOAM output file format and see how they are organized.

Again, I have never done this but it should be possible with some work.
It seems I did it
It can be made out of CFDof but directly in the OpenFOAM
Following command should be run in OpenFOAM terminal
reconstructPar -case <CaseDir> -latestTime
Here <CaseDir> - full path to the case data

After completion corresponded modification in the controlDict to start from latestTime

It works

Thank you very much for!

Best regards,
Andrey
Post Reply