Skip to content

Commit c1cb74b

Browse files
committed
Azure CI commit ref 60f3af15697c701d2ea8f3c08ceebd72a33e3dbe
1 parent 454ed3d commit c1cb74b

File tree

6,833 files changed

+1650979
-1
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

6,833 files changed

+1650979
-1
lines changed

en/latest

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v0.11.1
1+
v0.11.2

en/v0.11.2/.buildinfo

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Sphinx build info version 1
2+
# This file records the configuration used when building these files. When it is not found, a full rebuild will be done.
3+
config: 2296adff33f16fbd064b2b565386256e
4+
tags: 645f666f9bcd5a90fca523b33c5a78b7
Loading
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Here we compute the values of a scalar function on the z-faces. We then create
2+
# an averaging operator to approximate the function at cell centers. We choose
3+
# to define a scalar function that is strongly discontinuous in some places to
4+
# demonstrate how the averaging operator will smooth out discontinuities.
5+
#
6+
# We start by importing the necessary packages and defining a mesh.
7+
#
8+
from discretize import TensorMesh
9+
import numpy as np
10+
import matplotlib.pyplot as plt
11+
#
12+
h = np.ones(40)
13+
mesh = TensorMesh([h, h, h], x0="CCC")
14+
#
15+
# Create a scalar variable on z-faces
16+
#
17+
phi_z = np.zeros(mesh.nFz)
18+
xyz = mesh.faces_z
19+
phi_z[(xyz[:, 2] > 0)] = 25.0
20+
phi_z[(xyz[:, 2] < -10.0) & (xyz[:, 0] > -10.0) & (xyz[:, 0] < 10.0)] = 50.0
21+
#
22+
# Next, we construct the averaging operator and apply it to
23+
# the discrete scalar quantity to approximate the value at cell centers.
24+
# We plot the original scalar and its average at cell centers for a
25+
# slice at y=0.
26+
#
27+
Azc = mesh.average_face_z_to_cell
28+
phi_c = Azc @ phi_z
29+
#
30+
# And plot the results:
31+
#
32+
fig = plt.figure(figsize=(11, 5))
33+
ax1 = fig.add_subplot(121)
34+
v = np.r_[np.zeros(mesh.nFx+mesh.nFy), phi_z] # create vector for plotting
35+
mesh.plot_slice(v, ax=ax1, normal='Y', slice_loc=0, v_type="Fz")
36+
ax1.set_title("Variable at z-faces", fontsize=16)
37+
ax2 = fig.add_subplot(122)
38+
mesh.plot_image(phi_c, ax=ax2, normal='Y', slice_loc=0, v_type="CC")
39+
ax2.set_title("Averaged to cell centers", fontsize=16)
40+
plt.show()
41+
#
42+
# Below, we show a spy plot illustrating the sparsity and mapping
43+
# of the operator
44+
#
45+
fig = plt.figure(figsize=(9, 9))
46+
ax1 = fig.add_subplot(111)
47+
ax1.spy(Azc, ms=1)
48+
ax1.set_title("Z-Face Index", fontsize=12, pad=5)
49+
ax1.set_ylabel("Cell Index", fontsize=12)
50+
plt.show()
Loading
Loading

0 commit comments

Comments
 (0)