Skip to content

Commit

Permalink
start geometry
Browse files Browse the repository at this point in the history
  • Loading branch information
ratnania committed Mar 3, 2024
1 parent 29ff255 commit c4b0a9f
Show file tree
Hide file tree
Showing 6 changed files with 101 additions and 4 deletions.
4 changes: 4 additions & 0 deletions _toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ parts:
- file: chapter1/rules
- file: chapter1/poisson
- file: chapter1/boundary-conditions
- file: chapter1/geometry
sections:
- file: chapter1/analytical-mapping
- file: chapter1/discrete-mapping
- caption: Linear Problems
chapters:
- file: chapter2/poisson
Expand Down
75 changes: 75 additions & 0 deletions chapter1/analytical-mapping.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# Analytical Mapping
*Author: Ahmed Ratnani*

Analytical Mappings are provided as symbolic expressions, which allow us to compute automatically their jacobian matrices and all related geometrical information.

## Available mappings

| SymPDE objects | Physical Dimension | Logical Dimension | Description |
| -------------- | ----------------- | ---------------- | ----------- |
| `IdentityMapping` | 1D, 2D, 3D | 1D, 2D, 3D | Identity Mapping object <br> $\begin{cases} x&=x_1, \\ y&=x_2, \\ z &= x_3 \end{cases} $ |
| `AffineMapping` | 1D, 2D, 3D | 1D, 2D, 3D | Affine Mapping object <br> $\begin{cases} x &= c_1 + a_{11} x_1 + a_{12} x_2 + a_{13} x_3, \\ y &= c_2 + a_{21} x_1 + a_{22} x_2 + a_{23} x_3, \\ z &= c_3 + a_{31} x_1 + a_{32} x_2 + a_{33} x_3 \end{cases}$|
| `PolarMapping` | 2D | 2D | Polar Mapping object (Annulus) <br> $ \begin{cases} x &= c_1 + (r_{min} (1-x_1)+r_{max} x_1) \cos(x_2), \\ y &= c_2 + (r_{min} (1-x_1)+r_{max} x_1) \sin(x_2) \end{cases} $ |
| `TargetMapping` | 2D | 2D | Target Mapping object <br> $\begin{cases} x &= c_1 + (1-k) x_1 \cos(x_2) - D x_1^2, \\ y &= c_2 + (1+k) x_1 \sin(x_2) \end{cases}$|
| `CzarnyMapping` | 2D | 2D | Czarny Mapping object <br> $\begin{cases} x &= \frac{1}{\epsilon}(1 - \sqrt{ 1 + \epsilon (\epsilon + 2 x_1 \cos(x_2)) }), \\ y &= c_2 + \frac{b}{\sqrt{1-\epsilon^2/4}} \frac{ x_1 \sin(x_2)}{2 - \sqrt{ 1 + \epsilon (\epsilon + 2 x_1 \cos(x_2)) }} \end{cases}$|
| `CollelaMapping2D` | 2D | 2D | Collela Mapping object <br> $\begin{cases} x &= 2 (x_1 + \epsilon \sin(2 \pi k_1 x_1) \sin(2 \pi k_2 x_2)) - 1, \\ y &= 2 (x_2 + \epsilon \sin(2 \pi k_1 x_1) \sin(2 \pi k_2 x_2)) - 1 \end{cases}$|
| `TorusMapping` | 3D | 3D | Parametrization of a torus (or a portion of it) <br> $\begin{cases} x &= (R_0 + x_1 \cos(x_2)) \cos(x_3), \\ y &= (R_0 + x_1 \cos(x_2)) \sin(x_3), \\ z &= x_1 \sin(x_2) \end{cases}$|
| `TorusSurfaceMapping` | 3D | 2D | surface obtained by "slicing" the torus above at r = a <br> $\begin{cases} x &= (R_0 + a \cos(x_1)) \cos(x_2), \\ y &= (R_0 + a \cos(x_1)) \sin(x_2), \\ z &= a \sin(x_1) \end{cases}$|
| `TwistedTargetSurfaceMapping` | 3D | 2D | surface obtained by "twisting" the `TargetMapping` out of the (x, y) plane <br> $\begin{cases} x &= c_1 + (1-k) x_1 \cos(x_2) - D x_1^2 \\ y &= c_2 + (1+k) x_1 \sin(x_2) \\ z &= c_3 + x_1^2 \sin(2 x_2) \end{cases}$|
| `TwistedTargetMapping` | 3D | 3D | volume obtained by "extruding" the `TwistedTargetSurfaceMapping` along z <br> $\begin{cases} x &= c_1 + (1-k) x_1 \cos(x_2) - D x_1^2, \\ y &= c_2 + (1+k) x_1 \sin(x_2), \\ z &= c_3 + x_3 x_1^2 \sin(2 x_2) \end{cases}$|
| `SphericalMapping` | 3D | 3D | Parametrization of a sphere (or a portion of it) <br> $\begin{cases} x &= x_1 \sin(x_2) \cos(x_3), \\ y &= x_1 \sin(x_2) \sin(x_3), \\ z &= x_1 \cos(x_2) \end{cases}$|

