/[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 4122 by gross, Thu Dec 20 05:42:35 2012 UTC revision 4657 by jfenwick, Thu Feb 6 06:12:20 2014 UTC
# Line 1  Line 1 
1    
2  ##############################################################################  ##############################################################################
3  #  #
4  # Copyright (c) 2003-2012 by University of Queensland  # Copyright (c) 2003-2014 by University of Queensland
5  # http://www.uq.edu.au  # http://www.uq.edu.au
6  #  #
7  # Primary Business: Queensland, Australia  # Primary Business: Queensland, Australia
# Line 9  Line 9 
9  # http://www.opensource.org/licenses/osl-3.0.php  # http://www.opensource.org/licenses/osl-3.0.php
10  #  #
11  # Development until 2012 by Earth Systems Science Computational Center (ESSCC)  # Development until 2012 by Earth Systems Science Computational Center (ESSCC)
12  # Development since 2012 by School of Earth Sciences  # Development 2012-2013 by School of Earth Sciences
13    # Development from 2014 by Centre for Geoscience Computing (GeoComp)
14  #  #
15  ##############################################################################  ##############################################################################
16    
17  __copyright__="""Copyright (c) 2003-2012 by University of Queensland  __copyright__="""Copyright (c) 2003-2014 by University of Queensland
18  http://www.uq.edu.au  http://www.uq.edu.au
19  Primary Business: Queensland, Australia"""  Primary Business: Queensland, Australia"""
20  __license__="""Licensed under the Open Software License version 3.0  __license__="""Licensed under the Open Software License version 3.0
21  http://www.opensource.org/licenses/osl-3.0.php"""  http://www.opensource.org/licenses/osl-3.0.php"""
22  __url__="https://launchpad.net/escript-finley"  __url__="https://launchpad.net/escript-finley"
23    
 import logging  
24  import os  import os
25  from esys.downunder import *  from esys.downunder import *
26  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 39  features=[SmoothAnomaly(lx=30*U.km, ly=2
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=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)]
41    
 logger=logging.getLogger('inv')  
 logger.setLevel(logging.DEBUG)  
 handler=logging.StreamHandler()  
 handler.setLevel(logging.DEBUG)  
 logger.addHandler(handler)  
42  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)
43  domainbuilder=DomainBuilder(dim=2)  domainbuilder=DomainBuilder(dim=2)
44  domainbuilder.addSource(source)  domainbuilder.addSource(source)
# Line 57  inv.setSolverMaxIterations(40) Line 52  inv.setSolverMaxIterations(40)
52  inv.getCostFunction().setTradeOffFactorsModels(10)  inv.getCostFunction().setTradeOffFactorsModels(10)
53    
54  rho_new=inv.run()  rho_new=inv.run()
55  print "rho_new = ",rho_new  print("rho_new = %s"%rho_new)
56  print "rho =", source.getReferenceProperty()  print("rho = %s"%source.getReferenceProperty())
57  g, chi = inv.getCostFunction().getForwardModels()[0].getSurvey(0)  g, chi = inv.getCostFunction().getForwardModel().getSurvey(0)
58  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)
59    

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

  ViewVC Help
Powered by ViewVC 1.1.26