CFD Online Logo CFD Online URL
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

Mass source for simpleFoam-style solvers

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

LinkBack Thread Tools Search this Thread Display Modes
Old   December 15, 2017, 01:05
Default Mass source for simpleFoam-style solvers
New Member
Join Date: Jun 2011
Posts: 18
Rep Power: 12
timbojones is on a distinguished road
Hello everyone,

I've implemented a mass source term and an associated momentum source term in simpleFoam to simulate a nozzle injection that I don't want to resolve on the grid. The mass source is implemented as a source in pEqn and the momentum source in UEqn. The sources are set via custom fields and explicit source terms in these equations.

I'd like to accomplish the same task using fvOptions. For the momentum source, implementation is very straightforward. However, to my understanding, the mass source should show up in pEqn, but it's not a pressure source. That is it's not a semiImplicitScalarSource on field(p).

My question is this. Has anyone implemented a mass source in simpleFoam using fvOptions? Alternatively, if you've done it as custom solver with source in pEqn, is there a trick to getting this to work smoothly? Any help or sharing would be greatly appreciated!


Last edited by timbojones; December 15, 2017 at 01:07. Reason: Fixed minor grammatical errors
timbojones is offline   Reply With Quote

Old   April 13, 2018, 05:52
New Member
Join Date: Oct 2016
Posts: 2
Rep Power: 0
benjamintu is on a distinguished road
hey timbo, trying more or less the same stuff. In my case I can't use a constant source term, therefore I'm dependent on fvOptions coded source.

As you said, to remove mass one has to add a source term in pEqn, because continuity equations is included in there...

I have seen stable running and validated code using specific mass flow (kg/m3/s) as source term on RHS of pEqn (pEqn was similar to the one used in rhoReactingFoam), but this was not implemented with fvOptions...

My problem is that coded source seems not to know the field p (in contrary to rho, Yi-name, h). Looking in the sourcecode of rhoReactingFoam fvOptions is called like that:

fvOptions(psi, p_rgh,

in pEqn.H compared to that:

fvOptions(rho, Yi)

in YIEqn.H, might this be the diffrence causing trouble? Anyways would appreciate any help
benjamintu is offline   Reply With Quote

Old   November 28, 2019, 15:32
New Member
Carl Birger Jenssen
Join Date: Feb 2017
Location: Trondheim, Norway
Posts: 1
Rep Power: 0
carlbirger is on a distinguished road

I have exactly the same problem as timbojones. I want to add a mass source to simpleFoam using fvOptions. Did anybody succeed in doing this? I understand that there is a bit of programming involved to enable a source term to the P equation.

Alternatively, what is the simplest way of simulating a nozzle injection with a source term?

I would think that a mass source is one of the most basic things you woud want to include in a simulation, so this should be a question of general interest.

Any help or suggestion would be appreciated.

Carl Birger

PS. There is also this thread:

Add a mass source/sink to simpleFoam

But they point at a solution for fireFoam which from what I understand is a density based solver, for which the problem is much simpler.
carlbirger is offline   Reply With Quote


fvoptions, mass source, momentum source, simplefoam

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
[] Error creating ParaView-4.1.0 OpenFOAM 2.3.0 tlcoons OpenFOAM Installation 13 April 20, 2016 18:34
Problem compiling a custom Lagrangian library brbbhatti OpenFOAM Programming & Development 2 July 7, 2014 12:32
[swak4Foam] build problem swak4Foam OF 2.2.0 mcathela OpenFOAM Community Contributions 14 April 23, 2013 14:59
pisoFoam compiling error with OF 1.7.1 on MAC OSX Greg Givogue OpenFOAM Programming & Development 3 March 4, 2011 18:18
Problem with Mass source, Momentum source theory diffo Fluent UDF and Scheme Programming 0 August 20, 2009 07:10

All times are GMT -4. The time now is 22:54.