## Examples


```python
from sympde.topology import Square
from sympde.topology import PolarMapping

ldomain = Square('A',bounds1=(0., 1.), bounds2=(0, np.pi))
mapping = PolarMapping('M1',2, c1= 0., c2= 0., rmin = 0., rmax=1.)

domain = mapping(ldomain)

x,y = domain.coordinates
```


```python
mapping_1 = IdentityMapping('M1', 2)
mapping_2 = PolarMapping ('M2', 2, c1 = 0., c2 = 0.5, rmin = 0., rmax=1.)
mapping_3 = AffineMapping ('M3', 2, c1 = 0., c2 = np.pi, a11 = -1, a22 = -1, a21 = 0, a12 = 0)

A = Square('A',bounds1=(0.5, 1.), bounds2=(-1., 0.5))
B = Square('B',bounds1=(0.5, 1.), bounds2=(0, np.pi))
C = Square('C',bounds1=(0.5, 1.), bounds2=(np.pi-0.5, np.pi + 1))

D1 = mapping_1(A)
D2 = mapping_2(B)
D3 = mapping_3(C)

connectivity = [((0,1,1),(1,1,-1)), ((1,1,1),(2,1,-1))]
patches = [D1, D2, D3]
domain = Domain.join(patches, connectivity, 'domain')
```

```python
A = Square('A',bounds1=(0.2, 0.6), bounds2=(0, np.pi))
B = Square('B',bounds1=(0.2, 0.6), bounds2=(np.pi, 2*np.pi))
C = Square('C',bounds1=(0.6, 1.), bounds2=(0, np.pi))
D = Square('D',bounds1=(0.6, 1.), bounds2=(np.pi, 2*np.pi))

mapping_1 = PolarMapping('M1',2, c1= 0., c2= 0., rmin = 0., rmax=1.)
mapping_2 = PolarMapping('M2',2, c1= 0., c2= 0., rmin = 0., rmax=1.)
mapping_3 = PolarMapping('M3',2, c1= 0., c2= 0., rmin = 0., rmax=1.)
mapping_4 = PolarMapping('M4',2, c1= 0., c2= 0., rmin = 0., rmax=1.)

D1 = mapping_1(A)
D2 = mapping_2(B)
D3 = mapping_3(C)
D4 = mapping_4(D)

connectivity = [((0,1,1),(1,1,-1)), ((2,1,1),(3,1,-1)), ((0,0,1),(2,0,-1)),((1,0,1),(3,0,-1))]
patches = [D1, D2, D3, D4]
domain = Domain.join(patches, connectivity, 'domain')
```
4 changes: 4 additions & 0 deletions chapter1/discrete-mapping.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Discrete Mapping
*Author: Ahmed Ratnani*


18 changes: 18 additions & 0 deletions chapter1/geometry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Geometry
*Author: Ahmed Ratnani*

The IGA concept relies on the fact that the geometry (domain) is divided into subdomains, and each of these subdomains is the image of a **Line**, **Square** or a **Cube** by a geometric transformation (also called a **mapping**), that we shall call a **patch** or **logical domain**.

The following example shows a domain (half of annulus) that is the image of a logical domain using the mapping **F**. Each element (or cell) $Q$ of the logical domain is then mapped into an element $K$ of our domain, *i.e.* $K = \mathbf{F}(Q)$.

![png](images/geometry/element.png)

Coordinates in the logical domain are defined by the variables $\left( x_1, x_2, x_3 \right)$ while the physical coordinates are denoted by $\left( x,y,z \right)$.

## How to define a geometry?

Depending on your problem, you can be in one of the following situations;
- your geometry is trivial, *i.e.* it is a **Line**, **Square** or a **Cube**. In this case, just use the **SymPDE** adhoc constructors, for which you'll define the bounds.
- your geometry can be defined using an **Analytical Mapping**. See the next section.
- your geometry can be defined using a **Discrete Mapping**. See the next sections.

Binary file added chapter1/images/geometry/element.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 0 additions & 4 deletions references.bib
Original file line number Diff line number Diff line change
Expand Up @@ -272,10 +272,6 @@ @article{simeon_2011
doi = "10.1016/j.cma.2011.09.004",
url = "http://www.sciencedirect.com/science/article/pii/S0045782511002933",
author = "A.-V. Vuong and C. Giannelli and B. Juttler and B. Simeon",
keywords = "Adaptivity",
keywords = "Isogeometric analysis",
keywords = "Hierarchical B-splines",
keywords = "Local refinement"
}

@article{Costantini_Manni_Pelosi_Sampoli_2010,
Expand Down

0 comments on commit c4b0a9f

Please sign in to comment.