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

How to read multiphase parameters in creatFields from Transportproperties ?

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

Like Tree2Likes
  • 1 Post By Tobi
  • 1 Post By Amirhosseinesh

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 5, 2018, 10:22
Default How to read multiphase parameters in creatFields from Transportproperties ?
  #1
New Member
 
Amir
Join Date: Mar 2018
Posts: 3
Rep Power: 8
Amirhosseinesh is on a distinguished road
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
Amirhosseinesh is offline   Reply With Quote

Old   October 8, 2018, 10:56
Default
  #2
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Bad Wörishofen
Posts: 2,711
Blog Entries: 6
Rep Power: 52
Tobi has a spectacular aura aboutTobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
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
Tobi is offline   Reply With Quote

Old   October 8, 2018, 11:34
Default
  #3
New Member
 
Amir
Join Date: Mar 2018
Posts: 3
Rep Power: 8
Amirhosseinesh is on a distinguished road
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")
    );
but then again i have the error in running my simulation which says for example :"-->



Quote:
FOAM FATAL IO ERROR:
keyword nu is undefined in dictionary "/home/amir/OpenFOAM/amir-5.0/run/CompressibleLcmFoam/Lead_lag_Test/constant/transportProperties"

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
Amirhosseinesh is offline   Reply With Quote

Old   October 8, 2018, 15:17
Default
  #4
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Bad Wörishofen
Posts: 2,711
Blog Entries: 6
Rep Power: 52
Tobi has a spectacular aura aboutTobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
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.
dasa likes this.
__________________
Keep foaming,
Tobias Holzmann
Tobi is offline   Reply With Quote

Old   October 12, 2018, 11:28
Talking
  #5
New Member
 
Amir
Join Date: Mar 2018
Posts: 3
Rep Power: 8
Amirhosseinesh is on a distinguished road
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;

// ************************************************************************* //
dasa likes this.
Amirhosseinesh 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
[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


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