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

Initialization with previous solution: how?

Register Blogs Community New Posts Updated Threads Search

Like Tree11Likes
  • 1 Post By Astan
  • 3 Post By simrego
  • 5 Post By RobertHB
  • 1 Post By RobertHB
  • 1 Post By pooyanni

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 20, 2019, 10:07
Default Initialization with previous solution: how?
  #1
Member
 
Andrew
Join Date: Mar 2018
Posts: 82
Rep Power: 8
Astan is on a distinguished road
Hi guys I would like to kindly ask you an information how do you initialize a new simulation using a previously obtained convergence solution?

Thanks you in advance for the time spent in reading the post
Astan
granzer likes this.
Astan is offline   Reply With Quote

Old   February 20, 2019, 11:29
Default
  #2
Senior Member
 
anonymous
Join Date: Jan 2016
Posts: 416
Rep Power: 14
simrego is on a distinguished road
Hi!

It depends.
On the same mesh with the same BCs (for example changed material)? Just continue the run from the latestTime.
Same mesh with different BC? Modify the BC and continue from latestTime.
On a different mesh? Map the solution to the new mesh.
Or what is your problem exactly?
WaterHammer1985, granzer and Astan like this.
simrego is offline   Reply With Quote

Old   February 21, 2019, 03:46
Default
  #3
Senior Member
 
Robert
Join Date: May 2015
Location: Bremen, GER
Posts: 292
Rep Power: 12
RobertHB is on a distinguished road
Similar to what simrego wrote
Want to continue a converged solution? Change convergence criteria and startFrom latestTime; in the controlDict.
Want to continue a converged steady-state sim. in transient? Change the time scheme to something transient and startFrom latestTime; in the controlDict.
Want to change to BC's and see how you converged sim. changes? Copy the case, change to BC's in question and use mapFields from your converged timestep (use the -sourceTime option). Remember to use the cuttingPatches Option for patches where the BC's changed.
Want to run a scalarTransportFoam sim. with a previously converged velocity field? Copy the case, add a T file into your 0/ folder and map the converged vel. field (see above).
__________________
If you liked my answer to your question, please consider leaving a "Like" in return
RobertHB is offline   Reply With Quote

Old   February 21, 2019, 07:46
Default
  #4
Member
 
Andrew
Join Date: Mar 2018
Posts: 82
Rep Power: 8
Astan is on a distinguished road
Hi simrego and RobertHB, thanks you very much for your precise answers.

First question: how can i map the solution into a new mesh?

For example i run a steady simulation with a coarse mesh, then i want to do a new simulation on a fine mesh (same BC).
How can i use, as starting guess, the converged solution of the simulation on the coarse mesh?

Second questione: suppose i want to change BC, what are the mapFields and cuttingPatches options? When have i to use them?

I use simpleFoam solver in parallel.

Could you kindly list all the passages?, i have never done these operations before.

Thanks you very much, these information are really useful to me.

Astan
Astan is offline   Reply With Quote

Old   February 21, 2019, 08:29
Default
  #5
Senior Member
 
julien
Join Date: Dec 2018
Posts: 107
Rep Power: 8
julieng is on a distinguished road
Hello,

My guess is quite similar.
I use chtMultiRegionSimpleFoam in stationnary study. I compute the case, for example heating a solid by convection with hot air.
Transient cases with heating solid need sometimes to compute the case for time=hours!! with timestep around 1ms...

I want to use the "frozen flow" option, keep only the flow from the stationnary study and start the temperature calculation in transient mode.
I can use in the controlDict: "start from latest time" for the flow field
but I have to initialize the temperatures on the fluid and solid domains.

How can I do this?

Best regards
julieng is offline   Reply With Quote

Old   February 21, 2019, 10:57
Default
  #6
Member
 
Join Date: Mar 2016
Posts: 73
Rep Power: 10
sufjanst is on a distinguished road
You have to use the "mapFields" function. I think the syntax depends on your OF version.

If you type in "mapFields -help" you should get the syntax. If your geometry does not change (just different mesh), you can use the flag "-consistent".

