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

sampleDict output needs to be fixed!

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 1 Post By wyldckat
  • 1 Post By musahossein

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 5, 2013, 16:02
Default sampleDict output needs to be fixed!
  #1
Senior Member
 
musaddeque hossein
Join Date: Mar 2009
Posts: 309
Rep Power: 18
musahossein is on a distinguished road
Dear all:

The out out from sample dict for pressures need to be fixed. My code in sample dict was as follows:
leftwall
{
type patch;
patches (leftWall);
rhoName rhoInf;
rhoInf 998.2; //Reference density for fluid
interpolate true;
triangulate false;
}

the output is as shown in the attached images. The output filenames are not consistent. Can some one tell me how/where to fix this so that it is either leftwalls or leftwall? If on the otherhand the same code is embedded in controlDict, the files names come out as .leftwalls. Thanks!
musahossein is offline   Reply With Quote

Old   August 5, 2013, 16:04
Default
  #2
Senior Member
 
musaddeque hossein
Join Date: Mar 2009
Posts: 309
Rep Power: 18
musahossein is on a distinguished road
looks like the image did not attach. Here goes....
Attached Images
File Type: png Screenshot from 2013-08-05 15:00:38.png (7.1 KB, 162 views)
musahossein is offline   Reply With Quote

Old   August 6, 2013, 10:51
Default output time interval in sample dict
  #3
Senior Member
 
musaddeque hossein
Join Date: Mar 2009
Posts: 309
Rep Power: 18
musahossein is on a distinguished road
Can anyone tell me if the output time can be set in sampledict? IN controldict for example, I can specify the output at 0.05 secs. I did a run with this time interval. However I would now like obtain output at 0.01 by using sampleDict, without running the solver again.

I am running the sloshingTan2D example in interDyMFOAM.

Thankyou
Musa
musahossein is offline   Reply With Quote

Old   August 17, 2013, 08:43
Default
  #4
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Greetings Musaddeque,

From your description, it looks like you used 0.05 for writing outputs from the solver and now you want to sample with another period, although I'm not 100% if you want 0.01 or 0.1.
So, there are two possible situations:
  • If you want 0.1, then that means that need to tell sample which time instances you want to use:
    Code:
    sample -time "$(echo $(foamListTimes | awk '(NR+1)%2==0') | sed 's= =,=g')"
    It's a pretty convoluted way of doing this... but basically:
    1. foamListTimes - gives the list of existing times.
    2. The awk command gets only the odd number lines (0, 0.1, 0.2, etc).
    3. The sed command will replace spaces for commas.
    4. The "$()" is a way of launching sub-shells, i.e., to run commands from within the current command line.
  • If you want 0.01, that's somewhat insane, specially with a case that has the mesh moving around. In essence, this would imply that you want to interpolate data in time... for which OpenFOAM actually does give you this ability:
    Code:
    temporalInterpolate -divisions 5 -interpolationType spline -fields '(U alpha1 p_rgh)'
    Use "-help" for more options. As for the "p" field, the problem is that it doesn't exist in the folder "0", so you'll have to create one if you need it, which I think you can base yourself on the "p_rgh" field.
Best regards,
Bruno
ngj likes this.
__________________
wyldckat is offline   Reply With Quote

Old   August 27, 2013, 16:45
Default ControlDict error for forces
  #5
Senior Member
 
musaddeque hossein
Join Date: Mar 2009
Posts: 309
Rep Power: 18
musahossein is on a distinguished road
Thanks for the response. I think it is better to rerun controDict rather than add more code for post processing. I have, however another problem. I noted that OpenFOAM lets you obtain forces using the following code snippet in the controlDict:
Code:
    forces
    {
    type forces;
    functionObjectLibs ("libforces.so"); //Lib to load
    patches (leftWall rightWall lowerWall);
        pName    p;
        UName   U;
    rhoName rhoInf;

    rhoInf 998.2; //Reference density for fluid
        nuInf 1e-06
    CofR (0 -0.071 0.25); //Origin for moment calculations
    outputControl timeStep;
        outputInterval 1;
    }
