# Flow in porous media: a basic question (2)

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

 December 29, 2022, 12:00 #2 Senior Member   andy Join Date: May 2009 Posts: 276 Rep Power: 18 Is this homework?

 December 29, 2022, 13:29 #3 New Member   tara behmanesh Join Date: Jul 2022 Posts: 13 Rep Power: 4 It is a try to re-simulate a simulation article (in tissue engineering). The problem is consist of a time dependent (due to change in porosity of porous media with growth of mass ) flow in a porous media (a scaffold) described by Brinkman equation, coupled with reaction- diffusion equation and a growth equation. My major isn't mechanical engineering so i did know almost nothing in CFD and previously i didn't do any mathematical modeling and the most similar thing i did was solving a problem consisting of 2 ODEs using MATLAB ode45 😅 ( a bout 4 years ago) which i found it really cool at that time. Anyway currently i have problems with pressure-velocity coupling,(i was first introduced to pressure-velocity coupling in YouTube and get to know what's staggered grid and ACM and watched and solved a flow in cavity problem using ACM. To be honest befor that i did not know what to do with pressure ) but the problem is that in solving the "cavity flow" for example i knew what is the value of velocity first component at the all 4 boundary and so on. But here i have velocity profile at inlet and pressure at outlet so i tried to think what to do and came up with using of darcy formula for finding pressure at inlet and... Long story short i am just trying to find answers for simple questions that i face (by using as little as i know) and then ask am in a right way or not?😊 By the way i can't understand how simple or even funny my questions are cause i know almost nothing, so for me these are serious issues which I think about. And if anyone knows a good book (simple language and inclusion of basic concepts is really important) in CFD please introduce to me,it's really better if it does have some hands on. Thanks Last edited by tara behmanesh; December 29, 2022 at 15:14.

 December 29, 2022, 13:43 #4 Senior Member   andy Join Date: May 2009 Posts: 276 Rep Power: 18 Are you writing the CFD code from scratch, using an existing one and trying to work out how to specify your problem, adapting an existing CFD code for your problem, or something else.

 December 29, 2022, 15:18 #5 New Member   tara behmanesh Join Date: Jul 2022 Posts: 13 Rep Power: 4 Yes i am using a code which was for flow in cavity and trying to modify it for my problem.

December 29, 2022, 16:37
#6
Senior Member

andy
Join Date: May 2009
Posts: 276
Rep Power: 18
Quote:
 Originally Posted by tara behmanesh Yes i am using a code which was for flow in cavity and trying to modify it for my problem.
A square cavity with a moving wall? Or a complicated shaped moving two phase cavity? Or something else?

 December 29, 2022, 16:57 #7 New Member   tara behmanesh Join Date: Jul 2022 Posts: 13 Rep Power: 4 It was a square cavity with top moving wall and i set it's horizontal length equal to my porous media radius and the vertical equal to height/thickness of porous media.

 December 29, 2022, 17:14 #8 Senior Member   andy Join Date: May 2009 Posts: 276 Rep Power: 18 Is your task to develop what may be a fairly challenging CFD code (need to know a bit more to say) without a relevant background in CFD or someone to talk to at your end that develops CFD? Is owning the code important or can you use commercial and/or opensource CFD codes to solve the problem?

 December 30, 2022, 00:30 #9 New Member   tara behmanesh Join Date: Jul 2022 Posts: 13 Rep Power: 4 It wasn't a must to develop code (actually i first think to use ansys fluent but i wasn't familiar with it at all and that way i didn't know how to implement diffusion-reaction and growth equations.) however i was familiar with matlab and i discretized the 2 eqs (using method of lines )and i have 2 odes that should be solved simultaneously with velocity equation. On that time the discretization seemd easy and straightforward to me (so i though that's it i'm going to solve 3 time dependent odes by a solver like ode15 or something and the problem will be solved ,at that moment i didn't even heard of pressure-velocity coupling ) now i think it was a pretty good decision cause if i started with a commercial software probably never understand what's going on the background A question: After i cared for the boundary conditions as you said, then solving pressure-velocity on staggered grid and then having vlocity and pressure on actual nodes, am i allowed to implement the discretized odes (diffusion-reaction and growth) on actual nodes and solve them simultaneously with velocity? Or should i use another discretization method or is there something that i'm doing wrong? Thanks a lot

 December 30, 2022, 03:56 #10 Senior Member   andy Join Date: May 2009 Posts: 276 Rep Power: 18 There would seem to be quite a lot you are doing wrong but without knowing the objectives of your project and your working environment listing them will be difficult. A staggered grid approach develops increasing problems if you need to accurately resolve boundaries. If boundaries can be a bit vague you will need to introduce a method to represent them and probably resolve them better than the internal flow because this is where the gradients are largest. Your reactions will be changing the energy balance so you will need to solve for an energy-related transport equation with which one depending on other factors. Reactions will be changing the composition of your material and so you will likely need transport equations for them. Etc... All these additional numerical methods will have numerical issues like pressure/velocity decoupling, stiffness preventing convergence, large variations in scales preventing resolution forcing more modelling assumptions, etc... The easy option is to take a commercial or open source program in which all or almost all this has been implemented in many many lines of code and then read about what has been implemented while running some test cases to check. The hard and very time consuming option is to research and develop until you have implemented those many many lines of code over a period of years. Without doing this in a group of others developing CFD codes and knowledgeable supervisor/s will make it much more frustrating and lengthy. An intermediate approach is perhaps to construct your program using a scripting language and functions from libraries/toolkits while writing the odd low level routine for missing functionality. If you want to learn and have the time then using open source code rather than matlab is likely to be more fruitful in the longer term but this brings us back to the project objectives.

