# Spherical Surface in Volumetric Technique

#1

Hello,

The “volumetric technique” for calculating force defines a cube surrounding the object which the force applied on it should be calculated. Is there any way to specify a spherical surface surrounding the object?

I have a nano-sphere. It is located in free space, but it is very close to other objects. It is not possible to define a cubic that encompasses only the sphere not the nearby objects. I was wondering if there is a way to define a spherical volume (or surface) around the sphere in the “volumetric technique”. I appreciate any comment.

#2

Hi,

The total force result from the volumetric optical force analysis group is obtained by integrating the force components over the full volume. I think that if you wanted to, you could modify the analysis to integrate only over a spherical region that contains your object. There’s a good example on the following page which shows the use of a spherical filter in order to integrate results only over a spherical region - see the “absorbed power in spherical region” section:
https://kb.lumerical.com/en/index.html?layout_analysis_pabs_simple.html

#3

Hi,

Thank you very much for your explanation.

I read that article and modified the volumetric analysis. I added these lines at the end of the script:

# create integration filter
X=meshgrid3dx(x0,y0,z0);
Y=meshgrid3dy(x0,y0,z0);
Z=meshgrid3dz(x0,y0,z0);
filter= ((X-x_particle)^2 + (Y)^2 + (Z-z_particle)^2 ) < r_F_int^2;

F_total = matrixdataset(“F_total”);

But, when I run the analysis, I receive an error:
Error: prompt line 156: matrix arguments of * are not the same size
Line 156 is the last line.

By the way, in the “Variable Section”, it is not allowed to define a negative value (either for Length or Number). How can one define a negative value, say -1 as the x coordinate?

Thank you very much for your help.

#4

This error is occuring because the fx, fy, fz data is actually 4-dimensional where the 4th dimension corresponds to frequency, as the monitors are recording more than 1 frequency point.

You can correct the script by generating a 4D filter using the meshgrid4d script command, so the following lines should work:

X=meshgrid4d(1,x0,y0,z0,f);
Y=meshgrid4d(2,x0,y0,z0,f);
Z=meshgrid4d(3,x0,y0,z0,f);
filter= ((X-x_particle)^2 + (Y)^2 + (Z-z_particle)^2 ) < r_F_int^2;