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

class gefest.tools.estimators.estimator.Estimator[source]

Bases: object

Interface for estimation backends, e.g. physical simulators, neural networks.

__call__(struct: Structure) Any[source]

Incapsulates estimate method call for simler estimator usage.

abstract estimate(struct: Structure) Any[source]

Must implemet logic of estimation.

SWAN estimator

class gefest.tools.estimators.simulators.swan.swan_interface.Swan(path, targets, grid, domain, input_file_path='INPUT', hs_file_path='r/hs47dd8b1c0d4447478fec6f956c7e32d9.d')[source]

Bases: Estimator

Class for SWAN estimator.

estimate(struct: Structure) float[source]

Function to estimate wave high.

Parameters:

struct – Structure with polygons

Returns:

metric of wave high

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.

Parameters:
  • domain (Domain) – shape of the map to generate

  • structure (Structure) – structure for shaping obstacles

Returns:

array shaped as domain area, containing polygons as obstacles.

Return type:

obstacle_map (np.array)

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: Estimator

Class 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.

step(velocities, pressure, obstacle_map)[source]

Perform a simulation step, upadting the wind an pressure fields.

estimate(structure: Structure) ndarray[source]

Estimates sound pressule level for provided structure.

Parameters:

structure (Structure) – optimized structure

Returns:

map of sound pressure level (dB)

Return type:

ndarray

Comsol estimator