# Adjoint vector boundary condition

**URL:** https://discourse.julialang.org/t/adjoint-vector-boundary-condition/118149
**Category:** New to Julia
**Tags:** finite-element, gridap, adjoint
**Created:** [August 13, 2024, 5:25pm UTC](https://discourse.julialang.org/t/adjoint-vector-boundary-condition/118149 "2024-08-13T17:25:26Z")
**Posts on this page:** 2
**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: [August 13, 2024, 5:25pm UTC](https://discourse.julialang.org/t/adjoint-vector-boundary-condition/118149/1 "2024-08-13T17:25:26Z")

</div>

Hi, I am using Gridap to find adjoint vectors in finite element space. Assume that I have a beam with applied displacement as boundary condition on a line. In this case I got discontinuities in values of adjoint vectors. however if I applied the displacement as a traction in weak form I get correct results from my adjoint calculations. Is there anyone who can help me in this problem.

```julia
function stepDisp(fem_params,pth, uh_in,sh_in, vApp)
    uApp1(x) = VectorValue(0.0,0.0)
    uApp2(x) = VectorValue(0.0,0.0)
    uApp3(x) = VectorValue(0.0,-vApp)
    U_Disp = TrialFESpace(V0_Disp ,[uApp1 ,uApp2 ,uApp3])
    A_Disp(u,v,pth,uh_in,sh_in) = ((p->Em(p))∘pth) * (ε(v) ⊙ (σfun∘(ε(u), ε(uh_in), sh_in)))
    a_Disp(u,v) =∫(A_Disp(u,v,pth,uh_in,sh_in))fem_params.dΩ
    b_Disp(v) = 0.0
    op_Disp = AffineFEOperator(a_Disp ,b_Disp ,U_Disp ,fem_params.V0_Disp)
    uh_out = solve(op_Disp)
    return uh_out

end

```

this is how I implemented the displacement as bc. it seems that this bc is not applied in my adjoint vector calculation which is w = A/Ou

---

<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: [August 15, 2024, 7:31pm UTC](https://discourse.julialang.org/t/adjoint-vector-boundary-condition/118149/2 "2024-08-15T19:31:48Z")

</div>

@stevengj Based on our previous discussions I think you have the knowledge in this area and you might know the answer. I really appreciate your help.