However, when I run interDyMFoam, I get the following error:

Code:
Starting time loop

Reading surface description:
    leftwalls
    rightwalls

--> FOAM Warning : 
    From function void forces::read(const dictionary&)
    in file forces/forces.C at line 509
    Could not find U, p: in database.
    De-activating forces.
Interface Courant Number mean: 0 max: 0
Courant Number mean: 0.000151945 max: 0.00047273
deltaT = 0.00116279
Time = 0.00116279
Which U, p is it referring to?

Last edited by wyldckat; August 27, 2013 at 19:30. Reason: Added [CODE][/CODE]
musahossein is offline   Reply With Quote

Old   August 27, 2013, 18:18
Default keyword nu is undefined in dictionary "home/..../transportProperties"
  #6
Senior Member
 
musaddeque hossein
Join Date: Mar 2009
Posts: 309
Rep Power: 18
musahossein is on a distinguished road
Please ignore the previous post. I had a colon after the p and not a semi-colon. So I was getting an error and am now not getting an error. However, now I get an error that looks like this:

[9] --> FOAM FATAL IO ERROR:
[9] keyword nu is undefined in dictionary "/home/cfsengineers/OpenFOAM/cfsengineers-2.2.1/run/tutorials/multiphase/interDyMFoam/ras/sloshingTank2D/processor9/constant/transportProperties"
[9]
[9] file: /home/cfsengineers/OpenFOAM/cfsengineers-2.2.1/run/tutorials/multiphase/interDyMFoam/ras/sloshingTank2D/processor9/constant/transportProperties from line 0 to line 0.

nu is defined in the transportProperties. However, the lines referenced are line 0 to line 0. I cant understand what this means. Can anyone help?
musahossein is offline   Reply With Quote

Old   August 27, 2013, 19:33
Default
  #7
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Hi Musaddeque,

That's a bit strange. Does the file "processor9/constant/transportProperties" exist?
And is it empty or does it have the same contents as the one at the main "constant/transportProperties"?

Because the message about "line 0 to 0" means that the file is either empty or non-existent, or something went wrong when reading the file, such as not enough permissions or the file is binary or something like that.

Best regards,
Bruno
__________________
wyldckat is offline   Reply With Quote

Old   August 27, 2013, 22:00
Default
  #8
Senior Member
 
musaddeque hossein
Join Date: Mar 2009
Posts: 309
Rep Power: 18
musahossein is on a distinguished road
I agree that it is indeed strange. The transport properties file is as follows:

