22
Using Software Quality and Algorithm Testing to Verify a 1- Dimensional Transport Model World Environmental and Water Resources Congress Palm Springs, May 23, 2011 Kaveh Zamani Fabian Bombardelli Eli Ateljevich Jamie Anderson Modeling Support Branch, Bay- Delta Office Department of Water Resources Civil & Environmental Engineering Dept. University of California, Davis

Using Software Quality and Algorithm Testing to Verify a 1-Dimensional Transport Model

  • Upload
    nieve

  • View
    26

  • Download
    0

Embed Size (px)

DESCRIPTION

World Environmental and Water Resources Congress Palm Springs, May 23, 2011. Using Software Quality and Algorithm Testing to Verify a 1-Dimensional Transport Model. Kaveh Zamani Fabian Bombardelli. Eli Ateljevich Jamie Anderson. Modeling Support Branch, Bay-Delta Office - PowerPoint PPT Presentation

Citation preview

Page 1: Using Software Quality and Algorithm Testing to Verify a 1-Dimensional  Transport Model

Using Software Quality and Algorithm Testing

to Verify a 1-Dimensional

Transport Model

World Environmental and Water Resources CongressPalm Springs, May 23, 2011

Kaveh Zamani

Fabian Bombardelli

Eli Ateljevich

Jamie Anderson

Modeling Support Branch, Bay-Delta OfficeDepartment of Water Resources

Civil & Environmental Engineering Dept.University of California, Davis

Page 2: Using Software Quality and Algorithm Testing to Verify a 1-Dimensional  Transport Model

2

Verification: how to find a bug in a forest?

Page 3: Using Software Quality and Algorithm Testing to Verify a 1-Dimensional  Transport Model

3

There were 8/12 serious static faults per 1000 lines of executable files in C/Fortran! (SAND 2002-0529)

Page 4: Using Software Quality and Algorithm Testing to Verify a 1-Dimensional  Transport Model

How to develop a fully testable and tested transport code?

This Talk:

1. STM (Sediment and Transport Module)

2. Software testing

3. Verification measures

4. Transport test suite

5. Challenges

6. Result

4

Page 5: Using Software Quality and Algorithm Testing to Verify a 1-Dimensional  Transport Model

STM:Software testing: Verification:Transport test: Challenges:Results :

Governing Equation and Solution Algorithm

5

iii

i

ii

SinkSourcex

CAD

x

x

AUC

t

