Function and no method matching

Hi, I am writing this function in gridap and I got the error. Is there any suggestions how to solve this?

function dψP(uh,ψPlusnext_in,hh_in)
    h_in = hh_in
    if h_in  > ψPlusnext_in
        dp_out = project(CellState(0.0,dΩ), model ,dΩ,order)

    else
        dp_out = dψPos∘(ε(uh))
    end
    return dp_out
end

error

MethodError: no method matching zero(::Type{Gridap.FESpaces.SingleFieldFEFunction{GenericCellField{ReferenceDomain}}})
Closest candidates are:
  zero(::Union{Type{P}, P}) where P<:Dates.Period at E:\installed softwares\Julia-1.8.5\share\julia\stdlib\v1.8\Dates\src\periods.jl:53
  zero(::Field) at C:\Users\marya\.julia\packages\Gridap\971dU\src\Fields\FieldsInterfaces.jl:199
  zero(::Diagonal{T, StaticArraysCore.SVector{N, T}}) where {N, T} at C:\Users\marya\.julia\packages\StaticArrays\J9itA\src\SDiagonal.jl:41
Stacktrace:
  [1] testvalue(#unused#::Type{Gridap.FESpaces.SingleFieldFEFunction{GenericCellField{ReferenceDomain}}})
    @ Gridap.Arrays C:\Users\marya\.julia\packages\Gridap\971dU\src\Arrays\Interface.jl:164
  [2] return_cache(::Broadcasting{typeof(dψP)}, ::Vector{VectorValue{2, Float64}}, ::Vector{Float64}, ::Vector{Float64})
    @ Gridap.Arrays C:\Users\marya\.julia\packages\Gridap\971dU\src\Arrays\Maps.jl:210
  [3] return_cache(::Gridap.Fields.BroadcastingFieldOpMap{typeof(dψP)}, ::Vector{VectorValue{2, Float64}}, ::Vector{Float64}, ::Vector{Float64})
    @ Gridap.Fields C:\Users\marya\.julia\packages\Gridap\971dU\src\Fields\FieldArrays.jl:513
  [4] evaluate(::Gridap.Fields.BroadcastingFieldOpMap{typeof(dψP)}, ::Vector{VectorValue{2, Float64}}, ::Vector{Float64}, ::Vararg{Vector{Float64}})
    @ Gridap.Arrays C:\Users\marya\.julia\packages\Gridap\971dU\src\Arrays\Maps.jl:86
  [5] (::Gridap.Fields.BroadcastingFieldOpMap{typeof(dψP)})(::Vector{VectorValue{2, Float64}}, ::Vararg{Any})
    @ Gridap.Arrays C:\Users\marya\.julia\packages\Gridap\971dU\src\Arrays\Maps.jl:90
  [6] Gridap.CellData.OperationCellField(::Operation{typeof(dψP)}, ::Gridap.FESpaces.SingleFieldFEFunction{GenericCellField{ReferenceDomain}}, ::Vararg{CellField})
    @ Gridap.CellData C:\Users\marya\.julia\packages\Gridap\971dU\src\CellData\CellFields.jl:477
  [7] _operate_cellfields(::Operation{typeof(dψP)}, ::Gridap.FESpaces.SingleFieldFEFunction{GenericCellField{ReferenceDomain}}, ::Vararg{Any})
    @ Gridap.CellData C:\Users\marya\.julia\packages\Gridap\971dU\src\CellData\CellFields.jl:542
  [8] evaluate!(::Nothing, ::Operation{typeof(dψP)}, ::Gridap.FESpaces.SingleFieldFEFunction{GenericCellField{ReferenceDomain}}, ::Gridap.CellData.OperationCellField{ReferenceDomain}, ::CellState{Float64, CellPoint{ReferenceDomain, Gridap.Arrays.CompressedArray{Vector{VectorValue{2, Float64}}, 1, Vector{Vector{VectorValue{2, Float64}}}, Vector{Int8}}, 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}}}}, BodyFittedTriangulation{2, 2, UnstructuredDiscreteModel{2, 2, Float64, Oriented}, UnstructuredGrid{2, 2, Float64, Oriented, Nothing}, Gridap.Arrays.IdentityVector{Int64}}}})
    @ Gridap.CellData C:\Users\marya\.julia\packages\Gridap\971dU\src\CellData\CellFields.jl:435
  [9] evaluate(::Operation{typeof(dψP)}, ::Gridap.FESpaces.SingleFieldFEFunction{GenericCellField{ReferenceDomain}}, ::Gridap.CellData.OperationCellField{ReferenceDomain}, ::Vararg{Any})
    @ Gridap.Arrays C:\Users\marya\.julia\packages\Gridap\971dU\src\Arrays\Maps.jl:87
 [10] (::Operation{typeof(dψP)})(::Gridap.FESpaces.SingleFieldFEFunction{GenericCellField{ReferenceDomain}}, ::Vararg{Any})
    @ Gridap.Arrays C:\Users\marya\.julia\packages\Gridap\971dU\src\Arrays\Maps.jl:90
 [11] ∘(f::Function, g::Tuple{Gridap.FESpaces.SingleFieldFEFunction{GenericCellField{ReferenceDomain}}, Gridap.CellData.OperationCellField{ReferenceDomain}, CellState{Float64, CellPoint{ReferenceDomain, Gridap.Arrays.CompressedArray{Vector{VectorValue{2, Float64}}, 1, Vector{Vector{VectorValue{2, Float64}}}, Vector{Int8}}, 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}}}}, BodyFittedTriangulation{2, 2, UnstructuredDiscreteModel{2, 2, Float64, Oriented}, UnstructuredGrid{2, 2, Float64, Oriented, Nothing}, Gridap.Arrays.IdentityVector{Int64}}}}})
    @ Gridap.CellData C:\Users\marya\.julia\packages\Gridap\971dU\src\CellData\CellFields.jl:604
 [12] top-level scope
    @ In[245]:2

See Please read: make it easier to help you

In particular, give the entire stacktrace (it should be after the MethodError).

thank you. done

1 Like