1 Mass-consistent approximation as in WindNinja or QUIC
6 Location: wrf-fire/other/Matlab/quic
9 Given wind field u0, the code minimizes ||u-u0|| subject to div u=0 with
10 boundary condition u=0 on the ground.
12 The code uses staggered grid for wind components at mid sides, similarly
13 as in WRF. The Lagrange multiplier lambda enforcing div u = 0 is at
14 cell centers. The method consists of
15 1. preprocessing u0 and the mesh to set up the Laplace equation for lambda
16 2. solve the Laplace equation for lamda
17 3. postprocess lambda to compute u
19 FFT-based solver - Limited to uniform rectangular grid
21 The solution time scales as n log n with the size n of each dimension.
22 The block example on 500x500x50 mesh takes about 5 seconds on macbook pro.
23 The FFT use is suboptimal due to matlab limitations. The code uses complex
24 Fourier transform and mirroring in vertical direction. Standard
25 implementation by calls to appropriate real transforms should be 5 to 10
26 times faster. Terrain implemented approximately by setting zero input
27 wind u0 inside obstacles as in block_example.m.
37 Amul_v Multiply 3d field by a diagonal vector using 1d indexing mat_mul_v_test
38 Dmul_v Divergence (or transpose) of 3d field using 1d indexing mat_mul_v_test
39 Mmul_v Multiply wind field to flux matrix and 3d field, 1d indexing mat_mul_v_test
40 add_terrain_to_mesh Modify 3D mesh vertically to follow terrain plot_mesh_test
41 adj_mat_test Test that the matrices of div3 and grad3z are adjoint
42 adj_test Test if grad3z and div3 are adjoint, without matrices
43 all_test Run all tests
44 block_example Compute flow with block obstacle using FFT
45 cell2vec Flatten cell matrix of matrices to a vector
55 mass_cons_flux Mass consistent flux, uniform shifted mesh, direct or pcg mass_cons_flux_test
56 mass_cons_flux_test Testing mass_cons_flux, uniform terrain shifted mesh, compare direcrt and pcg
57 mass_cons_int.m Mass consistent approximation by FFT
58 mass_cons_int_test Testing mass consistent approximation by FFT
62 mat_gen_wind_flux_div.m
63 mat_gen_wind_flux_div_test.m
66 mat_wind_flux_div_test.m
69 multigrid Abstract multigrid method with smoothing by pcg multigrid_2d_test, multigrid_3d_test
70 multigrid_2d_test.m Test of multigrid on 2d Laplace with zero boundary conditions
71 multigrid_3d_test.m Test of multigrid on 3d Laplace with zero boundary conditions
75 plot_wind_above_terrain.m
86 startup.m Run this first to set up the environment.