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

time-varying pressure in OpenFoam

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 19, 2013, 12:36
Default time-varying pressure in OpenFoam
  #1
New Member
 
david mckelvey
Join Date: Nov 2013
Posts: 14
Rep Power: 12
dmck is on a distinguished road
hi

I want to use a time-varying pressure as my inlet condition, for an unsteady, compressible, case in a square duct. I was planing to use sonicFoam

I would like to add the time-varying pressure to the shockTube example, basically just changing the pressure. I looked at a tutorial on this, which used the timeVaryingTotalPressure, BC and which read the data from a file.

My question is can I run this in the setFields dict? to get the time-varying part along with the initial conditions for the rest of the mesh?

Or how could I achieve this?

Any advice would be useful

David
dmck is offline   Reply With Quote

Old   November 20, 2013, 04:39
Default
  #2
Senior Member
 
Elvis
Join Date: Mar 2009
Location: Sindelfingen, Germany
Posts: 620
Blog Entries: 6
Rep Power: 24
elvis will become famous soon enough
Hi,

what about swak4foam
http://openfoamwiki.net/index.php/Contrib/swak4Foam

http://openfoamwiki.net/index.php/Contrib_groovyBC
http://openfoamwiki.net/index.php/Co...funkySetFields

here you can read more swak4Foam-Gentle introduction and new developments
http://www.openfoamworkshop2013.org/...dGschaider.tar
elvis is offline   Reply With Quote

Old   November 21, 2013, 19:31
Default
  #3
New Member
 
david mckelvey
Join Date: Nov 2013
Posts: 14
Rep Power: 12
dmck is on a distinguished road
thanks for the information elvis

I've been trying to get up to speed with groovy bc and funky fields, I'm not sure I need to use these as firstly the field is uniform, its just the initial pressure wave is nonuniform, I thought the timeVaryingTotalPressure bc would be sufficient to the inlet.

or does anyone think this is wrong?

I used the timeVaryingTotalPressure inlet bc and was able to input the pressure wave that I want, however I did this for a square, straight pipe using pimpleFoam. I did this to learn how to input the pressure wave.

but when I tried to do the same thing using sonicFoam I could not get the simulation to run I got the following error,

#0 Foam::error:rintStack(Foam::Ostream&) in "/opt/openfoam201/platforms/linux64GccDPOpt/lib/libOpenFOAM.so"
#1 Foam::sigFpe::sigHandler(int) in "/opt/openfoam201/platforms/linux64GccDPOpt/lib/libOpenFOAM.so"
#2 in "/lib/libc.so.6"
#3 void Foam::divide<Foam::Vector<double>, Foam::fvsPatchField, Foam::surfaceMesh>(Foam::GeometricField<Foam::Vect or<double>, Foam::fvsPatchField, Foam::surfaceMesh>&, Foam::GeometricField<Foam::Vector<double>, Foam::fvsPatchField, Foam::surfaceMesh> const&, Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> const&) in "/opt/openfoam201/platforms/linux64GccDPOpt/bin/rhoCentralFoam"
#4 Foam::tmp<Foam::GeometricField<Foam::Vector<double >, Foam::fvsPatchField, Foam::surfaceMesh> > Foam:perator/<Foam::Vector<double>, Foam::fvsPatchField, Foam::surfaceMesh>(Foam::GeometricField<Foam::Vect or<double>, Foam::fvsPatchField, Foam::surfaceMesh> const&, Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> const&) in "/opt/openfoam201/platforms/linux64GccDPOpt/bin/rhoCentralFoam"
#5
in "/opt/openfoam201/platforms/linux64GccDPOpt/bin/rhoCentralFoam"
#6 __libc_start_main in "/lib/libc.so.6"
#7
in "/opt/openfoam201/platforms/linux64GccDPOpt/bin/rhoCentralFoam"
Floating point exception

any ideas? I think I might have an issue with my initial conditions

I have set my initial pressure with timeVaryingTotalPressure, fixed value for the outlet

I then used the setFields command to set the pressure and initial conditions for the rest of the mesh. is this the correct thing to do?

any advice is welcome

thanks
dmck is offline   Reply With Quote

Old   November 25, 2013, 11:57
Default effect of compressibility
  #4
