Greeting to all, I am new user to Julia and I was writing my code in Julia for the first time. I wanted to implement a Gaussian Heat surface over a circular radius and outside that radius I want to set the value to zero to that heat function. Here is the piece of my code-

#Center horizontal coordinates so that (x,y)=(0,0) correspond to the
#centre of the domain
xc= grid.xC.-mean(grid.xC) #grid.xC contain an array of discrete cordinates 0:1/256:4
yc= grid.yC.-mean(grid.yC) # similar to grid.yC but in y direction
#Radius of Gausian
R=xc.*xc + yc.*yc
#Cutt off radius r
r=1
Q(x,y,z,t) = 9e-5.*exp(-0.5.*(R))
Q[findall(R.>r)].=0

After running this part I am getting this- ERROR: MethodError: no method matching getindex(::typeof(Q), ::Array{Int64,1})

Parenthesis are for functions, and brackets for vectors/arrays. It is not clear what of the two you want. In Q(x,y,z,t) = 9e-5.*exp(-0.5.*(R)) you are declaring a function with 4 parameters (none of them is used inside the function), and in the sequence you try to index it as it was a vector. Can you provide a little more context? I am not aware of a language that would work that way.

Thank you for your reply sir, It is for heat flux boundary condition at the surface. I think I am confused how to write the function as I want the Heat flux i.e. Q to be a Gaussian Function only inside R < r and for R > r Q=0. Now I am very confused how to do that.

Is this the package you use? Can you point to an example in which it does something similar to what are you trying?

Your function does not take R nor r both are global variables. This mean the equation inside will give the same value does not matter what values you pass to it. You code is nonsensical on pure Julia, maybe the package your mentioned add some macros/DSL that allows for such constructs but then you need to point me to them.