# 1D heat transfer code issues

**URL:** <https://discourse.julialang.org/t/1d-heat-transfer-code-issues/113520>\
**Category:** New to Julia\
**Tags:** gridap\
**Created:** [April 26, 2024, 4:39am UTC](https://discourse.julialang.org/t/1d-heat-transfer-code-issues/113520 "2024-04-26T04:39:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mishal](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mishal/32/214462_2.png) [@Mishal](https://discourse.julialang.org/u/Mishal)\
**Post date:** [April 26, 2024, 4:39am UTC](https://discourse.julialang.org/t/1d-heat-transfer-code-issues/113520/1 "2024-04-26T04:39:42Z")

</div>

Hi Guys

Please refer to my code below.  
When trying to solve I get an error on the last line of the code.

ERROR: MethodError: no method matching a(::Gridap.FESpaces.SingleFieldFEBasis{Gridap.FESpaces.TestBasis, ReferenceDomain})

I am struggling to understand the error and how to fix it, can someone please assist?

```julia
using Gridap

k = 0.45
  
# Define the domain
𝒯 = CartesianDiscreteModel((0,1),(20)) # 1x1 surface which is meshed by 20 along each axis
Ω = Triangulation(𝒯)
dΩ = Measure(Ω,1)
# Define the Finite Element Spaces
refFE = ReferenceFE(lagrangian,Float64,1)
V = TestFESpace(𝒯,refFE,dirichlet_tags=[1])
Q = FESpace(𝒯, refFE)

uD = (0.1)

U = TrialFESpace(V,uD)
P = TrialFESpace(Q)

m(u,v) = ∫(u*v)dΩ
a(u,v) = ∫(k*u*v)dΩ

# # Create the TransientAffineFEOperator
op_Af = AffineFEOperator(m, a, U, P)

```

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [April 26, 2024, 2:03pm UTC](https://discourse.julialang.org/t/1d-heat-transfer-code-issues/113520/2 "2024-04-26T14:03:47Z")

</div>

> [@Mishal](#):
>
> `op_Af = AffineFEOperator(m, a, U, P)`

I think you’re misunderstanding the nature of a weak form. The second argument to `AffineFEOperator` should be a function `b(v)` of _one_ argument representing your right-hand side. You are getting the error because your `a(u, v)` has two arguments, so when Gridap.jl tries to call it with a single argument as `a(v)` it throws a `MethodError`.

See Gridap’s [Poisson tutorial](https://gridap.github.io/Tutorials/dev/pages/t001_poisson/).

---

<div class="post-metadata">

**Author:** ![Mishal](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mishal/32/214462_2.png) [@Mishal](https://discourse.julialang.org/u/Mishal)\
**Post date:** [April 30, 2024, 11:13am UTC](https://discourse.julialang.org/t/1d-heat-transfer-code-issues/113520/3 "2024-04-30T11:13:06Z")

</div>

I am still getting the same issue with the revised code attached below.

```julia
using Gridap

k = 0.45
  
# Define the domain
𝒯 = CartesianDiscreteModel((0,1),(20)) # 1x1 surface which is meshed by 20 along each axis
Ω = Triangulation(𝒯)
dΩ = Measure(Ω,1)
# Define the Finite Element Spaces
refFE = ReferenceFE(lagrangian,Float64,1)
V = TestFESpace(𝒯,refFE,dirichlet_tags=[1])
Q = FESpace(𝒯, refFE)

uD = (0.1)

U = TrialFESpace(V,uD)
P = TrialFESpace(Q)

f = 100
m(u,v) = ∫(k * ∂u/∂x * ∂v/∂x)dΩ
L(v) = ∫(f * v)dΩ

# # Create the TransientAffineFEOperator
op_Af = FEOperator(m, L, U, P)

uh = solve(op_Af)

```
