CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Pre-Processing

Problem with fluentDataToFoam (from OF 1.6 ex) in OF 2.1.1

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

Like Tree3Likes
  • 3 Post By wyldckat

Reply
 
LinkBack Thread Tools Display Modes
Old   March 10, 2013, 08:35
Default Problem with fluentDataToFoam (from OF 1.6 ex) in OF 2.1.1
  #1
DDB
New Member
 
DDB
Join Date: Jan 2013
Posts: 12
Rep Power: 2
DDB is on a distinguished road
Hi all,

I followed the instructions in this thread to overcome the compilation problems
can not complie fluentDataToFoam in OF2.1.1

I have already generated the OF mesh using fluent3DMeshToFoam. However, when I run fluentDataToFoam I get the error:

Code:
--> FOAM FATAL IO ERROR: 
cannot find file

file: /home/.../constant/polyMesh/zoneToPatchName at line 0.

    From function regIOobject::readStream()
    in file db/regIOobject/regIOobjectRead.C at line 73.

FOAM exiting
There is no file called zoneToPatchName in my polyMesh folder. Is this due to a change in fluent3DMeshToFoam since v1.6 or is it a problem with fluentDataToFoam?

Any help gratefully received!
DDB is offline   Reply With Quote

Old   March 10, 2013, 08:39
Default
  #2
Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 4,278
Blog Entries: 31
Rep Power: 45
wyldckat has a spectacular aura aboutwyldckat has a spectacular aura about
Hi DDB,

Can you create a simple test case and share it so that I (or anyone else) can try to replicate the same error!?

Best regards,
Bruno
wyldckat is offline   Reply With Quote

Old   March 10, 2013, 10:02
Default
  #3
DDB
New Member
 