AC

)()(

Operator splitting to combine:

• Modified Lax Two Step method + ODE integrator (Advection, Reaction )

• Crank- Nicolson in FVM framework (Dispersion)

HYDROHydrodynamic

HYDROHydrodynamic

QUAL1-D fate and

transport

QUAL1-D fate and

transport

PTMQuasi 3-D particle

Tracking

PTMQuasi 3-D particle

Tracking

Structure of Delta Simulation Model 2 (DSM2)

STM1-D sediment

transport model

STM1-D sediment

transport model

Page 6: Using Software Quality and Algorithm Testing to Verify a 1-Dimensional  Transport Model

6

Modular design Applicable in tidal environments Generalize Eulerian transport solver that

could be adapted to other constituents Second order accuracy Shock capturing Mass conservative Well tested Associated dynamic testing for

development

STM:Software testing: Verification:Transport test: Challenges:Results :

STM Project Goals

Page 7: Using Software Quality and Algorithm Testing to Verify a 1-Dimensional  Transport Model

7STM=Sediment and Transport Module

• Each function in STM has tests

• Code and analytical tests

• Each test puts light of a part

• Test wide range of scenarios

• Test for bad/incomplete input

• Produce report of pass/fail result

• Run tests regularly

(Fortran Unit Test Framework)

STM:Software testing: Verification:Transport test: Challenges:Results :

STM Code Testing

Page 8: Using Software Quality and Algorithm Testing to Verify a 1-Dimensional  Transport Model

8

Testing versus analytical solution1. Richardson Extrapolation2. Method of Manufactured Solution 3. Prescribed Forcing Method4. Perturbation 5. Using symmetry 6. Error analysis 7. Dense mesh solution

STM:Software testing: Verification:Transport test: Challenges:Results :

Convergence

Page 9: Using Software Quality and Algorithm Testing to Verify a 1-Dimensional  Transport Model

9

No! They are brutal. They expose bugs. But they leave behind some bugs as well.

Grid Size

Err

or

1

Nominal scheme’s order of accuracy (2)

1 1

A

B

a b

2≈a > b

After Leveque, 2002

STM:Software testing: Verification:Transport test: Challenges:Results :

Are convergence tests enough?

Page 10: Using Software Quality and Algorithm Testing to Verify a 1-Dimensional  Transport Model

10Adapted from Oberkampf and Trucano, 2002

STM:Software testing: Verification:Transport test: Challenges:Results :

Transport Test Suite

Page 11: Using Software Quality and Algorithm Testing to Verify a 1-Dimensional  Transport Model

11

1. Boundary values: remote Active2. Flow field and coefficients: constant Variable3. Single process Double process Triple process

2nd order accuracy

STM:Software testing: Verification:Transport test: Challenges:Results :

Incremental nature of the tests

Page 12: Using Software Quality and Algorithm Testing to Verify a 1-Dimensional  Transport Model

12

STM:Software testing: Verification:Transport test: Challenges:Results :

Layering in complexity

Page 13: Using Software Quality and Algorithm Testing to Verify a 1-Dimensional  Transport Model

13

STM:Software testing: Verification:Transport test: Challenges:Results :

Layering in complexity

Page 14: Using Software Quality and Algorithm Testing to Verify a 1-Dimensional  Transport Model

14

STM:Software testing: Verification:Transport test: Challenges:Results :

Layering in complexity

Page 15: Using Software Quality and Algorithm Testing to Verify a 1-Dimensional  Transport Model

15

STM:Software testing: Verification:Transport test: Challenges:Results :

Layering in complexity

Page 16: Using Software Quality and Algorithm Testing to Verify a 1-Dimensional  Transport Model

16

STM:Software testing: Verification:Transport test: Challenges:Results :

Layering in complexity

Page 17: Using Software Quality and Algorithm Testing to Verify a 1-Dimensional  Transport Model

17

1. Considering error distribution

2. Dimensionless numbers of natural phenomena

3. Preserving the basic shape4. Oscillation5. Smoothness of initial

condition6. Non-linear/stiff source

termGrid Size

Err

or Machine precisionexceeds round off

error

Computer precision

1

Order of Converge

IIIIII

STM:Software testing: Verification:Transport test: Challenges:Results :

General consideration

Page 18: Using Software Quality and Algorithm Testing to Verify a 1-Dimensional  Transport Model

18

0.0

0.2

0.4

0.6

0.8

1.0 Initial

t=T/4

t=T/4 Model

t=T/2

t=T/2 Model

t=3T/4

t=3T/4 Model

t=T

t=T Model

Channel Length (0 to L)

Con

cent

ratio

n (V

ol/V

ol) Lag

2Lag

Lag

STM:Software testing: Verification:Transport test: Challenges:Results :

Logical error in Advection-Reaction

Page 19: Using Software Quality and Algorithm Testing to Verify a 1-Dimensional  Transport Model

19

BffAufAu 1 hh Be

hhh BBe

• In boundary cells, local reduction up to 2 order does not reduce the global convergence rate.

• Inside the domain cells, local reduction up to 1 order does not reduce global convergence rate.

2

...),(...

x

jiC

2

...),1(...

x

jiC

STM:Software testing: Verification:Transport test: Challenges:Results :

Syntax error in Diffusion

Page 20: Using Software Quality and Algorithm Testing to Verify a 1-Dimensional  Transport Model

20

40,000 45,000 50,000 55,000 60,000 65,000 70,0000.0

0.4

0.8

1.2

1.6

2.0C(t=0)C(t=T/4)C(t=T/2)C(t=3T/4)C(t=T)Exact

Channel Length (m)

Co

nce

ntr

atio

n (

V/V

)

STM:Software testing: Verification:Transport test: Challenges:Results :

Example Advection Reaction, Tidal Flow

Page 21: Using Software Quality and Algorithm Testing to Verify a 1-Dimensional  Transport Model

21

We developed a step by step roadmap for complete verification of a transport code

Approximately 350 tests - 280 unit tests and 70 system/algorithm tests are there.

We designed a really complete test suite May help solve the “grey literature” issue in testing

transport Methods of Computer Science are there to guarantee the

results in computational fluid mechanics STM is, an open source, well tested, and nice

bedrock for further development

STM:Software testing: Verification:Transport test: Challenges:Results :

Accomplishments and final remarks

Page 22: Using Software Quality and Algorithm Testing to Verify a 1-Dimensional  Transport Model

Analog Delta Model

Thank You

Kaveh Zamani: [email protected]

Fabian Bombardelli, PhD: [email protected]

Eli Ateljevich, PhD, PE: [email protected]

Jamie Anderson, PhD, PE: [email protected]

22