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

How to use result of one simulation as a Boundary Condition in another simulation?

Register Blogs Community New Posts Updated Threads Search

Like Tree4Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 21, 2020, 00:58
Default
  #21
Senior Member
 
Join Date: Sep 2015
Location: Singapore
Posts: 102
Rep Power: 11
usv001 is on a distinguished road
Quote:
Originally Posted by ari003 View Post
Your post was very helpful but I ve another issue. I ve seen that the number of velocity should match with the number of faces but I m getting the output velocity as equal to the number of points(which is not the face center value). I m using OF7 which doesnt have sampledict folder. Is there any way by which I can get the output velocity corresponding to the face center?
Hi ari003,

I am assuming that you are trying to sample the patch values. The sampling process is different in the newer version. The following worked for me:
  1. Place a file caled 'singleGraph' in the system/ directory
    Code:
    /*--------------------------------*- C++ -*----------------------------------*\
    | =========                 |                                                 |
    | \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
    |  \\    /   O peration     | Version:  v1906                                 |
    |   \\  /    A nd           | Web:      www.OpenFOAM.com                      |
    |    \\/     M anipulation  |                                                 |
    \*---------------------------------------------------------------------------*/
    FoamFile
    {
        version     2.0;
        format      ascii;
        class       dictionary;
        location    "system";
        object      singleGraph;
    }
    // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
    
    singleGraph
    {
        type            surfaces;
        libs            ("libsampling.so");
        writeControl    writeTime;
    
        fields          ( rho );
        surfaceFormat   boundaryData;
        surfaces
        (
            right_patch
            {
                type            patch;
                patches         ("right"); // patch names
                interpolate     false;
            }
        );
    }
    
    // ************************************************************************* //
  2. Run the command 'postProcess -func singleGraph'

The sampled patch values will be generated in the correct format in the postProcessing/singleGraph/ directory.

Cheers,
USV
usv001 is offline   Reply With Quote

Old   May 21, 2020, 07:24
Default
  #22
Senior Member
 
Arijit Saha
Join Date: Feb 2019
Location: Singapore
Posts: 132
Rep Power: 7
ari003 is on a distinguished road
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 7
\\/ M anipulation |
-------------------------------------------------------------------------------
Description
Writes graph data for specified fields along a line, specified by start
and end points.

\*---------------------------------------------------------------------------*/

start (0 1e-06 0);
end (1 1e-06 0);
fields (U p);

// Sampling and I/O settings
#includeEtc "caseDicts/postProcessing/graphs/sampleDict.cfg"

// Override settings here, e.g.
/*
setConfig
{
type lineCell;
axis x; // y, z, xyz
}
*/

// Must be last entry
#includeEtc "caseDicts/postProcessing/graphs/graph.cfg"

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

It is giving the value along a line and the singleGraph folder looks like this which is quite different from yours.
ari003 is offline   Reply With Quote

Old   May 21, 2020, 07:28
Default
  #23
Senior Member
 
Join Date: Sep 2015
Location: Singapore
Posts: 102
Rep Power: 11
usv001 is on a distinguished road
Quote:
Originally Posted by ari003 View Post
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 7
\\/ M anipulation |
-------------------------------------------------------------------------------
Description
Writes graph data for specified fields along a line, specified by start
and end points.

\*---------------------------------------------------------------------------*/

start (0 1e-06 0);
end (1 1e-06 0);
fields (U p);

// Sampling and I/O settings
#includeEtc "caseDicts/postProcessing/graphs/sampleDict.cfg"

// Override settings here, e.g.
/*
setConfig
{
type lineCell;
axis x; // y, z, xyz
}
*/

// Must be last entry
#includeEtc "caseDicts/postProcessing/graphs/graph.cfg"

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

It is giving the value along a line and the singleGraph folder looks like this which is quite different from yours.
This is the default file. Create a new file 'singleGraph' in the system/ directory and copy the contents from my previous post.

USV
usv001 is offline   Reply With Quote

Old   May 21, 2020, 07:37
Default
  #24
Senior Member
 
Arijit Saha
Join Date: Feb 2019
Location: Singapore
Posts: 132
Rep Power: 7
ari003 is on a distinguished road
--> FOAM FATAL IO ERROR:
keyword interpolationScheme is undefined in dictionary "controlDict.functions.singleGraph.singleGraph "

file: controlDict.functions.singleGraph.singleGraph from line 20 to line 34.

From function const Foam::entry& Foam::dictionary::lookupEntry(const Foam::word&, bool, bool) const
in file db/dictionary/dictionary.C at line 573.

When I run the command it is showing up this error. What can I do any idea?
ari003 is offline   Reply With Quote

Old   May 21, 2020, 07:43
Default
  #25
Senior Member
 
Join Date: Sep 2015
Location: Singapore
Posts: 102
Rep Power: 11
usv001 is on a distinguished road
Quote:
Originally Posted by ari003 View Post
--> FOAM FATAL IO ERROR:
keyword interpolationScheme is undefined in dictionary "controlDict.functions.singleGraph.singleGraph "

