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

Prevent global Jacobian derivatives being interpreted as local derivatives #375

Merged
merged 5 commits into from
Jul 7, 2021
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
2 changes: 1 addition & 1 deletion ffcx/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ def _analyze_form(form: ufl.form.Form, parameters: typing.Dict) -> ufl.algorithm
do_apply_function_pullbacks=True,
do_apply_integral_scaling=True,
do_apply_geometry_lowering=True,
preserve_geometry_types=(ufl.classes.Jacobian, ),
preserve_geometry_types=(ufl.classes.Jacobian,),
do_apply_restrictions=True,
do_append_everywhere_integrals=False, # do not add dx integrals to dx(i) in UFL
complex_mode=complex_mode)
Expand Down
7 changes: 3 additions & 4 deletions ffcx/ir/elementtables.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,14 +201,13 @@ def get_modified_terminal_element(mt):
elif isinstance(mt.terminal, ufl.classes.Jacobian):
if mt.reference_value:
raise RuntimeError("Not expecting reference value of J.")

if gd:
raise RuntimeError("Not expecting global derivatives of J.")
element = mt.terminal.ufl_domain().ufl_coordinate_element()
assert len(mt.component) == 2
# Translate component J[i,d] to x element context rgrad(x[i])[d]
fc, d = mt.component # x-component, derivative

# Grad(Jacobian(...)) should be a local derivative
ld = tuple(sorted((d, ) + gd + ld))
ld = tuple(sorted((d, ) + ld))
else:
return None

Expand Down