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

Time varying pressure gradient for channel flow

Register Blogs Community New Posts Updated Threads Search

Like Tree3Likes
  • 1 Post By Tobermory
  • 1 Post By Tobermory
  • 1 Post By Tobermory

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 1, 2023, 09:04
Default Time varying pressure gradient for channel flow
  #1
Senior Member
 
chandra shekhar pant
Join Date: Oct 2010
Posts: 220
Rep Power: 16
chandra shekhar pant is on a distinguished road
Dear Foamers,
I am struggling to find a way through which I could impose time varying pressure gradient in the channel flow, I looked this website and got some clue, but unable to get the code running, I tried to impose using the following ways in fvoptions:

1. Using
Code:
 vectorCodedSource
, but unable to put the source term on the patches, the inlet patch is divided into 2 sub patches (given in the tutorial as inout1_half1 and inout2_half1). Although not even sure, if source term could be added to the patches/faces. And also not sure if could be done for multiple patches.

2. Using
Code:
vectorSemiImplicitSource
-- I used this successfully for constant pressure gradient but don't understand how this could be done for time varying pressure gradient.

I am tired of trying both the ways, but none is working. If would be very much kind and helpful if anyone could at least let me know which way to move forward, then I would try to concentrate and focus on that. Any help/comment/suggestion would be very much appreciated, many thanks in advance. Happy New Year -2022!
chandra shekhar pant is offline   Reply With Quote

Old   January 1, 2023, 10:10
Default
  #2
Senior Member
 
chandra shekhar pant
Join Date: Oct 2010
Posts: 220
Rep Power: 16
chandra shekhar pant is on a distinguished road
Hi again,
Using the first way, i.e.
Code:
vectorCodedSource
, first I created the cellzoneset using
Code:
topoSet
, by giving a small dimension (detax) in the streamwise direction so that a box is created (tried to give deltax same as that of mesh resolution, since unable to create a box without the 3rd dimension). Maybe some comments/suggestions for this point are welcomed.

Then I know the pressure gradient (let us say 1) in the streamwise direction and put inside that value inside the
Code:
vectorCodedSource
as
Code:
USource[celli] += vector(1, 0,0 );
My doubts/questions are:
1. Am I doing the toposet correctly? If not then how could I select the inlet face as the source for the pressure gradient term?
2. Using vectorCodedSource, should I multiply the pressure gradient term with the length of channel to get the force to be applied in the
Code:
USource[celli] +=
and also to be normalized by the volume of the cell i.e. V[celli]? Since in the previous thread I found that it is the volumetric force thus normalized with the volume.
This exercise I am doing first before implementing the time varying pressure gradient, so that I would be sure that I am moving in correct direction, since I already run the case using
Code:
vectorSemiImplicitSource
by specifying the pressure gradient value of 1, using
Code:
pressureGradient
{
    type 		vectorSemiImplicitSource;
    selectionMode   all;
    volumeMode specific;  
    injectionRateSuSp
     {  
   U ((1 0 0) 0); 
    }
}
Any comment/suggestion/help would be appreciated, many thanks in advance.
chandra shekhar pant is offline   Reply With Quote

Old   January 2, 2023, 04:52
Default
  #3
Senior Member
 
Join Date: Apr 2020
Location: UK
Posts: 668
Rep Power: 14
Tobermory will become famous soon enough
I am a bit puzzled about what you are trying to achieve, since you refer to patches, ie boundary conditions.

When I started reading your first post, I thought that you were trying to apply a global pressure gradient, to balance the wall shear ... and to make that time varying. Is that the case? If so, then this has nothing to do with the boundary conditions, but must be applied to the whole domain through a source term - eg vectorSemiImplicitSource. Perhaps you can apply a table to the source value, to get the time variation - I am not sure what OF version you are applying. Either that, or generate your own version of the solver and just code in the time variation into the solver.

If you are trying to do something else, then you'll need to explain it a bit more, I am afraid. Good luck!
Tobermory is offline   Reply With Quote

Old   January 2, 2023, 05:03
Default
  #4
Senior Member
 
chandra shekhar pant
Join Date: Oct 2010
Posts: 220
Rep Power: 16
chandra shekhar pant is on a distinguished road
Hi Tobermory,

Good morning and many thanks for your response, yes you are correct I am trying to impose (time varying periodic with respect to time ) pressure gradient to balance the wall shear force. As you stated that this could be done using
Code:
vectorSemiImplicitSource
, but this I used for fixed pressure gradient and I am getting fine results. But how this could be done for varying pressure gradient (by using vectorSemiImplicitSource)?


So then I looked at the

Code:
vectorCodedSource
through which I can easily write the simple time varying body force, then I thought that -- if at the inlet I could provide the total force then it would mean that this force will balance the shear force, that's why wrote the second post. Sorry for writing the confusing post. Any further comment/suggestion would be welcomed, many thanks in advance.
chandra shekhar pant is offline   Reply With Quote

Old   January 2, 2023, 05:11
Default
  #5
Senior Member
 
