CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

New scalar like alphaMax in phaseModel.c

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 25, 2020, 17:38
Default
  #21
Senior Member
 
Gerry Kan's Avatar
 
Gerry Kan
Join Date: May 2016
Posts: 376
Rep Power: 11
Gerry Kan is on a distinguished road
Quote:
Originally Posted by qi.yang@polimi.it View Post
That is definite a predefined dictionary. What you mean is that we cannot define a new thing in that type of file? Previously, I used to define a new dictionary in createFields.H and call the variable I defined in the solver main files without any problem. However, now I have to define it in a sub model. Grazie comunque.
Whether you can add extra keys to predefined dictionaries, I personally never tried and I don't know. As you mentioned, defining these keys in a new dictionary has worked, so we know what the solution should be.

As for this sub model, what you could do, is to introduce a global object (or variable) for myBeta, for instance. Your submodel will have visibility to it. Of course it is not very elegant because it this breaks encapsulation, but for the most part it works.

For the C++ purists, if there is a better way of doing this (through the registry if you only need read access, for instance) I would very much like to know.

Gerry.
Gerry Kan is offline   Reply With Quote

Old   August 27, 2020, 22:03
Default error is not reproduced
  #22
Senior Member
 
shinji nakagawa
Join Date: Mar 2009
Location: Japan
Posts: 113
Blog Entries: 1
Rep Power: 18
snak is on a distinguished road
Hi,


When I modified the original source code as you mentioned, no error occurred with the standard tutorial "twoPhaseEulerFoam/RAS/bubbleColumn". (OS: Ubuntu 20.04;OpenFOAM v7)

I added a "myBeta_" definition in header file and lookupOrDefault description in the constructor.


Do you use customized libraries or something? your log says "diffusionkEpsilon" and "mysigmake" .


Could you provide us with a test case you use and exact information about your environment (OS, OpenFOAM version, etc).





Quote:
Originally Posted by qi.yang@polimi.it View Post
Hi guys,

I added a new scalar in twophasesystem/phaseModel.C and I compiled successfully. The problem is that there is an error when I run the case. My objective is to use this constant in phasePair.C to calculate Re(). In oder to change the constant myBeta directly from dictionary (phaseProperties) without compiling every time, I think it is necessary to add a new scalar like alphaMax in phaseModel.C. Do you have any tip?
snak is offline   Reply With Quote

Old   August 28, 2020, 04:13
Default
  #23
Senior Member
 
kimy
Join Date: Mar 2019
Location: https://t.me/pump_upp
Posts: 164
Rep Power: 7
qi.yang@polimi.it is on a distinguished road
Send a message via ICQ to qi.yang@polimi.it Send a message via AIM to qi.yang@polimi.it Send a message via Yahoo to qi.yang@polimi.it
Hi Snak,

Thanks for your reply. I solved the problem by defining mybeta same as the one I defined in the createFields due to its consistency. Out of curiosity, you defined myBeta in a phaseModel dictionary? Can you directly change the value from the phaseModel Dict in the case file? I uploaded test file here and you can have a try (you should run blockMesh firstly). In terms of diffusionKe turbulence model, it will be used in the future, thus just delete it, use the default kE model.

Quote:
Originally Posted by snak View Post
Hi,


When I modified the original source code as you mentioned, no error occurred with the standard tutorial "twoPhaseEulerFoam/RAS/bubbleColumn". (OS: Ubuntu 20.04;OpenFOAM v7)

I added a "myBeta_" definition in header file and lookupOrDefault description in the constructor.


Do you use customized libraries or something? your log says "diffusionkEpsilon" and "mysigmake" .


Could you provide us with a test case you use and exact information about your environment (OS, OpenFOAM version, etc).
Attached Files
File Type: zip testcase.zip (17.9 KB, 1 views)
qi.yang@polimi.it is offline   Reply With Quote

Old   August 28, 2020, 06:18
Default
  #24
Senior Member
 
shinji nakagawa
Join Date: Mar 2009
Location: Japan
Posts: 113
Blog Entries: 1
Rep Power: 18
snak is on a distinguished road
Hi yangqi,


myBeta can be in constant/phaseProperties dict. The phaseProperties dict is attached. (phaseProperties.zip)


The modified code is attached as phaseModel.zip.


With these files, you can get the log like this,



Code:
from phseModel.C in air
    myBeta = 1
Calculating face flux field phi.air
Selecting diameterModel for phase air: isothermal
Selecting turbulence model type RAS
Selecting RAS turbulence model mixtureKEpsilon
RAS
{
    RASModel        mixtureKEpsilon;
    turbulence      on;
    printCoeffs     on;
    Cmu             0.09;
    C1              1.44;
    C2              1.92;
    C3              1.92;
    Cp              0.25;
    sigmak          1;
    sigmaEps        1.3;
}

Selecting thermodynamics package 
{
    type            heRhoThermo;
    mixture         pureMixture;
    transport       const;
    thermo          eConst;
    equationOfState perfectFluid;
    specie          specie;
    energy          sensibleInternalEnergy;
}

