# Get dof values of nodes

**URL:** <https://discourse.julialang.org/t/get-dof-values-of-nodes/101272>\
**Category:** New to Julia\
**Tags:** question, optimization, gridap\
**Created:** [July 6, 2023, 4:52pm UTC](https://discourse.julialang.org/t/get-dof-values-of-nodes/101272 "2023-07-06T16:52:46Z")\
**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:** [July 6, 2023, 4:52pm UTC](https://discourse.julialang.org/t/get-dof-values-of-nodes/101272/1 "2023-07-06T16:52:46Z")

</div>

Hi, I am using Gridap to solve and FE and then use it in optimization. i have non zero dirichlet boundary condition as displacement on a load line. to solve the finite element part i used below function

```julia
function stepDisp(fem_params,pth)
    A_Disp(u,v,pth) = ((p->Em(p))∘pth) * ε(v) ⊙ (σfun∘(ε(u)))
    a_Disp(u,v) = ∫(A_Disp(u,v,pth))fem_params.dΩ
    b_Disp(v) = 0.0
    op_Disp = AffineFEOperator(a_Disp ,b_Disp ,fem_params.U0_Disp ,fem_params.V0_Disp)
    uh_out = solve(op_Disp)
    return get_free_dof_values(uh_out)
end

```

and U0 is trial space

```julia
uApp1(x) = VectorValue(0.0,0.0)
uApp2(x) = VectorValue(0.0,0.0)
uApp3(x) = VectorValue(0.0,-vAppMax)
U0_Disp = TrialFESpace(V0_Disp ,[uApp1 ,uApp2 ,uApp3])

```

then i use results for topology optimization to do this i uses below objective

```julia
    u_vec = stepDisp(fem_params,pth)

u_vec' * O_mat * u_vec

```

where o is a matrix defined on space.  
however, as i run the problem it seems every thing is ok except in load line. as optimization delete material in places that there is no necessity, it delete material exactly on load line. and this is wring. could you please tell me where i am wrong in the code? my guess is that i get free dof from fe part and as there is dirichlet BC on load line, it doesn’t implement this into optimization part. but i cant solve this problem.  
thank you in advance for your help

---

<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:** [July 6, 2023, 11:06pm UTC](https://discourse.julialang.org/t/get-dof-values-of-nodes/101272/2 "2023-07-06T23:06:14Z")

</div>

respectfully, is there any suggestion on this issue?
