# How to assgin values to nodes on a vectorSpace?

**URL:** <https://fenicsproject.discourse.group/t/how-to-assgin-values-to-nodes-on-a-vectorspace/13083>\
**Category:** Legacy DOLFIN\
**Created:** [December 18, 2023, 9:39am UTC](https://fenicsproject.discourse.group/t/how-to-assgin-values-to-nodes-on-a-vectorspace/13083 "2023-12-18T09:39:29Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![gperezb1](https://avatars.discourse-cdn.com/v4/letter/g/f6c823/32.png) [@gperezb1](https://fenicsproject.discourse.group/u/gperezb1)\
**Post date:** [December 18, 2023, 9:39am UTC](https://fenicsproject.discourse.group/t/how-to-assgin-values-to-nodes-on-a-vectorspace/13083/1 "2023-12-18T09:39:29Z")

</div>

Hello everyone, I hope you are all doing well.

I have the following code, one that assigns the value of a constant in a given node.

```
  from dolfin import *
  
  import numpy as np
  
  mesh = UnitSquareMesh(10,10)
  
  V = FunctionSpace(mesh, "CG", 1)
  
  x = V.tabulate_dof_coordinates()
  
  point = [0.5,0.5]
  
  index = np.where((x == point).all(axis=1))[0][0]
  
  u = Function(V)
  
  value = 1
  
  u.vector().vec().setValueLocal(index, value)
  
  print(u.vector().get_local())

```

I need the same thing done, but for a vector field, such that for example, u in (0.5,0.5) has a value of (-1 , 1). Can it be done?

Thanks in advance

---

<div class="post-metadata">

**Author:** ![violetus](https://yyz2.discourse-cdn.com/free1/user_avatar/fenicsproject.discourse.group/violetus/32/5122_2.png) [@violetus](https://fenicsproject.discourse.group/u/violetus)\
**Post date:** [December 18, 2023, 1:10pm UTC](https://fenicsproject.discourse.group/t/how-to-assgin-values-to-nodes-on-a-vectorspace/13083/2 "2023-12-18T13:10:13Z")

</div>

Please consider reading [Problem with assigning vectors to nodes in a mesh](https://fenicsproject.discourse.group/t/problem-with-assigning-vectors-to-nodes-in-a-mesh/8115).
