Encyclopaedia Index

### MAGIC

This is an acronym for Marching Algorithm for Grid Creation, a feature which was introduced into PHOENICS in 1986.

It is also a one-argument PIL command, for generating curvilinear (BFC) grid coordinates within the sub-domain specified by the DOMAIN command.

There are two options:

1. MAGIC(T)....results in a grid generated by bi-linear or tri-linear interpolation, from the values of the coordinates set on the boundaries of the currently-active DOMAIN. (The argument T is a reference to the term 'transfinite interpolation', a name sometimes used in the literature)

This method generates the grid very quickly, and when the boundary coordinates are smoothly varying it generates useful grids. When the boundaries exhibit discontinuous changes in direction, MAGIC(T) tends to propagate the discontinuities into the domain. In such circumstances, it may produce highly non-orthogonal, and hence undesirable, grids.

2. MAGIC(L)....solves differential equations for the corner coordinates within the currently-active DOMAIN. The solution starts from the existing grid, however generated, eg. by MAGIC(L), MAGIC(T) or READCO.

MAGIC(L) involves the solution of Laplace-like equations for the cartesian coordinates of the cell corners. The finite- difference equations solved for XC, YC and ZC are expressed in linearized form, so that they can be solved by means of linear- equation solvers. The non-linearities of the equations find their expression in the coefficients of the linearized equations, and consequently the coefficients require updating after each solution of the linearized system of equations.

The solution-control parameters LITXC, LITYC & LITZC set the number of iterations of the linear-equation solver for the coordinates XC, YC and ZC. The parameter MSWP sets the number of sweeps of the sub-domain, each sweep involving the update of the coefficients of the equations.

The progress to convergence of the iterative process can be monitored at the VDU at the location IMON, JMON and KMON. The linear solver can be over-relaxed by RELXC, RELYC, RELZC. Other parameters related to the use of MAGIC(L) are: LIJ, LJK, LIK, SLIDW, SLIDE, SLIDS, SLIDN, SLIDL, SLIDH, FIXCOR and FIXDOM.

The VIEW command permits the grid generated to be displayed.

#### The theory underlying MAGIC(L)

1. xC, yC, and zC can be regarded as vectors; and, as such, they can be subjected to the grad operator.
2. grad xC, grad yC and grad zC are constant vectors, the components of which are:
1 0 0,
0 1 0 and
0 0 1 respectively.
3. The divergence of a constant vector is equal to zero. Therefore:
div grad xC =0,
div grad yC =0, and
div grad zC =0.
4. Expressed in terms of arbitrary three-dimensional co-ordinates i,j,k, the div grad operator can be expressed as:

wherein I, J and K are the so-called 'metrics', i.e. the local distance increments corresponding to increments in i, j and k respectively.
5. Any distance change ds can be be effected by making succcssive movements in each of the three cartesian-co-ordinate directions dx, dy, and dz; and these distance increments are connected by:

which can also be expressed, if and only if the i,j,k grid is orthogonal, by: