So I have a finite element space like this:

fes_V = H1(Om_mesh, order=1, dim=5)

where the mesh is a 3-D cube, but the number of components of the functions in H^1 is 5.

Eventually, I try to do this:

a_form = BilinearForm (fes_V, symmetric=False)

and I get this error:

netgen.libngpy._meshing.NgException: Could not create BilinearForm, space-dimension is 5

either define MAX_SYS_DIM with higher value and recompile,

or set flag ‘nonassemble’

I understand what it is saying, but where do I set this parameter? Also, am I going to run into issues when I try to do a solve with multi-grid? I’m trying to solve an elliptic *system*, which has 5 coupled equations, and is “very strongly elliptic”.

Any advice would be helpful.

Quick answer: Use

es_V = H1(Om_mesh, order=1) ** 5

BilinearForms on finite element spaces with space(…, dim=5) allocate sparse matrices, where the entries are 5x5 matrices, with 5 being a compile time constant. This requires to compile ngsolve for bock-sizes up to at least 5. Smoothers and direct solvers with block-entries up to that size are compiled as well.

Default compilation is for block-sizes up to 3, what is typically used for 3D elasticity.

Adding block-matrices with run-time blocksizes is on the todo list.

H1(…) ** 5

builds matrices with double entries, the matrix dimensions are 5 times larger. No specific compile for larger block-sizes is needed.

You can use u for a 5-dimensional trial-function, Grad(u) is a 5x3 matrix.

Joachim

PS: you provide the MAX_SYS_DIM to cmake

Thanks for the response. Will this alternative way be slower? It sounds like changing the block size would lead to more efficient implementation, but I am guessing.

I’ll try this of course.

We can now define BilineaForms an spaces with arbitrary dimension, the block dimensions of the Sparse-block-matrix is a run-time variable.

At the moment we only have the matrix-vector product, timings are comparable to compile-time fixed block-sizes.

More operations will come.