Join Date: Apr 2020
Location: UK
Posts: 668
Rep Power: 14
Tobermory will become famous soon enough
Aaah - okay - I understand now. I don't think that your idea of "applying the total force" at the inlet will work ... and certainly not in the way that you are envisaging. Are you using cyclic boundary conditions in the streamwise direction? If this is an incompressible fluid simulation, then the source term approach should be more robust.

If it's compressible flow, then you probably want to be applying a pressure boundary conditions at the upstream end ... and it all gets complicated.

Assuming it's incompressible, I would suggest tring a table for the source value, and if that doesn't work then the simplest would be to just write your own solver as I suggested in my earlier post.
Tobermory is offline   Reply With Quote

Old   January 2, 2023, 05:18
Default
  #6
Senior Member
 
chandra shekhar pant
Join Date: Oct 2010
Posts: 220
Rep Power: 16
chandra shekhar pant is on a distinguished road
Hi again,

Many thanks for your consistent help, support and cooperation. Sorry I forgot to mention that it's an in-compressible flow. So, my follow up questions would be:
1. Is it not possible to use
Code:
 vectorSemiImplicitSource
for the time varying pressure gradient ?
2. Could you please give some help for modifying or writing a code for that ?
3. What is physically or computationally wrong in providing the total force at the inlet ?
Sorry for asking multiple queries, but for last couple of weeks I am trying to figure this out but had failed and gave a try on this forum, hope you understand my situation, thanks again.
chandra shekhar pant is offline   Reply With Quote

Old   January 2, 2023, 05:34
Default
  #7
Senior Member
 
Join Date: Apr 2020
Location: UK
Posts: 668
Rep Power: 14
Tobermory will become famous soon enough
1. Yes - this seems the best approach to me. Look at the DOxygen entry for the class (https://cpp.openfoam.org/v8/classFoa...e.html#details) and you'll see that they use a table entry for the source value, which was the approach that I suggested. My suggestion is to follow this route.

2. If you wanted to code it up yourself, just add the coding for the time function that you want to apply in the solver loop, for whatever solver you are using. This is probably a more involved task, since you'll need ro learn some basic coding skills ... it will be useful for you in the future though if you want to continue using OF.

3. You can't apply it as a surface condition since the pressure gradient is a body force. Ask yourself, for example, how you would apply the effect of gravity by only using forces on the domain surface.
Tobermory is offline   Reply With Quote

Old   January 2, 2023, 06:00
Default
  #8
Senior Member
 
chandra shekhar pant
Join Date: Oct 2010
Posts: 220
Rep Power: 16
chandra shekhar pant is on a distinguished road
Hello again,

Thanks again for your help and sharing the link. I am afraid that I could import a table, since the pressure gradient needs to be on and off for certain cycles, and it needs to be for the whole simulations, thus I would assume that table approach won't be that beneficial (if I understand correctly then through the table we can import only limited cycles, which ever are given as input in the table). But I would guess that
Code:
type coded;
this could help me, but again not sure if:
1. This could be used for vector field also ?
2. Will it work for OpenFOAM v1906 and/or v 2112 ?
Any further comment/suggestion would be helpful, thanks again, highly appreciate your comments.
chandra shekhar pant is offline   Reply With Quote

Old   January 2, 2023, 06:46
Default
  #9
Senior Member
 
chandra shekhar pant
Join Date: Oct 2010
Posts: 220
Rep Power: 16
chandra shekhar pant is on a distinguished road
Quote:
Originally Posted by Tobermory View Post
3. You can't apply it as a surface condition since the pressure gradient is a body force. Ask yourself, for example, how you would apply the effect of gravity by only using forces on the domain surface.
It took me a while to understand this, and now what my understanding goes like this:
I artificially created a box of size (inletptach = ly \times lz) \times dx, here dx is in the streamwise grid size and ly, lz are the total domain length in the wall height and spanwise direction. And then after generating this in

Code:
topoSetDict
I was specifying the total force onto this region/domain using

Code:
vectorCodedSource
but not at all sure about the *region/domain* and/or *magnitude of this force*. Any further insight would be appreciated, many thanks in advance.
chandra shekhar pant is offline   Reply With Quote

Old   January 14, 2023, 08:25
Default
  #10
Senior Member
 
chandra shekhar pant
Join Date: Oct 2010
Posts: 220
Rep Power: 16
chandra shekhar pant is on a distinguished road
Hi again,
Thanks a lot for your help and support, I guess I figured this out and posted a detailed solution in
Could pressure gradient be modelled as "vectorCodedSource" in fvoptions at inlet
chandra shekhar pant 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
courant number increases to rather large values 6863523 OpenFOAM Running, Solving & CFD 22 July 5, 2023 23:48
Issues on the simulation of high-speed compressible flow within turbomachinery dowlee OpenFOAM Running, Solving & CFD 11 August 6, 2021 06:40
AMI speed performance danny123 OpenFOAM 21 October 24, 2020 04:13
Micro Scale Pore, icoFoam gooya_kabir OpenFOAM Running, Solving & CFD 2 November 2, 2013 13:58
IcoFoam parallel woes msrinath80 OpenFOAM Running, Solving & CFD 9 July 22, 2007 02:58


All times are GMT -4. The time now is 16:27.