# 1D heat transfer code issues

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?

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

``````

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.

1 Like

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

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