Maybe you will also need a "mapFieldsDict" in your system. You should find it in a tutorial or online.
sufjanst is offline   Reply With Quote

Old   February 22, 2019, 04:33
Default
  #7
Senior Member
 
julien
Join Date: Dec 2018
Posts: 107
Rep Power: 8
julieng is on a distinguished road
Hello,

And for the chtMultiRegion case, do you have an idea for the procedure to initialize the flow with stationnary case and start the transient temperature calculation please?

I think that maybe I have to run another solver with only the flow solved not the chtMultiRegionSimpleFoam, what do you think?

Best regards
julieng is offline   Reply With Quote

Old   February 24, 2019, 15:54
Default
  #8
Senior Member
 
julien
Join Date: Dec 2018
Posts: 107
Rep Power: 8
julieng is on a distinguished road
Hello,


I succeed to calculate a transient case starting from a stationnary case with CHT solver. The case description is: a steel duct internal diameter = 200 mm, external diameter = 300 mm, lenght = 3000 mm, heated from the external surface h=40 W/(m2.K) Ta=500 K and cooling by an internal air flow at 2.5 m/s. The flow is calculated with komegaSST turbulent model, y+<1 without wall functions. After 1000 iter I have all the residual variables lower than 1E-5.



Start the transient case:

I copy the stationnary case to start the new transient case.

Keep only the last time calculated time = 1000 -> replace the file 1000/T with the 0/T used for the initial stationnary case in both fluid and solid folders.

Change fvSolution files, replace SIMPLE by PIMPLE + frozenFlow = on


PIMPLE
{
nOuterCorrectors 10;
nNonOrthogonalCorrectors 2;
nCorrectors 2;
outerCorrectorResidualControl
{
U
{
tolerance 0.0001;
relTol 0;
}
p
{
tolerance 0.0001;
relTol 0;
}
}
//pRefValue 0;
//pRefCell 0;
frozenFlow on;
}


Change controlDict file for transient case:


application chtMultiRegionFoam;

startFrom latestTime;

startTime 1000;

stopAt endTime;

endTime 2000;

deltaT 0.00001;

writeControl adjustableRunTime;

writeInterval 50;

purgeWrite 0;

writeFormat ascii;

writePrecision 9;

writeCompression off;

timeFormat general;

timePrecision 6;

runTimeModifiable yes;

maxCo 100;

// Maximum diffusion number
maxDi 10.0;

adjustTimeStep yes;


I increase the maxCo to 100, I see that I have timestep close to 0.15 s and maxDi <1.


The problem is that I found the temperature of stationnary case after only 17 s !!



