def main(args): """Creates cartesianMesh.yaml file for stretched grid.""" mesh = CartesianStructuredMesh() mesh.create(mesh.read_yaml_file(args.input_path)) mesh.print_parameters() if args.output_path: mesh.write_yaml_file(args.output_path) if args.grid_path: mesh.write(args.grid_path, precision=16)
""" Creates a YAML file with info about the structured Cartesian mesh that will be parsed by cuIBM. """ from snake.cartesianMesh import CartesianStructuredMesh # info about the 2D structured Cartesian grid info = [{'direction': 'x', 'start': 0.0, 'subDomains': [{'end': 1.0, 'width': 0.0078125, 'stretchRatio': 1.0}]}, {'direction': 'y', 'start': 0.0, 'subDomains': [{'end': 1.0, 'width': 0.0078125, 'stretchRatio': 1.0}]}] mesh = CartesianStructuredMesh() mesh.create(info, mode='cuibm') mesh.print_parameters() mesh.write_yaml_file('domain.yaml')
'stretchRatio': 1.01, 'reverse': True, 'precision': 2 }, { 'end': 2.0, 'width': width, 'stretchRatio': 1.0 }, { 'end': 15.0, 'width': width, 'stretchRatio': 1.01, 'precision': 2 }] }, { 'direction': 'z', 'start': 0.0, 'subDomains': [{ 'end': spanwise_length, 'width': spanwise_width, 'stretchRatio': 1.0 }] }] mesh = CartesianStructuredMesh() mesh.create(info) mesh.print_parameters() filepath = root_dir / 'cartesianMesh.yaml' mesh.write_yaml_file(str(filepath))
""" Creates a YAML file with info about the structured Cartesian mesh that will be parsed by cuIBM. """ from snake.cartesianMesh import CartesianStructuredMesh # info about the 2D structured Cartesian grid info = [{ 'direction': 'x', 'start': 0.0, 'subDomains': [{ 'end': 1.0, 'width': 1.0 / 192, 'stretchRatio': 1.0 }] }, { 'direction': 'y', 'start': 0.0, 'subDomains': [{ 'end': 1.0, 'width': 1.0 / 192, 'stretchRatio': 1.0 }] }] mesh = CartesianStructuredMesh() mesh.create(info, mode='cuibm') mesh.print_parameters() mesh.write_yaml_file('domain.yaml')
'stretchRatio': 1.01, 'reverse': True, 'precision': 2 }, { 'end': 2.0, 'width': width, 'stretchRatio': 1.0 }, { 'end': 15.0, 'width': width, 'stretchRatio': 1.01, 'precision': 2 }] }] mesh = CartesianStructuredMesh() mesh.create(info) mesh.print_parameters() mesh.write_yaml_file('cartesianMesh.yaml') filepath = 'xgrid.dat' mesh.write(filepath, direction='x') with open(filepath, 'r') as infile: x = numpy.loadtxt(infile, dtype=numpy.float64) filepath = 'ygrid.dat' mesh.write(filepath, direction='y') with open(filepath, 'r') as infile: y = numpy.loadtxt(infile, dtype=numpy.float64) fig, ax = pyplot.subplots(figsize=(10.0, 10.0)) ax.grid()
'width': width, 'stretchRatio': 1.01, 'reverse': True, 'precision': 2 }, { 'end': 2.0, 'width': width, 'stretchRatio': 1.0 }, { 'end': 15.0, 'width': width, 'stretchRatio': 1.01, 'precision': 2 }] }, { 'direction': 'z', 'start': 0.0, 'subDomains': [{ 'end': spanwise_length, 'width': spanwise_width, 'stretchRatio': 1.0 }] }] mesh = CartesianStructuredMesh() mesh.create(info) mesh.print_parameters() mesh.write_yaml_file('cartesianMesh.yaml')