New Member
 
david mckelvey
Join Date: Nov 2013
Posts: 14
Rep Power: 12
dmck is on a distinguished road
update on previous post

I'm getting an error which I believe says I'm trying to divide by zero somewhere.

since I was able to run the time varying pressure for an incompressible case and not able to run it for a compressible case, I'm guessing I have an issue with compressibility.

since rho = p*psi and psi = 1/(R*T)

I need to incorporate T, using the isentropic relationship I calculated t for each corresponding time step - based on the pressure ratio p/p0

I have then added this file for the initial T folder using the time varying uniform value

does this seem reasonable?

FYI I want to simulate the movement of a pressure wave through a duct, I have experimental data for the pressure wave at a the inlet point.


any thoughts on my BC's? I'm guessing thats were the issue is?


I'm lacking in experience and would appreciate some assistance, some general explanation would be great



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       volScalarField;
    object      p;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dimensions      [1 -1 -2 0 0 0 0];

internalField   uniform 0;

boundaryField
{
    inlet      
    {
       
       type timeVaryingUniformFixedValue;
        fileName "$FOAM_CASE/constant/p0vsTime";
        outOfBounds clamp;
    
    }
wall
    {
        type            zeroGradient;
    }

    outlet     
    {
        type            fixedValue;
        value           uniform 101325;
    }

  

   
}

// ************************************************************************* //
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       volScalarField;
    object      T;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dimensions      [0 0 0 1 0 0 0];

internalField   uniform 1;

boundaryField
{
     inlet           
    {
        type timeVaryingUniformFixedValue;
        fileName "$FOAM_CASE/constant/t0vsTime";
        outOfBounds clamp;
     }

   wall           
       {
        type           zeroGradient;
       }

   outlet
      {
        type           zeroGradient;//fixedValue;
        //value         uniform 291;   
      } 
}

// ************************************************************************* //
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       volVectorField;
    object      U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dimensions      [0 1 -1 0 0 0 0];

internalField   uniform (0 0 0);

boundaryField
{
    inlet      
    {
        type            pressureInletOutletVelocity;
        value           uniform (0 0 0);
    }

 wall      
    {
        type            fixedValue;
        value           uniform (0 0 0);
    }

    outlet    
    {
         type            inletOutlet;
        inletValue      uniform (0 0 0);
        value           uniform (0 0 0);
    }

   // outlet2   
    //{
      //  type            inletOutlet;
        //inletValue      uniform (0 0 0);
        //value           uniform (0 0 0);
    //}

   
}

// ************************************************************************* //
dmck is offline   Reply With Quote

Old   December 17, 2013, 09:13
Default sorted
  #5
New Member
 
david mckelvey
Join Date: Nov 2013
Posts: 14
Rep Power: 12
dmck is on a distinguished road
I have managed to solve my issue, for my timeVaryingFixedValue files I had initial values which were t0=0 and p0=0, when I changed this to at t0=0, p0=101325 everything ran as expected.
dmck is offline   Reply With Quote

Old   November 1, 2022, 07:53
Default
  #6
Member
 
Sakun
Join Date: Nov 2019
Location: United Kingdom
Posts: 93
Rep Power: 6
Sakun is on a distinguished road
Quote:
Originally Posted by dmck View Post
I have managed to solve my issue, for my timeVaryingFixedValue files I had initial values which were t0=0 and p0=0, when I changed this to at t0=0, p0=101325 everything ran as expected.

Hi,



is it possible to have a look on your case file ?



thanks in advance
Sakun 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
Superlinear speedup in OpenFOAM 13 msrinath80 OpenFOAM Running, Solving & CFD 18 March 3, 2015 05:36
How to control output time of pressureTools functions? Fluido OpenFOAM Post-Processing 1 May 19, 2014 08:49
Orifice Plate with a fully developed flow - Problems with convergence jonmec OpenFOAM Running, Solving & CFD 3 July 28, 2011 05:24
air bubble is disappear increasing time using vof xujjun CFX 9 June 9, 2009 07:59
Gas pressure question Dan Moskal Main CFD Forum 0 October 24, 2002 22:02


All times are GMT -4. The time now is 09:21.