Topology optimization in gridap for structural problem

HI, I am using gridap package to FE and then topology optimization. i just followed the tutorial 18 of gridap but I get error as below. i really appreciate if anyone help me. also my model is 2D i dont know if i should specify the trial and test space as VectorValue{2,Float64} or just like tutorial float 64. ishould mention that my loading is increasing incrementally so my trial space changes in each iteration and i couldnt use it in tuple of fem_params.
AssertionError: L == D1 * D2

Stacktrace:
[1] (TensorValue{2, 2, Float64})(data::Tuple{Float64})
@ Gridap.TensorValues C:\Users\mm5335.julia\packages\Gridap\971dU\src\TensorValues\TensorValueTypes.jl:11
[2] TensorValue{2, 2, Float64, 4}(data::Float64)
@ Gridap.TensorValues C:\Users\mm5335.julia\packages\Gridap\971dU\src\TensorValues\TensorValueTypes.jl:58
[3] convert(#unused#::Type{TensorValue{2, 2, Float64, 4}}, x::Float64)
@ Base .\number.jl:7
[4] setindex!(A::Vector{TensorValue{2, 2, Float64, 4}}, x::Float64, i1::Int64)
@ Base .\array.jl:966
[5] _unsafe_copyto!(dest::Vector{TensorValue{2, 2, Float64, 4}}, doffs::Int64, src::Vector{Float64}, soffs::Int64, n::Int64)
@ Base .\array.jl:253
[6] unsafe_copyto!
@ .\array.jl:307 [inlined]
[7] _copyto_impl!
@ .\array.jl:331 [inlined]
[8] copyto!
@ .\array.jl:317 [inlined]
[9] copyto!
@ .\array.jl:343 [inlined]
[10] evaluate!(cache::Gridap.Arrays.CachedVector{TensorValue{2, 2, Float64, 4}, Vector{TensorValue{2, 2, Float64, 4}}}, k::Gridap.Arrays.MulAddMap{Int64}, a::Matrix{TensorValue{2, 2, Float64, 4}}, b::Vector{Float64}, c::Vector{Float64})
@ Gridap.Arrays C:\Users\mm5335.julia\packages\Gridap\971dU\src\Arrays\AlgebraMaps.jl:37
[11] evaluate
@ C:\Users\mm5335.julia\packages\Gridap\971dU\src\Arrays\Maps.jl:87 [inlined]
[12] return_value
@ C:\Users\mm5335.julia\packages\Gridap\971dU\src\Arrays\Maps.jl:64 [inlined]
[13] return_value
@ C:\Users\mm5335.julia\packages\Gridap\971dU\src\CellData\AttachDirichlet.jl:63 [inlined]
[14] return_type
@ C:\Users\mm5335.julia\packages\Gridap\971dU\src\Arrays\Maps.jl:62 [inlined]
[15] lazy_map(::Gridap.CellData.AttachDirichletMap, ::Gridap.Arrays.LazyArray{FillArrays.Fill{typeof(tuple), 1, Tuple{Base.OneTo{Int64}}}, Tuple{Matrix{TensorValue{2, 2, Float64, 4}}, Vector{Float64}}, 1, Tuple{Gridap.Arrays.LazyArray{FillArrays.Fill{Broadcasting{typeof(+)}, 1, Tuple{Base.OneTo{Int64}}}, Matrix{TensorValue{2, 2, Float64, 4}}, 1, Tuple{Gridap.Arrays.LazyArray{FillArrays.Fill{IntegrationMap, 1, Tuple{Base.OneTo{Int64}}}, Matrix{TensorValue{2, 2, Float64, 4}}, 1, Tuple{Gridap.Arrays.LazyArray{FillArrays.Fill{Gridap.Fields.BroadcastingFieldOpMap{typeof()}, 1, Tuple{Base.OneTo{Int64}}}, Array{TensorValue{2, 2, Float64, 4}, 3}, 1, Tuple{Gridap.Arrays.CompressedArray{Vector{Float64}, 1, Vector{Vector{Float64}}, Vector{Int8}}, Gridap.Arrays.LazyArray{FillArrays.Fill{Gridap.Fields.BroadcastingFieldOpMap{typeof(dot)}, 1, Tuple{Base.OneTo{Int64}}}, Array{TensorValue{2, 2, Float64, 4}, 3}, 1, Tuple{Gridap.Arrays.LazyArray{FillArrays.Fill{Gridap.Fields.BroadcastingFieldOpMap{typeof(dot)}, 1, Tuple{Base.OneTo{Int64}}}, Matrix{TensorValue{2, 2, Float64, 4}}, 1, Tuple{Gridap.Arrays.LazyArray{FillArrays.Fill{Broadcasting{typeof(pinvJt)}, 1, Tuple{Base.OneTo{Int64}}}, Vector{TensorValue{2, 2, Float64, 4}}, 1, Tuple{Gridap.Arrays.LazyArray{Gridap.Arrays.LazyArray{FillArrays.Fill{typeof(constant_field), 1, Tuple{Base.OneTo{Int64}}}, ConstantField{TensorValue{2, 2, Float64, 4}}, 1, Tuple{Gridap.Arrays.LazyArray{FillArrays.Fill{Gridap.Fields.LinearCombinationMap{Colon}, 1, Tuple{Base.OneTo{Int64}}}, TensorValue{2, 2, Float64, 4}, 1, Tuple{Gridap.Arrays.LazyArray{FillArrays.Fill{Broadcasting{Reindex{Vector{VectorValue{2, Float64}}}}, 1, Tuple{Base.OneTo{Int64}}}, Vector{VectorValue{2, Float64}}, 1, Tuple{Gridap.Arrays.Table{Int64, Vector{Int64}, Vector{Int32}}}}, Gridap.Arrays.CompressedArray{Vector{VectorValue{2, Float64}}, 1, Vector{Vector{VectorValue{2, Float64}}}, Vector{Int8}}}}}}, Vector{TensorValue{2, 2, Float64, 4}}, 1, Tuple{Gridap.Arrays.CompressedArray{Vector{VectorValue{2, Float64}}, 1, Vector{Vector{VectorValue{2, Float64}}}, Vector{Int8}}}}}}, Gridap.Arrays.CompressedArray{Matrix{TensorValue{2, 2, Float64, 4}}, 1, Vector{Matrix{TensorValue{2, 2, Float64, 4}}}, Vector{Int8}}}}, Gridap.Arrays.LazyArray{FillArrays.Fill{Gridap.Fields.TransposeMap, 1, Tuple{Base.OneTo{Int64}}}, Gridap.Fields.TransposeFieldIndices{Matrix{TensorValue{2, 2, Float64, 4}}, TensorValue{2, 2, Float64, 4}}, 1, Tuple{Gridap.Arrays.LazyArray{FillArrays.Fill{Gridap.Fields.BroadcastingFieldOpMap{typeof(dot)}, 1, Tuple{Base.OneTo{Int64}}}, Matrix{TensorValue{2, 2, Float64, 4}}, 1, Tuple{Gridap.Arrays.LazyArray{FillArrays.Fill{Broadcasting{typeof(pinvJt)}, 1, Tuple{Base.OneTo{Int64}}}, Vector{TensorValue{2, 2, Float64, 4}}, 1, Tuple{Gridap.Arrays.LazyArray{Gridap.Arrays.LazyArray{FillArrays.Fill{typeof(constant_field), 1, Tuple{Base.OneTo{Int64}}}, ConstantField{TensorValue{2, 2, Float64, 4}}, 1, Tuple{Gridap.Arrays.LazyArray{FillArrays.Fill{Gridap.Fields.LinearCombinationMap{Colon}, 1, Tuple{Base.OneTo{Int64}}}, TensorValue{2, 2, Float64, 4}, 1, Tuple{Gridap.Arrays.LazyArray{FillArrays.Fill{Broadcasting{Reindex{Vector{VectorValue{2, Float64}}}}, 1, Tuple{Base.OneTo{Int64}}}, Vector{VectorValue{2, Float64}}, 1, Tuple{Gridap.Arrays.Table{Int64, Vector{Int64}, Vector{Int32}}}}, Gridap.Arrays.CompressedArray{Vector{VectorValue{2, Float64}}, 1, Vector{Vector{VectorValue{2, Float64}}}, Vector{Int8}}}}}}, Vector{TensorValue{2, 2, Float64, 4}}, 1, Tuple{Gridap.Arrays.CompressedArray{Vector{VectorValue{2, Float64}}, 1, Vector{Vector{VectorValue{2, Float64}}}, Vector{Int8}}}}}}, Gridap.Arrays.CompressedArray{Matrix{TensorValue{2, 2, Float64, 4}}, 1, Vector{Matrix{TensorValue{2, 2, Float64, 4}}}, Vector{Int8}}}}}}}}}}, Gridap.Arrays.CompressedArray{Vector{Float64}, 1, Vector{Vector{Float64}}, Vector{Int8}}, Gridap.Arrays.LazyArray{Gridap.Arrays.LazyArray{FillArrays.Fill{typeof(constant_field), 1, Tuple{Base.OneTo{Int64}}}, ConstantField{TensorValue{2, 2, Float64, 4}}, 1, Tuple{Gridap.Arrays.LazyArray{FillArrays.Fill{Gridap.Fields.LinearCombinationMap{Colon}, 1, Tuple{Base.OneTo{Int64}}}, TensorValue{2, 2, Float64, 4}, 1, Tuple{Gridap.Arrays.LazyArray{FillArrays.Fill{Broadcasting{Reindex{Vector{VectorValue{2, Float64}}}}, 1, Tuple{Base.OneTo{Int64}}}, Vector{VectorValue{2, Float64}}, 1, Tuple{Gridap.Arrays.Table{Int64, Vector{Int64}, Vector{Int32}}}}, Gridap.Arrays.CompressedArray{Vector{VectorValue{2, Float64}}, 1, Vector{Vector{VectorValue{2, Float64}}}, Vector{Int8}}}}}}, Vector{TensorValue{2, 2, Float64, 4}}, 1, Tuple{Gridap.Arrays.CompressedArray{Vector{VectorValue{2, Float64}}, 1, Vector{Vector{VectorValue{2, Float64}}}, Vector{Int8}}}}}}, Gridap.Arrays.LazyArray{FillArrays.Fill{IntegrationMap, 1, Tuple{Base.OneTo{Int64}}}, Matrix{Float64}, 1, Tuple{Gridap.Arrays.CompressedArray{Array{Float64, 3}, 1, Vector{Array{Float64, 3}}, Vector{Int8}}, Gridap.Arrays.CompressedArray{Vector{Float64}, 1, Vector{Vector{Float64}}, Vector{Int8}}, Gridap.Arrays.LazyArray{Gridap.Arrays.LazyArray{FillArrays.Fill{typeof(constant_field), 1, Tuple{Base.OneTo{Int64}}}, ConstantField{TensorValue{2, 2, Float64, 4}}, 1, Tuple{Gridap.Arrays.LazyArray{FillArrays.Fill{Gridap.Fields.LinearCombinationMap{Colon}, 1, Tuple{Base.OneTo{Int64}}}, TensorValue{2, 2, Float64, 4}, 1, Tuple{Gridap.Arrays.LazyArray{FillArrays.Fill{Broadcasting{Reindex{Vector{VectorValue{2, Float64}}}}, 1, Tuple{Base.OneTo{Int64}}}, Vector{VectorValue{2, Float64}}, 1, Tuple{Gridap.Arrays.Table{Int64, Vector{Int64}, Vector{Int32}}}}, Gridap.Arrays.CompressedArray{Vector{VectorValue{2, Float64}}, 1, Vector{Vector{VectorValue{2, Float64}}}, Vector{Int8}}}}}}, Vector{TensorValue{2, 2, Float64, 4}}, 1, Tuple{Gridap.Arrays.CompressedArray{Vector{VectorValue{2, Float64}}, 1, Vector{Vector{VectorValue{2, Float64}}}, Vector{Int8}}}}}}}}, Gridap.Arrays.LazyArray{FillArrays.Fill{IntegrationMap, 1, Tuple{Base.OneTo{Int64}}}, Vector{Float64}, 1, Tuple{Gridap.Arrays.LazyArray{FillArrays.Fill{Gridap.Fields.BroadcastingFieldOpMap{typeof(inner)}, 1, Tuple{Base.OneTo{Int64}}}, Matrix{Float64}, 1, Tuple{Gridap.Arrays.CompressedArray{Matrix{VectorValue{2, Float64}}, 1, Vector{Matrix{VectorValue{2, Float64}}}, Vector{Int8}}, Gridap.Arrays.LazyArray{FillArrays.Fill{Gridap.Fields.LinearCombinationMap{Colon}, 1, Tuple{Base.OneTo{Int64}}}, Vector{VectorValue{2, Float64}}, 1, Tuple{Gridap.Arrays.LazyArray{FillArrays.Fill{Broadcasting{Gridap.Arrays.PosNegReindex{Vector{Float64}, Vector{Float64}}}, 1, Tuple{Base.OneTo{Int64}}}, Vector{Float64}, 1, Tuple{Gridap.Arrays.Table{Int32, Vector{Int32}, Vector{Int32}}}}, Gridap.Arrays.CompressedArray{Matrix{VectorValue{2, Float64}}, 1, Vector{Matrix{VectorValue{2, Float64}}}, Vector{Int8}}}}}}, Gridap.Arrays.CompressedArray{Vector{Float64}, 1, Vector{Vector{Float64}}, Vector{Int8}}, Gridap.Arrays.LazyArray{Gridap.Arrays.LazyArray{FillArrays.Fill{typeof(constant_field), 1, Tuple{Base.OneTo{Int64}}}, ConstantField{TensorValue{2, 2, Float64, 4}}, 1, Tuple{Gridap.Arrays.LazyArray{FillArrays.Fill{Gridap.Fields.LinearCombinationMap{Colon}, 1, Tuple{Base.OneTo{Int64}}}, TensorValue{2, 2, Float64, 4}, 1, Tuple{Gridap.Arrays.LazyArray{FillArrays.Fill{Broadcasting{Reindex{Vector{VectorValue{2, Float64}}}}, 1, Tuple{Base.OneTo{Int64}}}, Vector{VectorValue{2, Float64}}, 1, Tuple{Gridap.Arrays.Table{Int64, Vector{Int64}, Vector{Int32}}}}, Gridap.Arrays.CompressedArray{Vector{VectorValue{2, Float64}}, 1, Vector{Vector{VectorValue{2, Float64}}}, Vector{Int8}}}}}}, Vector{TensorValue{2, 2, Float64, 4}}, 1, Tuple{Gridap.Arrays.CompressedArray{Vector{VectorValue{2, Float64}}, 1, Vector{Vector{VectorValue{2, Float64}}}, Vector{Int8}}}}}}}}, ::Gridap.Arrays.LazyArray{FillArrays.Fill{Broadcasting{Gridap.Arrays.PosNegReindex{Vector{Float64}, Vector{Float64}}}, 1, Tuple{Base.OneTo{Int64}}}, Vector{Float64}, 1, Tuple{Gridap.Arrays.Table{Int32, Vector{Int32}, Vector{Int32}}}}, ::Vector{Bool})
@ Gridap.Arrays C:\Users\mm5335.julia\packages\Gridap\971dU\src\Arrays\LazyArrays.jl:57
[16] attach_dirichlet(cellmatvec::Gridap.Arrays.LazyArray{FillArrays.Fill{typeof(tuple), 1, Tuple{Base.OneTo{Int64}}}, Tuple{Matrix{TensorValue{2, 2, Float64, 4}}, Vector{Float64}}, 1, Tuple{Gridap.Arrays.LazyArray{FillArrays.Fill{Broadcasting{typeof(+)}, 1, Tuple{Base.OneTo{Int64}}}, Matrix{TensorValue{2, 2, Float64, 4}}, 1, Tuple{Gridap.Arrays.LazyArray{FillArrays.Fill{IntegrationMap, 1, Tuple{Base.OneTo{Int64}}}, Matrix{TensorValue{2, 2, Float64, 4}}, 1, Tuple{Gridap.Arrays.LazyArray{FillArrays.Fill{Gridap.Fields.BroadcastingFieldOpMap{typeof(
)}, 1, Tuple{Base.OneTo{Int64}}}, Array{TensorValue{2, 2, Float64, 4}, 3}, 1, Tuple{Gridap.Arrays.CompressedArray{Vector{Float64}, 1, Vector{Vector{Float64}}, Vector{Int8}}, Gridap.Arrays.LazyArray{FillArrays.Fill{Gridap.Fields.BroadcastingFieldOpMap{typeof(dot)}, 1, Tuple{Base.OneTo{Int64}}}, Array{TensorValue{2, 2, Float64, 4}, 3}, 1, Tuple{Gridap.Arrays.LazyArray{FillArrays.Fill{Gridap.Fields.BroadcastingFieldOpMap{typeof(dot)}, 1, Tuple{Base.OneTo{Int64}}}, Matrix{TensorValue{2, 2, Float64, 4}}, 1, Tuple{Gridap.Arrays.LazyArray{FillArrays.Fill{Broadcasting{typeof(pinvJt)}, 1, Tuple{Base.OneTo{Int64}}}, Vector{TensorValue{2, 2, Float64, 4}}, 1, Tuple{Gridap.Arrays.LazyArray{Gridap.Arrays.LazyArray{FillArrays.Fill{typeof(constant_field), 1, Tuple{Base.OneTo{Int64}}}, ConstantField{TensorValue{2, 2, Float64, 4}}, 1, Tuple{Gridap.Arrays.LazyArray{FillArrays.Fill{Gridap.Fields.LinearCombinationMap{Colon}, 1, Tuple{Base.OneTo{Int64}}}, TensorValue{2, 2, Float64, 4}, 1, Tuple{Gridap.Arrays.LazyArray{FillArrays.Fill{Broadcasting{Reindex{Vector{VectorValue{2, Float64}}}}, 1, Tuple{Base.OneTo{Int64}}}, Vector{VectorValue{2, Float64}}, 1, Tuple{Gridap.Arrays.Table{Int64, Vector{Int64}, Vector{Int32}}}}, Gridap.Arrays.CompressedArray{Vector{VectorValue{2, Float64}}, 1, Vector{Vector{VectorValue{2, Float64}}}, Vector{Int8}}}}}}, Vector{TensorValue{2, 2, Float64, 4}}, 1, Tuple{Gridap.Arrays.CompressedArray{Vector{VectorValue{2, Float64}}, 1, Vector{Vector{VectorValue{2, Float64}}}, Vector{Int8}}}}}}, Gridap.Arrays.CompressedArray{Matrix{TensorValue{2, 2, Float64, 4}}, 1, Vector{Matrix{TensorValue{2, 2, Float64, 4}}}, Vector{Int8}}}}, Gridap.Arrays.LazyArray{FillArrays.Fill{Gridap.Fields.TransposeMap, 1, Tuple{Base.OneTo{Int64}}}, Gridap.Fields.TransposeFieldIndices{Matrix{TensorValue{2, 2, Float64, 4}}, TensorValue{2, 2, Float64, 4}}, 1, Tuple{Gridap.Arrays.LazyArray{FillArrays.Fill{Gridap.Fields.BroadcastingFieldOpMap{typeof(dot)}, 1, Tuple{Base.OneTo{Int64}}}, Matrix{TensorValue{2, 2, Float64, 4}}, 1, Tuple{Gridap.Arrays.LazyArray{FillArrays.Fill{Broadcasting{typeof(pinvJt)}, 1, Tuple{Base.OneTo{Int64}}}, Vector{TensorValue{2, 2, Float64, 4}}, 1, Tuple{Gridap.Arrays.LazyArray{Gridap.Arrays.LazyArray{FillArrays.Fill{typeof(constant_field), 1, Tuple{Base.OneTo{Int64}}}, ConstantField{TensorValue{2, 2, Float64, 4}}, 1, Tuple{Gridap.Arrays.LazyArray{FillArrays.Fill{Gridap.Fields.LinearCombinationMap{Colon}, 1, Tuple{Base.OneTo{Int64}}}, TensorValue{2, 2, Float64, 4}, 1, Tuple{Gridap.Arrays.LazyArray{FillArrays.Fill{Broadcasting{Reindex{Vector{VectorValue{2, Float64}}}}, 1, Tuple{Base.OneTo{Int64}}}, Vector{VectorValue{2, Float64}}, 1, Tuple{Gridap.Arrays.Table{Int64, Vector{Int64}, Vector{Int32}}}}, Gridap.Arrays.CompressedArray{Vector{VectorValue{2, Float64}}, 1, Vector{Vector{VectorValue{2, Float64}}}, Vector{Int8}}}}}}, Vector{TensorValue{2, 2, Float64, 4}}, 1, Tuple{Gridap.Arrays.CompressedArray{Vector{VectorValue{2, Float64}}, 1, Vector{Vector{VectorValue{2, Float64}}}, Vector{Int8}}}}}}, Gridap.Arrays.CompressedArray{Matrix{TensorValue{2, 2, Float64, 4}}, 1, Vector{Matrix{TensorValue{2, 2, Float64, 4}}}, Vector{Int8}}}}}}}}}}, Gridap.Arrays.CompressedArray{Vector{Float64}, 1, Vector{Vector{Float64}}, Vector{Int8}}, Gridap.Arrays.LazyArray{Gridap.Arrays.LazyArray{FillArrays.Fill{typeof(constant_field), 1, Tuple{Base.OneTo{Int64}}}, ConstantField{TensorValue{2, 2, Float64, 4}}, 1, Tuple{Gridap.Arrays.LazyArray{FillArrays.Fill{Gridap.Fields.LinearCombinationMap{Colon}, 1, Tuple{Base.OneTo{Int64}}}, TensorValue{2, 2, Float64, 4}, 1, Tuple{Gridap.Arrays.LazyArray{FillArrays.Fill{Broadcasting{Reindex{Vector{VectorValue{2, Float64}}}}, 1, Tuple{Base.OneTo{Int64}}}, Vector{VectorValue{2, Float64}}, 1, Tuple{Gridap.Arrays.Table{Int64, Vector{Int64}, Vector{Int32}}}}, Gridap.Arrays.CompressedArray{Vector{VectorValue{2, Float64}}, 1, Vector{Vector{VectorValue{2, Float64}}}, Vector{Int8}}}}}}, Vector{TensorValue{2, 2, Float64, 4}}, 1, Tuple{Gridap.Arrays.CompressedArray{Vector{VectorValue{2, Float64}}, 1, Vector{Vector{VectorValue{2, Float64}}}, Vector{Int8}}}}}}, Gridap.Arrays.LazyArray{FillArrays.Fill{IntegrationMap, 1, Tuple{Base.OneTo{Int64}}}, Matrix{Float64}, 1, Tuple{Gridap.Arrays.CompressedArray{Array{Float64, 3}, 1, Vector{Array{Float64, 3}}, Vector{Int8}}, Gridap.Arrays.CompressedArray{Vector{Float64}, 1, Vector{Vector{Float64}}, Vector{Int8}}, Gridap.Arrays.LazyArray{Gridap.Arrays.LazyArray{FillArrays.Fill{typeof(constant_field), 1, Tuple{Base.OneTo{Int64}}}, ConstantField{TensorValue{2, 2, Float64, 4}}, 1, Tuple{Gridap.Arrays.LazyArray{FillArrays.Fill{Gridap.Fields.LinearCombinationMap{Colon}, 1, Tuple{Base.OneTo{Int64}}}, TensorValue{2, 2, Float64, 4}, 1, Tuple{Gridap.Arrays.LazyArray{FillArrays.Fill{Broadcasting{Reindex{Vector{VectorValue{2, Float64}}}}, 1, Tuple{Base.OneTo{Int64}}}, Vector{VectorValue{2, Float64}}, 1, Tuple{Gridap.Arrays.Table{Int64, Vector{Int64}, Vector{Int32}}}}, Gridap.Arrays.CompressedArray{Vector{VectorValue{2, Float64}}, 1, Vector{Vector{VectorValue{2, Float64}}}, Vector{Int8}}}}}}, Vector{TensorValue{2, 2, Float64, 4}}, 1, Tuple{Gridap.Arrays.CompressedArray{Vector{VectorValue{2, Float64}}, 1, Vector{Vector{VectorValue{2, Float64}}}, Vector{Int8}}}}}}}}, Gridap.Arrays.LazyArray{FillArrays.Fill{IntegrationMap, 1, Tuple{Base.OneTo{Int64}}}, Vector{Float64}, 1, Tuple{Gridap.Arrays.LazyArray{FillArrays.Fill{Gridap.Fields.BroadcastingFieldOpMap{typeof(inner)}, 1, Tuple{Base.OneTo{Int64}}}, Matrix{Float64}, 1, Tuple{Gridap.Arrays.CompressedArray{Matrix{VectorValue{2, Float64}}, 1, Vector{Matrix{VectorValue{2, Float64}}}, Vector{Int8}}, Gridap.Arrays.LazyArray{FillArrays.Fill{Gridap.Fields.LinearCombinationMap{Colon}, 1, Tuple{Base.OneTo{Int64}}}, Vector{VectorValue{2, Float64}}, 1, Tuple{Gridap.Arrays.LazyArray{FillArrays.Fill{Broadcasting{Gridap.Arrays.PosNegReindex{Vector{Float64}, Vector{Float64}}}, 1, Tuple{Base.OneTo{Int64}}}, Vector{Float64}, 1, Tuple{Gridap.Arrays.Table{Int32, Vector{Int32}, Vector{Int32}}}}, Gridap.Arrays.CompressedArray{Matrix{VectorValue{2, Float64}}, 1, Vector{Matrix{VectorValue{2, Float64}}}, Vector{Int8}}}}}}, Gridap.Arrays.CompressedArray{Vector{Float64}, 1, Vector{Vector{Float64}}, Vector{Int8}}, Gridap.Arrays.LazyArray{Gridap.Arrays.LazyArray{FillArrays.Fill{typeof(constant_field), 1, Tuple{Base.OneTo{Int64}}}, ConstantField{TensorValue{2, 2, Float64, 4}}, 1, Tuple{Gridap.Arrays.LazyArray{FillArrays.Fill{Gridap.Fields.LinearCombinationMap{Colon}, 1, Tuple{Base.OneTo{Int64}}}, TensorValue{2, 2, Float64, 4}, 1, Tuple{Gridap.Arrays.LazyArray{FillArrays.Fill{Broadcasting{Reindex{Vector{VectorValue{2, Float64}}}}, 1, Tuple{Base.OneTo{Int64}}}, Vector{VectorValue{2, Float64}}, 1, Tuple{Gridap.Arrays.Table{Int64, Vector{Int64}, Vector{Int32}}}}, Gridap.Arrays.CompressedArray{Vector{VectorValue{2, Float64}}, 1, Vector{Vector{VectorValue{2, Float64}}}, Vector{Int8}}}}}}, Vector{TensorValue{2, 2, Float64, 4}}, 1, Tuple{Gridap.Arrays.CompressedArray{Vector{VectorValue{2, Float64}}, 1, Vector{Vector{VectorValue{2, Float64}}}, Vector{Int8}}}}}}}}, cellvals::Gridap.Arrays.LazyArray{FillArrays.Fill{Broadcasting{Gridap.Arrays.PosNegReindex{Vector{Float64}, Vector{Float64}}}, 1, Tuple{Base.OneTo{Int64}}}, Vector{Float64}, 1, Tuple{Gridap.Arrays.Table{Int32, Vector{Int32}, Vector{Int32}}}}, cellmask::Vector{Bool})
@ Gridap.CellData C:\Users\mm5335.julia\packages\Gridap\971dU\src\CellData\AttachDirichlet.jl:4
[17] _pair_contribution_when_possible(biform::Gridap.CellData.DomainContribution, liform::Gridap.CellData.DomainContribution, uhd::Gridap.FESpaces.SingleFieldFEFunction{Gridap.CellData.GenericCellField{ReferenceDomain}})
@ Gridap.FESpaces C:\Users\mm5335.julia\packages\Gridap\971dU\src\FESpaces\Assemblers.jl:502
[18] collect_cell_matrix_and_vector(trial::Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Gridap.FESpaces.NodeToDofGlue{VectorValue{2, Int32}}}, test::Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Gridap.FESpaces.NodeToDofGlue{VectorValue{2, Int32}}}, biform::Gridap.CellData.DomainContribution, liform::Gridap.CellData.DomainContribution, uhd::Gridap.FESpaces.SingleFieldFEFunction{Gridap.CellData.GenericCellField{ReferenceDomain}})
@ Gridap.FESpaces C:\Users\mm5335.julia\packages\Gridap\971dU\src\FESpaces\Assemblers.jl:468
[19] AffineFEOperator(weakform::var"#5#6"{Float64, NamedTuple{(:V0_Disp, :Q, :P, :Qf, :Pf, :np, :Ī©, :dĪ©, :dĪ“_Load), Tuple{Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Gridap.FESpaces.NodeToDofGlue{VectorValue{2, Int32}}}, Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Nothing}, Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Nothing}, Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Gridap.FESpaces.NodeToDofGlue{VectorValue{2, Int32}}}, Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Gridap.FESpaces.NodeToDofGlue{VectorValue{2, Int32}}}, Int64, BodyFittedTriangulation{2, 2, UnstructuredDiscreteModel{2, 2, Float64, Oriented}, UnstructuredGrid{2, 2, Float64, Oriented, Nothing}, Gridap.Arrays.IdentityVector{Int64}}, Gridap.CellData.GenericMeasure, Gridap.CellData.GenericMeasure}}, Gridap.FESpaces.SingleFieldFEFunction{Gridap.CellData.GenericCellField{ReferenceDomain}}}, trial::Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Gridap.FESpaces.NodeToDofGlue{VectorValue{2, Int32}}}, test::Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Gridap.FESpaces.NodeToDofGlue{VectorValue{2, Int32}}}, assem::Gridap.FESpaces.GenericSparseMatrixAssembler)
@ Gridap.FESpaces C:\Users\mm5335.julia\packages\Gridap\971dU\src\FESpaces\AffineFEOperators.jl:37
[20] AffineFEOperator(::Function, ::Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Gridap.FESpaces.NodeToDofGlue{VectorValue{2, Int32}}}, ::Vararg{Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Gridap.FESpaces.NodeToDofGlue{VectorValue{2, Int32}}}})
@ Gridap.FESpaces C:\Users\mm5335.julia\packages\Gridap\971dU\src\FESpaces\AffineFEOperators.jl:47
[21] Filter(p0::Vector{Float64}; r::Float64, fem_params::NamedTuple{(:V0_Disp, :Q, :P, :Qf, :Pf, :np, :Ī©, :dĪ©, :dĪ“_Load), Tuple{Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Gridap.FESpaces.NodeToDofGlue{VectorValue{2, Int32}}}, Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Nothing}, Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Nothing}, Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Gridap.FESpaces.NodeToDofGlue{VectorValue{2, Int32}}}, Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Gridap.FESpaces.NodeToDofGlue{VectorValue{2, Int32}}}, Int64, BodyFittedTriangulation{2, 2, UnstructuredDiscreteModel{2, 2, Float64, Oriented}, UnstructuredGrid{2, 2, Float64, Oriented, Nothing}, Gridap.Arrays.IdentityVector{Int64}}, Gridap.CellData.GenericMeasure, Gridap.CellData.GenericMeasure}})
@ Main .\In[14]:9
[22] top-level scope
@ In[25]:2

