def main(): """Driver""" comm = MPI.COMM_WORLD rank = comm.Get_rank() mpi_size = comm.Get_size() num_nalu_ranks = 8 if mpi_size < 2 * num_nalu_ranks: raise ValueError("Must run on at least %d MPI ranks" % (2 * num_nalu_ranks)) num_amr_ranks = mpi_size - num_nalu_ranks nw.kokkos_initialize() sim = OversetSimulation(comm) sim.printer.echo("Initializing AMR-Wind on %d MPI ranks" % num_amr_ranks) amr_comm = create_subcomm(comm, num_amr_ranks, 0) if amr_comm != MPI.COMM_NULL: pamrex = amrex.PyAMReX(amr_comm, "sphere-amr.inp") awind = AMRWind(pamrex, sim.tioga) sim.register_solver(awind) sim.printer.echo("Initializing Nalu-Wind on %d MPI ranks" % num_nalu_ranks) nalu_comm = create_subcomm(comm, num_nalu_ranks, start_rank=num_amr_ranks) if nalu_comm != MPI.COMM_NULL: nalu = nw.NaluWind(nalu_comm, "sphere-nalu.yaml", sim.tioga) sim.register_solver(nalu) num_timesteps = 20 sim.printer.echo("Initializing overset simulation") sim.initialize() sim.printer.echo("Initialization successful") sim.run_timesteps(num_timesteps) sim.summarize_timings()
def main(): """Driver""" comm = MPI.COMM_WORLD rank = comm.Get_rank() nw.kokkos_initialize() sim = OversetSimulation(comm) sim.printer.echo("Initializing AMR-Wind") pamrex = amrex.PyAMReX(comm, "sphere-amr.inp") awind = AMRWind(pamrex, sim.tioga) sim.register_solver(awind) num_nalu_ranks = 8 sim.printer.echo("Initializing Nalu-Wind on %d MPI ranks" % num_nalu_ranks) nalu_comm = create_nalu_comm(comm, num_nalu_ranks) if nalu_comm != MPI.COMM_NULL: nalu = nw.NaluWind(nalu_comm, "sphere-nalu.yaml", sim.tioga) sim.register_solver(nalu) num_timesteps = 20 sim.printer.echo("Initializing overset simulation") sim.initialize() sim.printer.echo("Initialization successful") sim.run_timesteps(num_timesteps) sim.summarize_timings()
def main(argv): """Driver""" comm = MPI.COMM_WORLD rank = comm.Get_rank() nw.kokkos_initialize() sim = OversetSimulation(comm) sim.printer.echo("Initializing AMR-Wind") case = int(argv[0]) pamrex = amrex.PyAMReX(comm, "ctv-amr" + str(case) + ".inp") awind = AMRWind(pamrex, sim.tioga) sim.register_solver(awind) sim.printer.echo("Initializing Nalu-Wind") nalu = nw.NaluWind(comm, "ctv-nalu" + str(case) + ".yaml", sim.tioga) sim.register_solver(nalu) stop_time = 0.2 deltat = 0.025 / pow(2.0, case) num_timesteps = int(stop_time // deltat) sim.printer.echo("Initializing overset simulation") sim.initialize() sim.printer.echo("Initialization successful") sim.run_timesteps(num_timesteps) sim.summarize_timings()
# -*- coding: utf-8 -*- """\ AMR/Nalu integration """ from mpi4py import MPI import amrex from exwsim import tioga from exwsim.amr_wind.amr_wind_py import AMRWind import exwsim.nalu_wind as nw comm = MPI.COMM_WORLD nw.kokkos_initialize() tg = tioga.get_instance() tg.set_communicator(comm) print("Initializing AMR-Wind", flush=True) pamrex = amrex.PyAMReX(comm, "sphere-amr.inp") awind = AMRWind(pamrex, tg) awind.init_prolog() print("Initializing Nalu-Wind", flush=True) nalu = nw.NaluWind(comm, "sphere-nalu.yaml", tg) nalu.init_prolog(multi_solver_mode=True) nalu.pre_overset_conn_work() awind.pre_overset_conn_work() tg.profile() tg.perform_connectivity() tg.perform_connectivity_amr() nalu.post_overset_conn_work() awind.post_overset_conn_work()