Topology optimization in gridap for structural problem

I’m confused — that’s not how density-based topology optimization works.

You normally are optimizing a density function \rho(\vec{x}) \in [0,1] over the whole design domain, so that at each point in space (or in the design region), you have a scalar “density” \rho(\vec{x}) between 0 and 1, corresponding to two possible materials A and B. That is, points with \rho = 1 correspond to material A and points with \rho = 1 correspond to material B, while intermediate values of \rho correspond to some problem-dependent interpolation between A and B. (There are then additional steps: filtering to regularize the problem, and projection to “binarize” the problem and potentially penalties to eliminate intermediate values, as in the tutorial, but you can skip those steps to start with.)

So, in FEM TopOpt, your design “density” is generally a scalar-valued function represented in an FEM basis. In the tutorial, this is the quantity p. It shouldn’t be vector-valued.

I would definitely recommend reviewing some materials on topology optimization, e.g. Sigmund’s book.

but i did your suggestion and it doesnt work again

The backtrace is still showing the same problem — you are still trying to exponentiate a VectorValue, which doesn’t work. So you didn’t follow my suggestion of using a scalar density field as is normal in topology optimization.

PS. Please quote code and backtraces with backticks ```