also as i change the filtered trial and test space to float 64 type i get this error .
MethodError: convert(::Type{Union{}}, ::VectorValue{2, Float64}) is ambiguous. Candidates:
convert(::Type{<:StaticArraysCore.MVector{D, T}}, arg::VectorValue{D}) where {D, T} in Gridap.TensorValues at C:\Users\mm5335.julia\packages\Gridap\971dU\src\TensorValues\VectorValueTypes.jl:67
convert(::Type{<:VectorValue{D, T}}, arg::VectorValue{D, T}) where {D, T} in Gridap.TensorValues at C:\Users\mm5335.julia\packages\Gridap\971dU\src\TensorValues\VectorValueTypes.jl:72
convert(::Type{<:VectorValue{D, T}}, arg::VectorValue{D}) where {D, T} in Gridap.TensorValues at C:\Users\mm5335.julia\packages\Gridap\971dU\src\TensorValues\VectorValueTypes.jl:71
convert(::Type{<:StaticArraysCore.SVector{D, T}}, arg::VectorValue{D}) where {D, T} in Gridap.TensorValues at C:\Users\mm5335.julia\packages\Gridap\971dU\src\TensorValues\VectorValueTypes.jl:66
convert(::Type{C}, c::Number) where C<:ColorTypes.Colorant in ColorTypes at C:\Users\mm5335.julia\packages\ColorTypes\1dGw6\src\conversions.jl:74
convert(::Type{T}, x::Number) where T<:AbstractChar in Base at char.jl:184
convert(::Type{<:Tuple{Vararg{T, D}}}, arg::VectorValue{D}) where {D, T} in Gridap.TensorValues at C:\Users\mm5335.julia\packages\Gridap\971dU\src\TensorValues\VectorValueTypes.jl:68
convert(::Type{T}, x::Number) where T<:Number in Base at number.jl:7
convert(::Type{Union{}}, x) in Base at essentials.jl:213
convert(::Type{T}, arg) where T<:VecElement in Base at baseext.jl:19
Possible fix, define
convert(::Type{Union{}}, ::VectorValue{D, T}) where {D, T}

