def __init__(self, _, dt=None, grid=None, size=None, dv=None, courant_field_data=None): self.dt = dt if grid is None: self.mesh = Mesh.mesh_0d(dv) else: if size is None: size = tuple(1 for _ in range(len(grid))) self.mesh = Mesh(grid, size) self.courant_field_data = courant_field_data
def __init__(self, particles_builder: ParticlesBuilder, dt, grid, size, stream_function, field_values, rhod_of, mpdata_iters, mpdata_iga, mpdata_fct, mpdata_tot): super().__init__(particles_builder, dt, Mesh(grid, size), []) self.__rhod_of = rhod_of grid = self.mesh.grid rhod = np.repeat(rhod_of( (np.arange(grid[1]) + 1 / 2) / grid[1]).reshape((1, grid[1])), grid[0], axis=0) self.__GC, self.__mpdatas = Factories.stream_function_2d( grid=self.mesh.grid, size=self.mesh.size, dt=self.dt, stream_function=stream_function, field_values=dict((key, np.full(grid, value)) for key, value in field_values.items()), g_factor=rhod, options=Options(n_iters=mpdata_iters, infinite_gauge=mpdata_iga, flux_corrected_transport=mpdata_fct, third_order_terms=mpdata_tot)) rhod = particles_builder.particles.backend.from_ndarray(rhod.ravel()) self._values["current"]["rhod"] = rhod self._tmp["rhod"] = rhod self.asynchronous = False self.thread: Thread = None super().sync() self.notify()
def __init__(self, dt, grid, size, stream_function, field_values, rhod_of, mpdata_iters, mpdata_iga, mpdata_fct, mpdata_tot): super().__init__(dt, Mesh(grid, size), []) self.__rhod_of = rhod_of grid = self.mesh.grid self.rhod = np.repeat( rhod_of( (np.arange(grid[1]) + 1 / 2) / grid[1] ).reshape((1, grid[1])), grid[0], axis=0 ) self.__GC, self.__mpdatas = Factories.stream_function_2d( grid=self.mesh.grid, size=self.mesh.size, dt=self.dt, stream_function=stream_function, field_values=dict((key, np.full(grid, value)) for key, value in field_values.items()), g_factor=self.rhod, options=Options( n_iters=mpdata_iters, infinite_gauge=mpdata_iga, flux_corrected_transport=mpdata_fct, third_order_terms=mpdata_tot ) ) self.asynchronous = False self.thread: (Thread, None) = None
def __init__(self, particles: Particles, dt, mass_of_dry_air: float, p0: float, q0: float, T0: float, w: callable, z0: float = 0): super().__init__(particles, dt, Mesh.mesh_0d(), ['rhod', 'z', 't'], mass_of_dry_air) # TODO: move w-related logic to _MoistLagrangianParcel self.w = w pd0 = p0 * (1 - (1 + const.eps / q0)**-1) self['qv'][:] = q0 self['thd'][:] = phys.th_std(pd0, T0) self['rhod'][:] = pd0 / const.Rd / T0 self['z'][:] = z0 self['t'][:] = 0 self.sync_parcel_vars() _Moist.sync(self) self.notify()
def __init__(self, dt, mass_of_dry_air: float, p0: float, q0: float, T0: float, w: callable, z0: float = 0): super().__init__(dt, Mesh.mesh_0d(), ['rhod', 'z', 't'], mass_of_dry_air) # TODO: move w-related logic to _MoistLagrangianParcel self.w = w pd0 = p0 * (1 - (1 + const.eps / q0)**-1) self.params = (q0, phys.th_std(pd0, T0), pd0 / const.Rd / T0, z0, 0)
def __init__(self, _: ParticlesBuilder, dt, dv=None): self.dt = dt self.mesh = Mesh.mesh_0d(dv)
def __init__(self, dt, dv=None): self.dt = dt self.mesh = Mesh.mesh_0d(dv)