from phseModel.C in water
    myBeta = 0.1
Calculating face flux field phi.water
Quote:
Originally Posted by qi.yang@polimi.it View Post
Hi Snak,

Thanks for your reply. I solved the problem by defining mybeta same as the one I defined in the createFields due to its consistency. Out of curiosity, you defined myBeta in a phaseModel dictionary? Can you directly change the value from the phaseModel Dict in the case file? I uploaded test file here and you can have a try (you should run blockMesh firstly). In terms of diffusionKe turbulence model, it will be used in the future, thus just delete it, use the default kE model.



ADDED:


You changed Make/options files. If some library or solver include original twoPhaseSystem which is not consistent with your modified twoPhaseSystem, you may have the error you posted before.
Attached Files
File Type: zip phaseModel.zip (4.2 KB, 4 views)
File Type: zip phaseProperties.zip (872 Bytes, 4 views)
snak is offline   Reply With Quote

Old   August 28, 2020, 06:58
Default
  #25
Senior Member
 
kimy
Join Date: Mar 2019
Location: https://t.me/pump_upp
Posts: 164
Rep Power: 7
qi.yang@polimi.it is on a distinguished road
Send a message via ICQ to qi.yang@polimi.it Send a message via AIM to qi.yang@polimi.it Send a message via Yahoo to qi.yang@polimi.it
Thanks for your attention. I also tried in this way, no compiling error occurs but you could not call myBeta in another file. For example, I need to use myBeta in phasePair.C. One thing I am confused that the default alphaMax is also a scalar already defined and function alphaMax() also defined in phaseModel.H. However, when you define myBeta, no this procedure?



Quote:
Originally Posted by snak View Post
Hi yangqi,


myBeta can be in constant/phaseProperties dict. The phaseProperties dict is attached. (phaseProperties.zip)


The modified code is attached as phaseModel.zip.


With these files, you can get the log like this,



Code:
from phseModel.C in air
    myBeta = 1
Calculating face flux field phi.air
Selecting diameterModel for phase air: isothermal
Selecting turbulence model type RAS
Selecting RAS turbulence model mixtureKEpsilon
RAS
{
    RASModel        mixtureKEpsilon;
    turbulence      on;
    printCoeffs     on;
    Cmu             0.09;
    C1              1.44;
    C2              1.92;
    C3              1.92;
    Cp              0.25;
    sigmak          1;
    sigmaEps        1.3;
}

Selecting thermodynamics package 
{
    type            heRhoThermo;
    mixture         pureMixture;
    transport       const;
    thermo          eConst;
    equationOfState perfectFluid;
    specie          specie;
    energy          sensibleInternalEnergy;
}

from phseModel.C in water
    myBeta = 0.1
Calculating face flux field phi.water




ADDED:


You changed Make/options files. If some library or solver include original twoPhaseSystem which is not consistent with your modified twoPhaseSystem, you may have the error you posted before.
qi.yang@polimi.it is offline   Reply With Quote

Old   August 28, 2020, 07:27
Default
  #26
Senior Member
 
shinji nakagawa
Join Date: Mar 2009
Location: Japan
Posts: 113
Blog Entries: 1
Rep Power: 18
snak is on a distinguished road
hi,


After you modified phaseModel.H, you have to recompile all libraries including the phaseModel.H. Otherwise, info inside libraries will not coincide.


even if you have above problem, there will be no error at compilation. Each libraries is correct. However, at run-time, there will be discrepancy.


your Make/options file looks very complex. you have to be very careful, i guess.
snak is offline   Reply With Quote

Old   September 12, 2020, 04:43
Default OpenFOAM Programming & Development
  #27
New Member
 
rakki reddy
Join Date: Sep 2020
Posts: 1
Rep Power: 0
rakkioo7 is on a distinguished road
I accomplished something comparative in my solver, in which I read in word reference esteems and burden them in toward the beginning of the solver before the time circle. I gathered these custom settings in a different word reference and read them in like manner. This worked for me. From what I have found in your code, it appears to be that you are attempting to set up these keys in the default word references (e.g., control diet or evolution, to be straightforward I don't have the foggiest idea what they are called). I for one don't have the foggiest idea whether you can alter these default word references. This is the reason I proposed making a different word reference for your own settings.
rakkioo7 is offline   Reply With Quote

Reply

Tags
phasemodel, twophaseeuelrfoam, twophasesystem


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
problem during mpi in server: expected Scalar, found on line 0 the word 'nan' muth OpenFOAM Running, Solving & CFD 3 August 27, 2018 05:18
Division by zero exception - loop over scalarField Pat84 OpenFOAM Programming & Development 6 February 18, 2017 06:57
Issue symmetryPlane 2.5d extruded airfoil simulation 281419 OpenFOAM Running, Solving & CFD 5 November 28, 2015 14:09
Diverging solution in transonicMRFDyMFoam tsalter OpenFOAM Running, Solving & CFD 30 July 7, 2014 07:20
compressible flow in turbocharger riesotto OpenFOAM 50 May 26, 2014 02:47


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