Stacktrace:
[1] to_power_type(x::VectorValue{2, Float64})
@ Base .\intfuncs.jl:250
[2] power_by_squaring(x_::VectorValue{2, Float64}, p::Int64)
@ Base .\intfuncs.jl:265
[3] ^(x::VectorValue{2, Float64}, p::Int64)
@ Base .\intfuncs.jl:300
[4] _broadcast_getindex_evalf
@ .\broadcast.jl:670 [inlined]
[5] _broadcast_getindex
@ .\broadcast.jl:643 [inlined]
[6] _getindex
@ .\broadcast.jl:666 [inlined]
[7] _broadcast_getindex
@ .\broadcast.jl:642 [inlined]
[8] getindex
@ .\broadcast.jl:597 [inlined]
[9] copy
@ .\broadcast.jl:875 [inlined]
[10] materialize
@ .\broadcast.jl:860 [inlined]
[11] (::var"#E#60")(p::VectorValue{2, Float64})
@ Main .\In[49]:3
[12] (::var"#OC_mat#61"{var"#E#60"})(p::VectorValue{2, Float64})
@ Main .\In[49]:4
[13] Ļƒfun(Īµ::Function, p::VectorValue{2, Float64})
@ Main .\In[49]:5
[14] (::var"#76#77"{Gridap.FESpaces.SingleFieldFEBasis{Gridap.FESpaces.TrialBasis, ReferenceDomain}, Gridap.CellData.OperationCellField{ReferenceDomain}})(p::VectorValue{2, Float64})
@ Main .\In[56]:3
[15] evaluate!(cache::Nothing, f::Function, x::VectorValue{2, Float64})
@ Gridap.Arrays C:\Users\mm5335.julia\packages\Gridap\971dU\src\Arrays\Maps.jl:93
[16] evaluate(f::Function, x::VectorValue{2, Float64})
@ Gridap.Arrays C:\Users\mm5335.julia\packages\Gridap\971dU\src\Arrays\Maps.jl:87
[17] return_value(f::Function, x::VectorValue{2, Float64})
@ Gridap.Arrays C:\Users\mm5335.julia\packages\Gridap\971dU\src\Arrays\Maps.jl:64
[18] return_value(a::GenericField{var"#76#77"{Gridap.FESpaces.SingleFieldFEBasis{Gridap.FESpaces.TrialBasis, ReferenceDomain}, Gridap.CellData.OperationCellField{ReferenceDomain}}}, x::VectorValue{2, Float64})
@ Gridap.Fields C:\Users\mm5335.julia\packages\Gridap\971dU\src\Fields\FieldsInterfaces.jl:173
[19] return_type(f::GenericField{var"#76#77"{Gridap.FESpaces.SingleFieldFEBasis{Gridap.FESpaces.TrialBasis, ReferenceDomain}, Gridap.CellData.OperationCellField{ReferenceDomain}}}, x::VectorValue{2, Float64})
@ Gridap.Arrays C:\Users\mm5335.julia\packages\Gridap\971dU\src\Arrays\Maps.jl:62
[20] return_cache(f::GenericField{var"#76#77"{Gridap.FESpaces.SingleFieldFEBasis{Gridap.FESpaces.TrialBasis, ReferenceDomain}, Gridap.CellData.OperationCellField{ReferenceDomain}}}, x::Vector{VectorValue{2, Float64}})
@ Gridap.Fields C:\Users\mm5335.julia\packages\Gridap\971dU\src\Fields\FieldsInterfaces.jl:141
[21] evaluate(f::GenericField{var"#76#77"{Gridap.FESpaces.SingleFieldFEBasis{Gridap.FESpaces.TrialBasis, ReferenceDomain}, Gridap.CellData.OperationCellField{ReferenceDomain}}}, x::Vector{VectorValue{2, Float64}})
@ Gridap.Arrays C:\Users\mm5335.julia\packages\Gridap\971dU\src\Arrays\Maps.jl:86
[22] evaluate!(::Nothing, ::Function, ::GenericField{var"#76#77"{Gridap.FESpaces.SingleFieldFEBasis{Gridap.FESpaces.TrialBasis, ReferenceDomain}, Gridap.CellData.OperationCellField{ReferenceDomain}}}, ::Vector{VectorValue{2, Float64}})
@ Gridap.Arrays C:\Users\mm5335.julia\packages\Gridap\971dU\src\Arrays\Maps.jl:93
[23] evaluate
@ C:\Users\mm5335.julia\packages\Gridap\971dU\src\Arrays\Maps.jl:87 [inlined]
[24] return_value
@ C:\Users\mm5335.julia\packages\Gridap\971dU\src\Arrays\Maps.jl:64 [inlined]
[25] return_type
@ C:\Users\mm5335.julia\packages\Gridap\971dU\src\Arrays\Maps.jl:62 [inlined]
[26] lazy_map(::Function, ::FillArrays.Fill{GenericField{var"#76#77"{Gridap.FESpaces.SingleFieldFEBasis{Gridap.FESpaces.TrialBasis, ReferenceDomain}, Gridap.CellData.OperationCellField{ReferenceDomain}}}, 1, Tuple{Base.OneTo{Int64}}}, ::Gridap.Arrays.LazyArray{Gridap.Arrays.LazyArray{FillArrays.Fill{typeof(affine_map), 1, Tuple{Base.OneTo{Int64}}}, AffineMap{2, 2, Float64, 4}, 1, Tuple{Gridap.Arrays.LazyArray{FillArrays.Fill{Gridap.Fields.LinearCombinationMap{Colon}, 1, Tuple{Base.OneTo{Int64}}}, TensorValue{2, 2, Float64, 4}, 1, Tuple{Gridap.Arrays.LazyArray{FillArrays.Fill{Broadcasting{Reindex{Vector{VectorValue{2, Float64}}}}, 1, Tuple{Base.OneTo{Int64}}}, Vector{VectorValue{2, Float64}}, 1, Tuple{Gridap.Arrays.Table{Int64, Vector{Int64}, Vector{Int32}}}}, Gridap.Arrays.CompressedArray{Vector{VectorValue{2, Float64}}, 1, Vector{Vector{VectorValue{2, Float64}}}, Vector{Int8}}}}, Gridap.Arrays.LazyArray{FillArrays.Fill{Gridap.Fields.LinearCombinationMap{Colon}, 1, Tuple{Base.OneTo{Int64}}}, VectorValue{2, Float64}, 1, Tuple{Gridap.Arrays.LazyArray{FillArrays.Fill{Broadcasting{Reindex{Vector{VectorValue{2, Float64}}}}, 1, Tuple{Base.OneTo{Int64}}}, Vector{VectorValue{2, Float64}}, 1, Tuple{Gridap.Arrays.Table{Int64, Vector{Int64}, Vector{Int32}}}}, Gridap.Arrays.CompressedArray{Vector{Float64}, 1, Vector{Vector{Float64}}, Vector{Int8}}}}}}, Vector{VectorValue{2, Float64}}, 1, Tuple{Gridap.Arrays.CompressedArray{Vector{VectorValue{2, Float64}}, 1, Vector{Vector{VectorValue{2, Float64}}}, Vector{Int8}}}})
@ Gridap.Arrays C:\Users\mm5335.julia\packages\Gridap\971dU\src\Arrays\LazyArrays.jl:57
[27] lazy_map(#unused#::typeof(evaluate), a::Gridap.Arrays.LazyArray{FillArrays.Fill{Broadcasting{typeof(āˆ˜)}, 1, Tuple{Base.OneTo{Int64}}}, Gridap.Fields.OperationField{GenericField{var"#76#77"{Gridap.FESpaces.SingleFieldFEBasis{Gridap.FESpaces.TrialBasis, ReferenceDomain}, Gridap.CellData.OperationCellField{ReferenceDomain}}}, Tuple{AffineMap{2, 2, Float64, 4}}}, 1, Tuple{FillArrays.Fill{GenericField{var"#76#77"{Gridap.FESpaces.SingleFieldFEBasis{Gridap.FESpaces.TrialBasis, ReferenceDomain}, Gridap.CellData.OperationCellField{ReferenceDomain}}}, 1, Tuple{Base.OneTo{Int64}}}, Gridap.Arrays.LazyArray{FillArrays.Fill{typeof(affine_map), 1, Tuple{Base.OneTo{Int64}}}, AffineMap{2, 2, Float64, 4}, 1, Tuple{Gridap.Arrays.LazyArray{FillArrays.Fill{Gridap.Fields.LinearCombinationMap{Colon}, 1, Tuple{Base.OneTo{Int64}}}, TensorValue{2, 2, Float64, 4}, 1, Tuple{Gridap.Arrays.LazyArray{FillArrays.Fill{Broadcasting{Reindex{Vector{VectorValue{2, Float64}}}}, 1, Tuple{Base.OneTo{Int64}}}, Vector{VectorValue{2, Float64}}, 1, Tuple{Gridap.Arrays.Table{Int64, Vector{Int64}, Vector{Int32}}}}, Gridap.Arrays.CompressedArray{Vector{VectorValue{2, Float64}}, 1, Vector{Vector{VectorValue{2, Float64}}}, Vector{Int8}}}}, Gridap.Arrays.LazyArray{FillArrays.Fill{Gridap.Fields.LinearCombinationMap{Colon}, 1, Tuple{Base.OneTo{Int64}}}, VectorValue{2, Float64}, 1, Tuple{Gridap.Arrays.LazyArray{FillArrays.Fill{Broadcasting{Reindex{Vector{VectorValue{2, Float64}}}}, 1, Tuple{Base.OneTo{Int64}}}, Vector{VectorValue{2, Float64}}, 1, Tuple{Gridap.Arrays.Table{Int64, Vector{Int64}, Vector{Int32}}}}, Gridap.Arrays.CompressedArray{Vector{Float64}, 1, Vector{Vector{Float64}}, Vector{Int8}}}}}}}}, x::Gridap.Arrays.CompressedArray{Vector{VectorValue{2, Float64}}, 1, Vector{Vector{VectorValue{2, Float64}}}, Vector{Int8}})
@ Gridap.Fields C:\Users\mm5335.julia\packages\Gridap\971dU\src\Fields\ApplyOptimizations.jl:63
[28] evaluate!(cache::Nothing, f::Gridap.CellData.GenericCellField{ReferenceDomain}, x::Gridap.CellData.CellPoint{ReferenceDomain, Gridap.Arrays.CompressedArray{Vector{VectorValue{2, Float64}}, 1, Vector{Vector{VectorValue{2, Float64}}}, Vector{Int8}}, Gridap.Arrays.LazyArray{FillArrays.Fill{Broadcasting{Reindex{Vector{VectorValue{2, Float64}}}}, 1, Tuple{Base.OneTo{Int64}}}, Vector{VectorValue{2, Float64}}, 1, Tuple{Gridap.Arrays.Table{Int32, Vector{Int32}, Vector{Int32}}}}, BodyFittedTriangulation{2, 2, UnstructuredDiscreteModel{2, 2, Float64, Oriented}, UnstructuredGrid{2, 2, Float64, Oriented, Nothing}, Gridap.Arrays.IdentityVector{Int64}}})
@ Gridap.CellData C:\Users\mm5335.julia\packages\Gridap\971dU\src\CellData\CellFields.jl:387
[29] evaluate
@ C:\Users\mm5335.julia\packages\Gridap\971dU\src\Arrays\Maps.jl:87 [inlined]
[30] CellField
@ C:\Users\mm5335.julia\packages\Gridap\971dU\src\CellData\CellFields.jl:381 [inlined]
[31] #11
@ C:\Users\mm5335.julia\packages\Gridap\971dU\src\CellData\CellFields.jl:475 [inlined]
[32] map(f::Gridap.CellData.var"#11#13"{Gridap.CellData.CellPoint{ReferenceDomain, Gridap.Arrays.CompressedArray{Vector{VectorValue{2, Float64}}, 1, Vector{Vector{VectorValue{2, Float64}}}, Vector{Int8}}, Gridap.Arrays.LazyArray{FillArrays.Fill{Broadcasting{Reindex{Vector{VectorValue{2, Float64}}}}, 1, Tuple{Base.OneTo{Int64}}}, Vector{VectorValue{2, Float64}}, 1, Tuple{Gridap.Arrays.Table{Int32, Vector{Int32}, Vector{Int32}}}}, BodyFittedTriangulation{2, 2, UnstructuredDiscreteModel{2, 2, Float64, Oriented}, UnstructuredGrid{2, 2, Float64, Oriented, Nothing}, Gridap.Arrays.IdentityVector{Int64}}}}, t::Tuple{Gridap.CellData.OperationCellField{ReferenceDomain}, Gridap.CellData.GenericCellField{ReferenceDomain}})
@ Base .\tuple.jl:222
[33] Gridap.CellData.OperationCellField(::Operation{typeof(inner)}, ::Gridap.CellData.OperationCellField{ReferenceDomain}, ::Vararg{CellField})
@ Gridap.CellData C:\Users\mm5335.julia\packages\Gridap\971dU\src\CellData\CellFields.jl:475
[34] _operate_cellfields(::Operation{typeof(inner)}, ::Gridap.CellData.OperationCellField{ReferenceDomain}, ::Vararg{Any})
@ Gridap.CellData C:\Users\mm5335.julia\packages\Gridap\971dU\src\CellData\CellFields.jl:542
[35] evaluate!(::Nothing, ::Operation{typeof(inner)}, ::Gridap.CellData.OperationCellField{ReferenceDomain}, ::var"#76#77"{Gridap.FESpaces.SingleFieldFEBasis{Gridap.FESpaces.TrialBasis, ReferenceDomain}, Gridap.CellData.OperationCellField{ReferenceDomain}})
@ Gridap.CellData C:\Users\mm5335.julia\packages\Gridap\971dU\src\CellData\CellFields.jl:439
[36] evaluate(::Operation{typeof(inner)}, ::Gridap.CellData.OperationCellField{ReferenceDomain}, ::Function)
@ Gridap.Arrays C:\Users\mm5335.julia\packages\Gridap\971dU\src\Arrays\Maps.jl:87
[37] Map
@ C:\Users\mm5335.julia\packages\Gridap\971dU\src\Arrays\Maps.jl:90 [inlined]
[38] inner(a::Gridap.CellData.OperationCellField{ReferenceDomain}, b::Function)
@ Gridap.CellData C:\Users\mm5335.julia\packages\Gridap\971dU\src\CellData\CellFields.jl:625
[39] A_Disp(u::Gridap.FESpaces.SingleFieldFEBasis{Gridap.FESpaces.TrialBasis, ReferenceDomain}, v::Gridap.FESpaces.SingleFieldFEBasis{Gridap.FESpaces.TestBasis, ReferenceDomain}, pth::Gridap.CellData.OperationCellField{ReferenceDomain})
@ Main .\In[56]:3
[40] (::var"#79#80"{NamedTuple{(:V0_Disp, :Q, :P, :Qf, :Pf, :np, :Ī©, :dĪ©, :dĪ“_Load), Tuple{Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Gridap.FESpaces.NodeToDofGlue{VectorValue{2, Int32}}}, Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Nothing}, Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Nothing}, Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Gridap.FESpaces.NodeToDofGlue{Int32}}, Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Gridap.FESpaces.NodeToDofGlue{Int32}}, Int64, BodyFittedTriangulation{2, 2, UnstructuredDiscreteModel{2, 2, Float64, Oriented}, UnstructuredGrid{2, 2, Float64, Oriented, Nothing}, Gridap.Arrays.IdentityVector{Int64}}, Gridap.CellData.GenericMeasure, Gridap.CellData.GenericMeasure}}, Gridap.CellData.OperationCellField{ReferenceDomain}})(u::Gridap.FESpaces.SingleFieldFEBasis{Gridap.FESpaces.TrialBasis, ReferenceDomain}, v::Gridap.FESpaces.SingleFieldFEBasis{Gridap.FESpaces.TestBasis, ReferenceDomain})
@ Main .\In[56]:6
[41] assemble_matrix(f::var"#79#80"{NamedTuple{(:V0_Disp, :Q, :P, :Qf, :Pf, :np, :Ī©, :dĪ©, :dĪ“_Load), Tuple{Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Gridap.FESpaces.NodeToDofGlue{VectorValue{2, Int32}}}, Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Nothing}, Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Nothing}, Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Gridap.FESpaces.NodeToDofGlue{Int32}}, Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Gridap.FESpaces.NodeToDofGlue{Int32}}, Int64, BodyFittedTriangulation{2, 2, UnstructuredDiscreteModel{2, 2, Float64, Oriented}, UnstructuredGrid{2, 2, Float64, Oriented, Nothing}, Gridap.Arrays.IdentityVector{Int64}}, Gridap.CellData.GenericMeasure, Gridap.CellData.GenericMeasure}}, Gridap.CellData.OperationCellField{ReferenceDomain}}, a::Gridap.FESpaces.GenericSparseMatrixAssembler, U::TrialFESpace{Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Gridap.FESpaces.NodeToDofGlue{VectorValue{2, Int32}}}}, V::Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Gridap.FESpaces.NodeToDofGlue{VectorValue{2, Int32}}})
@ Gridap.FESpaces C:\Users\mm5335.julia\packages\Gridap\971dU\src\FESpaces\Assemblers.jl:285
[42] assemble_matrix(f::Function, U::TrialFESpace{Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Gridap.FESpaces.NodeToDofGlue{VectorValue{2, Int32}}}}, V::Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Gridap.FESpaces.NodeToDofGlue{VectorValue{2, Int32}}})
@ Gridap.FESpaces C:\Users\mm5335.julia\packages\Gridap\971dU\src\FESpaces\Assemblers.jl:342
[43] MatrixA(pth::Gridap.CellData.OperationCellField{ReferenceDomain}; fem_params::NamedTuple{(:V0_Disp, :Q, :P, :Qf, :Pf, :np, :Ī©, :dĪ©, :dĪ“_Load), Tuple{Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Gridap.FESpaces.NodeToDofGlue{VectorValue{2, Int32}}}, Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Nothing}, Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Nothing}, Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Gridap.FESpaces.NodeToDofGlue{Int32}}, Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Gridap.FESpaces.NodeToDofGlue{Int32}}, Int64, BodyFittedTriangulation{2, 2, UnstructuredDiscreteModel{2, 2, Float64, Oriented}, UnstructuredGrid{2, 2, Float64, Oriented, Nothing}, Gridap.Arrays.IdentityVector{Int64}}, Gridap.CellData.GenericMeasure, Gridap.CellData.GenericMeasure}}, vApp::Float64)
@ Main .\In[56]:5
[44] stepDisp(vApp::Float64)
@ Main .\In[58]:9
[45] top-level scope
@ In[59]:1

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)

