CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Community Contributions

[Other] Multi species mass transport library [update]

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

Like Tree37Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 10, 2018, 23:44
Smile fixedFlux boundary condition uploaded ?
  #101
Member
 
Haomin Yuan
Join Date: Jan 2012
Location: Madison, Wisconsin, USA
Posts: 59
Rep Power: 11
yhaomin2007 is on a distinguished road
Hi, all Foamers,

I just want to follow up this thread.
Is the fixedFlux boundary condition available now ??

It is very important for the test cases in the paper.

Thank you.


Quote:
Originally Posted by openfoamstudents View Post
Dear novyno, dear community,


Great work and thanks for this library!

In your publication in Computer Physics Communications, you mention a generic boundary condition for species mass flux, called fixedFlux.
Could you please post it here? I would like to use it for part of my bachelor thesis on silicium wafer processing.

I am trying to implement a simple surface reaction boundary with a sticking coefficient 0..1 (only valid for Ficks law, similar to the boundary fixedGradient):

// Get Species name
const word specie_(dimensionedInternalField().name());

// Get p, T, rho, moleFrac, massFrac, Alpha,diffAlpha, molarWeight
const fvPatchField<scalar>& p = patch().lookupPatchField<volScalarField, scalar>("p");
const fvPatchField<scalar>& T = patch().lookupPatchField<volScalarField, scalar>("T");
const fvPatchField<scalar>& rho = patch().lookupPatchField<volScalarField, scalar>("rho");
// const fvPatchField<scalar>& massFrac = patch().lookupPatchField<volScalarField, scalar>(specie_); // Mass fraction
const fvPatchField<scalar>& moleFrac = patch().lookupPatchField<volScalarField, scalar>("x_"+specie_); // Mole fraction
const fvPatchField<scalar>& diffAlpha = patch().lookupPatchField<volScalarField, scalar>("D_"+specie_); // Diffusion constant
const scalar molarWeight(molecularWeights[specie_]); // kg/mol

// Constants
const scalar R(8.3144621); // J/(K*mol) = kg^2*m^2*s^-2*kgmol^-1
const scalar twoPi(6.283185307179586);

gradient() = -stickingCoeff_*p*moleFrac / (sqrt(twoPi*molarWeight*R*T) * (rho*diffAlpha));

Unfortunately, in every second iteration, this formula produces a gradient only containing zeros "gradient() 25{-0}" which probably means, moleFrac is exactly zero (unphysical I think).
Can somebody help me out please?

Thanks a lot,
OpenFoamStudent
yhaomin2007 is offline   Reply With Quote

Old   June 30, 2018, 00:27
Default
  #102
New Member
 
Gao Zhengwei
Join Date: Jan 2017
Location: HangZhou, P.R.China
Posts: 10
Rep Power: 6
Gaozw is on a distinguished road
Quote:
Originally Posted by niklas View Post
Im in the process of updating your library to 2.1.x and I have a small question.

For instance, the correct routine in Fick.C show that there is a slight chance of
making an easy mistake, (without knowing probably)

the inert species mass fraction is grabbed from thermo like this.
// Calculate inert species
volScalarField& yInert = thermo_.composition().Y()[inertIndex_];

which is set to 1 - sum of the first N-1 species, like this
yInert = 1 - yt;

since yt is just calculated in the loop
forAll(this->D_, i)

where D is
D_.setSize(species().size()-1);

and it gets the name
"D_" + species()[i],

so D is 1 less than the number of species

Now...if the inert specie is not placed in the last position in the species list,
the inertIndex will point to the wrong specie and it will use the inertspecie to calculate yt...
so basically everything will be a mess.

why dont you do it like in the YEqn.H where you check the name of the species to see if its the same as
the inert specie name
if (Y[i].name() != inertSpecie)
or
if (i != inertIndex_)

to prevent people from making this mistake and allow the inert specie to be placed anywhere in the species list.

