COSP: Constant Optimising Software Package

__What is COSP
__

PHOENICS versions 3.5 and beyond are being delivered with a "goal-seeker" component, COSP which comprises a set of subroutines attached to PHOENICS for the purpose of solving so-called "inverse problems", such as:

- Determining what values of constants in empirically-based physical models, utilised by PHOENICS, best fit a prescribed set of experimental data.
- What geometrical or boundary-condition input data will cause the predicted performance of some equipment to be closest to some desired specification.
- What values of numerical values such as relaxation factors promote the most rapid convergence?

How COSP works

- When the COSP feature of PHOENICS is used for constant-optimising tasks of type 1 above, it takes as inputs:

- a Q1 file of multi-run type, which defines the experimental conditions which PHOENICS is required to simulate;
- a "target data" file which contains the experimental data, for each of these conditions, with which it is desired that the PHOENICS predictions should agree;
- a preliminary set of values of the constants which it is desired to optimise;
- information about how close a fit it is desired to achieve.

- PHOENICS multi-runs are then performed in repeated cycles. At the end of each cycle, the predictions are compared with the target data;
- a new set of constants is then selected in accordance with a systematic error-minimising strategy;
- the EARDAT file is correspondingly changed; and a new multi-run is then conducted;
- Cycles are terminated when the errors have been sufficiently reduced.
- Similar proceedings take place when the optimisation task is of type2 or type 3.

COSP has been evaluated through worked examples and also applied to the tobacco industry for the filter design.

__Worked examples
__

**Case 1. Searching the boundary value at the outlet
**

This example is to show how COSP has been used to search the correct boundary value for a convection-diffusion problem for which the exact solution is available for comparison with the numerical prediction.

**The exact solution and the data set
**

The mathematical descriptions for the convection-diffusion problem is as follows.

dJ/dx=1/Pe*d(dJ/dx)/dx+S,

where

S= 1-2/Pe+2x+pi*cos(pi*x)+pi**2*sin(pi*x)/Pe

Boundary conditions:

x= 0, J = 1+exp(-Pe)

x= 1, J = 4

The exact solution is :

J = 1+x+x**2+exp(-Pe(1-x))+sin(pi*x)

The exact solutions of J at x=0.5 with various Pe values are listed in table 1 and used for the COSP process

Table 1

NoVar |
Pe |
J at x=0.5 |

1 |
1 |
3.357 |

2 |
2 |
3.118 |

3 |
3 |
2.973 |

4 |
4 |
2.886 |

5 |
5 |
2.832 |

**
**

**The task
**

At the start of the searching process, an arbitrary initial value, 2 has been given and the searching range has been set as

1 < J (at x=1) < 8

The task of COSP is to find the best boundary value, J (at x=1) (ideally the value should be 4) which makes the difference between the prediction and experiments be regarded as negligible.

**Results
**

For this case, the grid of 40x2 has been used. The boundary values chosen by COSP at different number of runs are shown in the table 2 where F is the objective function which is used to measure the difference between predictions and experiments, and its tolerance can be specified by the user.

Table 2

NoRun |
F |
J ( at x=1) |

1 |
0.1458 |
2.00 |

10 |
0.109 |
2.50 |

50 |
0.019 |
4.24 |

105 |
0.001 |
3.99 |

COSP stopped at 105th run as the tolerance for F has been set to 0.001.

The best value at the boundary x= 1 found by COSP is 3.99 which is very close to the theoretical value 4.

The comparison between the exact solution and the calculated values at x=0.5 for various number of runs are shown in the table 3.

Table 3

Pe |
J(1) |
J(10) |
J(50) |
J(105) |
J(exact) |

1 |
2.601 |
2.790 |
3.448 |
3.353 |
3.357 |

2 |
2.576 |
2.712 |
3.187 |
3.118 |
3.118 |

3 |
2.602 |
2.697 |
3.023 |
2.975 |
2.973 |

4 |
2.643 |
2.704 |
2.920 |
2.888 |
2.886 |