thank you for your response. no I am basing my code off it. i provide you the short code here. i am using Īµ:Ļƒ = 0 as weak form and objectivity of strain energy for next level.

function  ElasFourthOrderConstTensor(E,Ī½,2)
        C1111 = (E.*(1-Ī½*Ī½))./((1+Ī½)*(1-Ī½-2*Ī½*Ī½))
        C1122 = (Ī½.*E)/(1-Ī½-2*Ī½*Ī½)
        C1112 = 0.0
        C2222 = (E.*(1-Ī½))/(1-Ī½-2*Ī½*Ī½)
        C2212 = 0.0
        C1212 =E/(2*(1+Ī½))
    end
    C_ten = SymFourthOrderTensorValue(C1111 ,C1112 ,C1122 ,C1112 ,C1212 ,C2212 ,C1122 ,C2212 ,C2222)
    return   C_ten
end
order = 1
reffe_Disp = ReferenceFE(lagrangian ,VectorValue{2,Float64},order)
V0_Disp = TestFESpace(model,reffe_Disp;conformity =:H1,
    dirichlet_tags = ["LeftSupport","RightSupport","LoadLine"],
    dirichlet_masks =[(false ,true), (true ,true), (false ,true)])
uh = zero(V0_Disp)
function  trial(vApp)
    uApp1(x) = VectorValue(0.0,0.0)
    uApp2(x) = VectorValue(0.0,0.0)
    uApp3(x) = VectorValue(0.0,-vApp)
    U_Disp = TrialFESpace(V0_Disp ,[uApp1 ,uApp2 ,uApp3])
    return U_Disp
end
p_reffe = ReferenceFE(lagrangian, Float64, 0)
Q = TestFESpace(Ī©, p_reffe, vector_type = Vector{Float64})
P = Q
np = num_free_dofs(P) # Number of cells in design region (number of design parameters)
pf_reffe = ReferenceFE(lagrangian, Float64, 1)
Qf = TestFESpace(Ī©, pf_reffe, vector_type = Vector{Float64})
Pf = Qf
function Ļƒfun(Īµ,p)
    E(p)= (p.^cp) .* E_mat
    OC_mat(p)= ElasFourthOrderConstTensor(E(p),Ī½_mat,2)
    Ļƒ = OC_mat(p)āŠ™Īµ
    return  Ļƒ
end
A_Disp(u,v,pth) =  Īµ(v) āŠ™ (p-> Ļƒfun(Īµ,p)āˆ˜(Īµ(u),pth))
function MatrixA(pth; fem_params,vApp)
    A_mat = assemble_matrix(trial(vApp), fem_params.V0_Disp) do u, v
        āˆ«(A_Disp(u,v,pth))fem_params.dā„¦
    end
    return lu(A_mat)
end
function  stepDisp(vApp)
    uApp1(x) = VectorValue(0.0,0.0)
    uApp2(x) = VectorValue(0.0,0.0)
    uApp3(x) = VectorValue(0.0,-vApp)
    U_Disp = TrialFESpace(V0_Disp ,[uApp1 ,uApp2 ,uApp3])
    A_Disp(u,v,pth) =  Īµ(v) āŠ™ (p->Ļƒfunāˆ˜(Īµ(u),pth))
    a_Disp(u,v,pth) =āˆ«(A_Disp(u,v,pth))fem_params.dā„¦
    b_vec = assemble_vector(0.0, fem_params.V0_Disp)
    A_mat = MatrixA(pth; fem_params, vApp)
    op_Disp = A_mat .\ b_vec
    uh_out = FEFunction(U_Disp, op_Disp)
    return  uh_out
end
p = zeros(fem_params.np)
pf_vec = Filter(p;r, fem_params)
pfh = FEFunction(fem_params.Pf, pf_vec)
pth = (pf -> Threshold(pf; Ī², Ī·)) āˆ˜ pfh
vApp = 0
delv = 1e-3
const  vAppMax = 0.1
innerMax = 10
count = 0
Load = Float64[]
Displacement = Float64[]
push!(Load, 0.0)
push!(Displacement, 0.0)
while  vApp .< vAppMax
    count = count  .+ 1
    if vApp  >= 3e-2
        delv = 1e-4
    end
    vApp = vApp .+ delv
    print("\n Entering  displacemtent  step :", float(vApp))
          uh = stepDisp(vApp)
    Node_Force = sum(āˆ«(n_Ī“_Loadā‹…(Ļƒfunāˆ˜(Īµ(uh),pth)))fem_params.dĪ“_Load)
    push!(Load , -Node_Force[2])
    push!( Displacement , vApp)
    writevtk(ā„¦,"results_SymThreePtBendingTest$count",cellfields= ["uh"=>uh])
 end
