CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Main CFD Forum (https://www.cfd-online.com/Forums/main/)
-   -   Crude solver for Stokes flow with moving immersed boundaries? (https://www.cfd-online.com/Forums/main/227332-crude-solver-stokes-flow-moving-immersed-boundaries.html)

amcbride May 25, 2020 08:58

Crude solver for Stokes flow with moving immersed boundaries?
 
I'm hoping for some help with a crude Stokes flow solver. My goal is to simulate a few thousand rigid, circular microrobotic agents in a 2D, low-Reynolds-number liquid environment. These agents secrete solutes that diffuse and degrade, and they sense the combined concentrations of these solutes. I'm deliberately keeping models abstract, but I would like the robots to displace the medium as they travel. I'm looking for a rough, easy-to-program approximation for this displacement, given that I don't have a CFD background.

I want to use a regular and fixed Cartesian grid, fine enough that an agent will occupy ten or so cells. I intend the agents to move by magic according to their internal logic; I don't want to simulate either a propulsion mechanism or the effect of the fluid on their motion. I'm only interested in the effect of the agents' moving bodies on the solute concentration fields. I'm also not very concerned about computational efficiency.

Based on what I've read so far about CFD, my best guess is that I should solve the unsteady, incompressible Stokes equations on a staggered grid using a finite difference method, some sort of fractional step for the pressure Poisson equation, and direct, discrete velocity forcing to implement the no-slip condition around the agents' bodies. Does it seem like I'm on the right track so far? Or is there a different approach I should consider?

sbaffini May 25, 2020 09:41

You seem to be on the right track but, as always, the devil is in the details.

First, from your point of view, unless you are willing to implement it yourself, I wouldn't focus too much on the implementation (do you care if the grid is staggered or not, if it is using finite difference, volume or elements or what exact immersed boundary method is used? I guess not). You need a 2D, incompressible, unsteady immersed boundary code with one passive scalar (or temperature).

It is more important how you intend to describe the immersed boundaries. Are your agents simple circles or squares, or something more complex (described how?)?

Also, how did you get to the requirement: 2D, 10 cells per agent and displace the medium as they travel?

According to the specificities above you could get closer to (the code that does) what you need.

For example, unless explicitly needed otherwise, my first attempt would surely be to treat the agents as simple moving sources for the passive scalar (i.e., no interactions at all with the flow field and no need for immersed boundaries), and the second one would treat them as simple circles (much more simple to handle than general immersed boundaries)

However, there certainly are codes that would do that, except that I'm not sure you can hope for 2D because you need to code for it on purpose and you don't get much in return.

amcbride May 25, 2020 11:13

Thank you, Paolo! Your response is very helpful.

I actually was assuming I would implement it myself. It's a proof-of-concept robotics demonstration, and I need to be able to read solute concentrations at the agents' sensor positions, and to use those readings to update the agents' velocities and rates of solute secretions, according to arbitrary logic. (Also, I need an arbitrary number of distinct solutes.) So because of this need for constant interface between the agents and the fluid, I thought it might be easier to code my own solver than try to use CFD software. I had the impression that most CFD software is not designed to be coupled with external logic like this in the middle of a run, but I might be mistaken?

The 2D specification was just for simplicity, assuming I'd be coding it myself. 3D would work too. I chose roughly ten cells per agent so that, if the agent bodies were modeled as straight lines between intersections with grid cell boundaries, they would be polygons with enough sides (eight or so) to be roughly circular.

As for why the displacement is needed, I currently have a simulation where the agent bodies don't displace the medium, and there is no flow at all, just solute diffusion and degradation. It works well. Adding displacement is just to make things slightly more realistic. (But of course my simulation will still be far from truly realistic.)

Right now I treat the agents as circles, described by an exact position and a radius. Circles are good enough, but it would be nice to use arbitrary shapes in the future. Why are circles so much easier? Does it have something to do with Oseenlets?

sbaffini May 26, 2020 06:59

Well, ok, I would not exclude other softwares can't do what you need, but as you have already something in place it is probably your best shot now (of course, I'm somehow giving for granted that you know how to write such a 2D cartesian CFD solver).

Now, as I actually work on a general purpose immersed boundary code, I can tell you that knowing that your immersed boundaries can only be simple analytical objects like circles or axis aligned boxes is a great simplification. And I feel it is also an appropriate one within the context of your simulation (i.e., 2D) where the main goal, I guess, is the agent logic and its outcome in a realistic scenario (not the absolutely realistic simulation).

Also, I was erroneously assuming that there was fluid motion independently from your agents, but in your case you clearly need a minimum (1 way at least) interaction of the agents with the fluid.

Now, the main problem is that the immersed boundary approach is just an umbrella for a plethora of approaches and, unfortunately, I am not really an expert of those in the context of the staggered finite differences method. But I can put forward few things I think might be relevant for you:

1) I would pay attention to where you put your agents sensors and sources, because in the flow you expect to simulate there is the high risk for the scalar to quickly saturate around the agent

2) In order to take care of 2 properly, I would avoid the immersed boundary approaches that allow the flow to be present in the immersed body, because this is likely going to create problems to your readings of the scalar

3) I would simply search for the simplest possible approach to achieve what you want without compromising the outcome of the simulation

Based on the previous reasoning, I would opt for an approach that simply blanks the interior of the circles/agents and use their velocity as boundary condition for the outer fluid. Unfortunately, you will have to look up yourself the details of the pressure equation in such a setting.

amcbride May 26, 2020 09:26

Thank you again! This is helpful advice, especially about the immersed boundary options. You're right that I'm more interested in agent logic than physical accuracy. I will read more about solving the pressure Poisson equation and give it a try.


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