December 30, 2022, 04:29
#11
Senior Member

Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,809
Rep Power: 72
Quote:
 Originally Posted by tara behmanesh It wasn't a must to develop code (actually i first think to use ansys fluent but i wasn't familiar with it at all and that way i didn't know how to implement diffusion-reaction and growth equations.) however i was familiar with matlab and i discretized the 2 eqs (using method of lines )and i have 2 odes that should be solved simultaneously with velocity equation. On that time the discretization seemd easy and straightforward to me (so i though that's it i'm going to solve 3 time dependent odes by a solver like ode15 or something and the problem will be solved ,at that moment i didn't even heard of pressure-velocity coupling ) now i think it was a pretty good decision cause if i started with a commercial software probably never understand what's going on the background A question: After i cared for the boundary conditions as you said, then solving pressure-velocity on staggered grid and then having vlocity and pressure on actual nodes, am i allowed to implement the discretized odes (diffusion-reaction and growth) on actual nodes and solve them simultaneously with velocity? Or should i use another discretization method or is there something that i'm doing wrong? Thanks a lot

Sorry but I have to say you are on the wrong way. You have a system of coupled PDE, hyperbolic in the divergence-free constraint and parabolic in the momentum equation.
This latter can be discretized in space and then you can use a semi-discrete time integration (method of line) but that is just one component of the full formulation. You have to consider the fact that the pressure equation is derived from the continuity, not from a thermodynamic law. Consequently the BCs for the pressure must satisfy a condition for the existence of a solution for the Poisson problem with Neumann conditions.

What CFD textbook have you read for this topic?

Your time will be lost if you simply think to extend the experience you had on ODE using Matlab.

 December 30, 2022, 05:31 #12 New Member   tara behmanesh Join Date: Jul 2022 Posts: 13 Rep Power: 4 Oh.. Thanks a lot to both of you. At least now i know that i was wasting my time reading on internet and watching some YouTube aiming to learn CFD (by learning some numerical techniques) while i was not aware of nature of the problem and equations that i wanted to solve. I wish i did asked sooner. And kindly can you introduce a good source to start learning CFD?

December 30, 2022, 05:43
#13
Senior Member

Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,809
Rep Power: 72
Quote:
 Originally Posted by tara behmanesh Oh.. Thanks a lot to both of you. At least now i know that i was wasting my time reading on internet and watching some YouTube aiming to learn CFD (by learning some numerical techniques) while i was not aware of nature of the problem and equations that i wanted to solve. I wish i did asked sooner. And kindly can you introduce a good source to start learning CFD?
You can find in this forum several posts asking for a list of good texbooks.

There is no unique textbook to learn CFD, you can go reading
- Anderson
- Ferziger, Peric and Street.
- Blazek
https://www.amazon.it/Introduction-C...81129660&psc=1

December 30, 2022, 07:52
#14
Senior Member

andy
Join Date: May 2009
Posts: 276
Rep Power: 18
Quote:
 Originally Posted by tara behmanesh Oh.. Thanks a lot to both of you. At least now i know that i was wasting my time reading on internet and watching some YouTube aiming to learn CFD (by learning some numerical techniques) while i was not aware of nature of the problem and equations that i wanted to solve. I wish i did asked sooner. And kindly can you introduce a good source to start learning CFD?
It depends on your project and where you want to go with it. Solving problems reliably requires little to no knowledge of computation but does require knowledge of the relevant physics, maths and to a limited extent the numerical methods (essentially how they show up in the simulations). If you want to develop your own code then understanding and implementing numerical methods grows to become the dominant task.

I would suggest defining a few test problems covering the breadth of the physics your are interested in. Finding a few existing CFD programs that can solve all or some of them. Choosing at least two, setting up and running the simulations and comparing the results. At this stage you won't know how reliable the simulations might be or be fully one top of what is going on but you will have information and evidence in front of you to guide the process of studying what is going on and what is or is not important.

If you have access to commercial programs like comsol and fluent they should be the quickest way to get going. Open source programs like OpenFOAM or equivalents are likely to require a bit more effort to get results but should expose you a bit more to what is going on. The next level down is linking together research packages like petsc, mfem, fenics, chemkin,... with a scripting language like python, matlab,... or a small wrapper in a compiled language like C++. Probably only useful if you want to develop your own code.