end

I would start with exactly the tutorial code first. Make sure it runs as expected. Then try to change one thing at a time to see where the problem arises, in order to narrow down your question.

A separate thing is to make sure you can solve the forward problem first before you worry about topology optimization. Does your code work for just solving the PDE for given coefficients (taking out all of the TopOpt stuff)?

PS. You quote code with ``` (backticks), not '''. (Iā€™ve corrected your post above.)

yes FE part is working before topology optimization part . for TO i should a design parameter(field variable- density) to pde and then it gives me errors.

What was the smallest change that caused the error? i.e. if you took your working FEM simulation, then inserted a variable density field, did that cause an error? If so, it would be useful to post the working code plus the change that caused the error. (Otherwise you are asking people to pore over the whole program without telling them the source of the problem.)

cc @fverdugo

this is the FE code which works.

function  ElasFourthOrderConstTensor(E,Ī½,PlanarState)
    # 1 for  Plane  Stress  and 2 Plane  Strain  Condition
    if  PlanarState  == 1
        C1111 =E/(1-Ī½*Ī½)
        C1122 = (Ī½*E)/(1-Ī½*Ī½)
        C1112 = 0.0
        C2222 =E/(1-Ī½*Ī½)
        C2212 = 0.0
        C1212 =E/(2*(1+Ī½))
    elseif  PlanarState  == 2
        C1111 = (E*(1-Ī½*Ī½))/((1+Ī½)*(1-Ī½-2*Ī½*Ī½))
        C1122 = (Ī½*E)/(1-Ī½-2*Ī½*Ī½)
        C1112 = 0.0
        C2222 = (E*(1-Ī½))/(1-Ī½-2*Ī½*Ī½)
        C2212 = 0.0
        C1212 =E/(2*(1+Ī½))
    end
    C_ten = SymFourthOrderTensorValue(C1111 ,C1112 ,C1122 ,C1112 ,C1212 ,C2212 ,C1122 ,C2212 ,C2222)
    return   C_ten
end
     

const  C_mat = ElasFourthOrderConstTensor(E_mat ,Ī½_mat ,2)
     
function Ļƒfun(Īµ)
    Ļƒ = C_matāŠ™Īµ
    return  Ļƒ
end
order = 1
reffe_PF = ReferenceFE(lagrangian ,Float64,order)
V0_PF = TestFESpace(model ,reffe_PF;conformity =:H1)
U_PF = TrialFESpace(V0_PF)
sh = zero(V0_PF)
     

reffe_Disp = ReferenceFE(lagrangian ,VectorValue{2,Float64},order)
V0_Disp = TestFESpace(model,reffe_Disp;conformity =:H1,
    dirichlet_tags = ["LeftSupport","RightSupport","LoadLine"],
    dirichlet_masks =[(false ,true), (true ,true), (false ,true)])

uh = zero(V0_Disp)
     

degree = 2*order
ā„¦= Triangulation(model)
dā„¦= Measure(ā„¦,degree)
     

labels = get_face_labeling(model)
LoadTagId = get_tag_from_name(labels ,"LoadLine")
Ī“_Load = BoundaryTriangulation(model ,tags = LoadTagId)
dĪ“_Load = Measure(Ī“_Load ,degree)
n_Ī“_Load = get_normal_vector(Ī“_Load)
     function  stepDisp(uh_in,sh_in ,vApp)
    uApp1(x) = VectorValue(0.0,0.0)
    uApp2(x) = VectorValue(0.0,0.0)
    uApp3(x) = VectorValue(0.0,-vApp)
    U_Disp = TrialFESpace(V0_Disp ,[uApp1 ,uApp2 ,uApp3])
    a_Disp(u,v) =āˆ«( (Īµ(v)āŠ™(Ļƒfunāˆ˜(Īµ(u),Īµ(uh_in),sh_in)) ) )*dā„¦
    b_Disp(v) = 0.0
    op_Disp = AffineFEOperator(a_Disp ,b_Disp ,U_Disp ,V0_Disp)
    uh_out = solve(op_Disp)
    return  uh_out
end
vApp = 0
delv = 1e-3
const  vAppMax = 0.1
innerMax = 10
count = 0
Load = Float64[]
Displacement = Float64[]
push!(Load, 0.0)
push!(Displacement, 0.0)
while  vApp .< vAppMax
    count = count  .+ 1
    if vApp  >= 3e-2
        delv = 1e-4
    end
    vApp = vApp .+ delv
    print("\n Entering  displacemtent  step :", float(vApp))
    for  inner = 1: innerMax
        uh = stepDisp(uh,vApp)
    Node_Force = sum(āˆ«(n_Ī“_Loadā‹…(Ļƒfunāˆ˜(Īµ(uh))))*dĪ“_Load)
    push!(Load , -Node_Force[2])
    push!( Displacement , vApp)
    writevtk(ā„¦,"results_SymThreePtBendingTest$count",cellfields= ["uh"=>uh])
 end
end

this is the code before opt after that sigma function has changed to code below and using the method of tutorial.

function Ļƒfun(Īµ,p)
    E(p)= (p.^cp) .* E_mat
    OC_mat(p)= ElasFourthOrderConstTensor(E(p),Ī½_mat,2)
    Ļƒ = OC_mat(p)āŠ™Īµ
    return  Ļƒ
end

If you change Ļƒfun to take two parameters rather than one, you will need to change all of the code that calls Ļƒfun appropriately. Ļƒfun(Īµ,p)āˆ˜(Īµ(u),pth) doesnā€™t look correct to me.

I think what you want is a 1-argument function, along the lines

function Ļƒfun(p)
    E(p)= (p.^cp) .* E_mat
    OC_mat(p)= ElasFourthOrderConstTensor(E(p),Ī½_mat,2)
    return OC_mat(p)
end

Then, in your weak form do something like Īµ(v) āŠ™ ((Ļƒfunāˆ˜pth) āŠ™ Īµ(u)). i.e. define only a single-argument function to act on the element functions, and then pull the āŠ™ Īµ(u) out (since Gridap knows how to perform āŠ™ on an FEFunction).

(Iā€™m just eyeballing it, but thatā€™s what jumped out at me. @fverdugo would know better.)

thank you for your suggestion. i did it but it gives me the error again as below.
Entering displacemtent step :0.001
MethodError: convert(::Type{Union{}}, ::VectorValue{2, Float64}) is ambiguous. Candidates:
convert(::Type{<:StaticArraysCore.MVector{D, T}}, arg::VectorValue{D}) where {D, T} in Gridap.TensorValues at C:\Users\mm5335.julia\packages\Gridap\971dU\src\TensorValues\VectorValueTypes.jl:67
convert(::Type{<:VectorValue{D, T}}, arg::VectorValue{D, T}) where {D, T} in Gridap.TensorValues at C:\Users\mm5335.julia\packages\Gridap\971dU\src\TensorValues\VectorValueTypes.jl:72
convert(::Type{<:VectorValue{D, T}}, arg::VectorValue{D}) where {D, T} in Gridap.TensorValues at C:\Users\mm5335.julia\packages\Gridap\971dU\src\TensorValues\VectorValueTypes.jl:71
convert(::Type{<:StaticArraysCore.SVector{D, T}}, arg::VectorValue{D}) where {D, T} in Gridap.TensorValues at C:\Users\mm5335.julia\packages\Gridap\971dU\src\TensorValues\VectorValueTypes.jl:66
convert(::Type{C}, c::Number) where C<:ColorTypes.Colorant in ColorTypes at C:\Users\mm5335.julia\packages\ColorTypes\1dGw6\src\conversions.jl:74
convert(::Type{T}, x::Number) where T<:AbstractChar in Base at char.jl:184
convert(::Type{<:Tuple{Vararg{T, D}}}, arg::VectorValue{D}) where {D, T} in Gridap.TensorValues at C:\Users\mm5335.julia\packages\Gridap\971dU\src\TensorValues\VectorValueTypes.jl:68
convert(::Type{T}, x::Number) where T<:Number in Base at number.jl:7
convert(::Type{Union{}}, x) in Base at essentials.jl:213
convert(::Type{T}, arg) where T<:VecElement in Base at baseext.jl:19
Possible fix, define
convert(::Type{Union{}}, ::VectorValue{D, T}) where {D, T}

Stacktrace:
[1] to_power_type(x::VectorValue{2, Float64})
@ Base .\intfuncs.jl:250
[2] power_by_squaring(x_::VectorValue{2, Float64}, p::Int64)
@ Base .\intfuncs.jl:265
[3] ^(x::VectorValue{2, Float64}, p::Int64)
@ Base .\intfuncs.jl:300
[4] _broadcast_getindex_evalf
@ .\broadcast.jl:670 [inlined]
[5] _broadcast_getindex
@ .\broadcast.jl:643 [inlined]
[6] _getindex
@ .\broadcast.jl:666 [inlined]
[7] _broadcast_getindex
@ .\broadcast.jl:642 [inlined]
[8] getindex
@ .\broadcast.jl:597 [inlined]
[9] copy
@ .\broadcast.jl:875 [inlined]
[10] materialize
@ .\broadcast.jl:860 [inlined]
[11] (::var"#E#8")(p::VectorValue{2, Float64})
@ Main .\In[16]:3
[12] (::var"#OC_mat#9"{var"#E#8"})(p::VectorValue{2, Float64})
@ Main .\In[16]:4
[13] Ļƒfun(p::VectorValue{2, Float64})
@ Main .\In[16]:10
[14] (::var"#10#11"{Gridap.CellData.OperationCellField{ReferenceDomain}})(p::VectorValue{2, Float64})
@ Main .\In[17]:3
[15] evaluate!(cache::Nothing, f::Function, x::VectorValue{2, Float64})
@ Gridap.Arrays C:\Users\mm5335.julia\packages\Gridap\971dU\src\Arrays\Maps.jl:93
[16] evaluate(f::Function, x::VectorValue{2, Float64})
@ Gridap.Arrays C:\Users\mm5335.julia\packages\Gridap\971dU\src\Arrays\Maps.jl:87
[17] return_value(f::Function, x::VectorValue{2, Float64})
@ Gridap.Arrays C:\Users\mm5335.julia\packages\Gridap\971dU\src\Arrays\Maps.jl:64
[18] return_value(a::GenericField{var"#10#11"{Gridap.CellData.OperationCellField{ReferenceDomain}}}, x::VectorValue{2, Float64})
@ Gridap.Fields C:\Users\mm5335.julia\packages\Gridap\971dU\src\Fields\FieldsInterfaces.jl:173
[19] return_type(f::GenericField{var"#10#11"{Gridap.CellData.OperationCellField{ReferenceDomain}}}, x::VectorValue{2, Float64})
@ Gridap.Arrays C:\Users\mm5335.julia\packages\Gridap\971dU\src\Arrays\Maps.jl:62
[20] return_cache(f::GenericField{var"#10#11"{Gridap.CellData.OperationCellField{ReferenceDomain}}}, x::Vector{VectorValue{2, Float64}})
@ Gridap.Fields C:\Users\mm5335.julia\packages\Gridap\971dU\src\Fields\FieldsInterfaces.jl:141
[21] evaluate(f::GenericField{var"#10#11"{Gridap.CellData.OperationCellField{ReferenceDomain}}}, x::Vector{VectorValue{2, Float64}})
@ Gridap.Arrays C:\Users\mm5335.julia\packages\Gridap\971dU\src\Arrays\Maps.jl:86
[22] evaluate!(::Nothing, ::Function, ::GenericField{var"#10#11"{Gridap.CellData.OperationCellField{ReferenceDomain}}}, ::Vector{VectorValue{2, Float64}})
@ Gridap.Arrays C:\Users\mm5335.julia\packages\Gridap\971dU\src\Arrays\Maps.jl:93
[23] evaluate
@ C:\Users\mm5335.julia\packages\Gridap\971dU\src\Arrays\Maps.jl:87 [inlined]
[24] return_value
@ C:\Users\mm5335.julia\packages\Gridap\971dU\src\Arrays\Maps.jl:64 [inlined]
[25] return_type
@ C:\Users\mm5335.julia\packages\Gridap\971dU\src\Arrays\Maps.jl:62 [inlined]
[26] lazy_map(::Function, ::FillArrays.Fill{GenericField{var"#10#11"{Gridap.CellData.OperationCellField{ReferenceDomain}}}, 1, Tuple{Base.OneTo{Int64}}}, ::Gridap.Arrays.LazyArray{Gridap.Arrays.LazyArray{FillArrays.Fill{typeof(affine_map), 1, Tuple{Base.OneTo{Int64}}}, AffineMap{2, 2, Float64, 4}, 1, Tuple{Gridap.Arrays.LazyArray{FillArrays.Fill{Gridap.Fields.LinearCombinationMap{Colon}, 1, Tuple{Base.OneTo{Int64}}}, TensorValue{2, 2, Float64, 4}, 1, Tuple{Gridap.Arrays.LazyArray{FillArrays.Fill{Broadcasting{Reindex{Vector{VectorValue{2, Float64}}}}, 1, Tuple{Base.OneTo{Int64}}}, Vector{VectorValue{2, Float64}}, 1, Tuple{Gridap.Arrays.Table{Int64, Vector{Int64}, Vector{Int32}}}}, Gridap.Arrays.CompressedArray{Vector{VectorValue{2, Float64}}, 1, Vector{Vector{VectorValue{2, Float64}}}, Vector{Int8}}}}, Gridap.Arrays.LazyArray{FillArrays.Fill{Gridap.Fields.LinearCombinationMap{Colon}, 1, Tuple{Base.OneTo{Int64}}}, VectorValue{2, Float64}, 1, Tuple{Gridap.Arrays.LazyArray{FillArrays.Fill{Broadcasting{Reindex{Vector{VectorValue{2, Float64}}}}, 1, Tuple{Base.OneTo{Int64}}}, Vector{VectorValue{2, Float64}}, 1, Tuple{Gridap.Arrays.Table{Int64, Vector{Int64}, Vector{Int32}}}}, Gridap.Arrays.CompressedArray{Vector{Float64}, 1, Vector{Vector{Float64}}, Vector{Int8}}}}}}, Vector{VectorValue{2, Float64}}, 1, Tuple{Gridap.Arrays.CompressedArray{Vector{VectorValue{2, Float64}}, 1, Vector{Vector{VectorValue{2, Float64}}}, Vector{Int8}}}})
@ Gridap.Arrays C:\Users\mm5335.julia\packages\Gridap\971dU\src\Arrays\LazyArrays.jl:57
[27] lazy_map(#unused#::typeof(evaluate), a::Gridap.Arrays.LazyArray{FillArrays.Fill{Broadcasting{typeof(āˆ˜)}, 1, Tuple{Base.OneTo{Int64}}}, Gridap.Fields.OperationField{GenericField{var"#10#11"{Gridap.CellData.OperationCellField{ReferenceDomain}}}, Tuple{AffineMap{2, 2, Float64, 4}}}, 1, Tuple{FillArrays.Fill{GenericField{var"#10#11"{Gridap.CellData.OperationCellField{ReferenceDomain}}}, 1, Tuple{Base.OneTo{Int64}}}, Gridap.Arrays.LazyArray{FillArrays.Fill{typeof(affine_map), 1, Tuple{Base.OneTo{Int64}}}, AffineMap{2, 2, Float64, 4}, 1, Tuple{Gridap.Arrays.LazyArray{FillArrays.Fill{Gridap.Fields.LinearCombinationMap{Colon}, 1, Tuple{Base.OneTo{Int64}}}, TensorValue{2, 2, Float64, 4}, 1, Tuple{Gridap.Arrays.LazyArray{FillArrays.Fill{Broadcasting{Reindex{Vector{VectorValue{2, Float64}}}}, 1, Tuple{Base.OneTo{Int64}}}, Vector{VectorValue{2, Float64}}, 1, Tuple{Gridap.Arrays.Table{Int64, Vector{Int64}, Vector{Int32}}}}, Gridap.Arrays.CompressedArray{Vector{VectorValue{2, Float64}}, 1, Vector{Vector{VectorValue{2, Float64}}}, Vector{Int8}}}}, Gridap.Arrays.LazyArray{FillArrays.Fill{Gridap.Fields.LinearCombinationMap{Colon}, 1, Tuple{Base.OneTo{Int64}}}, VectorValue{2, Float64}, 1, Tuple{Gridap.Arrays.LazyArray{FillArrays.Fill{Broadcasting{Reindex{Vector{VectorValue{2, Float64}}}}, 1, Tuple{Base.OneTo{Int64}}}, Vector{VectorValue{2, Float64}}, 1, Tuple{Gridap.Arrays.Table{Int64, Vector{Int64}, Vector{Int32}}}}, Gridap.Arrays.CompressedArray{Vector{Float64}, 1, Vector{Vector{Float64}}, Vector{Int8}}}}}}}}, x::Gridap.Arrays.CompressedArray{Vector{VectorValue{2, Float64}}, 1, Vector{Vector{VectorValue{2, Float64}}}, Vector{Int8}})
@ Gridap.Fields C:\Users\mm5335.julia\packages\Gridap\971dU\src\Fields\ApplyOptimizations.jl:63
[28] evaluate!(cache::Nothing, f::Gridap.CellData.GenericCellField{ReferenceDomain}, x::Gridap.CellData.CellPoint{ReferenceDomain, Gridap.Arrays.CompressedArray{Vector{VectorValue{2, Float64}}, 1, Vector{Vector{VectorValue{2, Float64}}}, Vector{Int8}}, Gridap.Arrays.LazyArray{FillArrays.Fill{Broadcasting{Reindex{Vector{VectorValue{2, Float64}}}}, 1, Tuple{Base.OneTo{Int64}}}, Vector{VectorValue{2, Float64}}, 1, Tuple{Gridap.Arrays.Table{Int32, Vector{Int32}, Vector{Int32}}}}, BodyFittedTriangulation{2, 2, UnstructuredDiscreteModel{2, 2, Float64, Oriented}, UnstructuredGrid{2, 2, Float64, Oriented, Nothing}, Gridap.Arrays.IdentityVector{Int64}}})
@ Gridap.CellData C:\Users\mm5335.julia\packages\Gridap\971dU\src\CellData\CellFields.jl:387
[29] evaluate
@ C:\Users\mm5335.julia\packages\Gridap\971dU\src\Arrays\Maps.jl:87 [inlined]
[30] CellField
@ C:\Users\mm5335.julia\packages\Gridap\971dU\src\CellData\CellFields.jl:381 [inlined]
[31] #11
@ C:\Users\mm5335.julia\packages\Gridap\971dU\src\CellData\CellFields.jl:475 [inlined]
[32] map(f::Gridap.CellData.var"#11#13"{Gridap.CellData.CellPoint{ReferenceDomain, Gridap.Arrays.CompressedArray{Vector{VectorValue{2, Float64}}, 1, Vector{Vector{VectorValue{2, Float64}}}, Vector{Int8}}, Gridap.Arrays.LazyArray{FillArrays.Fill{Broadcasting{Reindex{Vector{VectorValue{2, Float64}}}}, 1, Tuple{Base.OneTo{Int64}}}, Vector{VectorValue{2, Float64}}, 1, Tuple{Gridap.Arrays.Table{Int32, Vector{Int32}, Vector{Int32}}}}, BodyFittedTriangulation{2, 2, UnstructuredDiscreteModel{2, 2, Float64, Oriented}, UnstructuredGrid{2, 2, Float64, Oriented, Nothing}, Gridap.Arrays.IdentityVector{Int64}}}}, t::Tuple{Gridap.CellData.GenericCellField{ReferenceDomain}, Gridap.CellData.OperationCellField{ReferenceDomain}})
@ Base .\tuple.jl:222
[33] Gridap.CellData.OperationCellField(::Operation{typeof(inner)}, ::Gridap.CellData.GenericCellField{ReferenceDomain}, ::Vararg{CellField})
@ Gridap.CellData C:\Users\mm5335.julia\packages\Gridap\971dU\src\CellData\CellFields.jl:475
[34] _operate_cellfields(::Operation{typeof(inner)}, ::Gridap.CellData.GenericCellField{PhysicalDomain}, ::Vararg{Any})
@ Gridap.CellData C:\Users\mm5335.julia\packages\Gridap\971dU\src\CellData\CellFields.jl:542
[35] evaluate!
@ C:\Users\mm5335.julia\packages\Gridap\971dU\src\CellData\CellFields.jl:439 [inlined]
[36] evaluate
@ C:\Users\mm5335.julia\packages\Gridap\971dU\src\Arrays\Maps.jl:87 [inlined]
[37] Map
@ C:\Users\mm5335.julia\packages\Gridap\971dU\src\Arrays\Maps.jl:90 [inlined]
[38] inner
@ C:\Users\mm5335.julia\packages\Gridap\971dU\src\CellData\CellFields.jl:626 [inlined]
[39] A_Disp(u::Gridap.FESpaces.SingleFieldFEBasis{Gridap.FESpaces.TrialBasis, ReferenceDomain}, v::Gridap.FESpaces.SingleFieldFEBasis{Gridap.FESpaces.TestBasis, ReferenceDomain}, pth::Gridap.CellData.OperationCellField{ReferenceDomain})
@ Main .\In[17]:3
[40] (::var"#13#14"{NamedTuple{(:V0_Disp, :Q, :P, :Qf, :Pf, :np, :Ī©, :dĪ©, :dĪ“_Load), Tuple{Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Gridap.FESpaces.NodeToDofGlue{VectorValue{2, Int32}}}, Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Nothing}, Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Nothing}, Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Gridap.FESpaces.NodeToDofGlue{Int32}}, Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Gridap.FESpaces.NodeToDofGlue{Int32}}, Int64, BodyFittedTriangulation{2, 2, UnstructuredDiscreteModel{2, 2, Float64, Oriented}, UnstructuredGrid{2, 2, Float64, Oriented, Nothing}, Gridap.Arrays.IdentityVector{Int64}}, Gridap.CellData.GenericMeasure, Gridap.CellData.GenericMeasure}}, Gridap.CellData.OperationCellField{ReferenceDomain}})(u::Gridap.FESpaces.SingleFieldFEBasis{Gridap.FESpaces.TrialBasis, ReferenceDomain}, v::Gridap.FESpaces.SingleFieldFEBasis{Gridap.FESpaces.TestBasis, ReferenceDomain})
@ Main .\In[17]:6
[41] assemble_matrix(f::var"#13#14"{NamedTuple{(:V0_Disp, :Q, :P, :Qf, :Pf, :np, :Ī©, :dĪ©, :dĪ“_Load), Tuple{Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Gridap.FESpaces.NodeToDofGlue{VectorValue{2, Int32}}}, Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Nothing}, Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Nothing}, Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Gridap.FESpaces.NodeToDofGlue{Int32}}, Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Gridap.FESpaces.NodeToDofGlue{Int32}}, Int64, BodyFittedTriangulation{2, 2, UnstructuredDiscreteModel{2, 2, Float64, Oriented}, UnstructuredGrid{2, 2, Float64, Oriented, Nothing}, Gridap.Arrays.IdentityVector{Int64}}, Gridap.CellData.GenericMeasure, Gridap.CellData.GenericMeasure}}, Gridap.CellData.OperationCellField{ReferenceDomain}}, a::Gridap.FESpaces.GenericSparseMatrixAssembler, U::TrialFESpace{Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Gridap.FESpaces.NodeToDofGlue{VectorValue{2, Int32}}}}, V::Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Gridap.FESpaces.NodeToDofGlue{VectorValue{2, Int32}}})
@ Gridap.FESpaces C:\Users\mm5335.julia\packages\Gridap\971dU\src\FESpaces\Assemblers.jl:285
[42] assemble_matrix(f::Function, U::TrialFESpace{Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Gridap.FESpaces.NodeToDofGlue{VectorValue{2, Int32}}}}, V::Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Gridap.FESpaces.NodeToDofGlue{VectorValue{2, Int32}}})
@ Gridap.FESpaces C:\Users\mm5335.julia\packages\Gridap\971dU\src\FESpaces\Assemblers.jl:342
[43] MatrixA(pth::Gridap.CellData.OperationCellField{ReferenceDomain}; fem_params::NamedTuple{(:V0_Disp, :Q, :P, :Qf, :Pf, :np, :Ī©, :dĪ©, :dĪ“_Load), Tuple{Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Gridap.FESpaces.NodeToDofGlue{VectorValue{2, Int32}}}, Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Nothing}, Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Nothing}, Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Gridap.FESpaces.NodeToDofGlue{Int32}}, Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Gridap.FESpaces.NodeToDofGlue{Int32}}, Int64, BodyFittedTriangulation{2, 2, UnstructuredDiscreteModel{2, 2, Float64, Oriented}, UnstructuredGrid{2, 2, Float64, Oriented, Nothing}, Gridap.Arrays.IdentityVector{Int64}}, Gridap.CellData.GenericMeasure, Gridap.CellData.GenericMeasure}}, vApp::Float64)
@ Main .\In[17]:5
[44] stepDisp(vApp::Float64)
@ Main .\In[19]:9
[45] top-level scope
@ .\In[22]:28

I couldnt solve my problem. is there anyone who can help me?

The clue is in your stack trace:

It looksā€™s like youā€™re getting an error because youā€™re trying to exponentiate a VectorValue in Ļƒfun. i.e. the problem is your (p.^cp) line in Ļƒfun. (I donā€™t think Gridapā€™s VectorValue type supports broadcasted ā€œdotā€ operations like .^ ā€” according to the documentation, Gridap tensors are treated ā€œas if they were scalar values in broadcasted operationsā€, so p.^cp is equivalent to p^cp for a VectorValue.)

Isnā€™t p your density field for topology optimization? That would normally be a scalar \in [0,1], representing some interpolation between two materials. Why is it a VectorValue?

yes it is the density field. as it is specified in whole domain it is a vector not scaling value. but i did your suggestion and it doesnt work again
Entering displacemtent step :0.001
MethodError: convert(::Type{Union{}}, ::VectorValue{2, Float64}) is ambiguous. Candidates:
convert(::Type{<:StaticArraysCore.MVector{D, T}}, arg::VectorValue{D}) where {D, T} in Gridap.TensorValues at C:\Users\mm5335.julia\packages\Gridap\971dU\src\TensorValues\VectorValueTypes.jl:67
convert(::Type{<:VectorValue{D, T}}, arg::VectorValue{D, T}) where {D, T} in Gridap.TensorValues at C:\Users\mm5335.julia\packages\Gridap\971dU\src\TensorValues\VectorValueTypes.jl:72
convert(::Type{<:VectorValue{D, T}}, arg::VectorValue{D}) where {D, T} in Gridap.TensorValues at C:\Users\mm5335.julia\packages\Gridap\971dU\src\TensorValues\VectorValueTypes.jl:71
convert(::Type{<:StaticArraysCore.SVector{D, T}}, arg::VectorValue{D}) where {D, T} in Gridap.TensorValues at C:\Users\mm5335.julia\packages\Gridap\971dU\src\TensorValues\VectorValueTypes.jl:66
convert(::Type{C}, c::Number) where C<:ColorTypes.Colorant in ColorTypes at C:\Users\mm5335.julia\packages\ColorTypes\1dGw6\src\conversions.jl:74
convert(::Type{T}, x::Number) where T<:AbstractChar in Base at char.jl:184
convert(::Type{<:Tuple{Vararg{T, D}}}, arg::VectorValue{D}) where {D, T} in Gridap.TensorValues at C:\Users\mm5335.julia\packages\Gridap\971dU\src\TensorValues\VectorValueTypes.jl:68
convert(::Type{T}, x::Number) where T<:Number in Base at number.jl:7
convert(::Type{Union{}}, x) in Base at essentials.jl:213
convert(::Type{T}, arg) where T<:VecElement in Base at baseext.jl:19
Possible fix, define
convert(::Type{Union{}}, ::VectorValue{D, T}) where {D, T}

Stacktrace:
[1] to_power_type(x::VectorValue{2, Float64})
@ Base .\intfuncs.jl:250
[2] power_by_squaring(x_::VectorValue{2, Float64}, p::Int64)
@ Base .\intfuncs.jl:265
[3] ^(x::VectorValue{2, Float64}, p::Int64)
@ Base .\intfuncs.jl:300
[4] (::var"#E#31")(p::VectorValue{2, Float64})
@ Main .\In[32]:3
[5] (::var"#OC_mat#32"{var"#E#31"})(p::VectorValue{2, Float64})
@ Main .\In[32]:4
[6] Ļƒfun(Īµ::Function, p::VectorValue{2, Float64})
@ Main .\In[32]:5
[7] (::var"#33#34"{Gridap.FESpaces.SingleFieldFEBasis{Gridap.FESpaces.TrialBasis, ReferenceDomain}, Gridap.CellData.OperationCellField{ReferenceDomain}})(p::VectorValue{2, Float64})
@ Main .\In[33]:3
[8] evaluate!(cache::Nothing, f::Function, x::VectorValue{2, Float64})
@ Gridap.Arrays C:\Users\mm5335.julia\packages\Gridap\971dU\src\Arrays\Maps.jl:93
[9] evaluate(f::Function, x::VectorValue{2, Float64})
@ Gridap.Arrays C:\Users\mm5335.julia\packages\Gridap\971dU\src\Arrays\Maps.jl:87
[10] return_value(f::Function, x::VectorValue{2, Float64})
@ Gridap.Arrays C:\Users\mm5335.julia\packages\Gridap\971dU\src\Arrays\Maps.jl:64
[11] return_value(a::GenericField{var"#33#34"{Gridap.FESpaces.SingleFieldFEBasis{Gridap.FESpaces.TrialBasis, ReferenceDomain}, Gridap.CellData.OperationCellField{ReferenceDomain}}}, x::VectorValue{2, Float64})
@ Gridap.Fields C:\Users\mm5335.julia\packages\Gridap\971dU\src\Fields\FieldsInterfaces.jl:173
[12] return_type(f::GenericField{var"#33#34"{Gridap.FESpaces.SingleFieldFEBasis{Gridap.FESpaces.TrialBasis, ReferenceDomain}, Gridap.CellData.OperationCellField{ReferenceDomain}}}, x::VectorValue{2, Float64})
@ Gridap.Arrays C:\Users\mm5335.julia\packages\Gridap\971dU\src\Arrays\Maps.jl:62
[13] return_cache(f::GenericField{var"#33#34"{Gridap.FESpaces.SingleFieldFEBasis{Gridap.FESpaces.TrialBasis, ReferenceDomain}, Gridap.CellData.OperationCellField{ReferenceDomain}}}, x::Vector{VectorValue{2, Float64}})
@ Gridap.Fields C:\Users\mm5335.julia\packages\Gridap\971dU\src\Fields\FieldsInterfaces.jl:141
[14] evaluate(f::GenericField{var"#33#34"{Gridap.FESpaces.SingleFieldFEBasis{Gridap.FESpaces.TrialBasis, ReferenceDomain}, Gridap.CellData.OperationCellField{ReferenceDomain}}}, x::Vector{VectorValue{2, Float64}})
@ Gridap.Arrays C:\Users\mm5335.julia\packages\Gridap\971dU\src\Arrays\Maps.jl:86
[15] evaluate!(::Nothing, ::Function, ::GenericField{var"#33#34"{Gridap.FESpaces.SingleFieldFEBasis{Gridap.FESpaces.TrialBasis, ReferenceDomain}, Gridap.CellData.OperationCellField{ReferenceDomain}}}, ::Vector{VectorValue{2, Float64}})
@ Gridap.Arrays C:\Users\mm5335.julia\packages\Gridap\971dU\src\Arrays\Maps.jl:93
[16] evaluate
@ C:\Users\mm5335.julia\packages\Gridap\971dU\src\Arrays\Maps.jl:87 [inlined]
[17] return_value
@ C:\Users\mm5335.julia\packages\Gridap\971dU\src\Arrays\Maps.jl:64 [inlined]
[18] return_type
@ C:\Users\mm5335.julia\packages\Gridap\971dU\src\Arrays\Maps.jl:62 [inlined]
[19] lazy_map(::Function, ::FillArrays.Fill{GenericField{var"#33#34"{Gridap.FESpaces.SingleFieldFEBasis{Gridap.FESpaces.TrialBasis, ReferenceDomain}, Gridap.CellData.OperationCellField{ReferenceDomain}}}, 1, Tuple{Base.OneTo{Int64}}}, ::Gridap.Arrays.LazyArray{Gridap.Arrays.LazyArray{FillArrays.Fill{typeof(affine_map), 1, Tuple{Base.OneTo{Int64}}}, AffineMap{2, 2, Float64, 4}, 1, Tuple{Gridap.Arrays.LazyArray{FillArrays.Fill{Gridap.Fields.LinearCombinationMap{Colon}, 1, Tuple{Base.OneTo{Int64}}}, TensorValue{2, 2, Float64, 4}, 1, Tuple{Gridap.Arrays.LazyArray{FillArrays.Fill{Broadcasting{Reindex{Vector{VectorValue{2, Float64}}}}, 1, Tuple{Base.OneTo{Int64}}}, Vector{VectorValue{2, Float64}}, 1, Tuple{Gridap.Arrays.Table{Int64, Vector{Int64}, Vector{Int32}}}}, Gridap.Arrays.CompressedArray{Vector{VectorValue{2, Float64}}, 1, Vector{Vector{VectorValue{2, Float64}}}, Vector{Int8}}}}, Gridap.Arrays.LazyArray{FillArrays.Fill{Gridap.Fields.LinearCombinationMap{Colon}, 1, Tuple{Base.OneTo{Int64}}}, VectorValue{2, Float64}, 1, Tuple{Gridap.Arrays.LazyArray{FillArrays.Fill{Broadcasting{Reindex{Vector{VectorValue{2, Float64}}}}, 1, Tuple{Base.OneTo{Int64}}}, Vector{VectorValue{2, Float64}}, 1, Tuple{Gridap.Arrays.Table{Int64, Vector{Int64}, Vector{Int32}}}}, Gridap.Arrays.CompressedArray{Vector{Float64}, 1, Vector{Vector{Float64}}, Vector{Int8}}}}}}, Vector{VectorValue{2, Float64}}, 1, Tuple{Gridap.Arrays.CompressedArray{Vector{VectorValue{2, Float64}}, 1, Vector{Vector{VectorValue{2, Float64}}}, Vector{Int8}}}})
@ Gridap.Arrays C:\Users\mm5335.julia\packages\Gridap\971dU\src\Arrays\LazyArrays.jl:57
[20] lazy_map(#unused#::typeof(evaluate), a::Gridap.Arrays.LazyArray{FillArrays.Fill{Broadcasting{typeof(āˆ˜)}, 1, Tuple{Base.OneTo{Int64}}}, Gridap.Fields.OperationField{GenericField{var"#33#34"{Gridap.FESpaces.SingleFieldFEBasis{Gridap.FESpaces.TrialBasis, ReferenceDomain}, Gridap.CellData.OperationCellField{ReferenceDomain}}}, Tuple{AffineMap{2, 2, Float64, 4}}}, 1, Tuple{FillArrays.Fill{GenericField{var"#33#34"{Gridap.FESpaces.SingleFieldFEBasis{Gridap.FESpaces.TrialBasis, ReferenceDomain}, Gridap.CellData.OperationCellField{ReferenceDomain}}}, 1, Tuple{Base.OneTo{Int64}}}, Gridap.Arrays.LazyArray{FillArrays.Fill{typeof(affine_map), 1, Tuple{Base.OneTo{Int64}}}, AffineMap{2, 2, Float64, 4}, 1, Tuple{Gridap.Arrays.LazyArray{FillArrays.Fill{Gridap.Fields.LinearCombinationMap{Colon}, 1, Tuple{Base.OneTo{Int64}}}, TensorValue{2, 2, Float64, 4}, 1, Tuple{Gridap.Arrays.LazyArray{FillArrays.Fill{Broadcasting{Reindex{Vector{VectorValue{2, Float64}}}}, 1, Tuple{Base.OneTo{Int64}}}, Vector{VectorValue{2, Float64}}, 1, Tuple{Gridap.Arrays.Table{Int64, Vector{Int64}, Vector{Int32}}}}, Gridap.Arrays.CompressedArray{Vector{VectorValue{2, Float64}}, 1, Vector{Vector{VectorValue{2, Float64}}}, Vector{Int8}}}}, Gridap.Arrays.LazyArray{FillArrays.Fill{Gridap.Fields.LinearCombinationMap{Colon}, 1, Tuple{Base.OneTo{Int64}}}, VectorValue{2, Float64}, 1, Tuple{Gridap.Arrays.LazyArray{FillArrays.Fill{Broadcasting{Reindex{Vector{VectorValue{2, Float64}}}}, 1, Tuple{Base.OneTo{Int64}}}, Vector{VectorValue{2, Float64}}, 1, Tuple{Gridap.Arrays.Table{Int64, Vector{Int64}, Vector{Int32}}}}, Gridap.Arrays.CompressedArray{Vector{Float64}, 1, Vector{Vector{Float64}}, Vector{Int8}}}}}}}}, x::Gridap.Arrays.CompressedArray{Vector{VectorValue{2, Float64}}, 1, Vector{Vector{VectorValue{2, Float64}}}, Vector{Int8}})
@ Gridap.Fields C:\Users\mm5335.julia\packages\Gridap\971dU\src\Fields\ApplyOptimizations.jl:63
[21] evaluate!(cache::Nothing, f::Gridap.CellData.GenericCellField{ReferenceDomain}, x::Gridap.CellData.CellPoint{ReferenceDomain, Gridap.Arrays.CompressedArray{Vector{VectorValue{2, Float64}}, 1, Vector{Vector{VectorValue{2, Float64}}}, Vector{Int8}}, Gridap.Arrays.LazyArray{FillArrays.Fill{Broadcasting{Reindex{Vector{VectorValue{2, Float64}}}}, 1, Tuple{Base.OneTo{Int64}}}, Vector{VectorValue{2, Float64}}, 1, Tuple{Gridap.Arrays.Table{Int32, Vector{Int32}, Vector{Int32}}}}, BodyFittedTriangulation{2, 2, UnstructuredDiscreteModel{2, 2, Float64, Oriented}, UnstructuredGrid{2, 2, Float64, Oriented, Nothing}, Gridap.Arrays.IdentityVector{Int64}}})
@ Gridap.CellData C:\Users\mm5335.julia\packages\Gridap\971dU\src\CellData\CellFields.jl:387
[22] evaluate
@ C:\Users\mm5335.julia\packages\Gridap\971dU\src\Arrays\Maps.jl:87 [inlined]
[23] CellField
@ C:\Users\mm5335.julia\packages\Gridap\971dU\src\CellData\CellFields.jl:381 [inlined]
[24] #11
@ C:\Users\mm5335.julia\packages\Gridap\971dU\src\CellData\CellFields.jl:475 [inlined]
[25] map(f::Gridap.CellData.var"#11#13"{Gridap.CellData.CellPoint{ReferenceDomain, Gridap.Arrays.CompressedArray{Vector{VectorValue{2, Float64}}, 1, Vector{Vector{VectorValue{2, Float64}}}, Vector{Int8}}, Gridap.Arrays.LazyArray{FillArrays.Fill{Broadcasting{Reindex{Vector{VectorValue{2, Float64}}}}, 1, Tuple{Base.OneTo{Int64}}}, Vector{VectorValue{2, Float64}}, 1, Tuple{Gridap.Arrays.Table{Int32, Vector{Int32}, Vector{Int32}}}}, BodyFittedTriangulation{2, 2, UnstructuredDiscreteModel{2, 2, Float64, Oriented}, UnstructuredGrid{2, 2, Float64, Oriented, Nothing}, Gridap.Arrays.IdentityVector{Int64}}}}, t::Tuple{Gridap.CellData.OperationCellField{ReferenceDomain}, Gridap.CellData.GenericCellField{ReferenceDomain}})
@ Base .\tuple.jl:222
[26] Gridap.CellData.OperationCellField(::Operation{typeof(inner)}, ::Gridap.CellData.OperationCellField{ReferenceDomain}, ::Vararg{CellField})
@ Gridap.CellData C:\Users\mm5335.julia\packages\Gridap\971dU\src\CellData\CellFields.jl:475
[27] _operate_cellfields(::Operation{typeof(inner)}, ::Gridap.CellData.OperationCellField{ReferenceDomain}, ::Vararg{Any})
@ Gridap.CellData C:\Users\mm5335.julia\packages\Gridap\971dU\src\CellData\CellFields.jl:542
[28] evaluate!(::Nothing, ::Operation{typeof(inner)}, ::Gridap.CellData.OperationCellField{ReferenceDomain}, ::var"#33#34"{Gridap.FESpaces.SingleFieldFEBasis{Gridap.FESpaces.TrialBasis, ReferenceDomain}, Gridap.CellData.OperationCellField{ReferenceDomain}})
@ Gridap.CellData C:\Users\mm5335.julia\packages\Gridap\971dU\src\CellData\CellFields.jl:439
[29] evaluate(::Operation{typeof(inner)}, ::Gridap.CellData.OperationCellField{ReferenceDomain}, ::Function)
@ Gridap.Arrays C:\Users\mm5335.julia\packages\Gridap\971dU\src\Arrays\Maps.jl:87
[30] Map
@ C:\Users\mm5335.julia\packages\Gridap\971dU\src\Arrays\Maps.jl:90 [inlined]
[31] inner(a::Gridap.CellData.OperationCellField{ReferenceDomain}, b::Function)
@ Gridap.CellData C:\Users\mm5335.julia\packages\Gridap\971dU\src\CellData\CellFields.jl:625
[32] A_Disp(u::Gridap.FESpaces.SingleFieldFEBasis{Gridap.FESpaces.TrialBasis, ReferenceDomain}, v::Gridap.FESpaces.SingleFieldFEBasis{Gridap.FESpaces.TestBasis, ReferenceDomain}, pth::Gridap.CellData.OperationCellField{ReferenceDomain})
@ Main .\In[33]:3
[33] (::var"#36#37"{NamedTuple{(:V0_Disp, :Q, :P, :Qf, :Pf, :np, :Ī©, :dĪ©, :dĪ“_Load), Tuple{Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Gridap.FESpaces.NodeToDofGlue{VectorValue{2, Int32}}}, Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Nothing}, Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Nothing}, Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Gridap.FESpaces.NodeToDofGlue{Int32}}, Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Gridap.FESpaces.NodeToDofGlue{Int32}}, Int64, BodyFittedTriangulation{2, 2, UnstructuredDiscreteModel{2, 2, Float64, Oriented}, UnstructuredGrid{2, 2, Float64, Oriented, Nothing}, Gridap.Arrays.IdentityVector{Int64}}, Gridap.CellData.GenericMeasure, Gridap.CellData.GenericMeasure}}, Gridap.CellData.OperationCellField{ReferenceDomain}})(u::Gridap.FESpaces.SingleFieldFEBasis{Gridap.FESpaces.TrialBasis, ReferenceDomain}, v::Gridap.FESpaces.SingleFieldFEBasis{Gridap.FESpaces.TestBasis, ReferenceDomain})
@ Main .\In[33]:6
[34] assemble_matrix(f::var"#36#37"{NamedTuple{(:V0_Disp, :Q, :P, :Qf, :Pf, :np, :Ī©, :dĪ©, :dĪ“_Load), Tuple{Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Gridap.FESpaces.NodeToDofGlue{VectorValue{2, Int32}}}, Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Nothing}, Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Nothing}, Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Gridap.FESpaces.NodeToDofGlue{Int32}}, Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Gridap.FESpaces.NodeToDofGlue{Int32}}, Int64, BodyFittedTriangulation{2, 2, UnstructuredDiscreteModel{2, 2, Float64, Oriented}, UnstructuredGrid{2, 2, Float64, Oriented, Nothing}, Gridap.Arrays.IdentityVector{Int64}}, Gridap.CellData.GenericMeasure, Gridap.CellData.GenericMeasure}}, Gridap.CellData.OperationCellField{ReferenceDomain}}, a::Gridap.FESpaces.GenericSparseMatrixAssembler, U::TrialFESpace{Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Gridap.FESpaces.NodeToDofGlue{VectorValue{2, Int32}}}}, V::Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Gridap.FESpaces.NodeToDofGlue{VectorValue{2, Int32}}})
@ Gridap.FESpaces C:\Users\mm5335.julia\packages\Gridap\971dU\src\FESpaces\Assemblers.jl:285
[35] assemble_matrix(f::Function, U::TrialFESpace{Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Gridap.FESpaces.NodeToDofGlue{VectorValue{2, Int32}}}}, V::Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Gridap.FESpaces.NodeToDofGlue{VectorValue{2, Int32}}})
@ Gridap.FESpaces C:\Users\mm5335.julia\packages\Gridap\971dU\src\FESpaces\Assemblers.jl:342
[36] MatrixA(pth::Gridap.CellData.OperationCellField{ReferenceDomain}; fem_params::NamedTuple{(:V0_Disp, :Q, :P, :Qf, :Pf, :np, :Ī©, :dĪ©, :dĪ“_Load), Tuple{Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Gridap.FESpaces.NodeToDofGlue{VectorValue{2, Int32}}}, Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Nothing}, Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Nothing}, Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Gridap.FESpaces.NodeToDofGlue{Int32}}, Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Gridap.FESpaces.NodeToDofGlue{Int32}}, Int64, BodyFittedTriangulation{2, 2, UnstructuredDiscreteModel{2, 2, Float64, Oriented}, UnstructuredGrid{2, 2, Float64, Oriented, Nothing}, Gridap.Arrays.IdentityVector{Int64}}, Gridap.CellData.GenericMeasure, Gridap.CellData.GenericMeasure}}, vApp::Float64)
@ Main .\In[33]:5
[37] stepDisp(vApp::Float64)
@ Main .\In[35]:9
[38] top-level scope
@ .\In[36]:28

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 ```

