/[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 4154 by jfenwick, Tue Jan 22 09:30:23 2013 UTC revision 4213 by caltinay, Tue Feb 19 01:16:29 2013 UTC
# Line 20  __license__="""Licensed under the Open S Line 20  __license__="""Licensed under the Open S
20  http://www.opensource.org/licenses/osl-3.0.php"""  http://www.opensource.org/licenses/osl-3.0.php"""
21  __url__="https://launchpad.net/escript-finley"  __url__="https://launchpad.net/escript-finley"
22    
 import logging  
23  import os  import os
24  from esys.downunder import *  from esys.downunder import *
25  from esys.escript import unitsSI as U  from esys.escript import unitsSI as U
# Line 39  features=[SmoothAnomaly(lx=30*U.km, ly=2 Line 38  features=[SmoothAnomaly(lx=30*U.km, ly=2
38            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, \
39       x=68*U.km, y=3*U.km, depth=13*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)]
40    
 logger=logging.getLogger('inv')  
 logger.setLevel(logging.DEBUG)  
 handler=logging.StreamHandler()  
 handler.setLevel(logging.DEBUG)  
 logger.addHandler(handler)  
41  source=SyntheticFeatureData(DataSource.GRAVITY, DIM=2, number_of_elements=220, length=100*U.km, features=features)  source=SyntheticFeatureData(DataSource.GRAVITY, DIM=2, number_of_elements=220, length=100*U.km, features=features)
42  domainbuilder=DomainBuilder(dim=2)  domainbuilder=DomainBuilder(dim=2)
43  domainbuilder.addSource(source)  domainbuilder.addSource(source)
# Line 57  inv.setSolverMaxIterations(40) Line 51  inv.setSolverMaxIterations(40)
51  inv.getCostFunction().setTradeOffFactorsModels(10)  inv.getCostFunction().setTradeOffFactorsModels(10)
52    
53  rho_new=inv.run()  rho_new=inv.run()
54  print "rho_new = ",rho_new  print("rho_new = %s"%rho_new)
55  print "rho =", source.getReferenceProperty()  print("rho = %s"%source.getReferenceProperty())
56  g, chi = inv.getCostFunction().getForwardModel().getSurvey(0)  g, chi = inv.getCostFunction().getForwardModel().getSurvey(0)
57  saveSilo(os.path.join(WORKDIR, 'gravinv'), density=rho_new, density_ref=source.getReferenceProperty(), g=g, chi=chi)  saveSilo(os.path.join(WORKDIR, 'gravinv'), density=rho_new, density_ref=source.getReferenceProperty(), g=g, chi=chi)
58    

Legend:
Removed from v.4154  
changed lines
  Added in v.4213

  ViewVC Help
Powered by ViewVC 1.1.26