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

Use flow rate calculated from an function object in an injection model

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By ttjs3

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 25, 2016, 17:45
Default 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
ttjs3 is on a distinguished road
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
ttjs3 is offline   Reply With Quote

Old   May 26, 2016, 14:23
Default
  #2
Senior Member
 
Mahdi Hosseinali
Join Date: Apr 2009
Location: NB, Canada
Posts: 273
Rep Power: 18
anishtain4 is on a distinguished road
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.
anishtain4 is offline   Reply With Quote

Old   June 7, 2016, 09:52
Default
  #3
New Member
 
Jialin Su
Join Date: Mar 2015
Posts: 4
Rep Power: 11
ttjs3 is on a distinguished road
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.
superkelle likes this.
ttjs3 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
[Other] mesh airfoil NACA0012 anand_30 OpenFOAM Meshing & Mesh Conversion 13 March 7, 2022 17:22
Issues on the simulation of high-speed compressible flow within turbomachinery dowlee OpenFOAM Running, Solving & CFD 11 August 6, 2021 06:40
Overflow Error in Multiphase Modelling with Two Continuous Fluids ashtonJ CFX 6 August 11, 2014 14:32
injection problem Mark New FLUENT 0 August 4, 2013 01:30
Droplet Evaporation Christian Main CFD Forum 2 February 27, 2007 06:27


All times are GMT -4. The time now is 03:04.