Code:
 /*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  2.0.1                                 |
|   \\  /    A nd           | Web:      www.OpenFOAM.com                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    location    "constant";
    object      transportProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Phase1 is water; phase2 is air. Values for Standard Temperature and pressure (0 deg C, 14.69 psi
// or 101.325 kPa, ) in accordance with NIST
//

phase1
{
    transportModel  Newtonian;
    nu              nu [ 0 2 -1 0 0 0 0 ] 1e-06;
    rho             rho [ 1 -3 0 0 0 0 0 ] 998.2;
}

phase2
{
    transportModel  Newtonian;
    nu              nu [ 0 2 -1 0 0 0 0 ] 1.50e-05;
    rho             rho [ 1 -3 0 0 0 0 0 ] 1.2;
}

sigma           sigma [ 1 0 -2 0 0 0 0 ] 0;


// ************************************************************************* //
There may also be the case where there are additional files that OpenFOAM is trying to read in the same folder. As I have found out there are some instances where OpenFOAM will assume that all the files in the folder are relevant and will try to read all of them. So if you store older files for reference, then OpenFOAM may give error messages.
wyldckat likes this.

Last edited by wyldckat; August 28, 2013 at 16:10. Reason: Added [CODE][/CODE]
musahossein is offline   Reply With Quote

Old   August 27, 2013, 22:25
Default
  #9
Senior Member
 
musaddeque hossein
Join Date: Mar 2009
Posts: 309
Rep Power: 18
musahossein is on a distinguished road
Quote:
Originally Posted by wyldckat View Post
Hi Musaddeque,

That's a bit strange. Does the file "processor9/constant/transportProperties" exist?
And is it empty or does it have the same contents as the one at the main "constant/transportProperties"?

Because the message about "line 0 to 0" means that the file is either empty or non-existent, or something went wrong when reading the file, such as not enough permissions or the file is binary or something like that.

Best regards,
Bruno
I checked the constant folder for processor 9. The folder does not have a transportProperties file. Only the polymesh file. I assumed that during parallel processing interDyMFoam would create or copy the transport properties folder into the constant folder of each processor. My assumption was incorrect?
musahossein is offline   Reply With Quote

Old   August 28, 2013, 16:24
Default
  #10
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Hi Musaddeque,

Decomposition is usually only performed for the fields and mesh. All other dictionary files are meant to be only placed on the base case folder, since this way they will either:
  • be accessible to all parallel processes;
  • or the master process is the only one that needs to be aware of it.

The problem can be that you are trying to use something that is not aware that it should be looking in the base case folder and not inside the processor folder, which leads to this problem.

Wait... you're trying to use the forces function object, correct? Is there any other functions objects you are trying to use?
I ask this because there is a another possibility: the solver or function object might be trying to find the main "nu" value, as if there was only one fluid. But your case has got two fluids, which means that whatever you are using was only conceived for a single fluid.

Best regards,
Bruno
__________________
wyldckat is offline   Reply With Quote

Old   August 28, 2013, 17:13
Default
  #11
Senior Member
 
musaddeque hossein
Join Date: Mar 2009
Posts: 309
Rep Power: 18
musahossein is on a distinguished road
I am trying to capture wall pressure and wall forces. For the first one I am calling "libsurfaces.so" and for the second one "libforces.so". The nu error comes up when I call "libforces.so" and not when I call "libsurfaces.so"

My controldict code is as follows:


Code:
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    location    "system";
    object      controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

application     interDyMFoam;

startFrom       startTime;

startTime       0;

stopAt          endTime;

endTime         48;
//endTime        0.02;

//deltaT        0.01;
deltaT        0.001;

writeControl    adjustableRunTime;

 writeInterval   0.05;
//writeInterval  0.02;

purgeWrite      0;

writeFormat     ascii;

writePrecision  6;

writeCompression compressed;

timeFormat      general;

timePrecision   6;

runTimeModifiable yes;

adjustTimeStep  yes;

maxCo           0.5;
maxAlphaCo      0.5;

maxDeltaT       1;

functions
{

//    probes
//    {
//        type            probes;
//        functionObjectLibs ("libsampling.so");
//        outputControl   outputTime;
//        outputInterval  1;
//        probeLocations
//        (
//            ( 0 -20.0 0 )
//            ( 0  20.0 0 )
//        );
//        fields
//        (
//            p
//        );
//    }

       wallPressure
      {
        type            surfaces;
        functionObjectLibs ("libsampling.so");
        outputControl   outputTime;
        surfaceFormat   raw;
        fields    ( alpha1
                  p
            );
    interpolationScheme cell;
        surfaces
        (
            leftwalls
            {
                type        patch;
                patches     (leftWall);
        interpolate true;
                triangulate false;
            }
        rightwalls
            {
                type        patch;
                patches     (rightWall);
        interpolate true;
                triangulate false;
            }
        );
       }

    forces
    {
    type forces;
    functionObjectLibs ("libforces.so");         //Lib to load
    outputControl outputTime;
    patches (leftWall rightWall);
    pName p;
    UName U;
    rhoName rhoInf;
    rhoInf 998.2;                     //Reference density for fluid
    nuInf 1e-06;
    CofR (0 0 0);                    //Origin for moment calculations

    outputControl timeStep;
        outputInterval 1;
    }
    

} // end functions
I realize that this issue as been discussed on this forum, but it appears that this was corrected in OpenFOAM 2.2.1 which I have. But the error is still there.

Last edited by wyldckat; August 31, 2013 at 12:52. Reason: Added [CODE][/CODE]
musahossein is offline   Reply With Quote

Old   August 28, 2013, 17:15
Default
  #12
Senior Member
 
musaddeque hossein
Join Date: Mar 2009
Posts: 309
Rep Power: 18
musahossein is on a distinguished road
I am sorry - nu is not a problem for libsampling.so not libsurfaces.so
musahossein is offline   Reply With Quote

Old   August 31, 2013, 14:18
Default
  #13
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Hi Musaddeque,

I've tried the function objects you have on your "controlDict" in the tutorial case "multiphase/interDyMFoam/ras/testTubeMixer". And I found out that the problem comes from trying to use the function object "forces".

In addition, it doesn't matter if I run in serial or in parallel. The problem is that you're telling the "forces" function object to use "rhoInf" as the "rho" field, which is used for incompressible flow. But since you're using a solver of the type multiphase, you have 2 "nu" values and respectively 2 "rho" fields.
I searched with Google for:
Code:
openfoam multiphase forces
And found this thread: http://www.cfd-online.com/Forums/ope...mulations.html
I suggest you give it a very good read, to learn how to do this!

Good luck! Best regards,
Bruno


edit: if by any chance your patches or walls are all only in contact with a single phase, then perhaps you can use the rho for that phase. For example:
Code:
rhoName rho1;
or:
Code:
rhoName rho2;
__________________

Last edited by wyldckat; August 31, 2013 at 14:43. Reason: see "edit:"
wyldckat is offline   Reply With Quote

Old   September 6, 2013, 04:58
Default
  #14
Senior Member
 
Daniel Witte
Join Date: Nov 2011
Posts: 148
Rep Power: 15
danny123 is on a distinguished road
Hi Bruno, hi musahossein,

I have looked up your suggestions. Seems to me that the file Forces.C has to be altered and recompiled.

There are several cases mentioned that cover a couple of other solvers than interFoam. Reading the code there the program is looking for a something named
"obr_.foundObject" to identify which model to apply. First it Looks for RAS, and indeed I have a RASproperties file (even thoughI do not know what it is good for since flow conditions are laminar). At this point the code asks for rho(), which may not be defined for the interFoam solver. The Definition of RAS seems to broad to me.

Later on in the code it calls for LESModel, this will not apply anyway, then for "basicThermo". I do not know what this is.

Finally, the program looks for

singlePhaseTransportModel. This is whare the nu error seems to be generated.

Is there any obr_.foundObject variable identifying interDymFoam or InterFoam? Maybe use multiPhaseTransportModel as an identifier? Is there an identifier just for 2-phase laminar flow?

Another question:

The above mentioned thread treats the shear Forces generated, but there should also be the system pressure somewhere. For single Phase incompressible this is p x rho or p_rgh - rho g h if you have defined gravity. For a two Phase System, the Definition of p_rgh does not make much sense to me.

Where do I find the proper pressure Definition? Does the definition of p_rgh really make sense for InterFoam?

Regards,

Daniel
danny123 is offline   Reply With Quote

Old   September 6, 2013, 09:23
Default
  #15
Senior Member
 
musaddeque hossein
Join Date: Mar 2009
Posts: 309
Rep Power: 18
musahossein is on a distinguished road
danny123:

I am running interDymfoam for sloshingtank 2d case. I am using a 12 core server to run my code. My controldict referenced libforces.so. When I ran it the first time, error message "keyword nu not found" came up for each processor which did not make sense. The workaround involved making the following change to two files as described below:

In turbulence properties set:

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

simulationType RASModel;

// ************************************************** *********************** //

In rasproperties set:

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

RASModel laminar;

turbulence off;

printCoeffs on;


// ************************************************** *********************** //

For me this took care of the "nu" issue. However, as has been discussed in this thread, libforces.so still complains when running but does not affect the result.
musahossein is offline   Reply With Quote

Old   September 7, 2013, 08:03
Default
  #16
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Greetings to all!

@Musaddeque:
Quote:
Originally Posted by musahossein View Post
For me this took care of the "nu" issue. However, as has been discussed in this thread, libforces.so still complains when running but does not affect the result.
Keep in mind that means that you are telling the solver to assume the flow is laminar and not turbulent! But if your flow is turbulent by nature, then you should be getting seriously big problems on the results...


@Daniel:
Quote:
Originally Posted by danny123 View Post
Where do I find the proper pressure Definition? Does the definition of p_rgh really make sense for InterFoam?
What you're looking for is already detailed here: http://www.cfd-online.com/Forums/ope...tml#post364630 - post #21

Best regards,
Bruno
__________________
wyldckat is offline   Reply With Quote

Old   September 11, 2013, 12:39
Default
  #17
Senior Member
 
Daniel Witte
Join Date: Nov 2011
Posts: 148
Rep Power: 15
danny123 is on a distinguished road
Hello musahossein, hello Bruno,

my flow conditions are laminar all time, so I am not worried about turbulence. The method musahossein does indeed calculate forces.

Bruno, the method decribed in the post you sent us is not correct. The author may got the calculation of viscous forces right. However, pressure forces are pressure forces. There should be no difference whether it is Phase 1 or 2.

For the effect of gravity, I found the following post:

http://www.cfd-online.com/Forums/ope...e-gravity.html

I agree with author that for multi-phase systems, to account for gravity, you need to add rho() g to all fluid cells instead of using p_rgh static pressure. Do you know if this is implemented in interDymFoam? What kind of pressure definition should I use to account for gravity? Is it sufficient defining pd instead of p and it will use gravity g automatically (p being defined pd / rho I guess)?

Regards,

Daniel
danny123 is offline   Reply With Quote

Old   September 13, 2013, 22:51
Default
  #18
Senior Member
 
musaddeque hossein
Join Date: Mar 2009
Posts: 309
Rep Power: 18
musahossein is on a distinguished road
Quote:
Originally Posted by danny123 View Post
Hello musahossein, hello Bruno,

my flow conditions are laminar all time, so I am not worried about turbulence. The method musahossein does indeed calculate forces.

Bruno, the method decribed in the post you sent us is not correct. The author may got the calculation of viscous forces right. However, pressure forces are pressure forces. There should be no difference whether it is Phase 1 or 2.

For the effect of gravity, I found the following post:

http://www.cfd-online.com/Forums/ope...e-gravity.html

I agree with author that for multi-phase systems, to account for gravity, you need to add rho() g to all fluid cells instead of using p_rgh static pressure. Do you know if this is implemented in interDymFoam? What kind of pressure definition should I use to account for gravity? Is it sufficient defining pd instead of p and it will use gravity g automatically (p being defined pd / rho I guess)?

Regards,

Daniel
Daniel: You may want to check out this thread. It may be of some help to you.

http://www.cfd-online.com/Forums/ope...rgh-1-7-a.html
musahossein is offline   Reply With Quote

Reply

Tags
leftwall, leftwalls, output file name, sampledict


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
[swak4Foam] outputTime in Swak function immortality OpenFOAM Community Contributions 20 October 6, 2022 13:08
How to control output time of pressureTools functions? Fluido OpenFOAM Post-Processing 1 May 19, 2014 09:49
RNG diverged during the analysis the flow over a multi element airfoil, why? s.m OpenFOAM Running, Solving & CFD 0 August 5, 2013 09:39
mixerVesselAMI2D's mass is not balancing sharonyue OpenFOAM Running, Solving & CFD 6 June 10, 2013 10:34
lift and drag on ship superstructures vaina74 OpenFOAM Running, Solving & CFD 3 June 8, 2010 13:30


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