just a thought,
N
Hi, everyone!
I am new here and trying to modfity this code. Nikilas provided a good suggestion and I noticed that some codes are needed to be modified to ensure the consistence.

In file multiSpeciesTransportModel.C and multiSpeciesTransportModel.H:

I added a private member inertSpecie_ , which is initialized as

inertSpecie_(thermo.lookup("inertSpecie")),

In the function correct() in file Fick.C, a slight change is made:

[I] volScalarField yt = 0.0*thermo_.composition().Y(0);
surfaceScalarField nt = turbulence_.phi();
label inertIndex = -1;

forAll(species(), i)
{
volScalarField& yi = thermo_.composition().Y(i);
surfaceScalarField& ni = n_[i];

if (yi.name() != inertSpecie_)
{
tmp<fv::convectionScheme<scalar> > mvConvection
(
fv::convectionScheme<scalar>::New
(
mesh_,
fields,
turbulence_.phi(),
mesh_.divScheme("div(phi,Yi_h)")
)
);

if (mesh_.relaxField("Yi"))//Mohsen
{
yi.storePrevIter();
}

tmp<fvScalarMatrix> yEqn
(
fvm::ddt(thermo_.rho(), yi)
// + fvm::div(turbulence_.phi(), yi, "div(phi,Yi_h)")
+ mvConvection->fvmDiv(turbulence_.phi(), yi)
- fvm::laplacian(D_[i],yi, "laplacian(D,Yi)")
==
Sy_
);

eqnResidual = solve(yEqn() , mesh_.solver("Yi")).initialResidual();
maxResidual = max(eqnResidual, maxResidual);

if (mesh_.relaxField("Yi"))//Mohsen
{
yi.relax(mesh_.fieldRelaxationFactor("Yi"));//Mohsen
}

yi.max(0.0);
// yi.min(1.0);

ni = yEqn().flux();

nt -= ni;
yt += yi;
}
else
{
inertIndex = i;
}
}

// Calculate inert species
volScalarField& yInert = thermo_.composition().Y()[inertIndex];
yInert = 1 - yt;
forAll(yInert.boundaryField(), boundaryI)
{
forAll(yInert.boundaryField()[boundaryI], faceI)
{
yInert.boundaryField()[boundaryI][faceI] = 1- yt.boundaryField()[boundaryI][faceI];
}
}
yInert.max(0.0);
n_[inertIndex] = nt;

updateMolarFractions();

return maxResidual;


Note that, the inertIndex is not the same inertIndex_ in multiSpeciesTransportModel.H

I hope this will be helpful.
Gaozw is offline   Reply With Quote

Old   February 17, 2019, 19:43
Default Update of library to OpenFOAM 6
  #103
Senior Member
 
Joachim Herb
Join Date: Sep 2010
Posts: 624
Rep Power: 19
jherb is on a distinguished road
Hello,


I have created a non-complete update of the library to OpenFOAM-6.



Main changes:

- Handling of references, which are now const
- The definition of turbulence.phi() seems to have changed: It is now a volume flux, but a mass flux is need, so that has been added as additional internal variable
- Chemistry has changed so much, that I have (hopefully temporarily) disabled it.

It compiles and runs (TM). I just tested it with the testCase given in the original library without chemistry.



Any comments/improvements are welcome.
Attached Files
File Type: gz multiSpeciesMassTransportLibrary_OF6.tar.gz (58.8 KB, 89 views)
jherb is offline   Reply With Quote

Old   February 18, 2019, 18:14
Default
  #104
Senior Member
 
Joachim Herb
Join Date: Sep 2010
Posts: 624
Rep Power: 19
jherb is on a distinguished road
Updates:


- To use transport const, thermo hConst change the commented lines in multiSpeciesTransportModels.C
from
Code:
// makeMultiSpeciesTransportModel(Fick, gasThermoPhysics);
 ...
to


Code:
makeMultiSpeciesTransportModel(Fick, constGasHThermoPhysics);
 ...
