|
[Sponsors] |
Mass sink term in reactingFoam with scalarCodedSource |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
October 6, 2023, 12:54 |
Mass sink term in reactingFoam with scalarCodedSource
|
#1 |
Senior Member
Join Date: Dec 2021
Posts: 248
Rep Power: 5 |
Hey everyone,
I am running some reactions with reactingFoam, and I would like to add sink and source terms for several species. The final goal is to mimic a semipermeable membrane with a custom transfer rate (different from the one available with semiPermeableBaffleMassFraction ) but in a cellzone. So how can we have a massflowrate of one specific species leaving the domain? I have been trying to use scalarCodedSource in fvOptions to create a sink/source term: Code:
source_mass { type scalarCodedSource; name source_h2; scalarCodedSourceCoeffs { selectionMode cellSet; cellSet membrane; fields (H2); //name sourceTime; codeInclude #{ #}; codeCorrect #{ #}; codeAddSupRho #{ const scalarField& V = mesh_.V(); scalarField& massSource = eqn.source(); const labelList& cellIDs = cells(); forAll(cellIDs,i) { label cellI = cellIDs[i]; massSource[cellI] += -1e-2*V[cellI]; } #}; codeConstrain #{ #}; } sourceTimeCoeffs { } } But this affects only the mass fraction in a weird way, and it does not affect the other quantities such as pressure, velocity, temperature etc. Is there another field I could use to change the mass (I tried rho, but I got an error "not implemented"). I have a very poor understanding of all the coded options available in OpenFoam, so I will gladly hear any advice |
|
October 11, 2023, 02:06 |
|
#2 |
Member
Lukas
Join Date: Sep 2021
Posts: 36
Rep Power: 5 |
Hey what you want should be the mass source :
Code:
massSinkO2 { type massSource; selectionMode cellZone; cellZone membran; massFlowRate -0.1; // kg/s fieldValues { H2O 0; O2 1; T 352.15; U (0 0 0); } } Before it was something like this: Code:
massSource { type semiImplicitSource; active true; selectionMode cellZone; cellZone membran; volumeMode specific; sources { rho { explicit -0.1; implicit 0; } O2 { explicit -0.1; implicit 0; } } Last edited by Pappelau; October 11, 2023 at 02:12. Reason: adding info |
|
October 11, 2023, 04:36 |
|
#3 |
Senior Member
Join Date: Dec 2021
Posts: 248
Rep Power: 5 |
Thanks for your answer!
I did try massSource, but with OpenFoam v2306, and it raised me an error "unknown fvOption type" so I gave up and did not try with OpenFoam 11. I will give it a try then! The scalarSemiImplicitSource is also an option, but it results in the sum of mass fractions being more than 1 in a cell, so I am probably using it wrong. One more thing, what is the influence of the value for T in your massSource example? Since matter is leaving the domain, does it set a fixed value in the cellzone? or does it try to remove energy from the domain to match that temperature? I will try to find out by myself but if you have already some experience with it, I would be grateful for more information. |
|
October 13, 2023, 06:31 |
|
#4 |
Member
Lukas
Join Date: Sep 2021
Posts: 36
Rep Power: 5 |
Hey,
when working with species sum of mass fractions over 1 is common problem this can be fixed with limiters in fvSchemes (limitedLinear01). Another Point is the all time topic of using good meshes . Further species solves better with an allready preconverged case (Fix species for the first iterations). Next thing i observed is that you should use GAMG for Yi (seems to be most stable). The old implementation implicitSource lead to a temperatur increase if mass added and decrease if mass removed. For the new one (massSource) i can not say to much as i didnt work much with it since it is released. But it will NOT fix the temperature to this value . |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[waves2Foam] VRANS vs OpenFOAM Sink Term | Felix_Sp | OpenFOAM Community Contributions | 3 | August 5, 2023 06:43 |
gaussian distribution of momentum source term | kdot | Fluent UDF and Scheme Programming | 0 | August 3, 2023 17:03 |
How to add a sink term to the transport equation for the volume fraction in STAR CCM+ | ASLAN_1987 | STAR-CCM+ | 2 | March 8, 2021 12:47 |
How to add a sink term to the transport equation for the volume fraction | ASLAN_1987 | STAR-CCM+ | 2 | September 14, 2015 22:57 |
ATTENTION! Reliability problems in CFX 5.7 | Joseph | CFX | 14 | April 20, 2010 16:45 |