|
[Sponsors] |
How to restart time in the middle of a simulation and write time directories to anoth |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
March 4, 2016, 15:12 |
How to restart time in the middle of a simulation and write time directories to anoth
|
#1 |
Senior Member
Thomas Oliveira
Join Date: Apr 2015
Posts: 114
Rep Power: 12 |
Dear Foamers,
I need to: (1) solve for the velocity field and then (2) use this velocity field for the transport of a scalar. I would like to do that in just one code, so that the mesh and velocity field don't need to be reloaded from step (1) to (2). A sketch of the idea is below: Code:
// as in simpleFoam.C while (simple.loop()) { // --- Pressure-velocity SIMPLE corrector { #include "UEqn.H" #include "pEqn.H" } turbulence->correct(); runTime.write(); } // as in scalarTransportFoam.C while (simple.loop()) { while (simple.correctNonOrthogonal()) { solve(fvm::ddt(T) + fvm::div(phi, T) - fvm::laplacian(DT, T) == fvOptions(T)); } runTime.write(); } Would you have any idea on how to achieve this or other solution? Any insight, references to documentation or examples, or threads in the forum I may have missed are welcome. Thank for your attention, |
|
March 4, 2016, 19:24 |
|
#2 |
Senior Member
Wouter van der Meer
Join Date: May 2009
Location: Elahuizen, Netherlands
Posts: 203
Rep Power: 18 |
hello t.oliveira,
I do not think this is gonna work, because simple foam is not a time dependent solver, time is more or less the name of the iteration steps variables and have nothing to to with the clock time. (steady state solver) In scalar transport you need this 'clocktime' so the two do not mix. The best way is to solve with simplefoam and use the converged velocity to calculate the transport of the scalar. hope this helps, Wouter |
|
March 7, 2016, 05:30 |
|
#3 |
Senior Member
Thomas Oliveira
Join Date: Apr 2015
Posts: 114
Rep Power: 12 |
Hi Wouter,
Thanks for your reply. I am aware that the "time" in simpleFoam represents iteration steps, and that's why I want to separate the "time" of simpleFoam from the real time of scalarTransportFoam. I do intend to solve with simplefoam and use the converged velocity to calculate the transport of the scalar. However, I am looking for a way of doing that withing the same program, so that I save the time that it takes to reconstruct the mesh and reading the velocity field from a file. Regards, Thomas |
|
March 7, 2016, 06:20 |
|
#4 |
Senior Member
Thomas Oliveira
Join Date: Apr 2015
Posts: 114
Rep Power: 12 |
At this moment, I am considering exploring one of these tracks:
i) use subCycling ii) create a new Foam::Time object iii) reset time using Foam::Time::setTime Any thoughts? |
|
March 8, 2016, 16:14 |
How to explicitly couple two solvers / use the results of one solver in another
|
#5 |
Senior Member
Thomas Oliveira
Join Date: Apr 2015
Posts: 114
Rep Power: 12 |
I got a satisfactory solution, but I am almost sure that there must be neater a way of doing it.
My solution involved: - creating another Foam::argList beside the standard args. The "case" in this other argList is a subdirectory of the original case directory. This allows the "time" directories of the velocity field solver to be written to a separate subdirectory: Code:
Foam::argList args(argc, argv); if (!args.checkRootCase()) { Foam::FatalError.exit(); } HashTable<string> directoryVel; directoryVel.set("case", "flowSolver"); Foam::argList argsVel(args, directoryVel); if (!argsVel.checkRootCase()) { Foam::FatalError.exit(); } Code:
// Runtime for the solution of velocity and pressure fields Foam::Time runTimeVel(Foam::word("controlDictVel"), argsVel); // Runtime for the solution of reactive transport Foam::Time runTime(Foam::Time::controlDictName, args); - running the first solver - mapping the velocity field obtained by the first solver into the velocity field used by the second solver. More tests are needed to verify if this is doing what I expect it to do and that I didn't mess up with pointers and references: Code:
// U = UVel would work just if U.mesh() == UVel.mesh() // U.dimensionedInternalField() = UVel.dimensionedInternalField() would work just if U.mesh() == UVel.mesh() U.dimensionedInternalField().dimensions() = UVel.dimensionedInternalField().dimensions(); U.dimensionedInternalField().Field<vector>::operator=(UVel.dimensionedInternalField()); // U.boundaryField() = UVel.boundaryField() would work if they had same patches forAll(UVel.boundaryField(), i) { Field<vector> source = UVel.boundaryField()[i]; Field<vector> target = U.boundaryField()[i]; target = source; } Best wishes, Thomas |
|
March 9, 2016, 11:45 |
|
#6 |
Senior Member
David Gaden
Join Date: Apr 2009
Location: Winnipeg, Canada
Posts: 437
Rep Power: 22 |
__________________
~~~ Follow me on twitter @DavidGaden |
|
Tags |
output file, timestep |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Unsteady simulation solution files in parallel | gunnersnroses | SU2 | 1 | December 15, 2015 14:28 |
Incompressible simulation | brugiere_olivier | SU2 | 2 | April 15, 2014 11:12 |
time step directories naming issue | Andrea_85 | OpenFOAM | 3 | April 3, 2014 09:38 |
Is there a way to write the time step size, time a | may | FLUENT | 6 | November 22, 2009 12:52 |
MFX output of simulation time | Richard | CFX | 0 | October 10, 2008 10:50 |