Skip to content

Commit

Permalink
Documentation Changes
Browse files Browse the repository at this point in the history
  • Loading branch information
thivinanandh committed May 10, 2024
1 parent 1868c94 commit 03b927a
Show file tree
Hide file tree
Showing 21 changed files with 87 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ The computational domain is a circular domain with radius 1 centered at
.. figure:: mesh.png
:alt: alt text

alt text

Contents
--------

Expand Down Expand Up @@ -108,6 +106,14 @@ the boundary id and the value is the boundary function. The function
key of the dictionary is the boundary id and the value is the boundary
condition.

.. figure:: unitcircle.png
:alt: Unit Circle
:align: center

For externally created geometries from gmsh, the user needs to provide
the physical tag for the boundaries present in the geometry.
In our case, we have used 1000 to define the circular boundary in mesh file.

Note : As of now, only Dirichlet boundary conditions are supported.

.. code:: python
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,14 @@ gear geometry. The boundary ids are defined as 1000 and 1001
respectively. The boundary conditions are defined as “dirichlet” for
both the boundaries.

.. figure:: gmeshcircle.png
:alt: Gmesh Circle
:align: center

For externally created geometries from gmsh, the user needs to provide
the physical tag for the boundaries present in the geometry.
In our case, we have used 1001, 1000 to define the internal and external boundary in mesh file.

Note : As of now, only Dirichlet boundary conditions are supported.

.. code:: python
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,14 @@ the boundary id and the value is the boundary function. The function
key of the dictionary is the boundary id and the value is the boundary
condition.

.. figure:: unitcircle.png
:alt: Unit Circle
:align: center

For externally created geometries from gmsh, the user needs to provide
the physical tag for the boundaries present in the geometry.
In our case, we have used 1000 to define the circular boundary in mesh file.

Note : As of now, only Dirichlet boundary conditions are supported.

.. code:: python
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,14 @@ the boundary id and the value is the boundary function. The function
key of the dictionary is the boundary id and the value is the boundary
condition.

.. figure:: unitcircle.png
:alt: Unit Circle
:align: center

For externally created geometries from gmsh, the user needs to provide
the physical tag for the boundaries present in the geometry.
In our case, we have used 1000 to define the circular boundary in mesh file.

Note : As of now, only Dirichlet boundary conditions are supported.

.. code:: python
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,13 @@ using hard constraints, the boundary functions defined in the example
file are not used. Instead, the ansatz function for hard boundary
constraints is defined in the `main file <#main-file>`__

.. figure:: rect.png
:alt: Unit Square
:align: center

For internally generated geometries, the boundary id's will be hardcoded to
1000 for bottom, 1001 for right, 1002 for top, and 1003 for left; as shown in figure.

Defining the forcing function
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,14 @@ between the actual and estimated parameter needs to be calculated)

Defining boundary values
~~~~~~~~~~~~~~~~~~~~~~~~
Boundary values are defined using the functions ``get_boundary_function_dict`` and ``get_bound_cond_dict``
Boundary values are defined using the functions ``get_boundary_function_dict`` and ``get_bound_cond_dict``.

.. figure:: rect.png
:alt: Unit Square
:align: center

For internally generated geometries, the boundary id's will be hardcoded to
1000 for bottom, 1001 for right, 1002 for top, and 1003 for left; as shown in figure.

Defining the forcing function
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,14 @@ and estimated parameter needs to be calculated)

Defining boundary values
~~~~~~~~~~~~~~~~~~~~~~~~
Boundary values are defined using the functions ``get_boundary_function_dict`` and ``get_bound_cond_dict``
Boundary values are defined using the functions ``get_boundary_function_dict`` and ``get_bound_cond_dict``.

.. figure:: rect.png
:alt: Unit Square
:align: center

For internally generated geometries, the boundary id's will be hardcoded to
1000 for bottom, 1001 for right, 1002 for top, and 1003 for left; as shown in figure.

Defining the forcing function
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ Similarly, we can define more boundary functions like
functions are defined, we can assign them to the respective boundaries
using ``get_boundary_function_dict``

.. figure:: rect.png
:alt: Unit Square
:align: center

.. code:: python
def get_boundary_function_dict():
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,15 @@ where

We begin by introducing the various files required to run this example

Computational Domain
^^^^^^^^^^^^^^^^^^^^

The computational domain is a circular domain with radius 1 centered at
(0, 0).

.. figure:: mesh.png
:alt: alt text

Contents
--------

Expand Down Expand Up @@ -50,31 +59,36 @@ by defining a function for each boundary,

.. code:: python
def left_boundary(x, y):
def circle_boundary(x, y):
"""
This function will return the boundary value for given component of a boundary
"""
val = np.ones_like(x) * 0.0
return val
In the above snippet, we define a function ``left_boundary`` which
returns the Dirichlet values to be enforced at that boundary. Similarly,
we can define more boundary functions like ``right_boundary``,
``top_boundary`` and ``bottom_boundary``. Once these functions are
defined, we can assign them to the respective boundaries using
``get_boundary_function_dict``
The function ``circle_boundary`` returns the boundary value for a given
component of the boundary. The function ``get_boundary_function_dict``
returns a dictionary of boundary functions. The key of the dictionary is
the boundary id and the value is the boundary function. The function
``get_bound_cond_dict`` returns a dictionary of boundary conditions. The
key of the dictionary is the boundary id and the value is the boundary
condition.

.. code:: python
def get_boundary_function_dict():
"""
This function will return a dictionary of boundary functions
"""
return {1000: bottom_boundary, 1001: right_boundary, 1002: top_boundary, 1003: left_boundary}
return {1000: circle_boundary}
Here, ``1000``, ``1001``, etc. are the boundary identifiers obtained
from the geometry. Thus, each boundary gets mapped to it boundary value
in the dictionary.
For externally created geometries from gmsh, the user needs to provide
the physical tag for the boundaries present in the geometry.
In our case, we have used 1000 to define the circular boundary in mesh file.

.. figure:: unitcircle.png
:alt: Unit Circle
:align: center

Defining boundary conditions
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand All @@ -90,7 +104,7 @@ point).
"""
This function will return a dictionary of boundary conditions
"""
return {1000: "dirichlet", 1001: "dirichlet", 1002: "dirichlet", 1003: "dirichlet"}
return {1000: circle_boundary}
Defining the forcing function
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def get_bound_cond_dict():
"""
This function will return a dictionary of boundary conditions
"""
return {1000: "dirichlet", 1001: "dirichlet", 1002: "dirichlet", 1003: "dirichlet"}
return {1000: circle_boundary}


def get_bilinear_params_dict():
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_accuracy_cd2d_inverse_domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,4 +208,4 @@ def test_cd2d_accuracy_external(cd2d_test_data_circle, cd2d_learning_rate_static
l1_error_relative_inverse,
) = compute_errors_combined(actual_epsilon, inverse_pred)

assert l1_error < 7e-2 and l1_error_inverse < 7e-2
assert l1_error < 8.3e-2 and l1_error_inverse < 8.3e-2

0 comments on commit 03b927a

Please sign in to comment.