Hello everyone,
I’m new to ngsolve. I’ve been trying to compare my solution with its analytical solution, whose expression cannot be represented with coefficient functions. I’ve tried two alternatives: one is to evaluate it at each vertex of the mesh. The second is to evaluate the analytical solution on a grid and then use the voxel coefficient function. But both alternatives aren’t yielding results.
For the first option, I’m not sure how to set my grid function analytical solution at each point of the mesh.
For the second, I’m not sure what’s not working. I’m using the following lines of code:
for j,y in enumerate(y_vector):
u_aux[j,:]= A(t+y/c0)
func=VoxelCoefficient((-0.015, 0), (0.015, -0.06), u_aux, linear=True)
u_analytic.Set(func)
But I’m not getting the expected results.
My questions are:
- How do I set the analytical solution for each vertex in my first option?
for vertex in mesh.vertices:
y=vertex.point[1]
valor= A(t-y/c0)
#code to set u_analytic in vertex with value valor - What am I doing wrong by using voxel coefficient in the second option?
- Is there a more efficient way to do this?
thank you very much in advance,
Eve