 ## Fluids

#### How to find the location of the Source of the plume with the help of a robot using MATLAB?

• vkt1990
Subscriber

I want to find the location of the source of the plume by using a mobile robot.  I also want to know the time the robot will take to find the location.  please suggest me which software I  should use.
I am attaching here an image from a paper.

• Keyur Kanade
Ansys Employee

Hi,

Thanks!

Regards,

Keyur

• vkt1990
Subscriber
• Rob
Ansys Employee

You can use CFD to model the plume (as we've already established). Not sure what you're trying to do from there as you set the plume source as part of the model boundary conditions so we already know where it is.

• vkt1990
Subscriber
Actually I want to trace the source of the plume with the help of a robot .as you can see in right side of the picture, robot as a point . robot is tracing the source ...

This has been done by importing the ansys data into matlab... I am unable to understand how to do?
• Rob
Ansys Employee

We can export a range of data formats from Fluent, and you'd need to set this up before the run or read in many data sets & do the export afterwards. What you need in Matlab isn't something I can comment on.

• peteroznewman
Subscriber

Vtk1990,

I believe you are asking about how to program a mobile robot with an algorithm to find the source of the plume.

You want to test this algorithm in a data set that was generated by a CFD model. Members on this site can help with creating the CFD model to generate the data set.

The images show a 2D problem so the robot is only searching in the XY plane. The plume is an injection of CO2 that mixes with the air is what I got from your other post. The difference is in this post there is a nominal air velocity flowing in the channel.

I see that the flow is unsteady. I suggest you remove the square obstruction that makes the flow unsteady and create a steady state solution.  Use that static solution to develop an algorithm for the robot to find the source of the plume.

You need a detailed list of parameters for the CFD simulation:

• domain size L x H

• cell size

• air velocity

• plume size (will it be one cell?)

• Plume inlet velocity or mass flow rate: in 2D will it be directional or omnidirectional like a source?

• To simplify this project, limit the mesh to a pure rectangular grid.

• What is the CFD model: two phase or mixture?

I’m a CFD beginner and haven’t done any simulations with two fluids, so I’m not sure what is the quantity that is tracked in each cell for two phase flow. Let’s just call it concentration. Does concentration of CO2 vary between 0 and 1? Someone can clarify that point.

You need a detailed list of parameters for the robot:

• Robot Velocity: How fast can the robot move? Let’s assume one cell per second.

• Sensor Readings per Second: How many readings of the CO2 concentration can be done per second? Let’s assume one reading per second.

• Sensor Range: If the robot is on one cell, how far out can it sense the CO2 concentration? It knows the concentration of CO2 on the cell it occupies. Does its sensor allow it to obtain the CO2 concentration on the eight adjacent cells? This is an important distinction. If it can sense the concentration on the nine cells in its neighborhood, it can calculate a gradient to help it decide which direction to move in the next second. Let’s assume that to be the case, otherwise it has to move to those 8 cells to get those 8 readings and that will take 8 seconds.

• peteroznewman
Subscriber

ALGORITHM

For the Steady State flow, the algorithm is a basic constrained nonlinear optimization algorithm. Optimization algorithms are usually framed in terms of a minimization problem. If each cell contains a concentration of CO2, call that variable C, then instead of maximizing C, you can minimize F = 1 - C.

Then the optimization problem for the steady state solution is:

Minimize F(x,y), subject to 0 < x < L and 0 < y < H with an initial guess of (x0, y0).

You will have to do some research in optimization algorithms if you want to minimize the time it takes to find the plume, even in a steady state flow. Optimization algorithms generally have two steps. Step 1: local gradient evaluation to pick a direction. Step 2: line search along that direction to pick how far to move along that line before returning to step 1 and continuing to iterate in this way until some convergence criteria are met that says stop iterating, the source has been found.

The simplest algorithm is to calculate the local gradient in each of the eight possible directions and move to the cell that has the lowest value of F (highest concentration of CO2). While this seems intuitively correct, it is extremely slow, especially in this case of a plume. The reason is there is a steep gradient across the width of the plume, but only a shallow gradient along the length of the plume. That is why the conjugate gradient method was invented. You actually don’t want to go just down the steepest slope.

Once you pick a direction, the next part of the algorithm is to decide how far to move in that direction. In an algorithm where a function evaluation can be done at 5, 10 and 20 units along that direction as three evaluations, that is an example of how an optimization algorithm would decide how far to move in that direction before it performs another local gradient search. But if you are in a mobile robot with a limited velocity, then you can’t do a line search without travelling through each cell along that line. That means to get an evaluation at 20 units will take 20 seconds. Maybe the robot should have long range concentration sensors that can look along any line up to some limit, so they can decide how far to move. This is all assuming that the sensor can sense a value less than F = 1.

You also might have to put some heuristics into the algorithm. The algorithm has to deal with the situation where the robot starting location is in a part of the domain where it is surrounded by pure air. In that case, the gradient evaluation comes back as zero in every direction. There is no way to mathematically pick a direction, so the algorithm has to pick directions and perform some kind of grid search to find a trace of the plume.

Or you could just make it a prerequisite of the game that the robot starts within the plume.

It will be a lot of work to get the steady state algorithm working, so table the unsteady problem for now. Also, algorithm development is not really in the scope of what is discussed on this website. Perhaps you can find another place to hold a discussion, like the matlab community forum.

Regards,

Peter

• peteroznewman
Subscriber

I had a go at creating a steady state CO2 plume in this discussion if you want to take a look.

• Rob
Ansys Employee

Don't think staff can give out gold stars Peter, sorry!

We tend to measure volume (mass, or mole) fraction in Fluent which varies between 0 and 1 (total sum of all species adds to 1). Concentration, strictly can have any value depending on the units:   https://www.thoughtco.com/definition-of-concentration-605844   gives a good definition.  For gas plumes volume fraction is a good measure, but we'd probably worry about dangerous levels as a partial pressure: eg a partial pressure of ## bar is sufficient to asphyxiate someone (oxygen is toxic at a partial pressure of 1.6-2.0 bar depending on the individual and exposure time).

• vkt1990
Subscriber

I will apply this. thank you

• peteroznewman
Subscriber

Transient solution has been added to this discussion. 