[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Scalar code example 1.
From: |
Jean Marshall |
Subject: |
Scalar code example 1. |
Date: |
Sat, 21 Apr 2001 18:10:05 -0600 |
Hi!
We now have 2 examples of scalar code. The first is the artificial
viscosity code. The second is the advection.
Both of these packages are essentially dimension independent so that
almost all of the code doing the number crunching does not know whether
it is working in a 1D, 2D or 3D geometry. This is a highly
desirable feature since huge numbers of errors can be found and fixed
running in 1D geometry where the runs are only seconds or minutes
long while 3D runs may require hours or even days and 2D runs take
minutes to hours of run time.
The article discussing the
artificial viscosity is: Caramana et al Formulations of
Artificial Viscosity for Multi-Dimensional shock Wave Problems, J
Comp. Phys. [144], 70-97 (98).
The artificial visosity is interesting because it is very complex;
it really needs to be done in scalar code; and it makes use of many
different kinds of centerings. Many of the starting quantities are
CellCentered, for example density, and sound speed. We make use of
the SubCellCentered volumes for weighting. It has VertexCenterings,
EdgeCenterings, SubCellFaceCenterings, SubCellEdgeCenterings, and
SubCellCenterings.
Although this code does not use all centerings, a complet list that we
use follows:
CellCentered
VertexCentered
FaceCentered
EdgeCentered
SubCellCentered
SubVertexCentered
SubFaceCentered
SubEdgeCentered
These centering arise naturally when one uses integral methods to derive
the numerical equations from a set of partial differential
equations. Integral methods are useful because as we all learned
from our numerical analysis class, integration is numerically stable
while differentiation is unstable. Hence, using integral
methods rather than finite difference methods tends to produce more
stable algorithms for solving systems of partial differential
equations.
In this email, Don and I are sending the files for the artificial
viscosity. The scalar code here makes use of the existing POOMA
scalar function capability that Steve Smith provided.
On the other hand, the advection (which we will send in the next email)
makes use of iterators. Having now coded using both methods, we
like iterators better for scalar code. The reason is that in most
scalar code that we work with, there are many different calculations that
need to be done in scalar mode before we arrive at the final scalar
result. For example, in a typical artificial viscosity calculation,
we find that the artificial viscosity is turned on in only about 10 % of
the cells. .
In the code example, we calculated the VertDensity, VertSoundSpeed,
VertGammaConst, the EdgeVelocity, EdgeDensity, EdgeSoundSpeed, and
EdgeGammaConst all in array processing mode. In fact the vertex
centered quantities should only be calculated when one of the
EdgePsiLimiters associated with any of the edges coming from the vertex
point is nonzero. Similarly, the edge quantities are only
calculated when the EdgePsiLimiter for the edge is nonzero. The
rest if the hydro package needs the SubForceQ for velocity update, the
CellQ for the time step control and the SubPressureQMod for the
antihourglassing. Hence the artificial viscosity returns 3
different quantities for use elsewhere in the hydro. This is an
illustration why a scalar function that only returns a single array is
limiting. We had to write 3 scalar functions, one for each of the 3
quantities.
The artificial viscosity is also interesting because it needs:
VertexCoordinates
VertexVelocities
SubFace
areas
CellVolume
CellDensity
Cell
We are sending 5 routines:
7,377 QRelations.hh
33,216 QRelations.t.hh
1,368 QRelations1D.cc
1,370 QRelations2D.cc
1,374 QRelations3D.cc
The QRelations.t.hh contains the code for actually calculating the
quantities. The 3 files:
QRelations1D.cc, QRelations2D.cc and QRelations3D.cc were once in a
single file, but we subsequently split the file into 3 parts so that the
code would compile faster.
QRelations3D.cc
Description: Text document
QRelations.t.hh
Description: Text document
QRelations1D.cc
Description: Text document
QRelations2D.cc
Description: Text document
QRelations.hh
Description: Text document
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Scalar code example 1.,
Jean Marshall <=