|
[Sponsors] |
February 9, 2011, 07:37 |
Define simple multicomponent composition
|
#1 |
Senior Member
Cyprien
Join Date: Feb 2010
Location: Stanford University
Posts: 299
Rep Power: 18 |
Hello!
I am trying to implement multicomponent system in my model. For instance I want to consider O2, N2, CH4, CO2. For the moment I just want a simple model (no turbulence, thermo=constant). So I need to create the mass fraction fields. To clarify the post-treatment I want that my fields are named from the component name. So I code: Code:
wordList speciesNames ( transportProperties.lookup("speciesNames") ); speciesTable s(wordList speciesName); basicMultiComponentMixture& composition = s; PtrList<volScalarField>& Y = composition.Y(); Code:
basicMultiComponentMixture& composition = s; Best regards, Cyp |
|
February 9, 2011, 10:43 |
|
#2 |
Senior Member
Cyprien
Join Date: Feb 2010
Location: Stanford University
Posts: 299
Rep Power: 18 |
I fact I understand my mistake : the object "composition" need to be initialize with the constructor.
in basicMultiComponentMixture.H, the constructor is defined as: Code:
basicMultiComponentMixture ( const dictionary&, const wordList& specieNames, const fvMesh& ); Code:
basicMultiComponentMixture composition ( transportProperties, speciesNames, mesh ); Code:
Make/linux64GccDPOpt/icoFoam.o: In function `main': icoFoam.C:(.text+0x1c50): undefined reference to `Foam::basicMultiComponentMixture::basicMultiComponentMixture(Foam::dictionary const&, Foam::List<Foam::word> const&, Foam::fvMesh const&)' collect2: ld returned 1 exit status make: *** [/gemp/csoulain/OpenFOAM/csoulain-1.7.0/applications/bin/linux64GccDPOpt/icoFoamMulti] Erreur 1 |
|
February 9, 2011, 11:48 |
|
#3 |
Senior Member
Martin
Join Date: Oct 2009
Location: Aachen, Germany
Posts: 255
Rep Power: 22 |
Hi Cyp,
have you included "multiComponentMixture.H"? And have you updated the Make/options file? I suppose, you will need EXE_INC = \ -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \ . . . . EXE_LIBS = \ -lbasicThermophysicalModels \ -lspecie \ -lreactionThermophysicalModels \ . . . . Best regards Martin |
|
February 9, 2011, 12:03 |
|
#4 |
Senior Member
Cyprien
Join Date: Feb 2010
Location: Stanford University
Posts: 299
Rep Power: 18 |
Hi Martin,
thank you for your quite quick answer !! Indeed I haven't added these lines in my options files! Code:
EXE_INC = \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude |
|
February 9, 2011, 12:33 |
|
#5 |
Senior Member
Cyprien
Join Date: Feb 2010
Location: Stanford University
Posts: 299
Rep Power: 18 |
I have another question : I want to simulate gas - liquid mass transfer. Therefore, I can define two lists of mass fraction field (one for each phase).
Code:
PtrList<volScalarField>& Ya = composition.Y(); PtrList<volScalarField>& Yb = composition.Y(); Do you have an idea ? Edit : the solution I found : Code:
wordList speciesNames ( transportProperties.lookup("speciesNames") ); wordList liquidNames =speciesNames; wordList vaporNames =speciesNames; forAll(speciesNames,i) { liquidNames[i]+="-liq"; vaporNames[i] +="-vap"; }; basicMultiComponentMixture compositiona ( transportProperties, vaporNames, mesh ); basicMultiComponentMixture compositionb ( transportProperties, liquidNames, mesh ); PtrList<volScalarField>& Ya = compositiona.Y(); PtrList<volScalarField>& Yb = compositionb.Y(); Last edited by Cyp; February 17, 2011 at 08:43. |
|
February 17, 2011, 08:41 |
|
#6 |
Senior Member
Cyprien
Join Date: Feb 2010
Location: Stanford University
Posts: 299
Rep Power: 18 |
Hi!
Martin, the solution you mention above worked perfectly with OpenFOAM 1.7.0 installed on my desktop computer. However, it doesn't work with OF 1.7.1 installed on my own laptop. I get the following errore message while compiling: Code:
impesFoam2: symbol lookup error: /opt/openfoam171/lib/linux64GccDPOpt/libreactionThermophysicalModels.so: undefined symbol: _ZN4Foam11basicTh @++ Cyp |
|
December 14, 2012, 08:23 |
same kind of problem
|
#7 |
New Member
Olivier Macchion
Join Date: Jun 2010
Posts: 12
Rep Power: 16 |
Hello Cyp
I was wondering if you might have a look at the piece of code below. I am trying to do something similar to what you wrote in this thread, that is to say to include properties based on several species using a basicMultiComponentMixture. But I get the following error message: createFields.H: In function ‘int main(int, char**)’: createFields.H:50:76: error: expression list treated as compound expression in initializer [-fpermissive] createFields.H:50:76: warning: left operand of comma operator has no effect [-Wunused-value] createFields.H:50:76: warning: right operand of comma operator has no effect [-Wunused-value] createFields.H:50:76: error: invalid initialization of reference of type ‘Foam::basicMultiComponentMixture&’ from expression of type ‘Foam::fvMesh’ My createFields.H is the following: Info<< "Reading thermophysical properties\n" << endl; IOdictionary speciesDict ( IOobject ( "speciesDict", // dictionary name runTime.constant(), // the dictionary is found in constant mesh, // registry for the dictionary IOobject::MUST_READ, // must exist, otherwise failure IOobject::NO_WRITE // the dictionary is only read by the solver ) ); const wordList speciesNames ( speciesDict.lookup("species") ); const wordList buoyantSpeciesNames ( speciesDict.lookup("buoyantSpecies") ); label nSpecies = speciesNames.size(); PtrList<dimensionedScalar> M(nSpecies); forAll(speciesNames, i) { const word currentSpecie = speciesNames[i]; Info<< "Reading info on specie " << currentSpecie << endl; const dictionary& subDict = speciesDict.subDict(currentSpecie); M.set ( i, new dimensionedScalar(subDict.lookup("M")) ); } Info<< "Creating composition\n" << endl; // PtrList<volScalarField> Y(nSpecies); basicMultiComponentMixture& composition(speciesDict, speciesNames, mesh); PtrList<volScalarField>& Y = composition.Y(); Would you have any ideas? The code fails at the line: basicMultiComponentMixture& composition(speciesDict, speciesNames, mesh); Cheers Olivier |
|
September 19, 2014, 09:58 |
|
#8 |
Member
Timm Severin
Join Date: Mar 2014
Location: Munich
Posts: 63
Rep Power: 12 |
Hey Guys,
I know it is a long time since the last post, but I'm currently stuck at a similar problem, where I need simple support for multiple species but don't care for all the thermodynamical properties. My approach was similar to yours, but as it turns out that the baseMultiComponent class is (by now?) an abstract class and can not be created directly. My question would be if you didn't have this problem or if any of you already wrote a simple derived class? Otherwise I'd approach this now, but giving my practice this is gonna take some debugging time afterwards . Thanks, -Timm
__________________
PhD Student at the Institute of Biochemical Engineering at TU München Modelling of fluid dynamics in open photobioreactors. System: OpenFOAM 2.3.x, 64bit, 8 Core Xeon Workstation |
|
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
The correction on pressure equation of SIMPLE algorithm in MRFSimpleFOAM solver | renyun0511 | OpenFOAM Running, Solving & CFD | 0 | November 10, 2010 02:47 |
How to add correcting pressure equation in SIMPLE of MRFSimpleFOAM? | renyun0511 | OpenFOAM Programming & Development | 0 | November 4, 2010 02:38 |
Free surface boudary conditions with SOLA-VOF | Fan | Main CFD Forum | 10 | September 9, 2006 13:24 |
how to define 2d blockage in cfx? | ritesh | CFX | 0 | December 30, 2005 00:13 |
SIMPLE algorithm | Jonathan Castro | Main CFD Forum | 3 | December 10, 1999 05:59 |