Changeset 1150
- Timestamp:
- Mar 28, 2005, 11:20:14 PM (20 years ago)
- Location:
- inundation/ga/storm_surge/pyvolution
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
inundation/ga/storm_surge/pyvolution/cg_solve.py
r599 r1150 1 1 import exceptions 2 2 class VectorShapeError(exceptions.Exception): pass 3 4 import logging, logging.config 5 logger = logging.getLogger('cg_solve') 6 7 logging.config.fileConfig('log.ini') 8 9 #logger.setLevel(logging.DEBUG) 10 11 12 3 13 4 14 … … 7 17 Try to solve linear equation Ax = b using 8 18 conjugate gradient method 9 19 10 20 Input 11 21 A: matrix or function which applies a matrix, assumed symmetric … … 15 25 imax: max number of iterations 16 26 tol: tolerance used for residual 17 27 18 28 Output 19 29 x: approximate solution … … 21 31 22 32 from Numeric import dot, array, Float, zeros 23 33 24 34 b = array(b, typecode=Float) 25 35 if len(b.shape) != 1 : … … 28 38 if x0 is None: 29 39 x0 = zeros(b.shape, typecode=Float) 30 else: 40 else: 31 41 x0 = array(x0, typecode=Float) 32 42 33 43 34 44 #FIXME: Should test using None 35 45 if iprint == 0: 36 46 iprint = imax 37 47 38 48 i=1 39 49 x = x0 … … 58 68 i = i+1 59 69 if i%iprint == 0 : 60 pass 61 #FIXME: Should depend on verbosity 62 #print 'i = %g rTr = %20.15e'% (i,rTr) 70 logger.info('i = %g rTr = %20.15e'% (i,rTr)) 63 71 64 #FIXME: Should this raise an exception? 72 #FIXME: Should this raise an exception? 65 73 if i==imax: 66 74 print 'max number of iterations attained' 67 75 68 76 return x 69 70 -
inundation/ga/storm_surge/pyvolution/pyvolution.ini
r1065 r1150 1 1 [Files MRU] 2 0=c:\home\projects\python-fvm\pyvolution\cg_solve.py.html 3 1=c:\home\projects\python-fvm\pyvolution\pyvolution.zpi 4 2=c:\program files\zfw\readme.txt 2 0=c:\home\projects\python-fvm\pyvolution\least_squares.py 3 1=c:\home\projects\python-fvm\pyvolution\cg_solve.py.html 4 2=c:\home\projects\python-fvm\pyvolution\pyvolution.zpi 5 3=c:\program files\zfw\readme.txt -
inundation/ga/storm_surge/pyvolution/test_advection.py
r1018 r1150 133 133 134 134 #Populate boundary array with dirichlet conditions. 135 135 domain.neighbours = array([[1,-1,-2], [0,-3,-4]]) 136 136 domain.set_quantity('stage', [1.0, 0.0], 'centroids') 137 137 domain.distribute_to_vertices_and_edges() 138 138 139 139 domain.compute_fluxes() 140 140 141 141 X = domain.quantities['stage'].explicit_update
Note: See TracChangeset
for help on using the changeset viewer.