DDB
Join Date: Jan 2013
Posts: 12
Rep Power: 2
DDB is on a distinguished road
I'd love to, but I don't have access to fluent anymore :-(

I did some cases at uni a few years ago & now I want to work on them in OF, but I am not at uni now and I certainly cannot afford the fluent fees!
DDB is offline   Reply With Quote

Old   March 10, 2013, 11:42
Default
  #4
Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 4,278
Blog Entries: 31
Rep Power: 45
wyldckat has a spectacular aura aboutwyldckat has a spectacular aura about
Hi DDB,

Very well, then lets reverse engineer this thing.

First I'm going to use the tutorial "incompressible/icoFoam/cavity" as basis for creating the simple Fluent dataset:
  1. Run the tutorial:
    Code:
    blockMesh
    icoFoam
  2. Then extract the components for U:
    Code:
    foamCalc components U
Now to convert the mesh and data to Fluent format:
  1. Create the file "system/foamDataToFluentDict" with the following contents:
    Code:
    /*--------------------------------*- C++ -*----------------------------------*\
    | =========                 |                                                 |
    | \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
    |  \\    /   O peration     | Version:  2.1.x                                 |
    |   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
    |    \\/     M anipulation  |                                                 |
    \*---------------------------------------------------------------------------*/
    FoamFile
    {
        version     2.0;
        format      ascii;
        class       dictionary;
        location    "system";
        object      foamDataToFluentDict;
    }
    // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
    
    p 1;
    
    Ux 111;
    Uy 112;
    Uz 113;
    I know the codes, because I looked at the fluentDataToFoam source code, more specifically inside the file "fluentDataToFoam.L".
  2. Converted the OpenFOAM mesh and data to Fluent format:
    Code:
    foamMeshToFluent
    foamDataToFluent


Now for converting stuff back from Fluent to OpenFOAM:
  1. Convert the mesh by running:
    Code:
    fluentMeshToFoam fluentInterface/cavity.msh
    This is only because this is the simple cavity. fluent3DMeshToFoam should be used for more complicated cases.
  2. Then look into the file "fluentInterface/cavity.msh" and find the codes for each patch. At the end of the file you should find this:
    Code:
    (39 (1 fluid fluid-1)())
    (39 (2 interior interior-1)())
    (39 (10 wall movingWall)())
    (39 (11 wall fixedWalls)())
    (39 (12 pressure-outlet frontAndBack)())
    This is what we'll use as reference for the "zoneToPatchName" file.
  3. Create the file "constant/polyMesh/zoneToPatchName" with the following contents:
    Code:
    /*--------------------------------*- C++ -*----------------------------------*\
    | =========                 |                                                 |
    | \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
    |  \\    /   O peration     | Version:  2.1.x                                 |
    |   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
    |    \\/     M anipulation  |                                                 |
    \*---------------------------------------------------------------------------*/
    FoamFile
    {
        version     2.0;
        format      ascii;
        class       wordList;
        location    "constant/polyMesh";
        object      zoneToPatchName;
    }
    // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
    
    /*
    (39 (1 fluid fluid-1)())
    (39 (2 interior interior-1)())
    (39 (10 wall movingWall)())
    (39 (11 wall fixedWalls)())
    (39 (12 pressure-outlet frontAndBack)())
    */
    
    13
    (
      dummy    //foam 0 - no fluent correspondence
      unknown  //foam 1 - fluent 1
      interior //foam 2 - fluent 2
      dummy    //foam 3 - fluent 3
      dummy    //foam 4 - fluent 4
      dummy    //foam 5 - fluent 5
      dummy    //foam 6 - fluent 6
      dummy    //foam 7 - fluent 7
      dummy    //foam 8 - fluent 8
      dummy    //foam 9 - fluent 9
      movingWall    //foam 10 - fluent 10
      fixedWalls    //foam 11 - fluent 11
      frontAndBack  //foam 12 - fluent 12
    );
    Notice the details:
    • The commented block that has the files from the "cavity.msh" file are only there for reference for creating the array of names.
    • "unknown" is the default name given for the internal field, as defined in fluentDataToFoam's source code.
    • Keep in mind that the full array of names has to be given, with dummy names for the patches that don't have a name assigned on OpenFOAM's side of things.
    • Said array starts at 0 (zero), which is why there is the extract line at the top of the array.
  4. Then you can run the converter for the desired time instance:
    1. Edit the file "system/controlDict" and adjust the "startTime" entry accordingly. For example, I want to convert the time instance "0.1":
      Code:
      startTime       0.1;
    2. The convert:
      Code:
      fluentDataToFoam fluentInterface/cavity0.1.dat


A few notes of caution:
  • This conversion method does not take into account all of the possible boundary conditions! For example, the original boundary condition for "U" had the following "boundaryField":
    Code:
    boundaryField
    {
        movingWall
        {
            type            fixedValue;
            value           uniform (1 0 0);
        }
        fixedWalls
        {
            type            fixedValue;
            value           uniform (0 0 0);
        }
        frontAndBack
        {
            type            empty;
        }
    }
    The converted form resulted in:
    Code:
    boundaryField
    {
        movingWall
        {
            type            calculated;
            value           uniform (1 0 0);
        }
        fixedWalls
        {
            type            calculated;
            value           uniform (0 0 0);
        }
        frontAndBack
        {
            type            empty;
        }
    }
    This means that you have to edit the field files after conversion and correct appropriately.
  • Convertible fields can be found the source code file "fluentDataToFoam.L", in the "main" function. If you feel lost in the file, search for "momentum".
Best regards,
Bruno
solefire, Ohbuchi and DDB like this.
wyldckat is offline   Reply With Quote

Old   March 10, 2013, 14:42
Default
  #5
DDB
New Member
 
DDB
Join Date: Jan 2013
Posts: 12
Rep Power: 2
DDB is on a distinguished road
Bruno, you are an OF guru! Thank you so much!

I had no issues at all with the cavity problem, following the steps as you outlined, however I ran into some issues with my old fluent files.

The msh file is easier to find info for the zoneToPatchName than the cas file, but searching for "(39 (" found the stuff ok.

(For my reference when I come back to this, change the number in the zoneToPatchName to correspond to the number of patches! 13 is not unique!)

I have changed the startTime in system/controlDict, but the data only writes to the 0 folder (whereas following your example there was no issue in writing to whatever folder I chose).

I haven't had a chance to look at the boundary conditions yet, but your help so far has been amazing, thank you :-)
DDB is offline   Reply With Quote

Old   March 21, 2013, 06:20
Question
  #6
Senior Member
 
Join Date: Nov 2012
Posts: 143
Rep Power: 2
hz283 is on a distinguished road
Hello Bruno,

Your procedures listed are veru useful. I did the fluentDataToFoam but the following error:

Create time

Machine config: 600012484888
Grid size: nCells = 5984008 nFaces = 12248025 nPoints = 1156110
00Grid size: nCells = 1 nFaces = 25 nPoints = 1


--> FOAM FATAL IO ERROR:
wrong token type - expected int, found on line 1 the punctuation token '('

file: IStringStream.sourceFile at line 1.

From function operator>>(Istream&, int&)
in file primitives/ints/int/intIO.C at line 68.


FOAM exiting

Does it mean the format of the dat files are not correct?


Quote:
Originally Posted by wyldckat View Post
Hi DDB,

Very well, then lets reverse engineer this thing.

First I'm going to use the tutorial "incompressible/icoFoam/cavity" as basis for creating the simple Fluent dataset:
  1. Run the tutorial:
    Code:
    blockMesh
    icoFoam
  2. Then extract the components for U:
    Code:
    foamCalc components U
Now to convert the mesh and data to Fluent format:
  1. Create the file "system/foamDataToFluentDict" with the following contents:
    Code:
    /*--------------------------------*- C++ -*----------------------------------*\
    | =========                 |                                                 |
    | \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
    |  \\    /   O peration     | Version:  2.1.x                                 |
    |   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
    |    \\/     M anipulation  |                                                 |
    \*---------------------------------------------------------------------------*/
    FoamFile
    {
        version     2.0;
        format      ascii;
        class       dictionary;
        location    "system";
        object      foamDataToFluentDict;
    }
    // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
    
    p 1;
    
    Ux 111;
    Uy 112;
    Uz 113;
    I know the codes, because I looked at the fluentDataToFoam source code, more specifically inside the file "fluentDataToFoam.L".
  2. Converted the OpenFOAM mesh and data to Fluent format:
    Code:
    foamMeshToFluent
    foamDataToFluent


Now for converting stuff back from Fluent to OpenFOAM:
  1. Convert the mesh by running:
    Code:
    fluentMeshToFoam fluentInterface/cavity.msh
    This is only because this is the simple cavity. fluent3DMeshToFoam should be used for more complicated cases.
  2. Then look into the file "fluentInterface/cavity.msh" and find the codes for each patch. At the end of the file you should find this:
    Code:
    (39 (1 fluid fluid-1)())
    (39 (2 interior interior-1)())
    (39 (10 wall movingWall)())
    (39 (11 wall fixedWalls)())
    (39 (12 pressure-outlet frontAndBack)())
    This is what we'll use as reference for the "zoneToPatchName" file.
  3. Create the file "constant/polyMesh/zoneToPatchName" with the following contents:
    Code:
    /*--------------------------------*- C++ -*----------------------------------*\
    | =========                 |                                                 |
    | \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
    |  \\    /   O peration     | Version:  2.1.x                                 |
    |   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
    |    \\/     M anipulation  |                                                 |
    \*---------------------------------------------------------------------------*/
    FoamFile
    {
        version     2.0;
        format      ascii;
        class       wordList;
        location    "constant/polyMesh";
        object      zoneToPatchName;
    }
    // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
    
    /*
    (39 (1 fluid fluid-1)())
    (39 (2 interior interior-1)())
    (39 (10 wall movingWall)())
    (39 (11 wall fixedWalls)())
    (39 (12 pressure-outlet frontAndBack)())
    */
    
    13
    (
      dummy    //foam 0 - no fluent correspondence
      unknown  //foam 1 - fluent 1
      interior //foam 2 - fluent 2
      dummy    //foam 3 - fluent 3
      dummy    //foam 4 - fluent 4
      dummy    //foam 5 - fluent 5
      dummy    //foam 6 - fluent 6
      dummy    //foam 7 - fluent 7
      dummy    //foam 8 - fluent 8
      dummy    //foam 9 - fluent 9
      movingWall    //foam 10 - fluent 10
      fixedWalls    //foam 11 - fluent 11
      frontAndBack  //foam 12 - fluent 12
    );
    Notice the details:
    • The commented block that has the files from the "cavity.msh" file are only there for reference for creating the array of names.
    • "unknown" is the default name given for the internal field, as defined in fluentDataToFoam's source code.
    • Keep in mind that the full array of names has to be given, with dummy names for the patches that don't have a name assigned on OpenFOAM's side of things.
    • Said array starts at 0 (zero), which is why there is the extract line at the top of the array.
  4. Then you can run the converter for the desired time instance:
    1. Edit the file "system/controlDict" and adjust the "startTime" entry accordingly. For example, I want to convert the time instance "0.1":
      Code:
      startTime       0.1;
    2. The convert:
      Code:
      fluentDataToFoam fluentInterface/cavity0.1.dat


A few notes of caution:
  • This conversion method does not take into account all of the possible boundary conditions! For example, the original boundary condition for "U" had the following "boundaryField":
    Code:
    boundaryField
    {
        movingWall
        {
            type            fixedValue;
            value           uniform (1 0 0);
        }
        fixedWalls
        {
            type            fixedValue;
            value           uniform (0 0 0);
        }
        frontAndBack
        {
            type            empty;
        }
    }
    The converted form resulted in:
    Code:
    boundaryField
    {
        movingWall
        {
            type            calculated;
            value           uniform (1 0 0);
        }
        fixedWalls
        {
            type            calculated;
            value           uniform (0 0 0);
        }
        frontAndBack
        {
            type            empty;
        }
    }
    This means that you have to edit the field files after conversion and correct appropriately.
  • Convertible fields can be found the source code file "fluentDataToFoam.L", in the "main" function. If you feel lost in the file, search for "momentum".
Best regards,
Bruno
hz283 is offline   Reply With Quote

Old   March 24, 2013, 13:13
Default
  #7
Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 4,278
Blog Entries: 31
Rep Power: 45
wyldckat has a spectacular aura aboutwyldckat has a spectacular aura about
Hi hz283,

Follow my example with the tutorial case and then compare the file formats.
I say this because I can't figure out what's wrong just from your error message So you'll have to compare the files yourself!

Best regards,
Bruno
wyldckat is offline   Reply With Quote

Old   March 24, 2013, 14:15
Default
  #8
Senior Member
 
Join Date: Nov 2012
Posts: 143
Rep Power: 2
hz283 is on a distinguished road
Hi Bruno,

Thank you so much for your continuous help.

best H

Quote:
Originally Posted by wyldckat View Post
Hi hz283,

Follow my example with the tutorial case and then compare the file formats.
I say this because I can't figure out what's wrong just from your error message So you'll have to compare the files yourself!

Best regards,
Bruno
hz283 is offline   Reply With Quote

Reply

Thread Tools
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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
UDF compiling problem Wouter Fluent UDF and Scheme Programming 6 June 6, 2012 04:43
Problem Importing Geometry ProE to CFX fatb0y CFX 3 January 14, 2012 19:42
Solve single but higher order equation by OF 1.6 suffering Problem alundilong OpenFOAM Programming & Development 0 December 23, 2010 13:53
natural convection problem for a CHT problem Se-Hee CFX 2 June 10, 2007 06:29
Adiabatic and Rotating wall (Convection problem) ParodDav CFX 5 April 29, 2007 19:13


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