|
[Sponsors] |
November 23, 2016, 09:57 |
Adapt InjectionModel
|
#1 | |
Senior Member
Join Date: Jan 2010
Location: Stuttgart
Posts: 150
Rep Power: 16 |
Hello all,
I want to do a steady spray simulation (simpleReactingParcelFoam) in OpenFOAM 3.0.1. I have a list of injection sources, which includes injection position, injection velocity vector, density, diameter and mass. I found the KinematicLookupTableInjection model, which looks perfect for this job. You can specify an input file with a list of x, y, z, u, v, w, d, rho and mDot entries, and with the correct settings each injector injects one parcel at the given position with the given velocity, density and diameter. The only difficulty seem to be the mass flow rate, mDot. Each injected parcel has the same mass, independent on the mDot value given in the lookup table. I then looked at the KinematicLookupTableInjection source, and sure enough, mDot is only used to calculate the total injected volume, and is not exposed to other parts of OpenFOAM: Quote:
I know that OpenFOAM usually injects every parcel with the same mass, and as I found out this is also the case for KinematicLookupTableInjection. I also found a possible way to change this behavior, by modifying the InjectionModel class, more specifically the InjectionModel::injectSteadyState function. newVolumeFraction might be set dynamically by calling a (new) function in KinematicLookupTableInjection that returns a volumeFraction based on mDot of the current parceI. However, it looks like I would need to recompile the complete OpenFOAM spray library when I change InjectionModel.C, as the file is included nearly everywhere. Is there an easy way to have a custom InjectionModel.C only for the modified version of KinematicLookupTableInjection, while leaving other injection models unchanged? Any other way to specify a custom mass per parcel is also appreciated! Note that I would like to inject ~180,000 parcels, so I guess using 180,000 separate injection models with ManualInjection and a customly calculated mass is not a good way. Kind regards and thanks for any help in advance! Chrisi |
||
May 24, 2017, 09:54 |
|
#2 |
Member
Ali
Join Date: Oct 2013
Location: Scotland
Posts: 66
Rep Power: 13 |
Hi Chrisi
I have found the same problem as you, and think it's a bit of a flaw! Did you get any further with your problem? I've added another column in the lookupTable called 'numParticles' which is supposed to give the number of parcels to inject. Although this works to give the total number of parcels each timestep, it doesn't give the correct number of parcels to inject on each injector which is what you mentioned too. I'd be interested to hear what you've done. Here is a link to a tutorial I made which shows the first steps of what I have done: http://www.tfd.chalmers.se/~hani/kur.../tutorial1.pdf The application is slightly different, but you can get the gist. Alasdair |
|
May 24, 2017, 14:38 |
|
#3 |
Senior Member
Join Date: Jan 2010
Location: Stuttgart
Posts: 150
Rep Power: 16 |
Hello Alasdair,
what I did is to copy the existing KinematicLookupTableInjection model. Rename it to e.g. MyKinematicLookupTableInjection and copy the function "setNumberOfParticles" from the upper class InjectionModel to the end into your new class "MyKinematicLookupTableInjection". This is overwritting the function "setNumberOfParticles" which is included in the InjectionModel class. Within MyKinematicLookupTableInjection class you can redefine this function "setNumberOfParticles" with your intended calculation based on massFlowRate so that not every parcel has the same mass. Kind regards Chrisi |
|
May 25, 2017, 11:24 |
|
#4 |
Member
Ali
Join Date: Oct 2013
Location: Scotland
Posts: 66
Rep Power: 13 |
Hi Chrisi
Thanks a lot for your idea. I'll give that a go. I think it's what I need. Good idea! regards Alasdair |
|
June 23, 2017, 11:53 |
|
#5 |
Member
Ali
Join Date: Oct 2013
Location: Scotland
Posts: 66
Rep Power: 13 |
Hi Chrisi
I tried your idea but I couldn't get it to work. Would you mind sharing your file for me to have a look at? This would be a great help to me! kind regards Alasdair |
|
August 18, 2017, 11:25 |
|
#6 |
Member
Ali
Join Date: Oct 2013
Location: Scotland
Posts: 66
Rep Power: 13 |
Hello folks
I have managed to adapt the injection model as suggested, however there is still one issue. In my injection model, I have the variable 'setNumberOfParticles', and this is currently a scalar. In the original injection model, you would set this to =2 (for example), and then each injection site would have 2 particles injected. However, in my case I have a scalarList, in the form of the kinematicLookupTable. This has a number corresponding to each cell, of how many particles to inject. So my question is, how can I turn nP into a scalarList, when it is currently a scalar? It shouldn't be too difficult, but I can't figure it out... setNumberOfParticles can be viewed in InjectionModel.C if you want to have a look at how it is defined. Alasdair |
|
September 1, 2017, 03:23 |
code
|
#7 |
Senior Member
Join Date: Jan 2010
Location: Stuttgart
Posts: 150
Rep Power: 16 |
Hello,
please find my example attached. Kind regards Chrisi |
|
September 5, 2017, 07:20 |
|
#8 |
Member
Ali
Join Date: Oct 2013
Location: Scotland
Posts: 66
Rep Power: 13 |
Hi Chrisi
Thanks a lot for your message and code. The key thing I was missing was the 'currentInjector_', as I could not select each injector separately without this. So thanks again! If anyone is interested I can post my working file up here. Alasdair |
|
March 4, 2018, 19:25 |
|
#9 |
Member
Join Date: Oct 2015
Posts: 63
Rep Power: 11 |
Hi Alasdair,
Can you post your working file? Also, I want to inject particles at different instants of time. Normally what we do is specify the SOI and then the desired particles are injected every time step. What I want to do is specify the time steps when particles must be injected. For instance, say 2 particles are injected in the first time step, 0 particles injected in the second, 5 particles in the third and so on. I can create a file which has the time steps and the particles injected in that time step. But how do I make the injection model read this? Any help is greatly appreciated!! Thanks! Scram_1 |
|
December 26, 2022, 15:44 |
|
#10 | |
Member
Huan Zhang
Join Date: Nov 2020
Posts: 55
Rep Power: 5 |
Quote:
Have you figured out how to read the lookup table at each timestep? I am facing the same problem as yours. Please give me a hint, very appreciate! Sincerely, Jasper |
||
December 26, 2022, 17:25 |
|
#11 |
Member
Ali
Join Date: Oct 2013
Location: Scotland
Posts: 66
Rep Power: 13 |
Please search around for my PhD Thesis, more info in that. Thanks
|
|
December 26, 2022, 17:26 |
|
#12 |
Member
Huan Zhang
Join Date: Nov 2020
Posts: 55
Rep Power: 5 |
||
December 26, 2022, 17:31 |
|
#13 |
Member
Ali
Join Date: Oct 2013
Location: Scotland
Posts: 66
Rep Power: 13 |
No probs, I remember how hard life is when scrolling through openfoam and on these forums.
|
|
December 26, 2022, 17:33 |
|
#14 |
Member
Huan Zhang
Join Date: Nov 2020
Posts: 55
Rep Power: 5 |
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Yplus adapt | rafash2 | FLUENT | 0 | June 12, 2016 07:25 |
Implementing a new InjectionModel / RunTimeSelection Problems | spv24 | OpenFOAM Programming & Development | 1 | October 8, 2011 11:47 |
Creating Own InjectionModel | spv24 | Main CFD Forum | 1 | October 8, 2011 11:46 |
How to adapt region? | gholamghar | FLUENT | 3 | April 5, 2009 22:57 |
How to adapt lower phase in 3 D pipe flow | K.Baker | FLUENT | 2 | July 21, 2007 15:19 |