Exemplo n.º 1
0
def main_func(particle=0., t=0, out_count=0):
    particle0, grid_arr = init.initial()

    if t == 0:
        particle = np.copy(particle0)

    center_arr = grid_arr + step_length / 2.

    tin.time_int(particle, center_arr, t, out_count)

    print("\nstop_time reached...\n")
Exemplo n.º 2
0
        f_TI = leapfrog
#    elif time_integration_scheme == 'RK4':
#        f_TI = range_kutta_4
    else:
        raise ValueError('time_integration.py: Invalid time integration scheme...')
        
    return f_TI

time_int = time_int_func()

if __name__=='__main__':
    """
    -----Test block-----
    Run this module to get the time taken for one time integration step
    """
    
    import initial_condition as init
    import assign as asn
    import poisson as ps
    import time    

    particle,grid_arr = init.initial()
    center_arr = grid_arr+step_length/2.
    
    start = time.time()
    time_int (particle,center_arr,testflag=True)
    end = time.time()

    print("Time taken for one time integration step: "+str(end-start)+" sec")