Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix formatting of binary operators in single line #1533

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 34 additions & 68 deletions examples/dgmulti_2d/elixir_navierstokes_convergence_curved.jl
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,8 @@ end
(A * log(y + 2.0) * exp(-A * (y - 1.0)) +
(1.0 - exp(-A * (y - 1.0))) / (y + 2.0)) * cos(pi_t)
v1_yy = (sin(pi_x) *
(2.0 * A * exp(-A * (y - 1.0)) / (y + 2.0)
-
A * A * log(y + 2.0) * exp(-A * (y - 1.0))
-
(2.0 * A * exp(-A * (y - 1.0)) / (y + 2.0) -
A * A * log(y + 2.0) * exp(-A * (y - 1.0)) -
(1.0 - exp(-A * (y - 1.0))) / ((y + 2.0) * (y + 2.0))) * cos(pi_t))
v2 = v1
v2_t = v1_t
Expand Down Expand Up @@ -133,85 +131,53 @@ end
+ 2.0 * rho * v1 * v1_x
+ rho_y * v1 * v2
+ rho * v1_y * v2
+ rho * v1 * v2_y
+ rho * v1 * v2_y -
# stress tensor from x-direction
-
4.0 / 3.0 * v1_xx * mu_
+
2.0 / 3.0 * v2_xy * mu_
-
v1_yy * mu_
-
4.0 / 3.0 * v1_xx * mu_ +
2.0 / 3.0 * v2_xy * mu_ -
v1_yy * mu_ -
v2_xy * mu_)
# y-momentum equation
du3 = (rho_t * v2 + rho * v2_t + p_y + rho_x * v1 * v2
+ rho * v1_x * v2
+ rho * v1 * v2_x
+ rho_y * v2^2
+ 2.0 * rho * v2 * v2_y
+ 2.0 * rho * v2 * v2_y -
# stress tensor from y-direction
-
v1_xy * mu_
-
v2_xx * mu_
-
4.0 / 3.0 * v2_yy * mu_
+
v1_xy * mu_ -
v2_xx * mu_ -
4.0 / 3.0 * v2_yy * mu_ +
2.0 / 3.0 * v1_xy * mu_)
# total energy equation
du4 = (E_t + v1_x * (E + p) + v1 * (E_x + p_x)
+ v2_y * (E + p) + v2 * (E_y + p_y)
+ v2_y * (E + p) + v2 * (E_y + p_y) -
# stress tensor and temperature gradient terms from x-direction
-
4.0 / 3.0 * v1_xx * v1 * mu_
+
2.0 / 3.0 * v2_xy * v1 * mu_
-
4.0 / 3.0 * v1_x * v1_x * mu_
+
2.0 / 3.0 * v2_y * v1_x * mu_
-
v1_xy * v2 * mu_
-
v2_xx * v2 * mu_
-
v1_y * v2_x * mu_
-
v2_x * v2_x * mu_
-
4.0 / 3.0 * v1_xx * v1 * mu_ +
2.0 / 3.0 * v2_xy * v1 * mu_ -
4.0 / 3.0 * v1_x * v1_x * mu_ +
2.0 / 3.0 * v2_y * v1_x * mu_ -
v1_xy * v2 * mu_ -
v2_xx * v2 * mu_ -
v1_y * v2_x * mu_ -
v2_x * v2_x * mu_ -
T_const * inv_rho_cubed *
(p_xx * rho * rho
-
2.0 * p_x * rho * rho_x
+
2.0 * p * rho_x * rho_x
-
p * rho * rho_xx) * mu_
(p_xx * rho * rho -
2.0 * p_x * rho * rho_x +
2.0 * p * rho_x * rho_x -
p * rho * rho_xx) * mu_ -
# stress tensor and temperature gradient terms from y-direction
-
v1_yy * v1 * mu_
-
v2_xy * v1 * mu_
-
v1_y * v1_y * mu_
-
v2_x * v1_y * mu_
-
4.0 / 3.0 * v2_yy * v2 * mu_
+
2.0 / 3.0 * v1_xy * v2 * mu_
-
4.0 / 3.0 * v2_y * v2_y * mu_
+
2.0 / 3.0 * v1_x * v2_y * mu_
-
v1_yy * v1 * mu_ -
v2_xy * v1 * mu_ -
v1_y * v1_y * mu_ -
v2_x * v1_y * mu_ -
4.0 / 3.0 * v2_yy * v2 * mu_ +
2.0 / 3.0 * v1_xy * v2 * mu_ -
4.0 / 3.0 * v2_y * v2_y * mu_ +
2.0 / 3.0 * v1_x * v2_y * mu_ -
T_const * inv_rho_cubed *
(p_yy * rho * rho
-
2.0 * p_y * rho * rho_y
+
2.0 * p * rho_y * rho_y
-
(p_yy * rho * rho -
2.0 * p_y * rho * rho_y +
2.0 * p * rho_y * rho_y -
p * rho * rho_yy) * mu_)

return SVector(du1, du2, du3, du4)
Expand Down
27 changes: 9 additions & 18 deletions examples/dgmulti_3d/elixir_navierstokes_convergence.jl
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,10 @@ end
# Define auxiliary functions for the strange function of the y variable
# to make expressions easier to read
g = log(x[2] + 2.0) * (1.0 - exp(-A3 * (x[2] - 1.0)))
g_y = (A3 * log(x[2] + 2.0) * exp(-A3 * (x[2] - 1.0))
+
g_y = (A3 * log(x[2] + 2.0) * exp(-A3 * (x[2] - 1.0)) +
(1.0 - exp(-A3 * (x[2] - 1.0))) / (x[2] + 2.0))
g_yy = (2.0 * A3 * exp(-A3 * (x[2] - 1.0)) / (x[2] + 2.0)
-
(1.0 - exp(-A3 * (x[2] - 1.0))) / ((x[2] + 2.0)^2)
-
g_yy = (2.0 * A3 * exp(-A3 * (x[2] - 1.0)) / (x[2] + 2.0) -
(1.0 - exp(-A3 * (x[2] - 1.0))) / ((x[2] + 2.0)^2) -
A3^2 * log(x[2] + 2.0) * exp(-A3 * (x[2] - 1.0)))

# Density and its derivatives
Expand Down Expand Up @@ -182,8 +179,7 @@ end
+ rho * v1 * v2_y
+ rho_z * v1 * v3
+ rho * v1_z * v3
+ rho * v1 * v3_z
-
+ rho * v1 * v3_z -
mu_ * (tau11_x + tau12_y + tau13_z))
# y-momentum equation
du3 = (rho_t * v2 + rho * v2_t + p_y + rho_x * v1 * v2
Expand All @@ -193,8 +189,7 @@ end
+ 2.0 * rho * v2 * v2_y
+ rho_z * v2 * v3
+ rho * v2_z * v3
+ rho * v2 * v3_z
-
+ rho * v2 * v3_z -
mu_ * (tau12_x + tau22_y + tau23_z))
# z-momentum equation
du4 = (rho_t * v3 + rho * v3_t + p_z + rho_x * v1 * v3
Expand All @@ -204,23 +199,19 @@ end
+ rho * v2_y * v3
+ rho * v2 * v3_y
+ rho_z * v3^2
+ 2.0 * rho * v3 * v3_z
-
+ 2.0 * rho * v3 * v3_z -
mu_ * (tau13_x + tau23_y + tau33_z))
# Total energy equation
du5 = (E_t + v1_x * (E + p) + v1 * (E_x + p_x)
+ v2_y * (E + p) + v2 * (E_y + p_y)
+ v3_z * (E + p) + v3 * (E_z + p_z)
+ v3_z * (E + p) + v3 * (E_z + p_z) -
# stress tensor and temperature gradient from x-direction
-
mu_ * (q_xx + v1_x * tau11 + v2_x * tau12 + v3_x * tau13
+ v1 * tau11_x + v2 * tau12_x + v3 * tau13_x)
+ v1 * tau11_x + v2 * tau12_x + v3 * tau13_x) -
# stress tensor and temperature gradient terms from y-direction
-
mu_ * (q_yy + v1_y * tau12 + v2_y * tau22 + v3_y * tau23
+ v1 * tau12_y + v2 * tau22_y + v3 * tau23_y)
+ v1 * tau12_y + v2 * tau22_y + v3 * tau23_y) -
# stress tensor and temperature gradient terms from z-direction
-
mu_ * (q_zz + v1_z * tau13 + v2_z * tau23 + v3_z * tau33
+ v1 * tau13_z + v2 * tau23_z + v3 * tau33_z))

