Define simple multicomponent composition
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 Code:
basicMultiComponentMixture& composition = s; Best regards, Cyp |
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 Code:
basicMultiComponentMixture composition Code:
Make/linux64GccDPOpt/icoFoam.o: In function `main': |
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 |
Hi Martin,
thank you for your quite quick answer !! Indeed I haven't added these lines in my options files! Code:
EXE_INC = \ |
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(); Do you have an idea ? Edit : the solution I found : Code:
wordList speciesNames |
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 |
same kind of problem
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 |
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 |
All times are GMT -4. The time now is 21:35. |