Let's compile the integrand into a Listable
CompiledFunction
:
cintegrand = Block[{x, y, d, p, ζ, t},
With[{code =
N[(ζ (Exp[I 20000 ((d^2 + ζ^2)^(1/2) + ((p^2 + (x - ζ Cos[t])^2 + (y - ζ Sin[t])^2)^(1/2)))]))/(d^2 + ζ^2)^(1/2)]
},
Compile[{{x, _Real}, {y, _Real}, {d, _Real}, {p, _Real}, {ζ, _Real}, {t, _Real}},
code,
CompilationTarget -> "C",
RuntimeAttributes -> {Listable},
Parallelization -> True
]
]
];
Next, pick a Gauss quadrature rule for high order polynomials (the integrand is very smooth but quite oscillatory):
{pts, weights, errweights} = NIntegrate`GaussRuleData[9, $MachinePrecision];
Divide the integration domain into $m \times n$ rectangles and set up the quadrature points and weights:
m = 20;
n = 20;
ζdata = Partition[Subdivide[0., 0.008, m], 2, 1];
tdata = Partition[Subdivide[0., 2 Pi, n], 2, 1];
{ζ, t} = Transpose[Tuples[{Flatten[ζdata.{1. - pts, pts}], Flatten[tdata.{1. - pts, pts}]}]];
ω = Flatten[KroneckerProduct[
Flatten[KroneckerProduct[Differences /@ ζdata, weights]],
Flatten[KroneckerProduct[Differences /@ tdata, weights]]
]];
Define the mapping that parameterizes the graph of OP's function w
:
W = {x, y} \[Function] {x, y, Abs[cintegrand[x, y, 0.004, 20., ζ, t].ω]^2};
Compute the values of W
on a $101 \times 101$ grid:
R = 2.;
data = Outer[W, Subdivide[-R, R, 100], Subdivide[-R, R, 100]]; // AbsoluteTiming // First
28.2668
Plot the result
ListPlot3D[Flatten[data, 1], PlotRange -> All, AxesLabel -> {"x", "y", "w"}]