Skip to content

Domains

General Domain¤

Domain gives the boundaries and obstacles of a physical field.

A general domain is defined as

Domain

Parameters:

Name Type Description Default
boundaries Sequence

A sequence of four boundary objects representing the boundary conditions. The order is [left_boundary, right_boundary, top_boundary, bottom_boundary].

required
obstacles Sequence

A sequence of obstacle objects representing the solid obstacles inside the domain. Defaults to [].

[]
delta_x float

The grid spacing in the x direction. Defaults to 1.0.

1.0
delta_y float

The grid spacing in the y direction. Defaults to 1.0.

1.0

Special Domain¤

We also give some functions that can quickly generate domains with specific boundaries:

ConvDO.domain.UnconstrainedDomain ¤

UnconstrainedDomain(obstacles=[], delta_x=1, delta_y=1)

Create a domain with unconstrained boundary conditions for all boundaries.

Parameters:

Name Type Description Default
obstacles list

description. Defaults to [].

[]
delta_x int

description. Defaults to 1.

1
delta_y int

description. Defaults to 1.

1

Returns:

Name Type Description
Domain Domain

A domain object.

Source code in ConvDO/domain.py
190
191
192
193
194
195
196
197
198
199
200
201
202
def UnconstrainedDomain(obstacles=[],delta_x=1,delta_y=1):
    """
    Create a domain with unconstrained boundary conditions for all boundaries.

    Args:
        obstacles (list, optional): _description_. Defaults to [].
        delta_x (int, optional): _description_. Defaults to 1.
        delta_y (int, optional): _description_. Defaults to 1.

    Returns:
        Domain (Domain): A domain object.
    """
    return Domain(boundaries=[UnConstrainedBoundary()]*4,obstacles=obstacles,delta_x=delta_x,delta_y=delta_y)

ConvDO.domain.PeriodicDomain ¤

PeriodicDomain(obstacles=[], delta_x=1, delta_y=1)

Create a domain with periodic boundary conditions for all boundaries.

Parameters:

Name Type Description Default
obstacles list

description. Defaults to [].

[]
delta_x int

description. Defaults to 1.

1
delta_y int

description. Defaults to 1.

1

Returns:

Name Type Description
Domain Domain

A domain object.

Source code in ConvDO/domain.py
204
205
206
207
208
209
210
211
212
213
214
215
216
217
def PeriodicDomain(obstacles=[],delta_x=1,delta_y=1):
    """
    Create a domain with periodic boundary conditions for all boundaries.

    Args:
        obstacles (list, optional): _description_. Defaults to [].
        delta_x (int, optional): _description_. Defaults to 1.
        delta_y (int, optional): _description_. Defaults to 1.

    Returns:
        Domain (Domain): A domain object.

    """
    return Domain(boundaries=[PeriodicBoundary()]*4,obstacles=obstacles,delta_x=delta_x,delta_y=delta_y)