/[escript]/trunk/downunder/test/python/run_gravity.py
ViewVC logotype

Diff of /trunk/downunder/test/python/run_gravity.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 4079 by gross, Fri Nov 16 07:59:01 2012 UTC revision 4122 by gross, Thu Dec 20 05:42:35 2012 UTC
# Line 33  except KeyError: Line 33  except KeyError:
33     WORKDIR='.'     WORKDIR='.'
34    
35  features=[SmoothAnomaly(lx=30*U.km, ly=20*U.km, lz=18.*U.km, \  features=[SmoothAnomaly(lx=30*U.km, ly=20*U.km, lz=18.*U.km, \
36       x=8*U.km, y=3*U.km, depth=2.5*U.km, v_inner=200., v_outer=1e-6),\       x=22*U.km, y=3*U.km, depth=10*U.km, v_inner=200., v_outer=1e-6),\
37            SmoothAnomaly(lx=25*U.km, ly=20*U.km, lz=20*U.km,            SmoothAnomaly(lx=25*U.km, ly=20*U.km, lz=20*U.km,
38       x=30*U.km, y=1*U.km, depth=18*U.km, v_inner=-200., v_outer=1e-6),\       x=40*U.km, y=1*U.km, depth=22*U.km, v_inner=-500., v_outer=1e-6),\
39            SmoothAnomaly(lx=30*U.km, ly=20*U.km, lz=18.*U.km, \            SmoothAnomaly(lx=30*U.km, ly=20*U.km, lz=18.*U.km, \
40       x=68*U.km, y=3*U.km, depth=5*U.km, v_inner=200., v_outer=1e-6)]       x=68*U.km, y=3*U.km, depth=13*U.km, v_inner=200., v_outer=1e-6)]
41    
42  logger=logging.getLogger('inv')  logger=logging.getLogger('inv')
43  logger.setLevel(logging.DEBUG)  logger.setLevel(logging.DEBUG)
44  handler=logging.StreamHandler()  handler=logging.StreamHandler()
45  handler.setLevel(logging.DEBUG)  handler.setLevel(logging.DEBUG)
46  logger.addHandler(handler)  logger.addHandler(handler)
47  source=SyntheticData(DataSource.GRAVITY, DIM=2, NE=60, l=100*U.km, features=features)  source=SyntheticFeatureData(DataSource.GRAVITY, DIM=2, number_of_elements=220, length=100*U.km, features=features)
48  domainbuilder=DomainBuilder(dim=2)  domainbuilder=DomainBuilder(dim=2)
49  domainbuilder.addSource(source)  domainbuilder.addSource(source)
50  domainbuilder.setPadding(10)  domainbuilder.setElementPadding(20)
51  domainbuilder.setVerticalExtents(depth=30*U.km, air_layer=10*U.km, num_cells=16)  domainbuilder.setVerticalExtents(depth=50*U.km, air_layer=20*U.km, num_cells=25)
52    
53  inv=GravityInversion()  inv=GravityInversion()
54    inv.setup(domainbuilder)
55  inv.setSolverTolerance(1e-4)  inv.setSolverTolerance(1e-4)
56  inv.setSolverMaxIterations(40)  inv.setSolverMaxIterations(40)
57  inv.setSolverOptions(initialHessian=10)  inv.getCostFunction().setTradeOffFactorsModels(10)
 inv.setWeights(mu_model=1e-3)  
 inv.setup(domainbuilder)  
58    
59  rho_new=inv.run()  rho_new=inv.run()
60  g, chi = inv.getForwardModel().getSurvey(0)  print "rho_new = ",rho_new
61  saveSilo(os.path.join(WORKDIR, 'gravinv'), density=rho_new, density_ref=source.getReferenceDensity(), g=g, chi=chi)  print "rho =", source.getReferenceProperty()
62    g, chi = inv.getCostFunction().getForwardModels()[0].getSurvey(0)
63    saveSilo(os.path.join(WORKDIR, 'gravinv'), density=rho_new, density_ref=source.getReferenceProperty(), g=g, chi=chi)
64    

Legend:
Removed from v.4079  
changed lines
  Added in v.4122

  ViewVC Help
Powered by ViewVC 1.1.26