5 |
2.677 |
2.717 |
2.855 |
2.835 |
2.832 |

The run-time for 105-runs took 107 sec on a Petium III 600MHz.

**
**

**Case 2. Optimisation of the constants in the wall function for 2D pipe turbulent flow
**

This example is to show how COSP has been applied to a 2D pipe turbulent flow for optimisation of two constants in the wall function calculation.

**Experimental data
**

The following expression by Filonenko has been employed to provide the experimental data, with which the PHOENICS predictions should agree

DP (exp) = (A * L/2*Rp + 0.065)* Rho* Wo**2 / 2;

where A = 1./(1.82*Lg(Re)-1.64)**2; Re = Wo*2.*Rp / Vis

L and Rp is the length and radius of the pipe respectively; Rho is the density, Vis is the viscosity and Wo is the velocity.

At L = 5 m; Rp= 0.5 m ; Rho= 1.22 kg/m3; Vis =1.465E-5 m2/s;

the values of DP at 6 different velocities,

W_{0} = 10, 20, 30, 40, 50,60 m/s

are given in the table 4. These values serve a prescribed set of data for the comparison with predictions during the COSP searching process.

Table 4

NoVar |
W |
DP |

1 |
10 |
63.489 |

2 |
20 |
221.31 |

3 |
30 |
461.76 |

4 |
40 |
779.75 |

5 |
50 |
1172.0 |

6 |
60 |
1636.2 |

**
**

**Constant searching
**

The standard K-E model with the Blasius wall functions has been used for the numerical simulation. The following is the equation for the skin-friction factor:

Cf = C1/ Re**C2.

with the known constants, C1=0.023 and C2=0.25.

At the start of the constant-searching process, the initial guess values, C=0.02 and C2= -0.05 have been given and the following searching ranges have been set,

0.01 < C1 < 0.05; -0.1 < C2 < 0.3

The task for COSP is to find, by performing the above-described 'multi-runs', the constants, C1 and C2 which fit the predictions best to the experiments.

**Results
**

For this case, the grid of 20x20 has been used. The results of the constant-searching for different number runs are shown in the table 5.

Table 5

NoRun |
F |
Const1 |
Const2 |

1 |
1.63 |
0.02 |
-0.05 |

648 |
0.045 |
0.0116 |
0.148 |

1290 |
0.028 |
0.0161 |
0.1895 |

2508 |
0.015 |
0.021 |
0.2191 |

3072 |
0.0041 |
0.025 |
0.243 |

The comparison between the experimental and the calculated DP for different number of runs are shown in the table 6.

Table 6

W |
DP(1) |
DP(648) |
DP(1290) |
DP(2508) |
DP(3072) |
DP(exp) |

10 |
147.596 |
57.5819 |
59.5385 |
62.4620 |
63.1005 |
63.489 |

20 |
556.102 |
213.139 |
215.607 |
222.729 |
222.243 |
221.31 |

30 |
1210.88 |
458.046 |
457.424 |
468.230 |
463.779 |
461.76 |

40 |
2104.93 |
788.044 |
779.773 |
792.982 |
781.274 |
779.75 |

50 |
3233.55 |
1200.27 |
1179.18 |
1193.03 |
1170.54 |
1172.0 |

60 |
4593.12 |
1692.58 |
1653.06 |
1665.47 |
1628.46 |
1636.2 |

The run-time for 3072-runs is 17 hr on a Petium III 600MHz.

__
__

__The feature of COSP
__

The above examples have shown that COSP can be used to reliably choose, from arbitrary initial values, the boundary value for the first case and the constants for the second which best fit the prescribed set of the data.

It might reasonably be said the COSP represents the first step towards answering the designer's** real** CFD question, which is often** not**, 'What will the flow be if I choose these inflow conditions?' **but rather** 'What inflow conditions will give me the flow that I want?'

That being so, the future for COSP appears very bright. Being new, it has only a modest track record at present. Once its capabilities are recognised by PHOENICS users however, that situation can be expected soon to change.