Skip to content

Commit

Permalink
Merge pull request #1148 from tpersson/dyanpFixAfterSpaceCharge
Browse files Browse the repository at this point in the history
Fix to get Dynap to work with the ny space Charge module.
  • Loading branch information
tpersson committed Oct 21, 2022
2 parents fd0b07c + e49bcb3 commit ac243f5
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
11 changes: 11 additions & 0 deletions src/mad_dynap.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,17 @@ dynap_tables_create(struct in_cmd* cmd)

t = make_table("dynaptune", "dynaptune", dynaptune_table_cols, dynaptune_table_types, npart);
add_to_table_list(t, table_register);

if (table_exists("mytracksumm")) {
/* hrr Sep 2021 table mytracksumm is not cleaned so pre-existence printf is not needed.
printf("Table mytracksumm does exist already\n"); hrr Sep 2021 */
}
else {
t = make_table("mytracksumm", "mytracksumm", mytracksumm_table_cols,
mytracksumm_table_types, 2*stored_track_start->curr);
add_to_table_list(t, table_register);
}

}

// public interface
Expand Down
12 changes: 7 additions & 5 deletions src/trrun.f90
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ subroutine trrun(switch, turns, orbit0, rt, part_id, last_turn, last_pos, &
endif

!--- Write checkpoint_restart data
call BB_Write(jmax, orbit0, z);
call BB_Write(jmax, orbit0, z, dynap);

!--- enter last turn in summary table.
! Add as well as tracksumm recreated each RUN call new permanent table mytracksumm. ! hrr Feb 2022
Expand Down Expand Up @@ -5885,7 +5885,7 @@ subroutine BB_Update2(turn, orbit0, z, part_id, last_turn)

end subroutine BB_Update2

subroutine BB_Write(turn, orbit0, z)
subroutine BB_Write(turn, orbit0, z, dynap)

use spch_bbfi
use trackfi
Expand All @@ -5894,11 +5894,13 @@ subroutine BB_Write(turn, orbit0, z)
use SpaceCharge !hrr Oct 2021

integer, intent(IN) :: turn
logical, intent(In) :: dynap
integer :: i, j

double precision, intent(IN) :: orbit0(6), z(6,N_macro_surv)

! if (bb_sxy_update) then !hrr Dec 2021 checkpoint_restart must not depend on bb_sxy_update

!if (bb_sxy_update) !hrr Dec 2021 checkpoint_restart must not depend on bb_sxy_update
if (.not. dynap) then
rewind unit_chpt
write(unit_chpt) jmax
write(unit_chpt) Ex_rms
Expand All @@ -5911,7 +5913,7 @@ subroutine BB_Write(turn, orbit0, z)
write(unit_chpt) sigma_t
write(unit_chpt) mean_t
write(unit_chpt) N_ini
! endif !hrr Dec 2021
endif
end subroutine BB_Write

subroutine table_input(betx_start, bety_start, &
Expand Down

0 comments on commit ac243f5

Please sign in to comment.