|
[Sponsors] |
August 12, 2020, 11:54 |
Manually adding source terms
|
#1 |
Senior Member
Gerry Kan
Join Date: May 2016
Posts: 348
Rep Power: 10 |
Howdy Foamers:
I have the following question. In a compressible solver I am modifying the FV formation of YEqn.H to include a source term based on a uniform but transient injection rate for species "i": Code:
fvScalarMatrix YiEqn ( fvm::ddt(rho, Yi) == fvOptions(rho, Yi) + rhoSp ); rhoSp[k] = rho[k] * mdot[k] / ( rho[k]*V[k] + mdot[k]*dt ) where k is the cell ID rho[k] is the density of cell k mdot[k] is the injection rate of species i into cell k V[k] is the volume of cell k dt is the current time step The total mass of species i injected into the domain can be recovered by summing the amount of it over all cells (it does in my case), and the mass fraction of species i is expected to be very small ( < 1e-7 ). As a test case I have the injection take place in a closed chamber, where upon the amount of species i introduced into the domain is known a priori, and verification is made by summing up the amount (not mass fraction) of species i at each time step. In other words, at each time step, the difference between the computed and expected mass of species i at each time step should be very, very small. What I have noticed, however, is that, as time goes on, this difference creeps up geometrically and at some point early on in the simulation, it could double or triple the expected injection mass. My hunch is that it might have something to do with implicit vs explicit source terms. But unfortunately I don't really know how to proceed. Could someone shed some light on this matter? Thanks in advance, Gerry. Last edited by Gerry Kan; August 12, 2020 at 13:48. |
|
September 14, 2020, 09:23 |
|
#2 |
Senior Member
Gerry Kan
Join Date: May 2016
Posts: 348
Rep Power: 10 |
It turned out the implementation was correct from the get go. My original boundary conditions were simply non-conserving and therefore it appeared as if I was losing mass. In the end, I had all wall in my test domain (except for the boundary where the source term is implemented) into cyclic and the problem was solved.
Gerry. |
|
May 18, 2022, 14:07 |
|
#3 |
Member
MNM
Join Date: Aug 2017
Posts: 69
Rep Power: 8 |
Hi Gerry,
While looking for an explicit source addition in the governing equation, I came across your post. I've minor query regarding the implementation.... Is there any specific reason why u opt to divide by cell volume ? rhoSp[k] = rho[k] * mdot[k] / ( rho[k]*V[k] + mdot[k]*dt ) |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[foam-extend.org] Problems installing foam-extend-4.0 on openSUSE 42.2 and Ubuntu 16.04 | ordinary | OpenFOAM Installation | 19 | September 3, 2019 18:13 |
[Other] How to use finite area method in official OpenFOAM 2.2.0? | Detian Liu | OpenFOAM Meshing & Mesh Conversion | 4 | November 3, 2015 03:04 |
[foam-extend.org] problem when installing foam-extend-1.6 | Thomas pan | OpenFOAM Installation | 7 | September 9, 2015 21:53 |
SparceImage v1.7.x Issue on MAC OS X | rcarmi | OpenFOAM Installation | 4 | August 14, 2014 06:42 |
OpenFOAM on MinGW crosscompiler hosted on Linux | allenzhao | OpenFOAM Installation | 127 | January 30, 2009 19:08 |