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 CI errors #376

Merged
merged 4 commits into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
2 changes: 1 addition & 1 deletion examples/discrete_turbines/turbine_callback.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def __init__(self, solver_obj,
self.field_dims = []
for field_name in field_names:
if field_name != 'pow':
self.field_dims.append(solver_obj.fields[field_name].function_space().value_size)
self.field_dims.append(solver_obj.fields[field_name].function_space().block_size)
cpjordan marked this conversation as resolved.
Show resolved Hide resolved
attrs = {
# use null-padded ascii strings, dtype='U' not supported in hdf5,
# see http://docs.h5py.org/en/latest/strings.html
Expand Down
1 change: 1 addition & 0 deletions test/examples/test_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
'tidalfarm/tidalfarm.py',
'tidal_barrage/plotting.py',
'channel_inversion/plot_elevation_progress.py',
'channel_inversion/inverse_problem.py',
'tohoku_inversion/okada.py',
'tohoku_inversion/plot_convergence.py',
'tohoku_inversion/plot_elevation_initial_guess.py',
Expand Down
4 changes: 3 additions & 1 deletion test_adjoint/examples/test_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# list of all adjoint examples to run
adjoint_files = [
'tidalfarm/tidalfarm.py',
# 'channel_inversion/inverse_problem.py', # FIXME requires obs time series
'channel_inversion/inverse_problem.py',
]

cwd = os.path.abspath(os.path.dirname(__file__))
Expand All @@ -34,6 +34,8 @@ def example_file(request):

def test_examples(example_file, tmpdir, monkeypatch):
assert os.path.isfile(example_file), 'File not found {:}'.format(example_file)
if 'examples/channel_inversion/inverse_problem.py' in example_file:
pytest.xfail("Known issue with Firedrake and mixed function spaces. See Firedrake issue #3368.")
# copy mesh files
source = os.path.dirname(example_file)
for f in glob.glob(os.path.join(source, '*.msh')):
Expand Down
4 changes: 2 additions & 2 deletions thetis/callback.py
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ def __init__(self, solver_obj,
"""
# printing all detector output to log is probably not a useful default:
kwargs.setdefault('append_to_log', False)
self.field_dims = [solver_obj.fields[field_name].function_space().value_size
self.field_dims = [solver_obj.fields[field_name].function_space().block_size
cpjordan marked this conversation as resolved.
Show resolved Hide resolved
for field_name in field_names]
attrs = {
# use null-padded ascii strings, dtype='U' not supported in hdf5, see http://docs.h5py.org/en/latest/strings.html
Expand Down Expand Up @@ -996,7 +996,7 @@ def __init__(self, solver_obj, fieldnames, x, y,
self.field_dims = {}
for f in self.fieldnames:
func = solver_obj.fields[f]
self.field_dims[f] = func.function_space().value_size
self.field_dims[f] = func.function_space().block_size
cpjordan marked this conversation as resolved.
Show resolved Hide resolved
self.variable_names = ['z_coord']
for f, f_short in zip(fieldnames, field_short_names):
if self.field_dims[f] == 1:
Expand Down
6 changes: 3 additions & 3 deletions thetis/exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ def get_visu_space(fs):
"""
mesh = fs.mesh()
family = 'Lagrange' if is_cg(fs) else 'Discontinuous Lagrange'
if len(fs.ufl_element().value_shape) == 1:
dim = fs.ufl_element().value_shape[0]
if len(fs.ufl_function_space().value_shape) == 1:
cpjordan marked this conversation as resolved.
Show resolved Hide resolved
dim = fs.ufl_function_space().value_shape[0]
visu_fs = get_functionspace(mesh, family, 1, family, 1,
vector=True, dim=dim)
elif len(fs.ufl_element().value_shape) == 2:
elif len(fs.ufl_function_space().value_shape) == 2:
visu_fs = get_functionspace(mesh, family, 1, family, 1,
tensor=True)
else:
Expand Down
4 changes: 2 additions & 2 deletions thetis/utility.py
Original file line number Diff line number Diff line change
Expand Up @@ -605,8 +605,8 @@ def compute_elem_height(zcoord, output):
}
}
}""" % {'nodes': zcoord.cell_node_map().arity,
'func_dim': zcoord.function_space().value_size,
'output_dim': output.function_space().value_size},
'func_dim': zcoord.function_space().block_size,
'output_dim': output.function_space().block_size},
'my_kernel')
op2.par_loop(
kernel, fs_out.mesh().cell_set,
Expand Down
20 changes: 10 additions & 10 deletions thetis/utility3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -527,8 +527,8 @@ def __init__(self, input_2d, output_3d, elem_height=None):
}
}
}""" % {'nodes': self.fs_2d.finat_element.space_dimension(),
'func2d_dim': self.input_2d.function_space().value_size,
'func3d_dim': self.fs_3d.value_size,
'func2d_dim': self.input_2d.function_space().block_size,
'func3d_dim': self.fs_3d.block_size,
'v_nodes': n_vert_nodes},
'my_kernel')

Expand Down Expand Up @@ -664,8 +664,8 @@ def __init__(self, input_3d, output_2d,
}
}
}""" % {'nodes': self.output_2d.cell_node_map().arity,
'func2d_dim': self.output_2d.function_space().value_size,
'func3d_dim': self.fs_3d.value_size},
'func2d_dim': self.output_2d.function_space().block_size,
'func3d_dim': self.fs_3d.block_size},
'my_kernel')
else:
self.kernel = op2.Kernel("""
Expand All @@ -676,8 +676,8 @@ def __init__(self, input_3d, output_2d,
}
}
}""" % {'nodes': self.output_2d.cell_node_map().arity,
'func2d_dim': self.output_2d.function_space().value_size,
'func3d_dim': self.fs_3d.value_size},
'func2d_dim': self.output_2d.function_space().block_size,
'func3d_dim': self.fs_3d.block_size},
'my_kernel')

if self.do_hdiv_scaling:
Expand Down Expand Up @@ -771,8 +771,8 @@ def __init__(self, solver):
}
}
}""" % {'nodes': self.fs_2d.finat_element.space_dimension(),
'func2d_dim': self.fs_2d.value_size,
'func3d_dim': self.fs_3d.value_size,
'func2d_dim': self.fs_2d.block_size,
'func3d_dim': self.fs_3d.block_size,
'v_nodes': n_vert_nodes},
'my_kernel')

Expand All @@ -790,8 +790,8 @@ def __init__(self, solver):
}
}
}""" % {'nodes': self.fs_2d.finat_element.space_dimension(),
'func2d_dim': self.fs_2d.value_size,
'func3d_dim': self.fs_3d.value_size,
'func2d_dim': self.fs_2d.block_size,
'func3d_dim': self.fs_3d.block_size,
'v_nodes': n_vert_nodes},
'my_kernel')

Expand Down