Skip to content

Commit

Permalink
Ensure normalization works for spheres
Browse files Browse the repository at this point in the history
  • Loading branch information
kburns committed Feb 6, 2024
1 parent b0ee129 commit 4f96bb9
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions dedalus/core/field.py
Original file line number Diff line number Diff line change
Expand Up @@ -800,9 +800,10 @@ def allreduce_L2_norm(self, normalize_volume=True):
else:
raise ValueError("Norms only implemented up to rank-2 tensors.")
# Compute L2 norm
norm_sq = operators.Integrate(self_inner_product).evaluate().allreduce_data_max()
if normalize_volume:
norm_sq /= self.domain.volume
norm_sq = operators.Average(self_inner_product).evaluate().allreduce_data_max(layout='g')
else:
norm_sq = operators.Integrate(self_inner_product).evaluate().allreduce_data_max(layout='g')
return norm_sq ** 0.5

def normalize(self, normalize_volume=True):
Expand Down

0 comments on commit 4f96bb9

Please sign in to comment.