# Is it possible add a passive scalar to an already finished simulation?

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

 March 29, 2018, 15:00 Is it possible add a passive scalar to an already finished simulation? #1 Senior Member   Join Date: Mar 2018 Posts: 115 Rep Power: 8 I conducted a simulation in OpenFOAM of a flow over a cylinder. Now the simulation is finished. So I am in the step of postprocessing of the simulation and I decided to add a passive scalar to the domain. Can I solve for the passive scalar without restarting the simulation? Any ideas? zhangyan likes this.

 March 30, 2018, 05:15 #2 Member   Franco Marra Join Date: Mar 2009 Location: Napoli - Italy Posts: 68 Rep Power: 17 Dear Evren Linda, if I correctly understood your question, this is one of the exercise I do in my course for my students. It is rather simple. I start with a simulation of the lid driven cavity, the main OpenFoam tutorial you find in the user guide. When the solution is fully evolved and steady state reached, I have the velocity field corresponding to a vortex in the box. You can collect this velocity field and use it as a prescribed field in the simulation of the passive scalar. Of course you need to preserve the geometry of your case (maybe this is not strictly necessary, if you project this solution onto another mesh, but strange behaviors can arise). What I do is simply to create another case, for instance starting from tutorial \$FOAM_TUTORIALS/basic/scalarTransportFoam/pitzDaily where variable T is a passive scalar, and then replace geometry (blochMeshDict) with your geometry description and 0/U with the velocity field you like to use (by copying, say, yourcase/endtime/U in place of 0/U). An update of the boundary conditions of 0/T for the new geometry et voilà, you can have your passive scalar evolution. The possibility to reuse all fields in OpenFoam is one of the wonders I really like of this software. Feel free to contact me again if something is not clear. Good scalar Easter Eggs ! Franco excolade, anon_q and reverseila like this.

 March 30, 2018, 11:20 #3 Senior Member   Join Date: Mar 2018 Posts: 115 Rep Power: 8 Thank your very much dear Franco. If I really understand your answer, then I have to setup a case for scalarTransportFoam (say, named 'transportCase') and I have to replace the geometry (transport/constant/polyMesh) with my original case's polyMesh (cylinderCase/constant/polyMesh) and use cylinderCase's final solution as initial condition for transportCase. After doing that, that will solve for passive scalar only for the last time step(final solution of cylinderCase), so how can I solve for the entire time range? Do I need to setup transportCase for each time step of cylinderCase?

 March 30, 2018, 12:03 #4 Member   Franco Marra Join Date: Mar 2009 Location: Napoli - Italy Posts: 68 Rep Power: 17 Dear Evren Linda, I do not know your case. What I explained is valid for a steady case. This means that the new simulation "transportCase" will assume the flow field constant in time, solving only the transport of the scalar with this constant velocity field. If your flow is not steady, I am afraid it is almost impossible to solve a scalar transport without coupling it with the flow simulation: even if you would use all the saved time steps of your simulation, this will not be sufficient to get an equally accurate simulation of the transported scalar (at least in the case you did not save every computed time step). If your flow field reaches a steady state, you can use the last velocity field to initialize a simulation in time that only transport the scalar. scalarTransportFoam does not update the velocity field but use it to continuously update the position of the transported scalar. You can run it as long in time as required. Of course you need to setup initial (and boundary) conditions for your scalar variable. Regards, Franco anon_q likes this.

 March 30, 2018, 14:46 #5 Senior Member   Join Date: Mar 2018 Posts: 115 Rep Power: 8 Dear Franco thank you very much for your explanation. Now I understand well how things really work. I have a transient simulation so I need to restart it accordingly to account for the passive scalar. I can change pimpleFoam solver by adding the passive scalar transport equation, that works fine. But I believe, OpenFOAM solvers may have some features to allow adding such things without modifying the solver's code but unfortunately I do not know how. (I guess by adding something to controlDict) Can you please tell me how to setup a case (say for pimpleFoam) that will solve for a passive scalar? I would really appreciate your help. Last edited by anon_q; March 30, 2018 at 14:50. Reason: Fixing some typos

 March 30, 2018, 14:53 #6 Senior Member     Uwe Pilz Join Date: Feb 2017 Location: Leipzig, Germany Posts: 744 Rep Power: 15 If you want to use OF out of the box you may switch between pimpleFoam and scalartransportFoam. So you get a quasi transient solution for your scalar. It is need more computer power of course, but not in any case thayt is a problem. __________________ Uwe Pilz -- Die der Hauptbewegung überlagerte Schwankungsbewegung ist in ihren Einzelheiten so hoffnungslos kompliziert, daß ihre theoretische Berechnung aussichtslos erscheint. (Hermann Schlichting, 1950)

 March 30, 2018, 17:14 #7 Senior Member   Join Date: Mar 2018 Posts: 115 Rep Power: 8 Hello Uwe, I can't really understand what do you mean. Do you mean to start scalarTransportFoam for each time step of pimpleFoam?

March 31, 2018, 00:49
#8
Senior Member

Uwe Pilz
Join Date: Feb 2017
Location: Leipzig, Germany
Posts: 744
Rep Power: 15
Quote:
 Originally Posted by Evren Linda Hello Uwe, I can't really understand what do you mean. Do you mean to start scalarTransportFoam for each time step of pimpleFoam?
In principle. Of course not for every time step but for a time step small enough to cover the transient part of the flow.
__________________
Uwe Pilz
--
Die der Hauptbewegung überlagerte Schwankungsbewegung ist in ihren Einzelheiten so hoffnungslos kompliziert, daß ihre theoretische Berechnung aussichtslos erscheint. (Hermann Schlichting, 1950)

 April 3, 2018, 03:06 #9 Senior Member   Tom Fahner Join Date: Mar 2009 Location: Breda, Netherlands Posts: 638 Rep Power: 32 Hi, Check this explanation on the scalar transport functionObject. This allows you to solve for a passive scalar in any solver that works with function objects. Regards, Tom