1 | from collections import OrderedDict
|
---|
2 | from pairoptions import pairoptions
|
---|
3 | from IssmConfig import IssmConfig
|
---|
4 |
|
---|
5 |
|
---|
6 | def mumpsoptions(*args):
|
---|
7 | """
|
---|
8 | MUMPSOPTIONS - return MUMPS direct solver petsc options
|
---|
9 |
|
---|
10 | Usage:
|
---|
11 | options = mumpsoptions
|
---|
12 | """
|
---|
13 |
|
---|
14 | #retrieve options provided in varargin
|
---|
15 | options = pairoptions(*args)
|
---|
16 | mumps = OrderedDict()
|
---|
17 |
|
---|
18 | #default mumps options
|
---|
19 | PETSC_MAJOR = IssmConfig('_PETSC_MAJOR_')[0]
|
---|
20 | PETSC_MINOR = IssmConfig('_PETSC_MINOR_')[0]
|
---|
21 | if PETSC_MAJOR == 2.:
|
---|
22 | mumps['toolkit'] = 'petsc'
|
---|
23 | mumps['mat_type'] = options.getfieldvalue('mat_type', 'aijmumps')
|
---|
24 | mumps['ksp_type'] = options.getfieldvalue('ksp_type', 'preonly')
|
---|
25 | mumps['pc_type'] = options.getfieldvalue('pc_type', 'lu')
|
---|
26 | mumps['mat_mumps_icntl_14'] = options.options.getfieldvalue('mat_mumps_icntl_14', 120)
|
---|
27 | if PETSC_MAJOR == 3.:
|
---|
28 | mumps['toolkit'] = 'petsc'
|
---|
29 | mumps['mat_type'] = options.getfieldvalue('mat_type', 'mpiaij')
|
---|
30 | mumps['ksp_type'] = options.getfieldvalue('ksp_type', 'preonly')
|
---|
31 | mumps['pc_type'] = options.getfieldvalue('pc_type', 'lu')
|
---|
32 | if PETSC_MINOR > 8.:
|
---|
33 | mumps['pc_factor_mat_solver_type'] = options.getfieldvalue('pc_factor_mat_solver_type', 'mumps')
|
---|
34 | else:
|
---|
35 | mumps['pc_factor_mat_solver_package'] = options.getfieldvalue('pc_factor_mat_solver_package', 'mumps')
|
---|
36 | mumps['mat_mumps_icntl_14'] = options.getfieldvalue('mat_mumps_icntl_14', 120)
|
---|
37 |
|
---|
38 | #These 2 lines make raijin break (ptwgts error during solver with PETSc 3.3)
|
---|
39 | mumps['mat_mumps_icntl_28'] = options.getfieldvalue('mat_mumps_icntl_28', 1) #1=serial, 2=parallel
|
---|
40 | mumps['mat_mumps_icntl_29'] = options.getfieldvalue('mat_mumps_icntl_29', 2) #parallel ordering 1 = ptscotch, 2 = parmetis
|
---|
41 |
|
---|
42 | return mumps
|
---|