Cartesian product of square meshes?

Hello. I would like to solve a PDE with solutions like u\colon (0,1)^2\times (0,1)^2 \to \mathbb{R}. Attempting to use TensorProductMesh in ufl gives the error “Product of vector-valued elements not supported”. So is it at all possible to work with domains in more than 3 dimensions? Are there any known hacks for dealing with a Cartesian product of 2-dimensional meshes?

Is there a particular reason for wanting to do a cartiesian product of the meshes, and not make a suitable function space based on VectorElement or TensorElement?
At least in your example, the grids are identical in your cartesian product, is this supposed to be the case in all of your applications?

Hi dokken, thanks for the reply. Yes, the intended purpose for this application is to have a 2-dimensional mesh modeling a habitat, and u is a function of two individual’s spatial locations within that habitat. So in all instances the Cartesian product will have identical grids. Also the PDE is of the form

L_x u(x,y) + L_y u(x,y) = c

where c is constant, L_x is a differential operator acting only on the x slot of u and L_y is the same operator acting only on the y slot.

I might be mistaken but I thought TensorElements are used for tensor-valued functions, but here u is a scalar-valued function with tensor arguments. I don’t know how I would go about making a function space containing functions that are evaluated using coordinates like [[x1, x2], [y1, y2]]. If I could do that I’d be able to handle the rest of the implementation, I think.