Not Off topic - Optimization of a finite volume differencing scheme for multispecies transport problem
  Home FAQ Contact Sign in
comp.lang.fortran only
 
Advanced search
POPULAR GROUPS

more...

 Up
Not Off topic - Optimization of a finite volume differencing scheme for multispecies transport problem         

Group: comp.lang.fortran · Group Profile
Author: Carlie J. Coats
Date: Aug 3, 2008 09:00

bouloumag@gmail.com wrote:
> I am working on a 3d finite volume scheme for an advection-diffusion-
> reaction problem involving a large number of chemical species (more
> than 60) and a large domain (an big lake for example). Since this
> scheme will be used on large problem, I want it to be as efficient as
> possible. The linear operators are splitted in 2 :
>
> (1) advection-diffusion is solved using a fully implicit finite volume
> discretisation with a multigrid method for solving the linear system
> of equations
> (2) chemistry is solved using a Runge-Kutta-Rosenbrock solver for
> stiff ODE.
>
> The transport (1) actually have the following form
>
> do specie=1, nbSpecies
> call construct_matrix(specie)
> call solve_linear_system(specie)
> end do
>
> and takes a lot of time on the computer.
>
> Assuming that diffusion coefficients are the same for all species, the
> whole fluid (including all species) should follow the same path during
> the transport. I wonder if it really necessairy to loop over all
> species and compute the transport several time. It is possible to
> compute the transport of the fluid once, and after reuse this
> calculation to the different species ?
>
> I would really appreciate suggestion or reference on this.

I have done extensive research on similar problems in the past:
~50 species, Bott difference-based advection, Crank-Nicholson
diffusion, QSSA and EBI chemical solvers. That experience
is behind the MAQSIP-RT model we use for our air-quality
forecast work.

Based on that experience, I can give you this advice:

1) Subscript order is *really* important.

2) Relationship between loop order and subscript order is also
really important.

3) Subroutine-call structure can cost you some performance.

If you put species subscript as "fastest" (leftmost in Fortran), and
code all the processes with species-loop innermost, then you get at
least factor-of-three improvement over the species-subscript
"slowest"/species-loop outermost approach, in my experience. Note also
that having both the species and spatial loops visible at the same time
is also important; the structure you describe (where species loop
encloses subroutine calls that contain the spatial loops) prevents many
optimizations, and can easily cost factor-of-five performance. Or even
more-- MAQSIP-RT outperforms an equivalent STEM by a factor of 12 and
CAMx by a factor of 5, for typical problem-sizes...

You can find the notes for a seminar I presented to the US EPA's
Office of Research and Development in 2002 at URL

<http://www.baronams.com/staff/coats/epa2002_seminar.html>

(The examples were deliberately chosen from met model code rather
than atmospheric chemistry-transport code, so as to avoid stepping
on anyone's toes...Sorry)

Carlie J. Coats, Jr.,Ph.D.
Chief Systems Architect
Baron Advanced Meteorological Systems, LLC.
no comments
diggit! del.icio.us! reddit!