2.1. Domains

This module contains classes to store domain information in OpenTidalFarm. In particular each Domain includes:

  • the computational mesh;

  • subdomains markers (used to identify turbine site areas);

  • boundary markers (used to identify where boundary conditions shall be applied).

The mesh, and subdomain and surface makers can be visualised with

plot(domain.mesh, title="Mesh")
plot(domain.facet_ids, title="Area ids")
plot(domain.cell_ds, title="Boundary ids")
interactive()

2.1.1. Create a rectangular domain

class opentidalfarm.domains.rectangle_domain.RectangularDomain(x0, y0, x1, y1, nx, ny)[source]

Create a rectangular domain.

Parameters:
  • x0 (float) – The x coordinate of the bottom-left.

  • y0 (float) – The y coordinate of the bottom-left.

  • x1 (float) – The x coordinate of the top-right corner.

  • y1 (float) – The y coordinate of the top-right corner.

  • nx – The number of elements in the x direction

  • ny (int) – The number of elements in the y direction

cell_ids

A dolfin.CellFunction containing the area markers.

facet_ids

A dolfin.MeshFunction containing the surface markers.

2.1.2. Load domain from a mesh file

class opentidalfarm.domains.file_domain.FileDomain(mesh_file, facet_ids_file=None, cell_ids_file=None)[source]

Create a domain from DOLFIN mesh files (.xml).

Parameters:
  • mesh_file (str) – The .xml file of the mesh.

  • facet_ids_file (str) – The .xml file containing the facet ids of the mesh. If None, the default is to mesh_file + “_facet_region.xml”.

  • cell_ids_file (str) – The .xml file containing the cell ids of the mesh. If None, the default is to mesh_file + “_physical_region.xml”.

cell_ids

A dolfin.CellFunction containing the area markers.

facet_ids

A dolfin.FacetFunction containing the surface markers.

mesh

A dolfin.Mesh containing the mesh.