Expand Down
27 changes: 9 additions & 18 deletions examples/dgmulti_3d/elixir_navierstokes_convergence_curved.jl
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,10 @@ end
# Define auxiliary functions for the strange function of the y variable
# to make expressions easier to read
g = log(x[2] + 2.0) * (1.0 - exp(-A3 * (x[2] - 1.0)))
g_y = (A3 * log(x[2] + 2.0) * exp(-A3 * (x[2] - 1.0))
+
g_y = (A3 * log(x[2] + 2.0) * exp(-A3 * (x[2] - 1.0)) +
(1.0 - exp(-A3 * (x[2] - 1.0))) / (x[2] + 2.0))
g_yy = (2.0 * A3 * exp(-A3 * (x[2] - 1.0)) / (x[2] + 2.0)
-
(1.0 - exp(-A3 * (x[2] - 1.0))) / ((x[2] + 2.0)^2)
-
g_yy = (2.0 * A3 * exp(-A3 * (x[2] - 1.0)) / (x[2] + 2.0) -
(1.0 - exp(-A3 * (x[2] - 1.0))) / ((x[2] + 2.0)^2) -
A3^2 * log(x[2] + 2.0) * exp(-A3 * (x[2] - 1.0)))

# Density and its derivatives
Expand Down Expand Up @@ -190,8 +187,7 @@ end
+ rho * v1 * v2_y
+ rho_z * v1 * v3
+ rho * v1_z * v3
+ rho * v1 * v3_z
-
+ rho * v1 * v3_z -
mu_ * (tau11_x + tau12_y + tau13_z))
# y-momentum equation
du3 = (rho_t * v2 + rho * v2_t + p_y + rho_x * v1 * v2
Expand All @@ -201,8 +197,7 @@ end
+ 2.0 * rho * v2 * v2_y
+ rho_z * v2 * v3
+ rho * v2_z * v3
+ rho * v2 * v3_z
-
+ rho * v2 * v3_z -
mu_ * (tau12_x + tau22_y + tau23_z))
# z-momentum equation
du4 = (rho_t * v3 + rho * v3_t + p_z + rho_x * v1 * v3
Expand All @@ -212,23 +207,19 @@ end
+ rho * v2_y * v3
+ rho * v2 * v3_y
+ rho_z * v3^2
+ 2.0 * rho * v3 * v3_z
-
+ 2.0 * rho * v3 * v3_z -
mu_ * (tau13_x + tau23_y + tau33_z))
# Total energy equation
du5 = (E_t + v1_x * (E + p) + v1 * (E_x + p_x)
+ v2_y * (E + p) + v2 * (E_y + p_y)
+ v3_z * (E + p) + v3 * (E_z + p_z)
+ v3_z * (E + p) + v3 * (E_z + p_z) -
# stress tensor and temperature gradient from x-direction
-
mu_ * (q_xx + v1_x * tau11 + v2_x * tau12 + v3_x * tau13
+ v1 * tau11_x + v2 * tau12_x + v3 * tau13_x)
+ v1 * tau11_x + v2 * tau12_x + v3 * tau13_x) -
# stress tensor and temperature gradient terms from y-direction
-
mu_ * (q_yy + v1_y * tau12 + v2_y * tau22 + v3_y * tau23
+ v1 * tau12_y + v2 * tau22_y + v3 * tau23_y)
+ v1 * tau12_y + v2 * tau22_y + v3 * tau23_y) -
# stress tensor and temperature gradient terms from z-direction
-
mu_ * (q_zz + v1_z * tau13 + v2_z * tau23 + v3_z * tau33
+ v1 * tau13_z + v2 * tau23_z + v3 * tau33_z))

Expand Down