Ignore:
Timestamp:
12/19/17 15:26:51 (7 years ago)
Author:
dubos
Message:

devel/unstructured : bubble test case with Fortran time stepping

File:
1 edited

Legend:

Unmodified
Added
Removed
  • codes/icosagcm/devel/Python/test/py/slice_GW_hydro.py

    r631 r642  
    1515    caldyn_thermo = unst.thermo_entropy 
    1616    g = mesh.dx/metric.dx_g0 
    17     caldyn = unst.Caldyn_HPE(caldyn_thermo,caldyn_eta, mesh,metric,thermo,BC,g) 
    1817 
    1918    Sik = m0ik*gas0.s 
     
    2524        S0ik = m0ik*gas0.s 
    2625 
    27     u0=mesh.field_u()  
     26    u0=mesh.field_u() 
    2827    u0[:,range(0,2*nx,2),:] = 100.*mesh.dx # Doppler shift 100 m/s 
    2928    flow0=(m0ik,S0ik,u0) 
     
    3534    dt=T/nt 
    3635    print 'nt,dt,dx', nt,dt,dx 
    37     scheme = time_step.ARK2(caldyn.bwd_fast_slow, dt, a32=0.7) 
    38     #scheme = time_step.ARK3(caldyn.bwd_fast_slow, dt) 
    3936 
    40     flow=flow0 
     37    m,S,u=flow0 
     38 
     39    if False: # time stepping in Python 
     40        caldyn = unst.Caldyn_HPE(caldyn_thermo,caldyn_eta, mesh,thermo,BC,g) 
     41        scheme = time_step.ARK2(caldyn.bwd_fast_slow, dt, a32=0.7) 
     42        #scheme = time_step.ARK3(caldyn.bwd_fast_slow, dt) 
     43        def next_flow(m,S,u): 
     44            m,S,u = scheme.advance((m,S,u),nt) 
     45            return m,S,u,caldyn.geopot 
     46    else: # time stepping in Fortran 
     47        scheme = time_step.ARK2(None, dt, a32=0.7) 
     48        caldyn_step = unst.caldyn_step_HPE(mesh,scheme,nt, caldyn_thermo,caldyn_eta,thermo,BC,g) 
     49        def next_flow(m,S,u): 
     50            caldyn_step.mass[:,:], caldyn_step.theta_rhodz[:,:], caldyn_step.u[:,:] = m,S,u 
     51            caldyn_step.next() 
     52            return caldyn_step.mass, caldyn_step.theta_rhodz, caldyn_step.u, caldyn_step.geopot 
     53         
    4154    for i in range(10): 
    4255        time1=time.time() 
    43         flow = scheme.advance(flow,nt) 
     56        m,S,u,geopot = next_flow(m,S,u) 
    4457        time2=time.time() 
    45         m,S,u = flow 
    46         print 'ms per time step : ', 1000*(time2-time1)/nt 
    47         print 'ptop, model top (m) :', unst.getvar('ptop'), caldyn.geopot.max()/unst.getvar('g') 
    48         junk,fast,slow = caldyn.bwd_fast_slow(flow, 0.) 
    49         zz=caldyn.geopot[:,0:llm]/metric.g0/1000 
     58        print 'ms per time step : ', 1000*(time2-time1)/nt, 1000*unst.getvar('elapsed')/(nt*(i+1)) 
     59        print 'ptop, model top (m) :', unst.getvar('ptop'), geopot.max()/unst.getvar('g') 
     60        #        junk,fast,slow = caldyn.bwd_fast_slow(flow, 0.) 
     61        zz=geopot[:,0:llm]/metric.g0/1000 
    5062        plt.figure(figsize=(12,3)) 
    5163        ucomp = mesh.ucomp(u) 
Note: See TracChangeset for help on using the changeset viewer.