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

internalField nonuniform list issues (on alpha.* / phase initialization)

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 9, 2025, 03:23
Default internalField nonuniform list issues (on alpha.* / phase initialization)
  #1
New Member
 
Markus S.
Join Date: Jan 2025
Posts: 2
Rep Power: 0
Confluks is on a distinguished road
Hey there,

I'm trying to make use of a multiphase simulation (via interFoam) in OpenFoam 10. Before, I try to initilize different phases on the mesh. I specified the phases in "0" directory as well as the setFieldsDict. Then I run setFields function (after generating mesh of course).
The file alpha.* should be edited and must now contain a list of zeros and ones under the entry internalField. (I'm just using 2 phases here)

So, here is an example of what I would expect:
Code:
/*--------------------------------*- C++ -*----------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     | Website:  https://openfoam.org
    \\  /    A nd           | Version:  10
     \\/     M anipulation  |
\*---------------------------------------------------------------------------*/
FoamFile
{
    format      binary;
    class       volScalarField;
    location    "0";
    object      alpha.methanol;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dimensions      [0 0 0 0 0 0 0];

internalField   nonuniform List<scalar>
32400
(0
1
1
0
1
1
1
0
0
...
)

...
Unfortunately, when I run this function my file looks like this:


Code:
/*--------------------------------*- C++ -*----------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     | Website:  https://openfoam.org
    \\  /    A nd           | Version:  10
     \\/     M anipulation  |
\*---------------------------------------------------------------------------*/
FoamFile
{
    format      binary;
    class       volScalarField;
    location    "0";
    object      alpha.methanol;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dimensions      [0 0 0 0 0 0 0];

internalField   nonuniform List<scalar>
32400
(^@^@^@^@^@^@�?^@^@^@^@^@^@�?^@^@^@^@^@^@�?^@^@^@^@^@^@�?^@^@^@^@^@^@�?^@^@^@^@^@^@�?^@^@^@^@
...
Apparently, the formating is kinda off. Although, I don't get an error or warning massage using setFields:

Code:
/*---------------------------------------------------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     | Website:  https://openfoam.org
    \\  /    A nd           | Version:  10
     \\/     M anipulation  |
\*---------------------------------------------------------------------------*/
Build  : 10-c4cf895ad8fa
Exec   : setFields
Date   : Jan 08 2025
Time   : 14:37:39
Host   : "DESKTOP-NGKFP5B"
PID    : 40467
I/O    : uncollated
Case   : [...]
nProcs : 1
sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster (fileModificationSkew 10)
allowSystemOperations : Allowing user-supplied system call operations

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Create mesh for time = 0

Reading "setFieldsDict"

Setting field default values
    Setting internal values of volScalarField alpha.methanol

Setting field region values
    Adding cells with center within boxes 1((0 0 -1) (0.001 0.00025 1))
    Setting internal values of volScalarField alpha.methanol

End
Honestly, it looks like a formating issue but since the file is edited by OF functions it should be the correct format.


The entry is valid anyway since I am able to call interFoam and calculate the case. Also, I can see the initilized phases in Paraview.


Does anybody faced the same issue? Is there a "fix" or why it is appearing like this?


Looking forward to your replys

Cheers

Markus
Confluks is offline   Reply With Quote

Old   January 10, 2025, 05:13
Default
  #2
Senior Member
 
Tom Fahner
Join Date: Mar 2009
Location: Breda, Netherlands
Posts: 654
Rep Power: 33
tomf will become famous soon enoughtomf will become famous soon enough
Send a message via MSN to tomf Send a message via Skype™ to tomf
Hi Markus,

The file has been written in binary format, so it is easily read by the computer, but not so much by a human. If you would change the controlDict to have

Code:
writeFormat        ascii;
you will have a human-readable version of the file after running setFields.

However, these files will be bigger and less accurate (depending on writePrecision), so I would recommend leaving it to binary.

For testing/checking purposes, ascii can be used of course.

Regards,
Tom
tomf is offline   Reply With Quote

Old   January 13, 2025, 03:55
Default
  #3
New Member
 
Markus S.
Join Date: Jan 2025
Posts: 2
Rep Power: 0
Confluks is on a distinguished road
Hi Tom,


Thanks for your reply. That’s pretty much what I thought. And yes, it’s mainly for a test case configuration. I can also check it in ParaView, where it’s displayed correctly. However, I was just curious whether this behavior is intentional or not.
Also, thanks for the hint about ASCII formatting—that’ll definitely help for now.


Cheers,
Markus
Confluks 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
issues when using nonuniform List at inlet haow OpenFOAM Pre-Processing 0 July 2, 2018 14:33
Issues with symmetry patches perpendicular to outlets sturgeon OpenFOAM Running, Solving & CFD 2 October 9, 2017 10:46
Issues with volume of fluid in three phase simulation hooman.esl FLUENT 0 July 17, 2017 08:30
[Other] How to use finite area method in official OpenFOAM 2.2.0? Detian Liu OpenFOAM Meshing & Mesh Conversion 4 November 3, 2015 04:04
[foam-extend.org] problem when installing foam-extend-1.6 Thomas pan OpenFOAM Installation 7 September 9, 2015 22:53


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