# Dirac delta implementation in gridap

Hi dear all, i want to use Dirac delta function in my domain not just at special point like x0. below is a example of this

``````function MatrixOf(fem_params)
x0 = VectorValue(0,300)  # Position of the field to be optimized
δ = 1
return assemble_matrix(fem_params.U, fem_params.V) do u, v
∫((x->(1/(2*π)*exp(-norm(x - x0)^2 / 2 / δ^2))) * (∇(u) ⋅ ∇(v)) )fem_params.dΩ_c
end
end
``````

and to be clear it finds the matrix around x0. however i want to assemble it for each node. i have derived the node coordinate by below line

``````co= VectorValue(Gridap.ReferenceFEs.get_node_coordinates(Ω))
``````

however i cant make a loop for gridap to go through this vector and find o for each and then assemble it for all.
thanks for any suggestion.

@stevengj Hi, I have read the issues that you have been submitted on Dirac delta. can i apply Dirac delta not in guassian form to solve my problem?

I think you currently have to smooth out your delta function (e.g. as a Gaussian) in order to put it at an arbitrary point. This should be on the same order as other discretization errors if you make your smoothed delta have a diameter proportional to your mesh resolution.

thanks, so how can i make it to go through all points of domain not just one arbitrary point ? should i define for loop ?
i did it as below but it is not working

`````` x0 = VectorValue(fem_params.co)
∫( (x->((1/(2*π))*exp(-norm(x-x0[i])^2 / (2 * δ^2)))) * (∇(u)⊙ ∇(v)) )fem_params.dΩ for i in (0:4805)

``````