- If set up a test case, based on the one provided with the library, to a volume with all walls (and empty front and back) with just two different gases setup by setFields: in the top half only H2O, in the bottom half only N2. After start of the simulation, the two gases mix and the temperature starts to diverge from the starting 300 K more and more per time step.






To start the attached test case, issue the following commands:
Code:
blockMesh
setFields
modifiedReactingFoam
So I guess, this is not a physical result. The picture above was created using OpenFOAM 2.3.1. The version for OpenFOAM 6 produces results looking similar, but the temperature range is even larger (from 260 K to 326 K) for t = 0.5 s


Quote:
Originally Posted by jherb View Post
Hello,


I have created a non-complete update of the library to OpenFOAM-6.



Main changes:

- Handling of references, which are now const
- The definition of turbulence.phi() seems to have changed: It is now a volume flux, but a mass flux is need, so that has been added as additional internal variable
- Chemistry has changed so much, that I have (hopefully temporarily) disabled it.

It compiles and runs (TM). I just tested it with the testCase given in the original library without chemistry.



Any comments/improvements are welcome.
Attached Images
File Type: png mixing_T_multilib.png (11.5 KB, 368 views)
Attached Files
File Type: gz modifiedReactingFoam_pure_diff.tar.gz (6.1 KB, 55 views)
Krapf and Ramzy1990 like this.
jherb is offline   Reply With Quote

Old   April 26, 2019, 10:39
Default
  #105
New Member
 
NKR
Join Date: Jan 2019
Posts: 2
Rep Power: 0
nivethanakumar is on a distinguished road
hello mhsn, how did u solve that error /usr/bin/ld: cannot find -llduSolvers.
nivethanakumar is offline   Reply With Quote

Old   May 14, 2019, 11:25
Default
  #106
Member
 
Join Date: Mar 2016
Posts: 73
Rep Power: 7
sufjanst is on a distinguished road
Hello everyone,


thank you so much for sharing the library! This is very helpful!


One thing I didn't understand is:

There are models to calculate the diffusion-coefficient. What happens when I want to use Schmidt-diffusion for example? The diffusion-coefficient is calculated with mu, density and the schmidt-number.

Are all models for calculating the Diffusion-coefficient like champan-enskog disabled for this model? Or are these different diffusion-coefficients?


Thank you very much!
sufjanst is offline   Reply With Quote

Old   May 19, 2019, 18:16
Default
  #107
Senior Member
 
Joachim Herb
Join Date: Sep 2010
Posts: 624
Rep Power: 19
jherb is on a distinguished road
You set the diffusion model in the file constant/transportProperties, e.g.
Code:
multispeciesTransportModel SchmidtNumber<constGasHThermoPhysics>;
This means, that the diffusion is calculated using a Schmidt Number. In the correspoding file multiSpeciesMassTransportLibrary/multiSpeciesTransportModels/SchmidtNumber/SchmidtNumber.C it the number is read (also from transportProperties):
Code:
    Sc_(IOdictionary::lookupOrDefault<scalar>("Sc", 1))
It is used in same file:
Code:
            this->D_[i] = this->turbulence_.muEff() / Sc_;
and then this diffusion constant is used to calculate the diffusion of the species fractions.


If you use another mode, e.g. Fick, then you have to set
Code:
multispeciesTransportModelFick<gasHThermoPhysics>;
Then the diffusion constants for the different species are calculated based on the molar fractions.



Have a look at the README.txt file in the archive and the pdf somewhere in this thread.
jherb is offline   Reply With Quote

Old   August 23, 2019, 10:53
Default
  #108
Member
 
Thamali
Join Date: Jul 2013
Posts: 67
Rep Power: 10
Thamali is on a distinguished road
Hi Jherb and all,

Thanks a lot for all who contributed to this library.
If you have updated the solver for OpenFOAM6 with chemistry, I would be grateful to have it.
Otherwise I will try do it on my own.

Thanks in advance.
Thamali
Thamali is offline   Reply With Quote

Old   August 25, 2019, 16:06
Default
  #109
