|
[Sponsors] |
How to read multiphase parameters in creatFields from Transportproperties ? |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
October 5, 2018, 10:22 |
How to read multiphase parameters in creatFields from Transportproperties ?
|
#1 |
New Member
Amir
Join Date: Mar 2018
Posts: 3
Rep Power: 8 |
Hi,
I wrote a new code for Compressible LcmFoam which actually is improved version of LcmFoam for compressible flows. But i have an issue with my phases and parameters , if i give my parameters in creatFields , everything is fine and the solver works properly, but i want to read the parameters from my Transportproperties for multi-phase parameters. So the question is: I only have 2 of my parameters from Transportproperties (rho1 , rho2) but i need in my createFields to read the other parameters as well, such as (nu1, nu2) and speed of sound (C_Sound) and etc. can anyone help me what would be the command for that ? My Transportproperties would be the following: /*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 4.0 | | \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class dictionary; location "constant"; object transportProperties; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // phases (resin air); resin { transportModel Newtonian; nu [0 2 -1 0 0 0 0] 297e-7; rho [1 -3 0 0 0 0 0] 1110; } air { transportModel Newtonian; nu [0 2 -1 0 0 0 0] 14.5e-06; rho [1 -3 0 0 0 0 0] 1; } sigma [1 0 -2 0 0 0 0] 0.0; // ************************************************** *********************** // With best regards Amirhossein |
|
October 8, 2018, 10:56 |
|
#2 |
Super Moderator
Tobias Holzmann
Join Date: Oct 2010
Location: Bad Wörishofen
Posts: 2,711
Blog Entries: 6
Rep Power: 52 |
Hi,
your task requires the generation of an IOdictionary. After you build that object with the correct values, you can access the file and read out different data. Please check out Doxygen while searching IOdictionary
__________________
Keep foaming, Tobias Holzmann |
|
October 8, 2018, 11:34 |
|
#3 | |
New Member
Amir
Join Date: Mar 2018
Posts: 3
Rep Power: 8 |
Dear Tobi,
Thanks for the help. I tried to look it up and search it. I found a way to do it as following code in my createFields: Code:
IOdictionary transportProperties ( IOobject ( "transportProperties", runTime.constant(), mesh, IOobject::MUST_READ_IF_MODIFIED, IOobject::NO_WRITE ) ); dimensionedScalar nu1_val ( transportProperties.lookup("nu") ); Quote:
as you see i already defined nu in my transportProperties as well. i try to find "nu" first and then if it works other parameters. With best regards Amirhossein |
||
October 8, 2018, 15:17 |
|
#4 |
Super Moderator
Tobias Holzmann
Join Date: Oct 2010
Location: Bad Wörishofen
Posts: 2,711
Blog Entries: 6
Rep Power: 52 |
Hi,
no you did not define nu in your file as you should. You defined it within the subdictionary. The code is not smart enough to do it for you. You have to access the subdict first and then nu is found. Otherwise you have to define nu outside the subdicts.
__________________
Keep foaming, Tobias Holzmann |
|
October 12, 2018, 11:28 |
|
#5 |
New Member
Amir
Join Date: Mar 2018
Posts: 3
Rep Power: 8 |
Thanks a lot Tobi,
I have done it with your help and my advisor's help. For those who wants to do it call something from transportProperties in their createFields, I will put that part of my createFields here , i hope it helps others as well. creatheFields: Code:
IOdictionary transportProperties ( IOobject ( "transportProperties", runTime.constant(), mesh, IOobject::MUST_READ_IF_MODIFIED, IOobject::NO_WRITE ) ); dictionary phase1=transportProperties.subDict("resin"); dimensionedScalar nu1_val ( phase1.lookup("nu") ); dimensionedScalar rho1_val ( phase1.lookup("rho") ); dimensionedScalar c_sound_resin ( phase1.lookup("c_sound_resin") ); dimensionedScalar p1_0 ( phase1.lookup("p1_0") ); dictionary phase2=transportProperties.subDict("air"); dimensionedScalar nu2_val ( phase2.lookup("nu") ); dimensionedScalar rho2_val ( phase2.lookup("rho") ); dimensionedScalar T_val ( phase2.lookup("T_val") ); dimensionedScalar R_s ( phase2.lookup("R_s") ); transportProperties: Code:
/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 4.0 | | \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class dictionary; location "constant"; object transportProperties; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // phases (resin air); resin { transportModel Newtonian; nu nu [0 2 -1 0 0 0 0] 3333; rho rho [1 -3 0 0 0 0 0] 2222; c_sound_resin c_sound_resin [0 1 -1 0 0 0 0] 1470; p1_0 p1_0 [1 -1 -2 0 0 0 0] 100000; } air { transportModel Newtonian; nu nu [0 2 -1 0 0 0 0] 1111; rho rho [1 -3 0 0 0 0 0] 1; R_s R_s [0 2 -2 -1 0 0 0] 287; T_val T_val [0 0 0 1 0 0 0] 293; } sigma [1 0 -2 0 0 0 0] 0.0; // ************************************************************************* // |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[Commercial meshers] fluentMeshToFoam multidomain mesh conversion problem | Attesz | OpenFOAM Meshing & Mesh Conversion | 12 | May 2, 2013 11:52 |
Parameters for multigrid solver | HaZe | OpenFOAM Running, Solving & CFD | 3 | January 28, 2012 03:05 |
999999 (../../src/mpsystem.c@1123):mpt_read: failed:errno = 11 | UDS_rambler | FLUENT | 2 | November 22, 2011 10:46 |
Problem in running ICEM grid in Openfoam | Tarak | OpenFOAM | 6 | September 9, 2011 18:51 |
Phase locked average in run time | panara | OpenFOAM | 2 | February 20, 2008 15:37 |