From 6c85dc3a25ee79a9064fb48c2121bd7d17648253 Mon Sep 17 00:00:00 2001 From: Bryan Herman Date: Fri, 28 Oct 2011 19:47:53 -0400 Subject: [PATCH] successfully printed out total cross section from tally object --- src/DEPENDENCIES | 1 + src/cmfd_utils.f90 | 33 ++++++++++++++++++++++++++++++++- 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/src/DEPENDENCIES b/src/DEPENDENCIES index 1f0f091cc5..cb1119e040 100644 --- a/src/DEPENDENCIES +++ b/src/DEPENDENCIES @@ -1,4 +1,5 @@ cmfd_utils.o: global.o +cmfd_utils.o: mesh.o cross_section.o: constants.o cross_section.o: cross_section_header.o diff --git a/src/cmfd_utils.f90 b/src/cmfd_utils.f90 index dfa842d65b..25bd8db560 100644 --- a/src/cmfd_utils.f90 +++ b/src/cmfd_utils.f90 @@ -1,6 +1,8 @@ module cmfd_utils use global + use mesh, only: mesh_indices_to_bin + use tally_header, only: TallyObject, TallyScore implicit none @@ -47,7 +49,36 @@ contains subroutine print_cmfd() - write(7,*) 'hello world' + integer :: bins(TALLY_TYPES) ! bin for tally_types, for filters + integer :: ijk(3) ! indices for mesh cell where tally is + integer :: score_index ! index in tally score to get value + + real(8) :: tally_val ! value of tally being extracted + + type(TallyObject), pointer :: t ! pointer for a tally object + type(StructuredMesh), pointer :: m ! pointer for mesh object + + ! associate pointers with objects + t => tallies(1) + m => meshes(t % mesh) + + ! set all bins to 1 + bins = 1 + + ! get mesh indices, first we will first force to 1,1,1 + ijk = (/ 1, 1, 1 /) + + ! apply filters, here we will just try a mesh filter first + bins(T_MESH) = mesh_indices_to_bin(m,ijk) + + ! calculate score index from bins + score_index = sum((bins - 1) * t%stride) + 1 + + ! get value from tally object + tally_val = t%scores(score_index,1)%val + + ! write value to file + write(7,*) "Tally value is:",tally_val end subroutine print_cmfd