Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Mar 25, 2024
1 parent cb97589 commit 5122687
Show file tree
Hide file tree
Showing 14 changed files with 250 additions and 981 deletions.
6 changes: 3 additions & 3 deletions mayavi/mayavi_amcg/filters/boundary_marker_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,9 +193,9 @@ def perform_mask(self):
# value is the new cell_id of the corresponding cell in the masked grid
self._cell_mappings = list(
map(
lambda masked, cell_id: None
if masked
else unmasked_cells_list.insert_next_id(cell_id),
lambda masked, cell_id: (
None if masked else unmasked_cells_list.insert_next_id(cell_id)
),
in_masked,
cell_ids,
)
Expand Down
15 changes: 3 additions & 12 deletions python/fluidity/ocean_biology.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,7 @@ def pznd(state, parameters):
G_P = (g * p_P * P_n**2 * Z_n) / (k**2 + p_P * P_n**2 + p_D * D_n**2)

# Zooplankton grazing of detritus.
G_D = (g * (1 - p_P) * D_n**2 * Z_n) / (
k**2 + p_P * P_n**2 + p_D * D_n**2
)
G_D = (g * (1 - p_P) * D_n**2 * Z_n) / (k**2 + p_P * P_n**2 + p_D * D_n**2)

# Death rate of phytoplankton.
De_P = mu_P * P_n * P_n / (P_n + 0.2)
Expand Down Expand Up @@ -327,12 +325,7 @@ def six_component(state, parameters):

# Chl growth scaling factor
# R_P=(theta_m/theta)*J*(Q_N+Q_A)/(alpha*I_n+1e-7)
R_P = (
(theta_m / theta)
* (Q_N + Q_A)
* v
/ (v**2 + alpha**2 * I_n**2) ** 0.5
)
R_P = (theta_m / theta) * (Q_N + Q_A) * v / (v**2 + alpha**2 * I_n**2) ** 0.5

# Primary production
X_P = J * (Q_N + Q_A) * P_n
Expand All @@ -350,9 +343,7 @@ def six_component(state, parameters):
# G_D = (g * epsilon * (1 - p_P) * D_n**2 * Z_n) / (
# g + epsilon * (p_P * P_n**2 + p_D * D_n**2)
# )
G_D = (g * (1 - p_P) * D_n**2 * Z_n) / (
epsilon + (p_P * P_n**2 + p_D * D_n**2)
)
G_D = (g * (1 - p_P) * D_n**2 * Z_n) / (epsilon + (p_P * P_n**2 + p_D * D_n**2))

# Death rate of phytoplankton.
# There is an additional linear term because we have a unified model
Expand Down
4 changes: 1 addition & 3 deletions tests/netcdf_read_free_surface/height.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ def function(position):
xg = 3.0 * position[0]
yg = 3.0 * position[1]
h1 = multivariate_normal.pdf([xg, yg], cov=[[1, 0], [0, 1]])
h2 = multivariate_normal.pdf(
[xg, yg], mean=[1, 1], cov=[[1.5**2, 0], [0, 0.5**2]]
)
h2 = multivariate_normal.pdf([xg, yg], mean=[1, 1], cov=[[1.5**2, 0], [0, 0.5**2]])
h = 10.0 * (h1 - h2)
return h
6 changes: 3 additions & 3 deletions tests/square-convection/checkpoint/change_options
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ for i in range(len(flml_options) - 1):
line = flml_options[i]
if "<simulation_name>" in line:
# Change the simulation name
flml_options[
i + 1
] = '<string_value lines="1">square-convection-picked-up</string_value>\n'
flml_options[i + 1] = (
'<string_value lines="1">square-convection-picked-up</string_value>\n'
)

for i in range(len(flml_options)):
if "<checkpointing>" in flml_options[i]:
Expand Down
120 changes: 24 additions & 96 deletions tests/viscous_fs_simpletopbottom/solution.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,7 @@ def t0_eta():
- (delta_rho * k**2 * mu + k**2 * mu * rhog) * D * cosh(D * k) ** 2
- (delta_rho * k * mu + k * mu * rhog) * sinh(D * k) * cosh(D * k)
- sqrt(
(
delta_rho**2 * k**2
+ 2 * delta_rho * k**2 * rhog
+ k**2 * rhog**2
)
(delta_rho**2 * k**2 + 2 * delta_rho * k**2 * rhog + k**2 * rhog**2)
* D**2
* cosh(D * k) ** 4
- 2
Expand All @@ -61,11 +57,7 @@ def t0_eta():
* sinh(D * k)
* cosh(D * k) ** 3
+ (
(
delta_rho**2 * k**2
- 2 * delta_rho * k**2 * rhog
+ k**2 * rhog**2
)
(delta_rho**2 * k**2 - 2 * delta_rho * k**2 * rhog + k**2 * rhog**2)
* D**2
- 4 * delta_rho * rhog
)
Expand Down Expand Up @@ -97,11 +89,7 @@ def t0_xi():
- (delta_rho * k**2 * mu + k**2 * mu * rhog) * D * cosh(D * k) ** 2
- (delta_rho * k * mu + k * mu * rhog) * sinh(D * k) * cosh(D * k)
+ sqrt(
(
delta_rho**2 * k**2
+ 2 * delta_rho * k**2 * rhog
+ k**2 * rhog**2
)
(delta_rho**2 * k**2 + 2 * delta_rho * k**2 * rhog + k**2 * rhog**2)
* D**2
* cosh(D * k) ** 4
- 2
Expand All @@ -115,11 +103,7 @@ def t0_xi():
* sinh(D * k)
* cosh(D * k) ** 3
+ (
(
delta_rho**2 * k**2
- 2 * delta_rho * k**2 * rhog
+ k**2 * rhog**2
)
(delta_rho**2 * k**2 - 2 * delta_rho * k**2 * rhog + k**2 * rhog**2)
* D**2
- 4 * delta_rho * rhog
)
Expand Down Expand Up @@ -175,17 +159,12 @@ def nond_F(x, t):
+ delta_rho * k**2
+ k**2 * rhog
- sqrt(
(delta_rho**2 - 2 * delta_rho * rhog + rhog**2)
* sinh(k) ** 4
(delta_rho**2 - 2 * delta_rho * rhog + rhog**2) * sinh(k) ** 4
+ delta_rho**2 * k**2
+ 2 * delta_rho * k**2 * rhog
+ k**2 * rhog**2
+ 2
* (
delta_rho**2 * k
+ 2 * delta_rho * k * rhog
+ k * rhog**2
)
* (delta_rho**2 * k + 2 * delta_rho * k * rhog + k * rhog**2)
* sinh(k)
* cosh(k)
+ (
Expand Down Expand Up @@ -273,17 +252,12 @@ def nond_F(x, t):
+ delta_rho * k**2
+ k**2 * rhog
+ sqrt(
(delta_rho**2 - 2 * delta_rho * rhog + rhog**2)
* sinh(k) ** 4
(delta_rho**2 - 2 * delta_rho * rhog + rhog**2) * sinh(k) ** 4
+ delta_rho**2 * k**2
+ 2 * delta_rho * k**2 * rhog
+ k**2 * rhog**2
+ 2
* (
delta_rho**2 * k
+ 2 * delta_rho * k * rhog
+ k * rhog**2
)
* (delta_rho**2 * k + 2 * delta_rho * k * rhog + k * rhog**2)
* sinh(k)
* cosh(k)
+ (
Expand Down Expand Up @@ -385,11 +359,7 @@ def nond_F(x, t):
+ (delta_rho * k - k * rhog) * cosh(k) ** 2
- sqrt(
delta_rho**2 * k**2 * sinh(k) ** 4
- 2
* delta_rho**2
* k**2
* sinh(k) ** 2
* cosh(k) ** 2
- 2 * delta_rho**2 * k**2 * sinh(k) ** 2 * cosh(k) ** 2
+ delta_rho**2 * k**2 * cosh(k) ** 4
- 2 * delta_rho * k**2 * rhog * sinh(k) ** 4
+ 2 * delta_rho * k**2 * rhog * cosh(k) ** 4
Expand Down Expand Up @@ -420,11 +390,7 @@ def nond_F(x, t):
+ (delta_rho * k - k * rhog) * cosh(k) ** 2
+ sqrt(
delta_rho**2 * k**2 * sinh(k) ** 4
- 2
* delta_rho**2
* k**2
* sinh(k) ** 2
* cosh(k) ** 2
- 2 * delta_rho**2 * k**2 * sinh(k) ** 2 * cosh(k) ** 2
+ delta_rho**2 * k**2 * cosh(k) ** 4
- 2 * delta_rho * k**2 * rhog * sinh(k) ** 4
+ 2 * delta_rho * k**2 * rhog * cosh(k) ** 4
Expand Down Expand Up @@ -482,17 +448,12 @@ def nond_F(x, t):
+ delta_rho * k**2
+ k**2 * rhog
+ sqrt(
(delta_rho**2 - 2 * delta_rho * rhog + rhog**2)
* sinh(k) ** 4
(delta_rho**2 - 2 * delta_rho * rhog + rhog**2) * sinh(k) ** 4
+ delta_rho**2 * k**2
+ 2 * delta_rho * k**2 * rhog
+ k**2 * rhog**2
+ 2
* (
delta_rho**2 * k
+ 2 * delta_rho * k * rhog
+ k * rhog**2
)
* (delta_rho**2 * k + 2 * delta_rho * k * rhog + k * rhog**2)
* sinh(k)
* cosh(k)
+ (
Expand Down Expand Up @@ -522,17 +483,12 @@ def nond_F(x, t):
+ delta_rho * k**2
+ k**2 * rhog
- sqrt(
(delta_rho**2 - 2 * delta_rho * rhog + rhog**2)
* sinh(k) ** 4
(delta_rho**2 - 2 * delta_rho * rhog + rhog**2) * sinh(k) ** 4
+ delta_rho**2 * k**2
+ 2 * delta_rho * k**2 * rhog
+ k**2 * rhog**2
+ 2
* (
delta_rho**2 * k
+ 2 * delta_rho * k * rhog
+ k * rhog**2
)
* (delta_rho**2 * k + 2 * delta_rho * k * rhog + k * rhog**2)
* sinh(k)
* cosh(k)
+ (
Expand Down Expand Up @@ -666,17 +622,12 @@ def nond_G(x, t):
+ delta_rho * k**2
+ k**2 * rhog
- sqrt(
(delta_rho**2 - 2 * delta_rho * rhog + rhog**2)
* sinh(k) ** 4
(delta_rho**2 - 2 * delta_rho * rhog + rhog**2) * sinh(k) ** 4
+ delta_rho**2 * k**2
+ 2 * delta_rho * k**2 * rhog
+ k**2 * rhog**2
+ 2
* (
delta_rho**2 * k
+ 2 * delta_rho * k * rhog
+ k * rhog**2
)
* (delta_rho**2 * k + 2 * delta_rho * k * rhog + k * rhog**2)
* sinh(k)
* cosh(k)
+ (
Expand Down Expand Up @@ -797,17 +748,12 @@ def nond_G(x, t):
+ delta_rho * k**2
+ k**2 * rhog
+ sqrt(
(delta_rho**2 - 2 * delta_rho * rhog + rhog**2)
* sinh(k) ** 4
(delta_rho**2 - 2 * delta_rho * rhog + rhog**2) * sinh(k) ** 4
+ delta_rho**2 * k**2
+ 2 * delta_rho * k**2 * rhog
+ k**2 * rhog**2
+ 2
* (
delta_rho**2 * k
+ 2 * delta_rho * k * rhog
+ k * rhog**2
)
* (delta_rho**2 * k + 2 * delta_rho * k * rhog + k * rhog**2)
* sinh(k)
* cosh(k)
+ (
Expand Down Expand Up @@ -937,11 +883,7 @@ def nond_G(x, t):
+ (delta_rho * k - k * rhog) * cosh(k) ** 2
- sqrt(
delta_rho**2 * k**2 * sinh(k) ** 4
- 2
* delta_rho**2
* k**2
* sinh(k) ** 2
* cosh(k) ** 2
- 2 * delta_rho**2 * k**2 * sinh(k) ** 2 * cosh(k) ** 2
+ delta_rho**2 * k**2 * cosh(k) ** 4
- 2 * delta_rho * k**2 * rhog * sinh(k) ** 4
+ 2 * delta_rho * k**2 * rhog * cosh(k) ** 4
Expand Down Expand Up @@ -972,11 +914,7 @@ def nond_G(x, t):
+ (delta_rho * k - k * rhog) * cosh(k) ** 2
+ sqrt(
delta_rho**2 * k**2 * sinh(k) ** 4
- 2
* delta_rho**2
* k**2
* sinh(k) ** 2
* cosh(k) ** 2
- 2 * delta_rho**2 * k**2 * sinh(k) ** 2 * cosh(k) ** 2
+ delta_rho**2 * k**2 * cosh(k) ** 4
- 2 * delta_rho * k**2 * rhog * sinh(k) ** 4
+ 2 * delta_rho * k**2 * rhog * cosh(k) ** 4
Expand Down Expand Up @@ -1040,17 +978,12 @@ def nond_G(x, t):
+ delta_rho * k**2
+ k**2 * rhog
+ sqrt(
(delta_rho**2 - 2 * delta_rho * rhog + rhog**2)
* sinh(k) ** 4
(delta_rho**2 - 2 * delta_rho * rhog + rhog**2) * sinh(k) ** 4
+ delta_rho**2 * k**2
+ 2 * delta_rho * k**2 * rhog
+ k**2 * rhog**2
+ 2
* (
delta_rho**2 * k
+ 2 * delta_rho * k * rhog
+ k * rhog**2
)
* (delta_rho**2 * k + 2 * delta_rho * k * rhog + k * rhog**2)
* sinh(k)
* cosh(k)
+ (
Expand Down Expand Up @@ -1106,17 +1039,12 @@ def nond_G(x, t):
+ delta_rho * k**2
+ k**2 * rhog
- sqrt(
(delta_rho**2 - 2 * delta_rho * rhog + rhog**2)
* sinh(k) ** 4
(delta_rho**2 - 2 * delta_rho * rhog + rhog**2) * sinh(k) ** 4
+ delta_rho**2 * k**2
+ 2 * delta_rho * k**2 * rhog
+ k**2 * rhog**2
+ 2
* (
delta_rho**2 * k
+ 2 * delta_rho * k * rhog
+ k * rhog**2
)
* (delta_rho**2 * k + 2 * delta_rho * k * rhog + k * rhog**2)
* sinh(k)
* cosh(k)
+ (
Expand Down
Loading

0 comments on commit 5122687

Please sign in to comment.