Are you running exactly the code in the Gridap TopOpt Tutorial 18 or are you just basing your code off it, doing something a bit different?
(If you are following it exactly then your question about the trial/test space makes no sense because the tutorial is a scalar PDE. If your code is different from the tutorial it will not be possible to help you unless you post a minimal runnable code snippet that illustrates your problem. Please read: make it easier to help you)