It's not such an surprise - quadrature degree 20 in 3D needs 1331 quadrature points!
For compiled expression you should specify at least degree
Expression(code, degree=3)
(or whatever degree you need) or element. Just-in-time compiler has no algorithm to guess degree of C++ code supplied to Expression
.
Specifying
parameters["form_compiler"]["quadrature_degree"]
should not be needed. FFC estimates degree of each form by algorithms in UFL (although there are some bugs). Better you should specify degree to each form by syntax
foo*dx(None, form_compiler_parameters={'quadrature_degree': 14})
(or int
specifying domain instead of None
)
Regarding your other post here, note that both your expression are not exactly integrable using Gauss quadrature. I don't know with what degree you intended to integrate wf
and cPot
but 20 might be quite an overkill. For example degree 20 of the form a
assumes that wf*cPot
is of degree 12. (In addition wf
and cPot
are interpolated to degree 1 before integration because you didn't set degree of C++ expression as said above.)
You can specify some form compiler parameters to optimize for memory usage.
I set cPot = Expression(..., degree=3)
, wf = Expression(..., degree=3)
. Then with
parameters["form_compiler"]["quadrature_degree"] = 14
FFC did the job very promptly and GCC needed 4GB; output Assembly: 277.316293955 sec
; output on 2nd run Assembly: 8.01471805573 sec
. With
parameters["form_compiler"]["quadrature_degree"] = 14
parameters["form_compiler"]["optimize"] = True
parameters["form_compiler"]["representation"] = 'quadrature'
FFC took longer time but GCC finished very quickly with minimal memory resources; on the other hand actual assembling is much slower than with tensor representation; output Assembly: 99.2105529308 sec
; output on 2nd run Assembly: 77.5997550488 sec
. With
parameters["form_compiler"]["quadrature_degree"] = 14
parameters["form_compiler"]["representation"] = 'quadrature'
this is practically same; output Assembly: 77.1860561371 sec
; output on 2nd run Assembly: 55.6270360947 sec
.