You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The exponential mappings above have an e-folding controlled by scale ``h``.
573
-
It's worth noting that the exponential maps imply that the cell widths (distances between interfaces) grow linearly at a rate inversely proportional to ``h / (r - l)``.
574
+
It's worth noting that the exponential maps imply that the cell widths (distances between interfaces)
575
+
grow linearly at a rate inversely proportional to ``h / (r - l)``.
574
576
575
-
The right-biased map biases the interfaces being closer towards ``r``; the left-biased map biases the interfaces towards ``l``.
577
+
The right-biased map biases the interfaces being closer towards ``r``; the left-biased map biases
578
+
the interfaces towards ``l``.
576
579
577
-
At the limit ``h / (r - l) \to \infty`` both mappings reduce to identity (``w \to ξ``) and thus the grid becomes uniformly spaced.
580
+
At the limit ``h / (r - l) \to \infty`` both mappings reduce to identity (``w \to ξ``) and thus the
581
+
discretization becomes uniformly spaced.
578
582
579
583
!!! note "Oceanography-related bias"
580
-
For vertical coordinates fit for oceanographic purposes, the right-biased mapping is usually more relevant as it implies finer vertical resolution closer to the ocean's surface.
584
+
For vertical coordinates fit for oceanographic purposes, the right-biased mapping is usually more
585
+
relevant as it implies finer vertical resolution near the ocean's surface.
581
586
582
-
```@exampleexponentialcoord
587
+
```@exampleexponentialdiscretization
583
588
using Oceananigans.Grids: rightbiased_exponential_mapping, leftbiased_exponential_mapping
Note that the smallest the ratio ``h / (r - l)`` is, the more finely-packed are the mapped points towards the left or right side of the domain.
620
+
Note that the smallest the ratio ``h / (r - l)`` is, the more finely-packed are the mapped points
621
+
towards the left or right side of the domain.
616
622
617
-
Let's see how we use [`ExponentialCoordinate`](@ref). Below we construct a coordinate with 10 cells that spans the range ``[-700, 300]``. By default, the `ExponentialCoordinate` is right-biased.
623
+
Let's see how we use [`ExponentialDiscretization`](@ref). Below we construct a coordinate with 10 cells
624
+
that spans the range ``[-700, 300]``. By default, the `ExponentialDiscretization` is right-biased.
618
625
619
-
```@exampleexponentialcoord
626
+
```@exampleexponentialdiscretization
620
627
using Oceananigans
621
628
622
629
N = 10
623
630
l = -700
624
631
r = 300
625
632
626
-
x = ExponentialCoordinate(N, l, r)
633
+
x = ExponentialDiscretization(N, l, r)
627
634
```
628
635
629
636
Note that above, the default e-folding scale (`scale = (r - l) / 5`) was used.
630
637
631
638
We can inspect the interfaces of the coordinate via
632
639
633
-
```@exampleexponentialcoord
640
+
```@exampleexponentialdiscretization
634
641
[x(i) for i in 1:N+1]
635
642
```
636
643
637
644
Being right-biased, note above how the interfaces are closer together near ``r``.
638
645
639
-
To demonstrate how the scale ``h`` affects the coordinate, we construct below two such exponential
640
-
coordinates: the first with ``h / (r - l) = 1/5`` and the second with ``h / (r - l) = 1/2``.
646
+
To demonstrate how the scale ``h`` affects the discretization, we construct below two such exponential
647
+
discretizations: the first with ``h / (r - l) = 1/5`` and the second with ``h / (r - l) = 1/2``.
A downside of [`ExponentialCoordinate`](@ref) coordinate is that we don't have tight control on the minimum spacing at the biased edge.
704
-
To obtain a coordinate with a certain minimum spacing we need to play around with the scale ``h`` and the number of cells.
710
+
A downside of [`ExponentialDiscretization`](@ref) discretization is that we don't have tight control
711
+
on the minimum spacing at the biased edge.
712
+
To obtain a discretization with a certain minimum spacing we need to play around with the scale ``h``
713
+
and the number of cells.
705
714
706
715
707
-
### Constant-to-stretched-spacing coordinate
716
+
### Constant-to-stretched-spacing discretization
708
717
709
-
[`ConstantToStretchedCoordinate`](@ref) returns a coordinate with constant spacing over some extent and beyond
710
-
which the spacing increases with a prescribed stretching law; this allows a tighter control on the spacing at the biased edge.
718
+
[`ReferenceToStretchedDiscretization`](@ref) returns a discretization with a constant reference spacing over
719
+
some extent and beyond which the spacing increases with a prescribed stretching law; this allows a tighter
720
+
control on the spacing at the biased edge.
711
721
That is, we can prescribe a constant spacing over the top `surface_layer_height` below which the grid spacing
712
722
increases following a prescribed stretching law.
713
-
The downside here is that neither the final coordinate extent nor the total number of cells can be prescribed.
714
-
The coordinate's extent is greater or equal from what we prescribe via the keyword argument `extent`.
723
+
The downside here is that neither the final discretization extent nor the total number of cells can be prescribed.
724
+
The discretization's extent is greater or equal from what we prescribe via the keyword argument `extent`.
715
725
Also, the total number of cells we end up with depends on the stretching law.
716
726
717
727
As an example, we build three single-column vertical grids.
718
-
We use right-biased coordinate (i.e., `bias = :right`) since this way we can have tight control of the spacing at the ocean's surface (`bias_edge = 0`).
728
+
We use right-biased discretization (i.e., `bias = :right`) since this way we can have tight control of the spacing
729
+
at the ocean's surface (`bias_edge = 0`).
719
730
The three grids below have constant 30-meter spacing for the top 180 meters.
720
731
We prescribe to all three a `extent = 800` meters and we apply power-law stretching for depths below 120 meters.
721
732
The bigger the power-law stretching factor is, the further the last interface goes beyond the prescribed depth and/or with less total number of cells.
722
733
723
-
```@setupConstantToStretchedCoordinate
734
+
```@setupReferenceToStretchedDiscretization
724
735
using Oceananigans
725
736
using CairoMakie
726
737
set_theme!(Theme(fontsize=16))
727
738
```
728
739
729
-
```@exampleConstantToStretchedCoordinate
740
+
```@exampleReferenceToStretchedDiscretization
730
741
bias = :right
731
742
bias_edge = 0
732
743
extent = 800
733
744
constant_spacing = 25
734
745
constant_spacing_extent = 160
735
746
736
-
z = ConstantToStretchedCoordinate(; extent, bias, bias_edge,
737
-
constant_spacing, constant_spacing_extent,
738
-
stretching = PowerLawStretching(1.06))
747
+
z = ReferenceToStretchedDiscretization(; extent, bias, bias_edge,
0 commit comments