Current scores tally

Hello everyone!
I’m the newest user of Openmc, please help.

How to calculate current scores by changing the energy?
I don’t know how to complete it

tally_forward = openmc.Tally(name="forward current")
tally_backward = openmc.Tally(name="backward current")
tally_forward.scores = ["current"]
tally_backward.scores = ["current"]
sur_fwd_filter = openmc.filter.SurfaceFilter(sample_plane2.id)
sur_bwd_filter = openmc.filter.SurfaceFilter(sample_plane1.id)
from_sample_filter = openmc.filter.CellFromFilter(cell_sample.id)
tally_forward.filters = [sur_fwd_filter, from_sample_filter]
tally_backward.filters = [sur_bwd_filter, from_sample_filter]

Best regards

Hi @Eyvaz and welcome to the forum. What you have set up there looks like a partial current. If you just use a surface filter and ask for the “current” score, it will give you the net current through the surface. Combining a surface filter and a cellfrom filter allows you to get partial currents. Does that answer your question?

Thank You so much, Mr. Paul Romano.

I run this:

def run_model():
!rm *.h5
openmc.run(output=False)

create_model(1e-05, 3.0, add_forward_tally=True)
run_model()

create_model(1e-04, 3.0, add_forward_tally=True)
run_model()

create_model(1e-03, 3.0, add_forward_tally=True)
run_model()

But, I obtain an error message. How to correct mistakes here?

Best regards,
Eyvaz

And how to run and obtain current on the surface of the material by changing energy and thickness?