# Building a model to help me determine parameters of a physical water filter?

I am looking to identify the optimal parameters for a sand water filter (a ratio of coarse sand to fine sand) which has the fastest flow rate with the minimum cloudiness in the effluent water.

Without running multiple iterations of this sand filter, with different ratios, is it possible for me to try and build a model which will help me to identify the correct parameters of the sand filter while minimizing the number of iterations of the testing?

My first thought would be a linear model, with perhaps 3-5 test iterations, and then estimate the inflection point where I would want to set my sand filter ratio?

This seems like a physical problem that will already have been studied a great deal historically. Therefore it would be wrong to approach as a simple "experimental design" problem, independent of the context.

Finding an appropriate (physics-based) model is likely to be crucial. I would suggest looking at the engineering literature to see what framework might be suitable, in terms of model formulation and validation/calibration.

For example, some Googling suggests that the description is similar to "Deep bed filtration". Therefore an appropriate starting point might be

Keir et al. (2009) Deep bed filtration: modeling theory and practice.

Once you have a definite model, and associated parameter estimation problem, you can pose a more specific question here.

Update: The "multi-objective" answer by Hugh is a good general discussion of potential issues. In the particular context here, dimensional analysis would suggest that for a filter of a given size (volume) $V$, the flow rate $Q$ and residence time $T$ will be constrained by $$Q=\frac{V}{T}$$ So in a simple model (no idea how accurate it would be!), where the fractional decrease in turbidity increases with residence time $T$ (e.g. linear adsoprtion), then your two objectives could be in direct conflict. (Suggesting that perhaps $V$ would be a better design parameter.)

Some other physical effects worth considering are:

• In Darcy flow, you can get whatever flow rate you want by increasing the applied pressure gradient* $P$ and/or the cross-sectional area $A$. (*For pressure within reasonable limits.)
• Suspended sediment transport (deposition/entrainment) will be sensitive to the flow velocity, and the net impact on turbidity will also depend on the length of the flowpath ($L$, and perhaps the travel time $T$).

So as noted above, the size of the filter ($V=AL$) could be a significant design factor, if it is allowed to vary. (It will also affect the pore volume, which will impact how the filter "ages", as fines clog the pore-space of the sands.)

Changing the sand grain-size distribution in the filter will affect both the porosity and the permeability, which relate the pressure to the flow velocity. I cannot say exactly what impact this would have on the flow-rate vs. turbidity-reduction relationship, but it might be relatively second order compared to the $V$ effect.

• Actually, the Wikipedia page for Sand Filter has some generic discussion on design, with a few references. For what it's worth, these generic guidelines suggest grain sizes in the range 0.6-1.2 mm (i.e. "coarse sand"), and that due to maximum flow-velocity limitations, area $A$ is usually adjusted to get the desired $Q$. Oct 18 '16 at 22:00

Before considering what model to use you should consider what (mathematically) you are trying to optimize. You said you want "the fastest flow rate with the minimum cloudiness in the effluent water." that's two objectives to optimize. While you have two separate objectives it's impossible to say whether a very slow filter providing perfect water is better than a very fast filter that produces cloudy water (or any configuration between these two extremes).

The way in which you combine these two objectives may need a separate question entirely, a good approach could depends a lot on the specifics of what a filter system can achieve.

Once you have a single objective to measure the filter's performance you'll have to consider how to model the performance (call it $P$) as it varies with parameters of the filter.

If you just use a linear model you may run into problems. For example, if $P$ depends on two variables: How coarse the filter is ($X$), and how many layers of filtration there are ($Y$).

From a few experiments you may get a formula like $P=-3X+4Y+7$

As expected, a less coarse filter gives better results and more layers of filtration gives better results.

If you try to optimize this for a maximum $P$ you will find that the maximum occurs at $X=-\infty$ and $Y=\infty$. A linear model like this will always give extreme values for the optimum.

Often the extreme values of parameters perform poorly in practice. To capture the fact that very small and very large values of $X$ and $Y$ give bad performance but moderate values give good performance you can use a second order model. This will give you a performance formula like this:

$P=c_0+c_1X+c_2Y+c_3X^2+c_4Y^2+C_5XY$

If your data displays a trend of moderate values of $X$ and $Y$ outperforming extreme values then this kind of performance model can help you find an optimum.

You may want to ask another question here once you know your measure of performance and the various parameters which affect it. People can give more directed advice; here I'm just aiming to show the problem with linear modeling.

• I vote against the linear model. I bet it is nonlinear. The "good enough" provides a line in the sand (heh) so what is "good enough" speed or "good enough" transparency are going to bound acceptable models. If it were a cubic polynomial then I would like a sampling that allows decent estimation of the variance which is a 6th order polynomial. I would look at no less than 7 distinct sample locations in the domain. I would also want some replication (3x?), because the real world is noisy, and it is easy to make mistakes in a single test. Oct 18 '16 at 15:41
• Wow, great answer Hugh. You definitely posed some great points! And great points from you, EngrStudent.
– Gary
Oct 18 '16 at 18:09
• You mention having a single objective to measure performance. This single objective can be a measure of the turbidity of the water. This is easily measurable. Perhaps I can use this as my measure of performance.
– Gary
Oct 19 '16 at 15:21
• @Nick if you only use the turbidity then you're neglecting the speed of filtering which you said was important. Since you want to minimize turbidity and maximize speed it might make sense to divide turbidity by speed and minimize that value. Although you can get more sophisticated about how to combine the turbidity and speed measurements.
– Hugh
Oct 19 '16 at 16:47

This is a classic use case for Bayesian optimisation, which focuses on optimising black-box functions that are expensive to sample.

You would place a Gaussian process prior over your function and use the mean and variance of the posterior to iteratively pick sets of parameters to trial using what is known as an acquisition function.

The spearmint library by Jasper Snoek would be a good starting point. Many of his papers and others from the Harvard group give a good overview of Bayesian optimisation.

• I would say that the field "which focuses on optimising functions that are expensive to sample" would be more like surrogate optimization, of which the Gaussian-process flavor is a common variant. Oct 18 '16 at 23:08
• Also given that the problem has a single design variable bounded between 0 and 1, the experiments would have to be pretty expensive to go very far down this route (e.g. perhaps a quadratic response surface, requiring a third sample at 1/2). Oct 18 '16 at 23:27
• I've edited to indicate that BO focuses on black-box functions. BO for a simple problem is <10 lines of code. I have no idea about the cost of the experiments or the physics of the system. Oct 18 '16 at 23:35
• That is fine. For "cost" measured as # function evaluations, a good benchmark study is in the reference cited at my answer here. (This includes "Bayesian Optimization", in the form of DACE.) Oct 18 '16 at 23:43
• Surrogate optimization and Bayesian optimization seem like very feasible methods for which I may want to consider. I would need to choose a proper surrogate model, (response surface being one of these options). In brief, my approach may be to design a factorial or fractional factorial experiment, to generate which are the most critical exploratory variables.
– Gary
Oct 19 '16 at 15:32