yes you are right density is scalar in each point but in domain with all nodes is like a vector. i did this:

function  ElasFourthOrderConstTensor(E,Ī½,PlanarState)
    # 1 for  Plane  Stress  and 2 Plane  Strain  Condition
    if  PlanarState  == 1
        C1111 =E/(1-Ī½*Ī½)
        C1122 = (Ī½*E)/(1-Ī½*Ī½)
        C1112 = 0.0
        C2222 =E/(1-Ī½*Ī½)
        C2212 = 0.0
        C1212 =E/(2*(1+Ī½))
    elseif  PlanarState  == 2
        C1111 = (E.*(1-Ī½*Ī½))/((1+Ī½)*(1-Ī½-2*Ī½*Ī½))
        C1122 = (Ī½*E)/(1-Ī½-2*Ī½*Ī½)
        C1112 = 0.0
        C2222 = (E*(1-Ī½))/(1-Ī½-2*Ī½*Ī½)
        C2212 = 0.0
        C1212 =E/(2*(1+Ī½))
    end
    C_ten = SymFourthOrderTensorValue(C1111 ,C1112 ,C1122 ,C1112 ,C1212 ,C2212 ,C1122 ,C2212 ,C2222)
    return   C_ten
end
function Ļƒfun(Īµ,p)
    E(p)= (p^cp) * E_mat
    OC_mat(p)= ElasFourthOrderConstTensor(E(p),Ī½_mat,2)
    Ļƒ = OC_mat(p)āŠ™Īµ
    return  Ļƒ
