Searching for DSMC collision partners using pseudo

advertisement
Searching for DSMC collision partners
using pseudo-subcells
Department of Mechanical Engineering Report No. 2009/11, University of Queensland
Presented at DSMC09, Santa Fe, NM, Sept 13-17, 2009
Michael N. Macrossan
Centre for Hypersoncis
University of Queensland
Brisbane, AUSTRALIA
– Typeset by FoilTEX –
Abstract: LeBeau et al. introduced the “virtual subcell” (VSC) method of finding a collision
partner for a given particle in a cell. In the VSC method all potential collision partners in the cell
are examined to find the nearest neighbor. To limit the CPU time required for large numbers of
particles in the cell the search can be restricted to a subset of all particles in the cell; the nearest
particle from that restricted search is used. For 3D hexahedral cells, of various aspect ratios, the
expected nearest neighbor distance is found to be given (within few percent) by
dn =
0.746
L
N 0.383
(1)
where N is the number of particles in the cell and L is the cube root of the cell volume. Here
I test a modification of the VSC method, the “pseudo-subcell” (PSC) method, whereby the
search for a collision partner is truncated whenever a “near enough” particle is found. The “near
enough” distance, or diameter of the pseudo-subcell, is δ = F dn. For a factor F = 1.1 there is
good chance that a “near enough” particle is, in fact, the nearest neighbor. The mean collision
separation (MCS) is then found to be less than 1.04dn.
Gallis et al. report that VSC is computationally efficient for N < 30, so here the VSC search
is restricted to 29 remaining particles. The PSC search is restricted to 33 remaining particles, to
– Typeset by FoilTEX –
DSMC09: Pseudo-subcells
yield the same MCS as VSC for N > 30. The limiting (smallest) value of δ for PSC corresponds
to that for N = 30. Fig. 1 compares the performance of VSC and PSC for different values of
N . For large N both methods give a MCS value similar to that which would be expected using
35 standard subcells. PSC uses between 12% and 20% less CPU than VSC. PSC can be tailored
to give a range of accuracy and CPU saving compared to VSC. There seems to be no need for
a standard subcell method; the PSC search routine can be used in all cases merely by limiting δ
and the search length.
1
0.34
0.9
CPU/SEARCH (ARBITRARY UNITS)
0.32
0.3
MSC/Lr
0.28
0.26
0.24
0.7
0.6
0.5
0.4
0.22
0.2
10
0.8
15
20
25
N (PARTICLES/CELL)
30
35
40
Mean collision separation (PSC and VSC)
– Typeset by FoilTEX –
10
15
20
25
N (PARTICLES/CELL)
30
35
40
CPU time (PSC and VSC). 3D cells.
DSMC09: Pseudo-subcells
Outline
• Importance of mean collision separation (MCS)
• Strategies to reduce MCS: subcells (Bird 1994) and ‘Virtual subcells (VSC)’ (LeBeau et al.
2003)
• Pseudo-subcells (PSC): modification of virtual subcell method
• Sacrifice some accuracy to reduce computational cost (adjustable trade-off)
• VSC and PSC for large number of molecules in cell: truncated random search. No need for
standard subcell method
– Typeset by FoilTEX –
DSMC09: Pseudo-subcells
Effect of mean collision separation MCS
•
•
•
•
•
Angular momentum is not conserved in DSMC collision
Meiburg (1986) showed some adverse effects arising from this non-conservation1
Non-conservation depends on particle separation
Bird (1994) introduced subcells within each collision cell to reduce mean collision separation
Subcells tend to make collision partners near (or nearest neighbors)
1
A. Garcia reported during question time that Meiburg’s comparison of DSMC results with molecular dynamics
results was not valid, since the freestream conditions were not properly matched between two examples but that,
nevertheless, the mean collision separation is an important measure of accuracy. (MNM 30 Sep 2009)
– Typeset by FoilTEX –
DSMC09: Pseudo-subcells
Subcells reduce mean collision separation (Bird 1994)
Collision cell divided into subcells: MCS ∝ subcell dimension
• For each collision in cell:
– Choose first molecule for collision from entire cell, at
random: Molecule A for example
– Choose collision partner B from same subcell
• Some cost to ‘index’ molecules to subcells and cells
• Some cost when only one particle in subcell
– Typeset by FoilTEX –
DSMC09: Pseudo-subcells
‘Virtual subcells’ (LeBeau et al. 2003)
• For each collision in cell:
– Choose first molecule for collision from entire cell, at
random: Molecule A for example
– Find nearest neighbor to A: molecule C
• Exhaustive search of all N − 1 ‘possibilities’
• Not as expensive as it seems for N < 20 − 30
MCS as small as possible for given conditions
– Typeset by FoilTEX –
DSMC09: Pseudo-subcells
Reducing the search length for VSC
•
•
•
•
Usually the nearest neighbor is not the last particle checked
Maybe half of the search is ‘wasted’ - If we knew we could stop the search!
Can we guess that we have probably found the nearest neighbor?
If distance d to particle << mean separation between particles, we probably have nearest
neighbor? We probably should stop search? Maybe some other criteria?
• Pseudo-subcell method: set ‘near enough distance’ δ ; if d < δ accept particle, stop search;
otherwise search covers all N , choose nearest neighbor (PSC → VSC for δ → 0).
• Details (a) how to set δ (b) how to conduct search.
– Typeset by FoilTEX –
DSMC09: Pseudo-subcells
The ‘near-enough distance’ δ; radius of pseudo-subcell
• Expected distance to nearest neighbor, dn, depends on N (particles in cell)
• From statistical trials we find (for 3D cells of various aspect ratios)2
dn
0.746
Expected minimum distance
= 0.383
L
N
where L =
1
Vc3 , Vc
is cell volume
• Set δ = F dn. Set factor F for compromise between accuracy and speed.
• For F = 1.1, the MCS found to be 4% larger than for VSC (exhaustive search).
2
The equation gives a compromise fit of the data for dn for cells of various aspect ratios. Similarly for 2D cells,
1
0.672
dn = 0.561 Vc2 gives a good fit for various cell aspect ratios.
N
– Typeset by FoilTEX –
DSMC09: Pseudo-subcells
How to conduct search?
• Each particle in simulation labelled with a number
• All labels within one cell gathered in a list, e.g. [ 4 19 35 67 201 340 560 ]
• For each collision:
– Select first particle at random, e.g. particle 35 in above list
– Start search for near enough neighbor at next particle in list
– Full search order is then 67 201 340 560 4 19
• Assumes no correlation between place in list and distance to neighbors
• Allows a random partial search, without selecting at random from the list
• For N very large, the search length can be limited e.g. to 29 neighbors3, and MCS reaches a
lower limit, equivalent to a fixed number of subcells/cell, and CPU reaches upper limit.
3
VSC ‘competitive’ for N ≤ 30 (Bird et al. 2009). I understand NASA-DAC code may limit the VSC search
length but am not sure of the details. Correction: Gerald LeBeau informed me at the conference that a restricted
search was not used in DAC (MNM 30 Sep 2009).
– Typeset by FoilTEX –
DSMC09: Pseudo-subcells
Mean collision separation for PSC and VSC
0.34
0.32
◦ VSC, search length limited to 29
0.3
(Squares) PSC:
MSC/Lr
0.28
•
•
•
•
0.26
0.24
3D cell. Aspect 1:2:3
PSC factor F = 1.1
Search length limited to 33
Comes to same limit as VSC
0.22
0.2
10
– Typeset by FoilTEX –
15
20
25
N (PARTICLES/CELL)
30
35
40
DSMC09: Pseudo-subcells
CPU time for PSC and VSC
1
CPU/SEARCH (ARBITRARY UNITS)
0.9
• PSC: 12% to 18% less CPU
• Cost of collision selection only, which
may be small part of entire CPU
• The VSC search tested here is the
same as for PSC (starts at next in list,
loops back to start of list) as required
for the limited search strategy.
• PSC not so good for N < 5
0.8
0.7
0.6
0.5
0.4
10
15
– Typeset by FoilTEX –
20
25
N (PARTICLES/CELL)
30
35
40
DSMC09: Pseudo-subcells
1.1
1.1
1.05
1.05
1
1
0.95
0.95
RELATIVE TO VSC
RELATIVE TO VSC
Trade-off: vary F to vary pseudo-subcell radius δ
0.9
0.85
0.8
0.75
0.7
0.9
0.9
0.85
0.8
MCS 5
MCS 15
MCS 25
CPU 5
CPU 15
CPU 25
0.95
0.75
1
1.05
1.1
1.15
F SCALE FACTOR
1.2
(a) 3D CELLS. Aspect 1:2:3
– Typeset by FoilTEX –
1.25
1.3
0.7
0.9
MCS 5
MCS 15
MCS 25
CPU 5
CPU 15
CPU25
0.95
1
1.05
1.1
1.15
F SCALE FACTOR
1.2
1.25
1.3
(b) 2D CELLS. Aspect 1:2
DSMC09: Pseudo-subcells
Conclusions
• A saving in CPU, with almost the same accuracy, can be obtained with PSC. Requires a small
change to the VSC procedure.
• If a value of MCS 10% greater than VSC value is acceptable then savings of CPU of 25% can
be achieved.
• There seems to be no reason for two different search routines for large and small N . For
example, limited search length of about 30 in VSC (or PSC) gives the same MCS as standard
subcell method using 34 subcells/cell.
• If VSC or PSC ‘competitive’ only for N ≤ 20 (Gallis et al. 2009) maximum search length
can of course be set lower.
– Typeset by FoilTEX –
DSMC09: Pseudo-subcells
Bibliography
• G. A. Bird. Molecular Gas Dynamics and the Direct Simulation of Gas Flows. Clarendon,
Oxford, 1994.
• G. A. Bird, M. A. Gallis, J. R. Torczynski, and D. J. Rader. Accuracy and efficiency of
the sophisticated direct simulation Monte Carlo algorithm for simulating non-continuum gas
flows. Physics of Fluids, 21:017103, 2009.
• M. A. Gallis, J. R. Torczynski, D. J. Rader, and G. A. Bird. An improved-accuracy DSMC
algorithm. In T. Abe, editor, Rarefied Gas Dynamics, 26th International Symposium, AIP
Conference Proceedings, volume 1084, pages 299–304, 2009.
• G. J. LeBeau, K. A. Boyles, and F. E. Lumpkin III. Virtual sub-cells for the direct simulation
Monte-Carlo method. A.I.A.A. paper 2003-1031, 2003.
• E. Meiburg. Comparison of the molecular dynamics method and the direct silumation
technique for flows around simple geometries. Physics of Fluids, 29:3107–3113, 1986.
– Typeset by FoilTEX –
DSMC09: Pseudo-subcells
Download