Webnucleo.org

Mail Lists | Developers
small logo


Warning: This is no longer the latest available version of this module. Please see the releases page for the most recent version. The Webnucleo group strongly recommends the use of the latest version of any of its online modules.

This tutorial demonstrates how to use the example codes in the wn_sparse_solve distribution src/examples directory. The sample input files used in the tutorial are included in the distribution release and may be located in the data_pub directory.

Example 1: Solve a sparse matrix equation without preconditioning.

wn_sparse_solve routines demonstrated in example1.c are:

To run example1, type the following on the command line:


./example1 ../../data_pub/matrix.xml ../../data_pub/rhs.xml gmres 10 1.e-4 1.e-4 > ex1_output.txt

The result is ex1_output.txt

Try other solvers. For example, to use the biconjugate gradient solver instead of the gmres solver, type


./example1 ../../data_pub/matrix.xml ../../data_pub/rhs.xml bcg 10 1.e-4 1.e-4 > ex1_output_bcg.txt

The result is ex1_output_bcg.txt

In this example, and all subsequent ones, you can also print out information about the solution iterations. For example, type


./example1 ../../data_pub/matrix.xml ../../data_pub/rhs.xml bcg 10 1.e-4 1.e-4 debug > ex1_output_debug.txt

The result is ex1_output_debug.txt

-top-

Example 2: Solve a sparse matrix equation using a user-supplied convergence tester.

wn_sparse_solve routines demonstrated in example2.c are:

To run example2, type the following on the command line:


./example2 ../../data_pub/matrix.xml ../../data_pub/rhs.xml bcg 20 1.e-4 1.e-4 > ex2_output.txt

The result is ex2_output.txt

-top-

Example 3: Solve a sparse matrix equation using a user-supplied preconditioner matrix.

wn_sparse_solve routines demonstrated in example3.c are:

To run example3, type the following on the command line:


./example3 ../../data_pub/matrix.xml ../../data_pub/preconditioner.xml ../../data_pub/rhs.xml gmres 20 1.e-4 1.e-4 > ex3_output.txt

The result is ex3_output.txt

-top-

Example 4: Solve a sparse matrix equation using SPARSKIT's incomplete lu decompositon routines for the preconditioner solves.

wn_sparse_solve routines demonstrated in example4.c are:

To run example4, type the following on the command line:


./example4 ../../data_pub/matrix.xml ../../data_pub/rhs.xml gmres 10 1.e-4 1.e-4 > ex4_output.txt

The result is ex4_output.txt

-top-

Example 5: Solve the linear matrix equation dY/dt = AY with Sparskit.

wn_sparse_solve routines demonstrated in example5.c are:

To run example5, type the following on the command line:


./example5 ../../data_pub/exp_matrix.xml ../../data_pub/exp_initial_vector.xml 1 10 20 1.e-4 > ex5_output.txt

The result is ex5_output.txt

-top-

Example 6: Solve the linear matrix equation dY/dt = AY + P with Sparskit.

wn_sparse_solve routines demonstrated in example6.c are:

To run example6, type the following on the command line:


./example6 ../../data_pub/phi_matrix.xml ../../data_pub/phi_initial_vector.xml ../../data_pub/phi_constant_vector.xml 1 10 20 1.e-4 > ex6_output.txt

The result is ex6_output.txt

-top-



Valid XHTML 1.1        Copyright © 2001-2012, Clemson University. All rights reserved.        Valid CSS!
Page last modified on 2008/06/30 16:01