Estimators
The purpose of an estimator is to calculate the component of the fitness function that requires physical simulation, for example, using differential equations or surrogate models. The estimator should mainly implement an interface of interaction with external stimulatior, such as comsol multiphysics, SWAN or neural network models.
GEFEST provides estimators for several tasks.
Estimator interface
SWAN estimator
Sound waves estimator
- gefest.tools.estimators.simulators.sound_wave.sound_interface.generate_map(domain, structure)[source]
Generates obstacke map according to polygons in structure inside of domain borders.
- gefest.tools.estimators.simulators.sound_wave.sound_interface.generate_random_map(map_size: tuple[int, int], random_seed: int)[source]
Randomly generate an array of zeros (free media) and ones (obstacles).
The obstacles have basic geometric shapes.
- Parameters:
map_size (tuple) – shape of the map to generate
random_seed (int) – random seed for random generation of obstacles
- Returns:
array shaped as map_size, containing random obstacles
- Return type:
random_map (np.array)
- gefest.tools.estimators.simulators.sound_wave.sound_interface.update_velocity(velocities: ndarray, pressure: ndarray, obstacle_map: ndarray, size_x: int, size_y: int)[source]
Update the velocity field based on Komatsuzaki’s transition rules.
- gefest.tools.estimators.simulators.sound_wave.sound_interface.update_perssure(pressure, velocities)[source]
Update the pressure field based on Komatsuzaki’s transition rules.
- gefest.tools.estimators.simulators.sound_wave.sound_interface.eval_spl(pressure_hist, integration_interval=60)[source]
Computes the sound pressure level map.
https://en.wikipedia.org/wiki/Sound_pressure#Sound_pressure_level
- Parameters:
integration_interval (int) – interval over which the rms pressure is computed, starting from the last simulation iteration backwards.
- Returns:
map of sound pressure level (dB).
- Return type:
spl (np.array)
- class gefest.tools.estimators.simulators.sound_wave.sound_interface.SoundSimulator(domain, duration=200, obstacle_map=None)[source]
Bases:
EstimatorClass for the configuration and simulation of sound propagation in a map with obstacles.
Adapted from https://github.com/Alexander3/wave-propagation Based on Komatsuzaki T. “Modelling of Incident Sound Wave Propagation around Sound Barriers Using Cellular Automata” (2012)
- Variables:
map_size (tuple) – size of the map
obstacle_map (np.array) – free media = 0, obstacles = 1. If the given shape is different from map_size, ignore the parameters and generate a map with no obstacles.
duration (int) – duration (in seconds) of the simulation.
size_x (int) – number of cols in the grid.
size_y (int) – number of cols in the grid.
pressure (np.array) – pressure field at current iteration.
pressure_hist (np.array) – history of all simulated pressure fields.
_velocities (np.array) – velocity field at current iteration.