Geometry

geometry_initialization.circle(x)[source]

Computes the signed distance from a point to a circle.

This function calculates the signed distance from a point x = (x_0, x_1) to a circle centered at (1, 0.5) with radius 0.3. The function returns a negative value if the point is inside the circle and a positive value if it is outside.

\[\text{distance}(x) = -\left(\sqrt{(x_0 - 1)^2 + (x_1 - 0.5)^2} - 0.3\right)\]
Parameters:

x (tuple) – A tuple representing the point coordinates (x_0, x_1).

Returns:

The signed distance from the point to the circle.

Return type:

float

geometry_initialization.level_set(x, parameters)[source]

Computes a 2D level set function based on cosine functions.

This function returns a level set value based on a combination of cosine functions depending on the coordinates of the input point x = (x_0, x_1) and a parameter lx.

\[\text{level set}(x) = -\cos\left(\frac{6\pi x_0}{l_x}\right)\cos(4\pi x_1) - 0.6\]
Parameters:
  • x (tuple) – A tuple representing the point coordinates (x_0, x_1).

  • parameters (object with attribute lx.) – The parameters object containing the domain length lx.

Returns:

The computed level set value.

Return type:

float

geometry_initialization.level_set_3D(x, parameters)[source]

Computes a 3D level set function based on cosine functions.

This function returns a level set value based on a combination of cosine functions depending on the coordinates of the input point x = (x_0, x_1, x_2) and a parameter lx, ‘ly’ and ‘lz’, the dimensions of the box containing \(\Omega\).

\[\text{level set}(x) = -\cos\left(\frac{6\pi x_0}{l_x}\right)\cos(4\pi x_1)\cos(4\pi x_2) - 0.6\]
Parameters:
  • x (tuple) – A tuple representing the point coordinates (x_0, x_1, x_2).

  • parameters (object with attribute lx.) – The parameters object containing the domain length lx, ‘ly’ and ‘lz’.

Returns:

The computed level set value.

Return type:

float