end
using LinearAlgebra
A_Disp(u,v,pth) =  Īµ(v) āŠ™ (p-> Ļƒfun(Īµ,p)āˆ˜(Īµ(u),pth))
function MatrixA(pth; fem_params,vApp)
    A_mat = assemble_matrix(trial(vApp), fem_params.V0_Disp) do u, v
        āˆ«(A_Disp(u,v,pth))fem_params.dā„¦
    end
    return lu(A_mat)
end
function  stepDisp(vApp)
    uApp1(x) = VectorValue(0.0,0.0)
    uApp2(x) = VectorValue(0.0,0.0)
    uApp3(x) = VectorValue(0.0,-vApp)
    U_Disp = TrialFESpace(V0_Disp ,[uApp1 ,uApp2 ,uApp3])
    A_Disp(u,v,pth) =  Īµ(v) āŠ™ (p->Ļƒfunāˆ˜(Īµ(u),pth))
    a_Disp(u,v,pth) =āˆ«(A_Disp(u,v,pth))fem_params.dā„¦
    b_vec = assemble_vector(0.0, fem_params.V0_Disp)
    A_mat = MatrixA(pth; fem_params, vApp)
    op_Disp = A_mat \ b_vec
    uh_out = FEFunction(U_Disp, op_Disp)
    return  uh_out
