# Collect\_cell\_matrix error

**URL:** https://discourse.julialang.org/t/collect-cell-matrix-error/99416
**Category:** New to Julia
**Tags:** question, package
**Created:** [May 25, 2023, 11:28pm UTC](https://discourse.julialang.org/t/collect-cell-matrix-error/99416 "2023-05-25T23:28:52Z")
**Posts on this page:** 5
**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: [May 25, 2023, 11:28pm UTC](https://discourse.julialang.org/t/collect-cell-matrix-error/99416/1 "2023-05-25T23:28:52Z")

</div>

can anyone help me in solving the error in collect\_cell\_matrix in gridap. i have searched about it and it seems that it is about gridap codes itself.

---

<div class="post-metadata">

### Author: ![hendri54](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/hendri54/32/9621_2.png) [@hendri54](https://discourse.julialang.org/u/hendri54)
#### Post date: [May 26, 2023, 12:20am UTC](https://discourse.julialang.org/t/collect-cell-matrix-error/99416/2 "2023-05-26T00:20:09Z")

</div>

More information is needed to effectively suggest solutions. Please see

> [@Please read: make it easier to help you](https://discourse.julialang.org/t/please-read-make-it-easier-to-help-you/14757):
>
> Welcome to the Julia Discourse! We are enthusiastic about helping Julia programmers, both beginner and experienced. This public service announcement (PSA) outlines best practices when asking for help. Following these points makes it easier for us to help you and more likely you’ll get a prompt, useful answer. Keywords are highlighted to make it easier to refer to specific points. Choose a descriptive title that captures the key part of your question, eg “plots with multiple axes” instead of …

---

<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: [May 26, 2023, 7:00pm UTC](https://discourse.julialang.org/t/collect-cell-matrix-error/99416/3 "2023-05-26T19:00:54Z")

</div>

i get this error  
AssertionError: ndims(eltype(cell\_mat)) == 2

Stacktrace:  
[1] collect\_cell\_matrix(trial::TrialFESpace{Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Gridap.FESpaces.NodeToDofGlue{VectorValue{2, Int32}}}}, test::Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Gridap.FESpaces.NodeToDofGlue{VectorValue{2, Int32}}}, a::Gridap.CellData.DomainContribution)  
@ Gridap.FESpaces C:\Users\marya.julia\packages\Gridap\971dU\src\FESpaces\Assemblers.jl:399  
[2] assemble\_matrix(f::var"#41#43", 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\marya.julia\packages\Gridap\971dU\src\FESpaces\Assemblers.jl:285  
[3] 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\marya.julia\packages\Gridap\971dU\src\FESpaces\Assemblers.jl:342  
[4] top-level scope  
@ In[35]: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: [May 26, 2023, 7:11pm UTC](https://discourse.julialang.org/t/collect-cell-matrix-error/99416/4 "2023-05-26T19:11:47Z")

</div>

i think the error comes from this function

```julia
function MatrixOf(fem_params)
    return assemble_matrix(fem_params.U_Disp, fem_params.V0_Disp) do u, v
        0.5 * ∫(((p->Em(p))∘pth) * C_mat)fem_params.dΩ
    end
end

```

---

<div class="post-metadata">

### Author: ![hendri54](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/hendri54/32/9621_2.png) [@hendri54](https://discourse.julialang.org/u/hendri54)
#### Post date: [May 26, 2023, 10:03pm UTC](https://discourse.julialang.org/t/collect-cell-matrix-error/99416/5 "2023-05-26T22:03:23Z")

</div>

It would help to provide a MWE (see again the above mentioned link on helping others help you).
