Skip to content

Commit

Permalink
Spellcheck the TaichiEvent example programs
Browse files Browse the repository at this point in the history
  • Loading branch information
JustinBonus committed Sep 21, 2024
1 parent 0a2a15a commit 4262569
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion modules/createEVENT/TaichiEvent/eulerfluid2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ def pressure_projection(pf: ti.template(), vf: ti.template(), vf_new: ti.templat


#####################
# Boundry Condition
# Boundary Condition
#####################
@ti.func
def vel_with_boundary(vf: ti.template(), i: int, j: int, shape) -> ti.f32:
Expand Down
24 changes: 12 additions & 12 deletions modules/createEVENT/TaichiEvent/implicit_fem.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,17 +147,17 @@ def matmul_cell(ret: ti.template(), vel: ti.template()):


@ti.kernel
def add(ans: ti.template(), a: ti.template(), k: ti.f32, b: ti.template()):
for i in ans:
ans[i] = a[i] + k * b[i]
def add(input: ti.template(), a: ti.template(), k: ti.f32, b: ti.template()):
for i in input:
input[i] = a[i] + k * b[i]


@ti.kernel
def dot(a: ti.template(), b: ti.template()) -> ti.f32:
ans = 0.0
value = 0.0
for i in a:
ans += a[i].dot(b[i])
return ans
value += a[i].dot(b[i])
return value


F_b = ti.Vector.field(3, dtype=ti.f32, shape=n_verts)
Expand Down Expand Up @@ -245,7 +245,7 @@ def flatten(dest: ti.types.ndarray(), src: ti.template()):


@ti.kernel
def aggragate(dest: ti.template(), src: ti.types.ndarray()):
def aggregate(dest: ti.template(), src: ti.types.ndarray()):
for i in range(n_verts):
for j in range(3):
dest[i][j] = src[3 * i + j]
Expand All @@ -256,7 +256,7 @@ def direct():
get_b()
flatten(F_b_ndarr, F_b)
v = solver.solve(F_b_ndarr)
aggragate(F_v, v)
aggregate(F_v, v)
F_f.fill(0)
add(F_x, F_x, dt, F_v)

Expand Down Expand Up @@ -304,16 +304,16 @@ def floor_bound():

@ti.func
def check(u):
ans = 0
value = 0
rest = u
for i in ti.static(range(3)):
k = rest % n_cube[2 - i]
rest = rest // n_cube[2 - i]
if k == 0:
ans |= 1 << (i * 2)
value |= 1 << (i * 2)
if k == n_cube[2 - i] - 1:
ans |= 1 << (i * 2 + 1)
return ans
value |= 1 << (i * 2 + 1)
return value


def gen_indices():
Expand Down
4 changes: 2 additions & 2 deletions modules/createEVENT/TaichiEvent/karman_vortex_street.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def solve(self):
vel = self.vel.to_numpy()
ugrad = np.gradient(vel[:, :, 0])
vgrad = np.gradient(vel[:, :, 1])
vor = ugrad[1] - vgrad[0]
vorticity = ugrad[1] - vgrad[0]
vel_mag = (vel[:, :, 0] ** 2.0 + vel[:, :, 1] ** 2.0) ** 0.5
## color map
colors = [
Expand All @@ -156,7 +156,7 @@ def solve(self):
]
my_cmap = matplotlib.colors.LinearSegmentedColormap.from_list("my_cmap", colors)
vor_img = cm.ScalarMappable(norm=matplotlib.colors.Normalize(vmin=-0.02, vmax=0.02), cmap=my_cmap).to_rgba(
vor
vorticity
)
vel_img = cm.plasma(vel_mag / 0.15)
img = np.concatenate((vor_img, vel_img), axis=1)
Expand Down
2 changes: 1 addition & 1 deletion modules/createEVENT/TaichiEvent/snow_phaseField.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def __init__(
self.n_fold_symmetry = n_fold_symmetry # n-fold rotational symmetry of the crystalline structure
self.angle0 = angle0 / 180.0 * np.pi # initial tilt angle of the crystal

### m(T) = (α / π) * arctan[γ(Te - T)], m determines the relative potential between water vapor and crystal
### m(T) = (α / π) * arctan[γ(T_equi - T)], m determines the relative potential between water vapor and crystal
self.alpha = 0.9 / np.pi # α
self.gamma = 10.0 # γ
self.temperature_equi = 1.0 # temperature of equilibrium state
Expand Down
2 changes: 1 addition & 1 deletion modules/createEVENT/TaichiEvent/two_stream_instability.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
np = 16384 # numer of particles
vb = 1.0 # beam-velocity, one is vb, the other is -vb
vt = 0.3 # thermal velocity
wp = 1 # Plasma frequence
wp = 1 # Plasma frequency
qm = -1 # charge-mass ratio
q = wp * wp / (qm * np / L) # charge of a particle
rho_back = -q * np / L # background charge density
Expand Down

0 comments on commit 4262569

Please sign in to comment.