end
p = zeros(fem_params.np)
pf_vec = Filter(p;r, fem_params)
pfh = FEFunction(fem_params.Pf, pf_vec)
pth = (pf -> Threshold(pf; Ī², Ī·)) āˆ˜ pfh
vApp = 0
delv = 1e-3
const  vAppMax = 0.1
innerMax = 10
count = 0
Load = Float64[]
Displacement = Float64[]
push!(Load, 0.0)
push!(Displacement, 0.0)
while  vApp .< vAppMax
    count = count  .+ 1
    if vApp  >= 3e-2
        delv = 1e-4
    end
    vApp = vApp .+ delv
    print("\n Entering  displacemtent  step :", float(vApp))
          uh = stepDisp(vApp)
    Node_Force = sum(āˆ«(n_Ī“_Loadā‹…(Ļƒfunāˆ˜(Īµ(uh),pth)))fem_params.dĪ“_Load)
    push!(Load , -Node_Force[2])
    push!( Displacement , vApp)
    writevtk(ā„¦,"results_SymThreePtBendingTest$count",cellfields= ["uh"=>uh])
 end
end

do you know how can i solve this error ?
MethodError: no method matching *(::SymFourthOrderTensorValue{2, Float64, 9}, ::typeof(symmetric_gradient))
Closest candidates are:
*(::Any, ::Any, ::Any, ::Anyā€¦) at operators.jl:591
*(::AbstractThunk, ::Any) at C:\Users\mm5335.julia\packages\ChainRulesCore\a4mIA\src\tangent_arithmetic.jl:125
*(::CellField, ::Function) at C:\Users\mm5335.julia\packages\Gridap\971dU\src\CellData\CellFields.jl:625
ā€¦

Stacktrace:
[1] top-level scope
@ In[137]:8

is there any one to help me in this issue?
i really need your help

Not related to your question but you may want to take a look at GitHub - JuliaTopOpt/TopOpt.jl: A beautifully Julian topology optimization package..

Try

A_Disp(u,v,pth) = Īµ(v) āŠ™ (Ļƒfunāˆ˜(Īµ(u),pth))

1 Like

thank you for your reply but it isnt the solution i get this error again
MethodError: no method matching *(::var"#30#31"{Gridap.CellData.OperationCellField{ReferenceDomain}}, ::typeof(Ļƒfun))
Closest candidates are:
*(::Any, ::Any, ::Any, ::Anyā€¦) at operators.jl:591
*(::ChainRulesCore.AbstractThunk, ::Any) at C:\Users\mm5335.julia\packages\ChainRulesCore\a4mIA\src\tangent_arithmetic.jl:125
*(::CellField, ::Function) at C:\Users\mm5335.julia\packages\Gridap\971dU\src\CellData\CellFields.jl:625
ā€¦

Stacktrace:
[1] A_Disp(u::Gridap.FESpaces.SingleFieldFEBasis{Gridap.FESpaces.TrialBasis, ReferenceDomain}, v::Gridap.FESpaces.SingleFieldFEBasis{Gridap.FESpaces.TestBasis, ReferenceDomain}, pth::Gridap.CellData.OperationCellField{ReferenceDomain})
@ Main .\In[25]:2
[2] (::var"#33#34"{NamedTuple{(:V0_Disp, :V0_PF, :U_PF, :Q, :P, :Qf, :Pf, :np, :Ī©, :dĪ©, :dĪ“_Load), Tuple{Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Gridap.FESpaces.NodeToDofGlue{VectorValue{2, Int32}}}, Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Gridap.FESpaces.NodeToDofGlue{Int32}}, Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Gridap.FESpaces.NodeToDofGlue{Int32}}, Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Nothing}, Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Nothing}, Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Gridap.FESpaces.NodeToDofGlue{Int32}}, Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Gridap.FESpaces.NodeToDofGlue{Int32}}, Int64, BodyFittedTriangulation{2, 2, UnstructuredDiscreteModel{2, 2, Float64, Oriented}, UnstructuredGrid{2, 2, Float64, Oriented, Nothing}, Gridap.Arrays.IdentityVector{Int64}}, Gridap.CellData.GenericMeasure, Gridap.CellData.GenericMeasure}}, Gridap.CellData.OperationCellField{ReferenceDomain}})(u::Gridap.FESpaces.SingleFieldFEBasis{Gridap.FESpaces.TrialBasis, ReferenceDomain}, v::Gridap.FESpaces.SingleFieldFEBasis{Gridap.FESpaces.TestBasis, ReferenceDomain})
@ Main .\In[25]:5
[3] assemble_matrix(f::var"#33#34"{NamedTuple{(:V0_Disp, :V0_PF, :U_PF, :Q, :P, :Qf, :Pf, :np, :Ī©, :dĪ©, :dĪ“_Load), Tuple{Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Gridap.FESpaces.NodeToDofGlue{VectorValue{2, Int32}}}, Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Gridap.FESpaces.NodeToDofGlue{Int32}}, Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Gridap.FESpaces.NodeToDofGlue{Int32}}, Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Nothing}, Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Nothing}, Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Gridap.FESpaces.NodeToDofGlue{Int32}}, Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Gridap.FESpaces.NodeToDofGlue{Int32}}, Int64, BodyFittedTriangulation{2, 2, UnstructuredDiscreteModel{2, 2, Float64, Oriented}, UnstructuredGrid{2, 2, Float64, Oriented, Nothing}, Gridap.Arrays.IdentityVector{Int64}}, Gridap.CellData.GenericMeasure, Gridap.CellData.GenericMeasure}}, Gridap.CellData.OperationCellField{ReferenceDomain}}, a::Gridap.FESpaces.GenericSparseMatrixAssembler, U::TrialFESpace{Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Gridap.FESpaces.NodeToDofGlue{VectorValue{2, Int32}}}}, V::Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Gridap.FESpaces.NodeToDofGlue{VectorValue{2, Int32}}})
@ Gridap.FESpaces C:\Users\mm5335.julia\packages\Gridap\971dU\src\FESpaces\Assemblers.jl:285
[4] assemble_matrix(f::Function, U::TrialFESpace{Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Gridap.FESpaces.NodeToDofGlue{VectorValue{2, Int32}}}}, V::Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Gridap.FESpaces.NodeToDofGlue{VectorValue{2, Int32}}})
@ Gridap.FESpaces C:\Users\mm5335.julia\packages\Gridap\971dU\src\FESpaces\Assemblers.jl:342
[5] MatrixA(pth::Gridap.CellData.OperationCellField{ReferenceDomain}; fem_params::NamedTuple{(:V0_Disp, :V0_PF, :U_PF, :Q, :P, :Qf, :Pf, :np, :Ī©, :dĪ©, :dĪ“_Load), Tuple{Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Gridap.FESpaces.NodeToDofGlue{VectorValue{2, Int32}}}, Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Gridap.FESpaces.NodeToDofGlue{Int32}}, Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Gridap.FESpaces.NodeToDofGlue{Int32}}, Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Nothing}, Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Nothing}, Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Gridap.FESpaces.NodeToDofGlue{Int32}}, Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Gridap.FESpaces.NodeToDofGlue{Int32}}, Int64, BodyFittedTriangulation{2, 2, UnstructuredDiscreteModel{2, 2, Float64, Oriented}, UnstructuredGrid{2, 2, Float64, Oriented, Nothing}, Gridap.Arrays.IdentityVector{Int64}}, Gridap.CellData.GenericMeasure, Gridap.CellData.GenericMeasure}}, vApp::Float64)
@ Main .\In[25]:4
[6] stepDisp(uh_in::Gridap.FESpaces.SingleFieldFEFunction{Gridap.CellData.GenericCellField{ReferenceDomain}}, sh_in::Gridap.FESpaces.SingleFieldFEFunction{Gridap.CellData.GenericCellField{ReferenceDomain}}, vApp::Float64)
@ Main .\In[26]:9
[7] top-level scope
@ In[27]:2