Skip to content

Commit

Permalink
Merge branch 'main' into non_inc_imp_rk
Browse files Browse the repository at this point in the history
  • Loading branch information
tommbendall authored Nov 18, 2024
2 parents f812c98 + 6268004 commit 5250ad5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion gusto/core/coordinates.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def register_space(self, domain, space_name):
space = domain.spaces(space_name)

# Use the appropriate scalar function space if the space is vector
if np.prod(space.ufl_element().value_shape) > 1:
if np.prod(space.value_shape) > 1:
# TODO: get scalar space, and only compute coordinates if necessary
logger.warning(f'Space {space_name} has more than one dimension, '
+ 'and coordinates used for netCDF output have not '
Expand Down
8 changes: 4 additions & 4 deletions gusto/recovery/recovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,20 +332,20 @@ def find_eff_coords(V0):
vec_DG1 = VectorFunctionSpace(mesh, DG1_element)
x = SpatialCoordinate(mesh)

if isinstance(V0.ufl_element(), VectorElement) or V0.ufl_element().value_size > 1:
if isinstance(V0.ufl_element(), VectorElement) or V0.value_size > 1:
eff_coords_list = []
V0_coords_list = []

# treat this separately for each component
for i in range(V0.ufl_element().value_size):
for i in range(V0.value_size):
# fill an d-dimensional list with i-th coordinate
x_list = [x[i] for j in range(V0.ufl_element().value_size)]
x_list = [x[i] for j in range(V0.value_size)]

# the i-th element in V0_coords_list is a vector with all components the i-th coord
ith_V0_coords = Function(V0).project(as_vector(x_list))
V0_coords_list.append(ith_V0_coords)

for i in range(V0.ufl_element().value_size):
for i in range(V0.value_size):
# slice through V0_coords_list to obtain the coords of the DOFs for that component
x_list = [V0_coords[i] for V0_coords in V0_coords_list]

Expand Down
2 changes: 1 addition & 1 deletion gusto/solvers/preconditioners.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def initialize(self, pc):
for i, Vi in enumerate(V):

# Vector-valued spaces will have a non-empty value_shape
if Vi.ufl_element().value_shape:
if Vi.value_shape:
self.vidx = i
else:
self.pidx = i
Expand Down

0 comments on commit 5250ad5

Please sign in to comment.