/[escript]/trunk/finley/test/python/coalgas.py
ViewVC logotype

Diff of /trunk/finley/test/python/coalgas.py

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

revision 3525 by gross, Tue May 24 04:04:58 2011 UTC revision 3526 by gross, Tue May 24 05:01:46 2011 UTC
# Line 461  class DualPorosity(object): Line 461  class DualPorosity(object):
461                 rerr=norm_e/norm_u                 rerr=norm_e/norm_u
462             else:             else:
463                 rerr=norm_e                 rerr=norm_e
464                 if rerr>self.__rtol: converged=False                 if norm_e>self.__rtol * norm_u + 1.e-10: converged=False
465             if self.verbose: print "   comp %i: relative change = %e"%(i, rerr)             if self.verbose: print "   comp %i: change = %e (value = %e)"%(i, norm_e,norm_u)
466          n+=1          n+=1
467          self.u=u          self.u=u
468           print "iteration completed."           print "iteration completed."
# Line 573  class PorosityOneHalfModel(DualPorosity) Line 573  class PorosityOneHalfModel(DualPorosity)
573              q_gas=Scalar(0., DiracDeltaFunctions(self.domain))              q_gas=Scalar(0., DiracDeltaFunctions(self.domain))
574              q_water=Scalar(0., DiracDeltaFunctions(self.domain))              q_water=Scalar(0., DiracDeltaFunctions(self.domain))
575              BHP=interpolate(p_init, DiracDeltaFunctions(self.domain))              BHP=interpolate(p_init, DiracDeltaFunctions(self.domain))
             wells_init={ "bhp" : BHP, "q_gas": q_gas, "q_water": q_water}  
576    
577              self.u=(p_init,S_fg_init, c_mg_init, wells_init)              self.u=(p_init,S_fg_init, c_mg_init, BHP, q_gas, q_water)
578    
579        def solvePDE(self, dt):        def solvePDE(self, dt):
580            
581       p_f, S_fg, c_mg, wells_state =self.getState()       p_f, S_fg, c_mg, BHP_old, q_gas_old, q_water_old =self.getState()
582       p_f_old, S_fg_old, c_mg_old, wells_sate_old=self.getOldState()       p_f_old, S_fg_old, c_mg_old, BHP, q_gas, q_water =self.getOldState()
583    
584           S_fw=1-S_fg           S_fw=1-S_fg
585    
# Line 589  class PorosityOneHalfModel(DualPorosity) Line 588  class PorosityOneHalfModel(DualPorosity)
588            print "S_fg range = ",inf(S_fg),sup(S_fg)            print "S_fg range = ",inf(S_fg),sup(S_fg)
589            print "S_fw range = ",inf(S_fw),sup(S_fw)            print "S_fw range = ",inf(S_fw),sup(S_fw)
590            print "c_mg range = ",inf(c_mg),sup(c_mg)            print "c_mg range = ",inf(c_mg),sup(c_mg)
591                print "wells state =",wells_state                print "BHP =",BHP
592                  print "q_gas =",q_gas
593                  print "q_water =",q_water
594    
595           k_fw=self.k_w(S_fw)           k_fw=self.k_w(S_fw)
596           if self.verbose: print "k_fw range = ",inf(k_fw),sup(k_fw)           if self.verbose: print "k_fw range = ",inf(k_fw),sup(k_fw)
# Line 646  class PorosityOneHalfModel(DualPorosity) Line 647  class PorosityOneHalfModel(DualPorosity)
647           for I in self.wells:           for I in self.wells:
648           prod_index.setTaggedValue(I.name, I.getProductivityIndex() )           prod_index.setTaggedValue(I.name, I.getProductivityIndex() )
649    
650       F_fp_Y = A_fw * prod_index * wells_state["bhp"]       F_fp_Y = A_fw * prod_index * BHP
651       F_fs_Y = A_fg * prod_index * wells_state["bhp"]       F_fs_Y = A_fg * prod_index * BHP
652       D_fpp =  A_fw * prod_index       D_fpp =  A_fw * prod_index
653       D_fsp =  A_fg * prod_index       D_fsp =  A_fg * prod_index
654    
# Line 751  class PorosityOneHalfModel(DualPorosity) Line 752  class PorosityOneHalfModel(DualPorosity)
752           BHP=clip( p_f_wells - q/prod_index * self.rho_w.rho_surf/A_fw_wells, minval = BHP_limit)           BHP=clip( p_f_wells - q/prod_index * self.rho_w.rho_surf/A_fw_wells, minval = BHP_limit)
753                    
754           print "AAA",BHP           print "AAA",BHP
755           wells_state_new={ "bhp" : BHP, "q_gas": A_fg_wells * prod_index*(p_f_wells-BHP)/self.rho_g.rho_surf, "q_water": A_fw_wells * prod_index*(p_f_wells-BHP)/self.rho_w.rho_surf }           return (p_f,S_fg, c_mg, BHP, q_gas, q_water )
   
          return (p_f,S_fg, c_mg, wells_state_new)  

Legend:
Removed from v.3525  
changed lines
  Added in v.3526

  ViewVC Help
Powered by ViewVC 1.1.26