Senior Member
 
Joachim Herb
Join Date: Sep 2010
Posts: 624
Rep Power: 19
jherb is on a distinguished road
You can find the current state of the port at https://github.com/jmozmoz/OFdevelopments


There are still bugs in treating the passive species. But based on a talk "Development and verification of a multi-species gas transport solver" by Vijaya Kumar G et al., at the OpenFOAM Workshop at Duisburg the problems with temperature differences due to diffusion should be solve.
clapointe likes this.
jherb is offline   Reply With Quote

Old   March 24, 2021, 02:44
Default Tritium transport equation
  #110
New Member
 
Pratyush Kumar
Join Date: Jun 2019
Location: Mumbai
Posts: 18
Rep Power: 4
PRATBHARAT is on a distinguished road
Dear Valerio,

First of all, I would like to thank you for this updated library. I want to use this library for tritium transport using the Champan-Enskog model for diffusion coefficient and Fick’s model for flux modelling in a porous media domain. I am not interested in reaction mechanisms for now. As per my understanding to use it on some membrane domain, I should modify the solver and change the value of porosity and tortuosity in the respective libraries. Can I use this solver on the membrane without including the flux modelling? The reason why I am asking this question is because the solubility or entrapment effects have not been considered. If the answer is not, what modifications will be required?

Also, I have a little confusion about the reaction mechanism of the solver. As I understand by going through solver, your solver can only solve the combustion reactions? Correct me if I'm wrong? So, if I want to model the co-permeation of two molecules H2, D2 through membrane, a reaction like H2+D2-> 2HD (where H is hydrogen, D is deuterium) can be modeled for the same, how should I begin to include it in the same solver?
PRATBHARAT is offline   Reply With Quote

Old   August 13, 2021, 13:43
Post
  #111
New Member
 
Ejaz Ahmed
Join Date: May 2021
Posts: 6
Rep Power: 2
ejaz8894 is on a distinguished road
I am thanking you all for the contributions you have made. I'm currently working on icoReactingMultiphaseInterFoam solver on OpenFOAM - v2012 in order to model liquid evaporation which is using VOF (volume of fluid) based interface capturing method. I figured out that, the solver doesn't have any mass diffusivity in species transport equation. I need to modify the species transport equation for that. Can I install this "Multispecies Mass Transport Library" in OpenFOAM - v2012 & use the library in the icoReactingMultiphaseInterFoam solver? If not, what modifications do I need to make? I will really appreciate your help & suggestions. Thank you in advance!
ejaz8894 is offline   Reply With Quote

Old   November 10, 2021, 00:37
Default Please Update the Library for New versions of OpenFOAM
  #112
New Member
 
Sk Hossen Ali
Join Date: Jul 2021
Location: India
Posts: 3
Rep Power: 2
Sk Hossen Ali is on a distinguished road
Dear Foamers,

Thanks a lot for all the efforts till now, this is to bring to your kind attention that the libraries that you provided is not compatible with new versions of openfoam.

Please guide me on how to use the library if it is possible to run it in any currently supported versions of openfoam, or please try update it for the current versions of openfoam.

I have tried to install openfoam-2.3.0 in the ubuntu20.04LTS but did not compilled correctly. While I was trying to install Ubuntu13 it said it is no longer supported.

Thanks in advance
Sk Hossen Ali
Sk Hossen Ali is offline   Reply With Quote

Reply

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
UDS and fluent internal species transport model jinsong FLUENT 0 May 3, 2018 12:37
Inconsistencies in reading .dat file during run time in new injection model Scram_1 OpenFOAM 0 March 23, 2018 23:29
Surface instabilities with 2-phase species transport richard222 Fluent Multiphase 0 May 4, 2016 05:06
Species Mole and Mass Fraction Macro combustion FLUENT 15 October 29, 2013 04:57
Questions for a species transport problems (snapshots attached) aleisia FLUENT 2 October 9, 2011 05:40


All times are GMT -4. The time now is 19:41.