# Function and no method matching

**URL:** <https://discourse.julialang.org/t/function-and-no-method-matching/109760>\
**Category:** New to Julia\
**Tags:** gridap\
**Created:** [February 5, 2024, 8:58pm UTC](https://discourse.julialang.org/t/function-and-no-method-matching/109760 "2024-02-05T20:58:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mary](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mary/32/53139_2.png) [@mary](https://discourse.julialang.org/u/mary)\
**Post date:** [February 5, 2024, 8:58pm UTC](https://discourse.julialang.org/t/function-and-no-method-matching/109760/1 "2024-02-05T20:58:44Z")

</div>

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

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

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

```

---

<div class="post-metadata">

**Author:** ![nsajko](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nsajko/32/221187_2.png) [@nsajko](https://discourse.julialang.org/u/nsajko)\
**Post date:** [February 5, 2024, 9:18pm UTC](https://discourse.julialang.org/t/function-and-no-method-matching/109760/2 "2024-02-05T21:18:27Z")

</div>

See [Please read: make it easier to help you](https://discourse.julialang.org/t/please-read-make-it-easier-to-help-you/14757)

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

---

<div class="post-metadata">

**Author:** ![mary](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mary/32/53139_2.png) [@mary](https://discourse.julialang.org/u/mary)\
**Post date:** [February 5, 2024, 9:30pm UTC](https://discourse.julialang.org/t/function-and-no-method-matching/109760/3 "2024-02-05T21:30:46Z")

</div>

thank you. done
