# How can I edit a scipt to calculate the Power Fraction of a PCF

#1

Power Fraction defined by (the ratio of optical power inside the air holes to the total power)
the refractive index of air holes is 1.0,I am going to find integral coordinate of holes,but dont know how to edit the script

#2

Hi, @wzx2179 !

Could you please be more specific on what you are doing?
We can hardly explain you without having a script and/or simulation file

#3

yeah,sorry about that .thanks for replying .
am trying to using FDE in MODE solutions to simulate a PCF ,and going to calculate Power Fraction of a mode ,I think a script is needed to complete this job .The size of simulation file is more than 200M ,its difficult to upload it .

#4

Hi @wzx2179,

You are right, you will have to write a script to do this. It shouldn’t be too complicated, you can get the data from the mode solver using getresult. For instance:

E=getresult("FDE::data::mode1", "E");
H=getresult("FDE::data::mode1", "H");
P=getresult("FDE::data::mode1", "P");


Will give you the fields and the Poynting vector for the first mode.

To get the power inside the holes, I think you can apply a similar method as shown in the power absorption calculation in multiple materials. You can use the index profile to create a filter (1 in the holes, where the index is 1, and 0 elsewhere) and apply the filter to the fields.

You can get the index profile also using “getresult”:

Index=getresult("FDE::data::material", "index");
`

I hope this helps!