source: trunk/anuga_work/development/2010-projects/kv/readme.txt @ 8051

Last change on this file since 8051 was 8051, checked in by steve, 14 years ago

Added in Lindon's code

File size: 2.6 KB
Line 
1ANUGA Kinematic Viscosity Module
2Lindon Roberts, 2010
3
4Summary
5============================================================================
6This module applies kinematic viscosity smoothing to the velocities in a
7domain, given by the parabolic equations
8  du/dt = (h*u_x)_x + (h*u_y)_y
9  dv/dt = (h*v_x)_x + (h*v_y)_y
10for u(x,y) and v(x,y) being water velocities, and h(x,y) is the stage height.
11For more details on the implementation, see the report. In particular, the
12code implements a pure elliptic solver. Both solvers are implicit.
13
14Files Included
15============================================================================
16- kinematic_viscosity.py: The main python module.
17- kinematic_viscosity_ext.c: The C extension to the python module.
18- test_kinematic_viscosity.py: A unit test for the python module.
19- util_ext.*: Copies of the files in anuga.utilities (for kinematic_viscosity_ext.c).
20- sparse.py: A modified version of anuga.utilities.sparse (which will supersede it).
21- test_sparse.py: A unit test for the sparse module.
22- make.bat: A makefile script for MinGW on Windows (this may have to be modified).
23
24Usage
25============================================================================
26Some sample code can be found in the unit tests. In particular, one
27requires an anuga.abstract_2d_finite_volumes.domain domain, a numpy
28vector h with h.shape == (n,) of stage heights and momentum numpy matrix
29p with p == [(hu) | (hv)] where u and v are x- and y-velocity and
30p.shape == (n,2).
31
32The stage height vector is the stage heights for the current time step.
33
34To initialise the kinematic viscosity operator, one uses
35kv_operator = kinematic_viscosity.Kinematic_Viscosity_Operator(domain)
36with optional parameters
37
381. apply_triangle_areas (default True)
39Whether or not to include the factor of 1/|Triangle area| in the numerical
40approximation (see the report for more details).
41
422. verbose (default False)
43Whether to include detailed logs for anuga.log.
44
45Parabolic Solver:
46We use the commands
47> kv_operator.apply_stage_heights(h)
48> p_new = kv_operator.parabolic_solver(p)
49
50Elliptic Solver:
51This solves
52  (h*u_x)_x + (h*u_y)_y = f_1
53  (h*v_y)_y + (h*v_y)_y = f_2
54We also need a right-hand side numpy matrix f with f.shape == (n,2)
55and f == [f_1 | f_2]. Then
56> kv_operator.apply_stage_heights(h)
57> p = kv_operator.cg_solve(f)
58You can also solve for in only one dimension with
59> kv_operator.apply_stage_heights(h)
60> kv_operator.set_qty_considered('u')
61> p_x = kv_operator.cg_solve(f1)
62(and similarly for v)
63
64============================================================================
65
66Last Modified: 25 October 2010
Note: See TracBrowser for help on using the repository browser.