From a623193a4d22beb9b7c9c6403871c4a51f1633be Mon Sep 17 00:00:00 2001 From: Joe Dean Date: Sun, 4 Jul 2021 11:24:20 +0100 Subject: [PATCH 1/5] Check no global derivatives of the Jacobian are present --- ffcx/ir/elementtables.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ffcx/ir/elementtables.py b/ffcx/ir/elementtables.py index 7dccc6f7d..288a9f180 100644 --- a/ffcx/ir/elementtables.py +++ b/ffcx/ir/elementtables.py @@ -201,13 +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)) else: return None From d41704294e85b095335de6672268ad41e00e7527 Mon Sep 17 00:00:00 2001 From: Joe Dean Date: Sun, 4 Jul 2021 11:26:47 +0100 Subject: [PATCH 2/5] Don't preserve Jacobian --- ffcx/analysis.py | 1 - 1 file changed, 1 deletion(-) diff --git a/ffcx/analysis.py b/ffcx/analysis.py index c849dfbb6..1d28ae060 100644 --- a/ffcx/analysis.py +++ b/ffcx/analysis.py @@ -160,7 +160,6 @@ 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, ), do_apply_restrictions=True, do_append_everywhere_integrals=False, # do not add dx integrals to dx(i) in UFL complex_mode=complex_mode) From 2dc439fcec607119a9844d750740d0d6a62129b3 Mon Sep 17 00:00:00 2001 From: Joe Dean Date: Mon, 5 Jul 2021 21:28:28 +0100 Subject: [PATCH 3/5] Preserve Jacobain --- ffcx/analysis.py | 1 + 1 file changed, 1 insertion(+) diff --git a/ffcx/analysis.py b/ffcx/analysis.py index 1d28ae060..c849dfbb6 100644 --- a/ffcx/analysis.py +++ b/ffcx/analysis.py @@ -160,6 +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, ), do_apply_restrictions=True, do_append_everywhere_integrals=False, # do not add dx integrals to dx(i) in UFL complex_mode=complex_mode) From f338597f93c3159b8855d1182e1c51297ca4022b Mon Sep 17 00:00:00 2001 From: Joe Dean Date: Mon, 5 Jul 2021 21:32:03 +0100 Subject: [PATCH 4/5] Remove space --- ffcx/analysis.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ffcx/analysis.py b/ffcx/analysis.py index c849dfbb6..4583f9d59 100644 --- a/ffcx/analysis.py +++ b/ffcx/analysis.py @@ -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) From 950efce99b0dd687fe8a3bea7f68d503eaa36536 Mon Sep 17 00:00:00 2001 From: Joe Dean Date: Wed, 7 Jul 2021 12:08:05 +0100 Subject: [PATCH 5/5] Remove gd from ld (it will always be an empty tuple) --- ffcx/ir/elementtables.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ffcx/ir/elementtables.py b/ffcx/ir/elementtables.py index 288a9f180..6ec71014d 100644 --- a/ffcx/ir/elementtables.py +++ b/ffcx/ir/elementtables.py @@ -207,8 +207,7 @@ def get_modified_terminal_element(mt): 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 - - ld = tuple(sorted((d, ) + gd + ld)) + ld = tuple(sorted((d, ) + ld)) else: return None