mindelec.geometry.GeometryWithTime
- class mindelec.geometry.GeometryWithTime(geometry, timedomain, sampling_config=None)[source]
Definition of geometry with time.
- Parameters
geometry (Geometry) – geometry.
timedomain (TimeDomain) – time domain.
sampling_config (SamplingConfig) – sampling configuration. Default: None.
- Raises
ValueError – If sampling_config is not None but sampling_config.time is None.
- Supported Platforms:
Ascend
Examples
>>> from easydict import EasyDict as edict >>> from mindelec.geometry import create_config_from_edict, Rectangle, TimeDomain, GeometryWithTime >>> rect_with_time_config = edict({ ... 'domain': edict({ ... 'random_sampling': True, ... 'size': 200, ... }), ... 'BC': edict({ ... 'random_sampling': False, ... 'size': 100, ... 'with_normal': True, ... }), ... 'IC': edict({ ... 'random_sampling': False, ... 'size': [10, 10], ... }), ... 'time': edict({ ... 'random_sampling': True, ... 'size': 10, ... }) ... }) >>> rect = Rectangle("rect", [-1.0, -0.5], [1.0, 0.5]) >>> time = TimeDomain("time", 0.0, 1.0) >>> rect_with_time = GeometryWithTime(rect, time) >>> sampling_config = create_config_from_edict(rect_with_time_config) >>> rect_with_time.set_sampling_config(sampling_config) >>> bc, bc_normal = rect_with_time.sampling(geom_type="BC") >>> domain = rect_with_time.sampling(geom_type="domain") >>> ic = rect_with_time.sampling(geom_type="IC") >>> print(domain.shape) (200, 3) >>> print(bc.shape) (90, 3) >>> print(ic.shape) (100, 3)
- sampling(geom_type='domain')[source]
sampling points.
- Parameters
geom_type (str) –
geometry type: can be ‘domain’ or ‘BC’ or ‘IC’. Default: ‘domain’.
’domain’, feasible domain of the problem.
’BC’, boundary of the problem.
’IC’, initial condition of the problem.
- Returns
- Numpy.array, if the with_normal property of boundary configuration is true, returns 2D numpy array with
boundary normal vectors. Otherwise, returns 2D numpy array without boundary normal vectors.
- Raises
ValueError – If config is None.
KeyError – If geom_type is domain but config.domain is None.
KeyError – If geom_type is BC but config.bc is None.
KeyError – If geom_type is IC but config.ic is None.
ValueError – If geom_type is not BC, IC nor domain.
- set_sampling_config(sampling_config: SamplingConfig)[source]
set sampling info
- Parameters
sampling_config (SamplingConfig) – sampling configuration.
- Raises
TypeError – If sampling_config is not instance of SamplingConfig.