# Project CellStates in Gridap

**URL:** <https://discourse.julialang.org/t/project-cellstates-in-gridap/99387>\
**Category:** General Usage\
**Tags:** question\
**Created:** [May 25, 2023, 3:07pm UTC](https://discourse.julialang.org/t/project-cellstates-in-gridap/99387 "2023-05-25T15:07:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![christopherfear](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/christopherfear/32/50235_2.png) [@christopherfear](https://discourse.julialang.org/u/christopherfear)\
**Post date:** [May 25, 2023, 3:07pm UTC](https://discourse.julialang.org/t/project-cellstates-in-gridap/99387/1 "2023-05-25T15:07:00Z")

</div>

I am looking to project a CellState from the triangulation of a quad mesh created in gmsh.

Triangles created in gmsh/ a domain of quads made in Gridap (with the domain and partition functions) work with no issues.

The MWE of the code is as follows:

`using Gridap  
using LinearAlgebra  
using GridapGmsh

model = GmshDiscreteModel(“C:/Users/ttcf5/gui.msh”)

order = 1  
reffe = ReferenceFE(lagrangian,Float64,order)  
V = TestFESpace(model,reffe)  
U = TrialFESpace(V)

degree = 2\*order  
Ω = Triangulation(model)  
dΩ = Measure(Ω,degree)

f = CellState(1.0, dΩ)

function project(q,model,dΩ,order)  
reffe = ReferenceFE(lagrangian,Float64,order)  
V = FESpace(model,reffe,conformity=:L2)  
a(u,v) = ∫( u\*v )_dΩ  
l(v) = ∫( v_q )\*dΩ  
op = AffineFEOperator(a,l,V,V)  
qh = solve(op)  
qh  
end

fh = project(f, model, dΩ, order)`

The error is:

> ERROR:  
> It is not possible to evaluate the given CellState on the given CellPoint.  
> a CellState can only be evaluated at the CellPoint it was created from.  
> If you want to evaluate at another location, you would need first to project the CellState  
> to a FESpace (e.g. via a L2 projection).

Am I misunderstanding something?  
Could anyone help me to solve this problem?

---

<div class="post-metadata">

**Author:** ![christopherfear](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/christopherfear/32/50235_2.png) [@christopherfear](https://discourse.julialang.org/u/christopherfear)\
**Post date:** [May 31, 2023, 12:59pm UTC](https://discourse.julialang.org/t/project-cellstates-in-gridap/99387/2 "2023-05-31T12:59:41Z")

</div>

Just in case anyone runs into the same issue. This was a bug that has been solved and is undergoing testing before being added to the master.

> <https://github.com/gridap/Gridap.jl/issues/905>
>
> I am looking to project a CellState from the triangulation of a quad mesh create…d in gmsh.
> 
> Triangles created in gmsh/ a domain of quads made in Gridap (with the domain and partition functions) work with no issues.
> 
> The MWE of the code is as follows:
> 
> \`using Gridap
> using LinearAlgebra
> using GridapGmsh
> 
> model = GmshDiscreteModel("C:/Users/ttcf5/gui.msh")
> 
> order = 1
> reffe = ReferenceFE(lagrangian,Float64,order)
> V = TestFESpace(model,reffe)
> U = TrialFESpace(V)
> 
> degree = 2\*order
> Ω = Triangulation(model)
> dΩ = Measure(Ω,degree)
> 
> f = CellState(1.0, dΩ)
> 
> function project(q,model,dΩ,order)
> reffe = ReferenceFE(lagrangian,Float64,order)
> V = FESpace(model,reffe,conformity=:L2)
> a(u,v) = ∫( u\*v )\*dΩ
> l(v) = ∫( v\*q )\*dΩ
> op = AffineFEOperator(a,l,V,V)
> qh = solve(op)
> qh
> end
> 
> fh = project(f, model, dΩ, order)\`
> 
> The error is:
> 
> \> ERROR: 
> It is not possible to evaluate the given CellState on the given CellPoint.
> a CellState can only be evaluated at the CellPoint it was created from.
> If you want to evaluate at another location, you would need first to project the CellState
> to a FESpace (e.g. via a L2 projection).
> 
> Am I misunderstanding something?
> Could anyone help me to solve this problem?