file: controlDict.functions.singleGraph.singleGraph from line 20 to line 34.

From function const Foam::entry& Foam::dictionary::lookupEntry(const Foam::word&, bool, bool) const
in file db/dictionary/dictionary.C at line 573.

When I run the command it is showing up this error. What can I do any idea?
Whenever I face such a problem, I include the missing keyword ('interpolationScheme' in this case) in the dictionary with some dummy entry.

Code:
singleGraph
{
    ...
    interpolationScheme blah; // blah = some dummy value
    ...
}
OpenFOAM will throw an error saying that the entry 'blah' is invalid and will give you a list of valid entries. Choose one that works.

USV
usv001 is offline   Reply With Quote

Old   May 21, 2020, 08:01
Default
  #26
Senior Member
 
Arijit Saha
Join Date: Feb 2019
Location: Singapore
Posts: 132
Rep Power: 7
ari003 is on a distinguished road
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1906 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object singleGraph;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

singleGraph
{
type surfaces;
libs ("libsampling.so");
writeControl writeTime;
interpolationScheme blah;

fields ( U );
surfaceFormat boundaryData;
surfaces
(
right_patch
{
type patch;
patches ("right"); // patch names
interpolate true;
}
);
}

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

I used cell, cellPoint, blah but now it is not showing up in the post-processor directory. Even when I used blah it didnt pop up any error.
ari003 is offline   Reply With Quote

Old   May 21, 2020, 08:05
Default
  #27
Senior Member
 
Join Date: Sep 2015
Location: Singapore
Posts: 102
Rep Power: 11
usv001 is on a distinguished road
Quote:
Originally Posted by ari003 View Post
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1906 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object singleGraph;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

singleGraph
{
type surfaces;
libs ("libsampling.so");
writeControl writeTime;
interpolationScheme blah;

fields ( U );
surfaceFormat boundaryData;
surfaces
(
right_patch
{
type patch;
patches ("right"); // patch names
interpolate true;
}
);
}

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

I used cell, cellPoint, blah but now it is not showing up in the post-processor directory. Even when I used blah it didnt pop up any error.
What I provided earlier worked for me in v1906. I am not sure if it will work in v7. In v1906, it did not ask for interpolationScheme also.

By the way, do you have a patch named 'right'? If not, please try using one of your patches.

USV
usv001 is offline   Reply With Quote

Old   May 21, 2020, 08:27
Default
  #28
Senior Member
 
Arijit Saha
Join Date: Feb 2019
Location: Singapore
Posts: 132
Rep Power: 7
ari003 is on a distinguished road
Sir, actually I was trying to extract one surface from the pitzdaily case and feed that output velocity into the inlet. I did that by using surface dict and that gave the velocity at all points i.e 62 velocities but I want the velocity corresponding to the faces i.e 30 velocity component so that I can feed that in input. But at this point I m unable to extract the velocity corres to each face at that specific surface. I had put the patch name as"surfaces" still it didnt work and even I cant send you the file because it is exceeding the limit. Any kind of help will be really great.
ari003 is offline   Reply With Quote

Old   May 21, 2020, 11:27
Default
  #29
Senior Member
 
Join Date: Sep 2015
Location: Singapore
Posts: 102
Rep Power: 11
usv001 is on a distinguished road
Quote:
Originally Posted by ari003 View Post
Sir, actually I was trying to extract one surface from the pitzdaily case and feed that output velocity into the inlet. I did that by using surface dict and that gave the velocity at all points i.e 62 velocities but I want the velocity corresponding to the faces i.e 30 velocity component so that I can feed that in input. But at this point I m unable to extract the velocity corres to each face at that specific surface. I had put the patch name as"surfaces" still it didnt work and even I cant send you the file because it is exceeding the limit. Any kind of help will be really great.
Then your patches entry should have the patch name 'outlet'. Also, if you just want the values maybe you can just extract them from the field files using bash commands like sed or awk.

USV
usv001 is offline   Reply With Quote

Old   May 21, 2020, 11:49
Default
  #30
Senior Member
 
Arijit Saha
Join Date: Feb 2019
Location: Singapore
Posts: 132
Rep Power: 7
ari003 is on a distinguished road
Didnt work also after putting outlet as the name of the patch.
ari003 is offline   Reply With Quote

Reply


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
sliding mesh problem in CFX Saima CFX 46 September 11, 2021 08:38
Change a boundary condition based on simulation result and recompute the simulation Robin.Kamenicky CFX 1 March 7, 2017 19:35
Domain Imbalance HMR CFX 5 October 10, 2016 06:57
turbineSiting tutorial: slip condition at top boundary gives unexpected result letzel OpenFOAM 0 June 6, 2014 06:25
Convective Heat Transfer - Heat Exchanger Mark CFX 6 November 15, 2004 16:55


All times are GMT -4. The time now is 08:32.