'you are using snake-{}'.format(snake.__version__)) atol_min, atol_max = 5, 16 time_step = 1500 main_directory = os.path.dirname(__file__) reference_directory = os.path.join(main_directory, 'atol16') reference = CuIBMSimulation(directory=reference_directory, description='atol=1.0E-16') reference.read_forces() fx_reference = reference.forces[0].values[-1] fy_reference = reference.forces[1].values[-1] reference.read_grid() p_reference = reference.read_pressure(time_step) qx_reference, qy_reference = reference.read_fluxes(time_step) fx_errors, fy_errors = [], [] p_errors = [] qx_errors, qy_errors = [], [] for atol in range(atol_min, atol_max): directory = os.path.join(main_directory, 'atol{}'.format(atol)) simu = CuIBMSimulation(directory=directory, description='1.0E-{}'.format(atol)) simu.read_forces() fx = simu.forces[0].values[-1] fy = simu.forces[1].values[-1] simu.read_grid()
refinement_ratio = 2.0 fx, fy = [], [] p = [] qx, qy = [], [] main_directory = os.path.dirname(__file__) for time_increment, final_time_step in zip(time_increments, final_time_steps): directory = os.path.join(main_directory, time_increment.replace('=', '')) simu = CuIBMSimulation(directory=directory, description=time_increment) simu.read_forces() fx.append(simu.forces[0].values[-1]) fy.append(simu.forces[1].values[-1]) simu.read_grid() p_simu = simu.read_pressure(final_time_step) p.append(p_simu.values) qx_simu, qy_simu = simu.read_fluxes(final_time_step) qx.append(qx_simu.values) qy.append(qy_simu.values) file_path = os.path.join(os.path.dirname(__file__), 'temporalConvergence.txt') with open(file_path, 'w') as outfile: outfile.write('\n* Drag force:\n') outfile.write( 'Value and relative difference with the reference value (smallest dt)\n' ) outfile.write('\t{}: {}\n'.format(time_increments[0], fx[0])) for i in (1, 2): outfile.write('\t{}: {} ({}%)\n'.format( time_increments[i], fx[i], (fx[i] - fx[0]) / fx[0] * 100.0))
warnings.warn('The figures were originally created with snake-0.1.2, ' + 'you are using snake-{}'.format(snake.__version__)) atol_min, atol_max = 5, 16 time_step = 1500 main_directory = os.path.dirname(__file__) reference_directory = os.path.join(main_directory, 'atol16') reference = CuIBMSimulation(directory=reference_directory, description='atol=1.0E-16') reference.read_forces() fx_reference = reference.forces[0].values[-1] fy_reference = reference.forces[1].values[-1] reference.read_grid() p_reference = reference.read_pressure(time_step) qx_reference, qy_reference = reference.read_fluxes(time_step) fx_errors, fy_errors = [], [] p_errors = [] qx_errors, qy_errors = [], [] for atol in range(atol_min, atol_max): directory = os.path.join(main_directory, 'atol{}'.format(atol)) simu = CuIBMSimulation(directory=directory, description='1.0E-{}'.format(atol)) simu.read_forces() fx = simu.forces[0].values[-1] fy = simu.forces[1].values[-1] simu.read_grid() p = simu.read_pressure(time_step)
refinement_ratio = 2.0 fx, fy = [], [] p = [] qx, qy = [], [] main_directory = os.path.dirname(__file__) for time_increment, final_time_step in zip(time_increments, final_time_steps): directory = os.path.join(main_directory, time_increment.replace("=", "")) simu = CuIBMSimulation(directory=directory, description=time_increment) simu.read_forces() fx.append(simu.forces[0].values[-1]) fy.append(simu.forces[1].values[-1]) simu.read_grid() p_simu = simu.read_pressure(final_time_step) p.append(p_simu.values) qx_simu, qy_simu = simu.read_fluxes(final_time_step) qx.append(qx_simu.values) qy.append(qy_simu.values) file_path = os.path.join(os.path.dirname(__file__), "temporalConvergence.txt") with open(file_path, "w") as outfile: outfile.write("\n* Drag force:\n") outfile.write("Value and relative difference with the reference value (smallest dt)\n") outfile.write("\t{}: {}\n".format(time_increments[0], fx[0])) for i in (1, 2): outfile.write("\t{}: {} ({}%)\n".format(time_increments[i], fx[i], (fx[i] - fx[0]) / fx[0] * 100.0)) outfile.write( "Observed order of convergence: {}\n".format(