# Time solid_to_fluid ext_solid
1000.13405 499.891939 497.178975
1000.2681 496.740847 494.689595
1000.40214 493.959894 492.484837
1000.53619 491.49687 490.53135
1000.67024 489.314543 488.800297
1000.80429 487.380704 487.26627
1000.93834 485.66697 485.906804
1001.07239 484.148245 484.702009
1001.20643 482.802311 483.634272
1001.34048 481.609489 482.687988
1001.47453 480.552349 481.849334
1001.60858 479.615448 481.106063
1001.74263 478.785102 480.44732
1001.87668 478.049188 479.86349
1002.01072 477.396962 479.346052
1002.14477 476.818906 478.887453
1002.27882 476.306582 478.481001
1002.41287 475.852514 478.120766
1002.54692 475.450077 477.801491
1002.68097 475.0934 477.51852
1002.81501 474.777278 477.267724
1002.94906 474.497101 477.045444
1003.08311 474.248781 476.848438
1003.21716 474.028695 476.673832
1003.35121 473.833635 476.51908
1003.48525 473.660753 476.381924
1003.6193 473.507529 476.260363
1003.75335 473.371727 476.152625
1003.8874 473.251367 476.057137
1004.02145 473.144693 475.972507
1004.1555 473.050149 475.897501
1004.28954 472.966356 475.831024
1004.42359 472.892091 475.772107
1004.55764 472.826272 475.719889
1004.69169 472.767937 475.67361
1004.82574 472.716236 475.632594
1004.95979 472.670415 475.596242
1005.09383 472.629805 475.564025
1005.22788 472.593813 475.535472
1005.36193 472.561915 475.510166
1005.49598 472.533645 475.487739
1005.63003 472.50859 475.467863
1005.76408 472.486386 475.450247
1005.89812 472.466706 475.434635
1006.03217 472.449266 475.420799
1006.16622 472.433809 475.408537
1006.30027 472.420111 475.39767
1006.43432 472.40797 475.38804
1006.56836 472.397212 475.379505
1006.70241 472.387677 475.371941
1006.83646 472.379227 475.365237
1006.97051 472.371738 475.359297
1007.10456 472.365101 475.354032
1007.23861 472.35922 475.349366
1007.37265 472.354008 475.345232
1007.5067 472.349389 475.341567
1007.64075 472.345295 475.33832
1007.7748 472.341668 475.335443
1007.90885 472.338453 475.332893
1008.0429 472.335604 475.330633
1008.17694 472.333079 475.32863
1008.31099 472.330842 475.326855
1008.44504 472.328859 475.325283
1008.57909 472.327103 475.323889
1008.71314 472.325546 475.322654
1008.84718 472.324166 475.32156
1008.98123 472.322943 475.32059
1009.11528 472.32186 475.31973
1009.24933 472.3209 475.318969
1009.38338 472.320049 475.318294
1009.51743 472.319295 475.317696
1009.65147 472.318627 475.317166
1009.78552 472.318035 475.316697
1009.91957 472.317511 475.31628
1010.05362 472.317046 475.315912
1010.18767 472.316634 475.315585
1010.32172 472.316269 475.315295
1010.45576 472.315946 475.315039
1010.58981 472.315659 475.314812
1010.72386 472.315405 475.31461
1010.85791 472.31518 475.314432
1010.99196 472.314981 475.314274
1011.12601 472.314804 475.314133
1011.26005 472.314648 475.314009
1011.3941 472.314509 475.313899
1011.52815 472.314386 475.313802
1011.6622 472.314277 475.313716
1011.79625 472.314181 475.313639
1011.93029 472.314095 475.313571
1012.06434 472.314019 475.313511
1012.19839 472.313952 475.313458
1012.33244 472.313893 475.313411
1012.46649 472.31384 475.313369
1012.60054 472.313794 475.313332
1012.73458 472.313752 475.313299
1012.86863 472.313716 475.31327
1013.00268 472.313683 475.313245
1013.13673 472.313654 475.313222
1013.27078 472.313629 475.313202
1013.40483 472.313607 475.313184
1013.53887 472.313587 475.313168
1013.67292 472.313569 475.313155
1013.80697 472.313553 475.313142
1013.94102 472.31354 475.313131
1014.07507 472.313527 475.313122
1014.20912 472.313517 475.313121
1014.34316 472.313512 475.313121
1014.47721 472.313511 475.313121
1014.61126 472.313511 475.313121
1014.74531 472.313511 475.313121
1014.87936 472.313511 475.313121
1015.0134 472.313511 475.313121
1015.14745 472.313511 475.313121
1015.2815 472.313511 475.313121
1015.41555 472.313511 475.313121
1015.5496 472.313511 475.313121
1015.68365 472.313511 475.313121


That seems absolutly impossible in a real life.
See my thermophysicalProperties file



object thermophysicalProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

thermoType
{
type heSolidThermo;
mixture pureMixture;
transport constIso;
thermo hConst;
equationOfState rhoConst;
specie specie;
energy sensibleEnthalpy;
}

mixture
{
specie
{
molWeight 50;
}

transport
{
kappa 20;
}

thermodynamics
{
Hf 0;
Cp 450;
}

equationOfState
{
rho 8000;
}
}





Any idea will be very helpfull for me



Best regards


Julien
julieng is offline   Reply With Quote

Old   February 25, 2019, 03:49
Default
  #9
Senior Member
 
