Skip to content

Conversation

@valeriaRaffuzzi
Copy link
Member

I've added a source which is a combination of sources, each assigned a weight (or probability). The mixSource samples which source is actually used from the weights. the sources inside mixSource have to be built inside the Factory, which is a bit unusual; however it's necessary to avoid circular dependencies.

This PR also advances the RNG in both fixedSource and eigen PP after source generation, as this was not done before and resulting in a considerable bias in fixed source mode D:

Update rng in PPs after source generation
!! Sample particle Energy/Group and angle Angle
!! Sample particle Energy/Group and angle
!!
!! Sets diraction of a particle together with its energy.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
!! Sets diraction of a particle together with its energy.
!! Sets direction of a particle together with its energy.

!! See source_inter for details
!!
!! Errors:
!! - when the number of weigths doesn't correspond to the number of sources
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
!! - when the number of weigths doesn't correspond to the number of sources
!! - when the number of weights doesn't correspond to the number of sources

w = dir(3)

! Perform standard roatation. Note that indexes are parametrised
! Perform standard rotation. Note that indexes are parametrised
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
! Perform standard rotation. Note that indexes are parametrised
! Perform standard rotation. Note that indexes are parameterised


end do

! Register all clerks to recive their reports
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
! Register all clerks to recive their reports
! Register all clerks to receive their reports


end do

! Verify that final memLoc and memSize are consistant
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
! Verify that final memLoc and memSize are consistant
! Verify that final memLoc and memSize are consistent

!!
!! Result:
!! Null is source is not of ceNuclearDatabase class
!! Null if source is not of ceNuclearDatabase class
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
!! Null if source is not of ceNuclearDatabase class
!! Null if source is not of ceNeutronDatabase class

!! Result:
!! Null is source is not of ceNuclearDatabase class
!! Null if source is not of ceNuclearDatabase class
!! Target points to source if source is ceNuclearDatabase class
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
!! Target points to source if source is ceNuclearDatabase class
!! Target points to source if source is ceNeutronDatabase class

!! Sample particle Energy/Group and angle Angle
!! Sample particle Energy/Group and angle
!!
!! Sets diraction of a particle together with its energy.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
!! Sets diraction of a particle together with its energy.
!! Sets direction of a particle together with its energy.

use particle_class, only : particleState

! Source
use source_inter, only : source
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
use source_inter, only : source
use source_inter, only : source

character(100), parameter :: Here = 'init (mixSource_class.f90)'

! Get number of sources
N = size(self % sources)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a bit bewildering. Might be good to highlight that sources has already been initialised elsewhere due to trying to avoid circular dependencies.

if (size(weights) /= N) then
call fatalError(Here, 'The number of sources and weights is not the same')
end if
if (any(weights == ZERO)) call fatalError(Here, 'Some of the weights are zero')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't we also want to ensure weights are positive?

Suggested change
if (any(weights == ZERO)) call fatalError(Here, 'Some of the weights are zero')
if (any(weights <= ZERO)) call fatalError(Here, 'Some of the weights are not positive')

Copy link
Collaborator

@ChasingNeutrons ChasingNeutrons left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just a few small things.

V. Raffuzzi added 2 commits January 25, 2025 17:25
Update rng in PPs after source generation
@ChasingNeutrons ChasingNeutrons merged commit ca26467 into CambridgeNuclear:main Jan 25, 2025
5 checks passed
@ChasingNeutrons ChasingNeutrons mentioned this pull request Jan 25, 2025
@valeriaRaffuzzi valeriaRaffuzzi deleted the sourceContainer branch January 27, 2025 12:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants