|
[Sponsors] |
Use flow rate calculated from an function object in an injection model |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
May 25, 2016, 18:45 |
Use flow rate calculated from an function object in an injection model
|
#1 |
New Member
Jialin Su
Join Date: Mar 2015
Posts: 4
Rep Power: 11 |
Dear Foamers,
I am trying to set up a new injection model. I need to decide the injection position based on the time varying flow rate through an orifice in the domain. In controldict we can set up a function object to calculate the flow rate through a cross section of the orifice and write it out to a file. But is there a way to pass the flow rate as a parameter into my new injection model so that I can use it to calculate the parcel injection position? In Fortran we can just store it in a variable and pass it on across subroutines. But it's much less straightforward in c++. I am really stumped. Could someone help me out? Thanks in advance. Callum |
|
May 26, 2016, 15:23 |
|
#2 |
Senior Member
Mahdi Hosseinali
Join Date: Apr 2009
Location: NB, Canada
Posts: 273
Rep Power: 18 |
Hi,
If you are developing your own solver I don't think there's a way to pass a function object variable to the solver as function objects will be compiled during the run time and solver is not aware of them. I think the best way would be to read the averaging area from an input dictionary and then implement that part in your solver. Averaging a part in your solver should not be hard. |
|
June 7, 2016, 10:52 |
|
#3 |
New Member
Jialin Su
Join Date: Mar 2015
Posts: 4
Rep Power: 11 |
Hiya, think I probably give the solution I found myself for this problem in case someone else has the need to do something similar.
Basically I just put the corresponding parts of code used to calculate the flow in function objects into my injection model. The functions that I put into my codes are: sampledSurfaceFaces getFieldValues combineFields The codes for these functions can be found in the original OpenFOAM codes. They just need to be adapted to the new code where they are used. In addition, the following header files are also needed: #include "interpolationCellPoint.H" #include "ListListOps.H" #include "Pstream.H" Hope this can be helpful to other users. Cheers. |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[Other] mesh airfoil NACA0012 | anand_30 | OpenFOAM Meshing & Mesh Conversion | 13 | March 7, 2022 18:22 |
Issues on the simulation of high-speed compressible flow within turbomachinery | dowlee | OpenFOAM Running, Solving & CFD | 11 | August 6, 2021 07:40 |
Overflow Error in Multiphase Modelling with Two Continuous Fluids | ashtonJ | CFX | 6 | August 11, 2014 15:32 |
injection problem | Mark New | FLUENT | 0 | August 4, 2013 02:30 |
Droplet Evaporation | Christian | Main CFD Forum | 2 | February 27, 2007 07:27 |