def main(): ''' Die Parameter werden beim Aufruf aus dem config-Files abgerufen usage: >> miniTopSim.py <ConfigFiles...> ''' if(len(argv) > 1 ): configFileNames = argv[1:] else: stderr.write('Error: usage: '+ argv[0] + ' <filename.cfg>') stderr.flush() exit(2) # Read the parameter file par.init() print('Configuration files:\n{0}\n'.format(configFileNames)) for configFiles in configFileNames: par.read(configFiles) surface = Surface() with open(surface.get_surfaceFile(), "w") as file: #initial values surface.write(file, 0) total_time = par.TOTAL_TIME dt = par.TIME_STEP time = 1 #np.arange(initialTime, total_time + dt, dt) while time <= total_time: surface.process(dt) surface.write(file, time * dt) time += dt plot = Plot(surface.get_surfaceFile()) plot.plot()
def test_surface(): dir_path = os.path.dirname(os.path.abspath(__file__)) par.init() par.read(os.path.join(dir_path, 'test_surface.cfg')) surface = Surface() print('PRESS ANY KEY TO EXIT THE PLOT') for t in arange(1, par.TOTAL_TIME + par.TIME_STEP, par.TIME_STEP): surface.process(par.TIME_STEP) plt.title('Test Surface{0}'.format(t)) plt.plot(surface.xvals, surface.yvals, '.r-') plt.xlabel('x') plt.ylabel('y') plt.connect('key_press_event', event) plt.show()