diff --git a/epoch1d/src/physics_packages/injectors.F90 b/epoch1d/src/physics_packages/injectors.F90 index e5b580250..ea98f9265 100644 --- a/epoch1d/src/physics_packages/injectors.F90 +++ b/epoch1d/src/physics_packages/injectors.F90 @@ -307,6 +307,13 @@ SUBROUTINE run_single_injector(injector) #ifndef PER_SPECIES_WEIGHT density = MIN(density, injector%density_max) new%weight = weight_fac * density +#endif +#if defined(PHOTONS) || defined(BREMSSTRAHLUNG) + ! For photons, assign additional variable used in photon particle-push + IF (species_list(injector%species)%species_type == c_species_id_photon) & + THEN + new%particle_energy = SQRT(SUM(new%part_p**2)) * c + END IF #endif CALL add_particle_to_partlist(plist, new) END DO diff --git a/epoch1d/src/user_interaction/helper.F90 b/epoch1d/src/user_interaction/helper.F90 index cf959d137..3f7e99c89 100644 --- a/epoch1d/src/user_interaction/helper.F90 +++ b/epoch1d/src/user_interaction/helper.F90 @@ -92,6 +92,9 @@ SUBROUTINE auto_load TYPE(particle_species), POINTER :: species INTEGER :: i0, i1, iu, io TYPE(initial_condition_block), POINTER :: ic +#if defined(PHOTONS) || defined(BREMSSTRAHLUNG) + TYPE(particle), POINTER :: current +#endif IF (pre_loading .AND. n_species > 0) THEN i0 = 1 - ng @@ -141,6 +144,17 @@ SUBROUTINE auto_load ELSE IF (species%ic_df_type == c_ic_df_arbitrary) THEN CALL setup_particle_dist_fn(species, species_drift) END IF + +#if defined(PHOTONS) || defined(BREMSSTRAHLUNG) + ! For photons, assign additional variable used in photon particle-push + IF (species_list(ispecies)%species_type == c_species_id_photon) THEN + current => species%attached_list%head + DO WHILE (ASSOCIATED(current)) + current%particle_energy = SQRT(SUM(current%part_p**2)) * c + current => current%next + END DO + END IF +#endif END DO IF (pre_loading) RETURN diff --git a/epoch2d/src/physics_packages/injectors.F90 b/epoch2d/src/physics_packages/injectors.F90 index af1b0ddd8..063489586 100644 --- a/epoch2d/src/physics_packages/injectors.F90 +++ b/epoch2d/src/physics_packages/injectors.F90 @@ -366,6 +366,13 @@ SUBROUTINE run_single_injector(injector) #ifndef PER_SPECIES_WEIGHT density = MIN(density, injector%density_max) new%weight = weight_fac * density +#endif +#if defined(PHOTONS) || defined(BREMSSTRAHLUNG) + ! For photons, assign additional variable used in photon particle-push + IF (species_list(injector%species)%species_type == c_species_id_photon) & + THEN + new%particle_energy = SQRT(SUM(new%part_p**2)) * c + END IF #endif CALL add_particle_to_partlist(plist, new) END DO diff --git a/epoch2d/src/user_interaction/helper.F90 b/epoch2d/src/user_interaction/helper.F90 index 0ee2b5b32..a1ef3b571 100644 --- a/epoch2d/src/user_interaction/helper.F90 +++ b/epoch2d/src/user_interaction/helper.F90 @@ -98,6 +98,9 @@ SUBROUTINE auto_load TYPE(particle_species), POINTER :: species INTEGER :: i0, i1, iu, io TYPE(initial_condition_block), POINTER :: ic +#if defined(PHOTONS) || defined(BREMSSTRAHLUNG) + TYPE(particle), POINTER :: current +#endif IF (pre_loading .AND. n_species > 0) THEN i0 = 1 - ng @@ -147,6 +150,17 @@ SUBROUTINE auto_load ELSE IF (species%ic_df_type == c_ic_df_arbitrary) THEN CALL setup_particle_dist_fn(species, species_drift) END IF + +#if defined(PHOTONS) || defined(BREMSSTRAHLUNG) + ! For photons, assign additional variable used in photon particle-push + IF (species_list(ispecies)%species_type == c_species_id_photon) THEN + current => species%attached_list%head + DO WHILE (ASSOCIATED(current)) + current%particle_energy = SQRT(SUM(current%part_p**2)) * c + current => current%next + END DO + END IF +#endif END DO IF (pre_loading) RETURN diff --git a/epoch3d/src/physics_packages/injectors.F90 b/epoch3d/src/physics_packages/injectors.F90 index 90c87b1ab..0acba3718 100644 --- a/epoch3d/src/physics_packages/injectors.F90 +++ b/epoch3d/src/physics_packages/injectors.F90 @@ -403,6 +403,13 @@ SUBROUTINE run_single_injector(injector) #ifndef PER_SPECIES_WEIGHT density = MIN(density, injector%density_max) new%weight = weight_fac * density +#endif +#if defined(PHOTONS) || defined(BREMSSTRAHLUNG) + ! For photons, assign additional variable used in photon particle-push + IF (species_list(injector%species)%species_type == c_species_id_photon) & + THEN + new%particle_energy = SQRT(SUM(new%part_p**2)) * c + END IF #endif CALL add_particle_to_partlist(plist, new) END DO diff --git a/epoch3d/src/user_interaction/helper.F90 b/epoch3d/src/user_interaction/helper.F90 index b99c6c4e2..ed8394659 100644 --- a/epoch3d/src/user_interaction/helper.F90 +++ b/epoch3d/src/user_interaction/helper.F90 @@ -104,6 +104,9 @@ SUBROUTINE auto_load TYPE(particle_species), POINTER :: species INTEGER :: i0, i1, iu, io TYPE(initial_condition_block), POINTER :: ic +#if defined(PHOTONS) || defined(BREMSSTRAHLUNG) + TYPE(particle), POINTER :: current +#endif IF (pre_loading .AND. n_species > 0) THEN i0 = 1 - ng @@ -153,6 +156,17 @@ SUBROUTINE auto_load ELSE IF (species%ic_df_type == c_ic_df_arbitrary) THEN CALL setup_particle_dist_fn(species, species_drift) END IF + +#if defined(PHOTONS) || defined(BREMSSTRAHLUNG) + ! For photons, assign additional variable used in photon particle-push + IF (species_list(ispecies)%species_type == c_species_id_photon) THEN + current => species%attached_list%head + DO WHILE (ASSOCIATED(current)) + current%particle_energy = SQRT(SUM(current%part_p**2)) * c + current => current%next + END DO + END IF +#endif END DO IF (pre_loading) RETURN