Skip to content

Commit

Permalink
Prevent global Jacobian derivatives being interpreted as local deriva…
Browse files Browse the repository at this point in the history
…tives (#375)

* Check no global derivatives of the Jacobian are present

* Don't preserve Jacobian

* Preserve Jacobain

* Remove space

* Remove gd from ld (it will always be an empty tuple)
  • Loading branch information
jpdean authored Jul 7, 2021
1 parent f389d9f commit a129989
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
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

0 comments on commit a129989

Please sign in to comment.