Robert
Join Date: May 2015
Location: Bremen, GER
Posts: 292
Rep Power: 12
RobertHB is on a distinguished road
Quote:
Originally Posted by julieng View Post
Hello,

I succeed to calculate a transient case starting from a stationnary case with CHT solver. [...]

The problem is that I found the temperature of stationnary case after only 17 s !!

That seems absolutly impossible in a real life.
You are starting from a converged (Residual <= 1e-5) stationary case. The means that there is no difference between the current and the former iteration. Your velocity field does not change any more, neither does your temperature field. If you copy this solution and try to run it in a transient solver, what would happen? Nothing. You flow is allready at a stage where is does not change anymore. Should your simulation stop after 17 sec? Well it depends. Do it with pisoFoam and your solver will run until the endTime is reached. But pimpleFoam stops after 17 sec.? That is because pimpleFoam uses residualControl similar to simpleFoam. If your residual falls below this value the simulation stops.
granzer likes this.
__________________
If you liked my answer to your question, please consider leaving a "Like" in return
RobertHB is offline   Reply With Quote

Old   February 25, 2019, 18:58
Default
  #10
Senior Member
 
julien
Join Date: Dec 2018
Posts: 107
Rep Power: 8
julieng is on a distinguished road
Thank you for your answer Robert,


See my previous post, I wrote



"I keep only the last time calculated time = 1000 -> I replace the file 1000/T with the 0/T used for the initial stationary case in both fluid and solid folders."


So the initial temperatures for the transient case are well defined.


I found my mistake, I forgot to put Euler in the fvScheme instead of stationary!


Now the case runs for more than 10000 sec before reach the stationary state.


Problem resolved. Thank you
julieng is offline   Reply With Quote

Old   June 13, 2019, 15:48
Default
  #11
New Member
 
pooyan
Join Date: Mar 2013
Location: Boston, US
Posts: 6
Rep Power: 13
pooyanni is on a distinguished road
Quote:
Originally Posted by RobertHB View Post
Similar to what simrego wrote
Want to continue a converged solution? Change convergence criteria and startFrom latestTime; in the controlDict.
Want to continue a converged steady-state sim. in transient? Change the time scheme to something transient and startFrom latestTime; in the controlDict.
Want to change to BC's and see how you converged sim. changes? Copy the case, change to BC's in question and use mapFields from your converged timestep (use the -sourceTime option). Remember to use the cuttingPatches Option for patches where the BC's changed.
Want to run a scalarTransportFoam sim. with a previously converged velocity field? Copy the case, add a T file into your 0/ folder and map the converged vel. field (see above).

Is there a way to only map specific fields across the two cases? For example, If one wants to only use the velocity field data and not the pressure field from an incompressible case to a compressible case.

Regards
granzer likes this.
pooyanni is offline   Reply With Quote

Old   June 14, 2019, 04:54
Default
  #12
Senior Member
 
Zander Meiring
Join Date: Jul 2018
Posts: 125
Rep Power: 8
yambanshee is on a distinguished road
Quote:
Originally Posted by pooyanni View Post
Is there a way to only map specific fields across the two cases? For example, If one wants to only use the velocity field data and not the pressure field from an incompressible case to a compressible case.

Regards
Depends on your version of openFoam, but there is a -fields option in some of them. I believe with 1806 it would be -fields '(U)' and with OF5.x you may need to make use of the utility mapFieldsPar
yambanshee is offline   Reply With Quote

Reply


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
Segmentation Error during solution initialization using F_FLUX(f,t) Command Navier Stoke Fluent UDF and Scheme Programming 1 September 17, 2019 16:23
Initializing an unsteady solution from previous solution Mahdi_Kh FLUENT 0 May 31, 2016 09:12
Solution Initialization nausheensultana FLUENT 1 December 17, 2015 01:56
Solution initialization in case of couette flow dreamz FLUENT 0 March 15, 2015 09:49
Conduct initialization with a old mesh solution Jianfeng Zou FLUENT 1 September 12, 2007 07:06


All times are GMT -4. The time now is 13:07.