Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions app/main.f90
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ program tcell
use tcelsim, only : initialize_positions, create_distribution, create_rand_num_table, move_tcells
implicit none

integer ncells, npositions, nintervals
parameter(ncells = 100, npositions = 25)
integer ncells, npositions, nintervals, nveldim
parameter(ncells = 100, npositions = 25, nveldim = 4)
parameter(nintervals = 10)

double precision vel(nintervals)
Expand All @@ -14,7 +14,7 @@ program tcell
double precision, allocatable :: y(:,:)
double precision, allocatable :: z(:,:)

allocate(random_number_table(ncells,npositions,4))
allocate(random_number_table(ncells,npositions,nveldim))
allocate(x(ncells,npositions))
allocate(y(ncells,npositions))
allocate(z(ncells,npositions))
Expand All @@ -23,8 +23,8 @@ program tcell

call create_distribution(vel,cumulative_distribution,nintervals)

call create_rand_num_table(ncells,npositions,random_number_table)
call create_rand_num_table(ncells,npositions,random_number_table,nveldim)

call move_tcells(x,y,z,vel,cumulative_distribution,random_number_table,ncells,npositions,nintervals)
call move_tcells(x,y,z,vel,cumulative_distribution,random_number_table,ncells,npositions,nintervals,nveldim)

end program
2 changes: 1 addition & 1 deletion src/tcelsim/distribution_m.f90
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module subroutine create_distribution(vel,cumulative_distribution,nintervals)

implicit none
integer, intent(in) :: nintervals
double precision, intent(out) :: cumulative_distribution(0:nintervals)
double precision, intent(out) :: cumulative_distribution(nintervals+1)
double precision, intent(out) :: vel(nintervals)

end subroutine create_distribution
Expand Down
6 changes: 3 additions & 3 deletions src/tcelsim/distribution_s.f90
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@
end do

! Form the cumulative distribution
cumulative_distribution(0) = 0.d0
do i = 1,nintervals
cumulative_distribution(1) = 0.d0
do i = 2,nintervals+1
cumulative_distribution(i) = cumulative_distribution(i-1) + &
sample_distribution(i)
sample_distribution(i-1)
end do

end procedure create_distribution
Expand Down
6 changes: 3 additions & 3 deletions src/tcelsim/move_m.f90
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ module move_m

interface

module subroutine move_tcells(x,y,z,vel,cumulative_distribution,random_number_table,ncells,npositions,nintervals)
module subroutine move_tcells(x,y,z,vel,cumulative_distribution,random_number_table,ncells,npositions,nintervals,nveldim)
implicit none
integer, intent(in) :: ncells,npositions,nintervals
double precision, intent(in) :: random_number_table(ncells,npositions,4)
integer, intent(in) :: ncells,npositions,nintervals,nveldim
double precision, intent(in) :: random_number_table(ncells,npositions,nveldim)
double precision, intent(inout) :: x(ncells,npositions)
double precision, intent(inout) :: y(ncells,npositions)
double precision, intent(inout) :: z(ncells,npositions)
Expand Down
4 changes: 2 additions & 2 deletions src/tcelsim/move_s.f90
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@

! Sample from the distribution
do k = 1,nintervals
if (rr1 .ge. cumulative_distribution(k-1) .and. &
rr1 .lt. cumulative_distribution(k)) then
if (rr1 .ge. cumulative_distribution(k) .and. &
rr1 .lt. cumulative_distribution(k+1)) then
speed = vel(k)
end if
end do
Expand Down
6 changes: 3 additions & 3 deletions src/tcelsim/random_numbers_m.f90
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ module random_numbers_m

interface

module subroutine create_rand_num_table(ncells,npositions,random_number_table)
module subroutine create_rand_num_table(ncells,npositions,random_number_table,nveldim)

implicit none
integer, intent(in) :: ncells,npositions
double precision, intent(out) :: random_number_table(ncells,npositions,4)
integer, intent(in) :: ncells,npositions, nveldim
double precision, intent(out) :: random_number_table(ncells,npositions,nveldim)

end subroutine

Expand Down
2 changes: 1 addition & 1 deletion src/tcelsim/random_numbers_s.f90
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

do i = 1,ncells
do j = 1,npositions
do k = 1,4
do k = 1,nveldim
call random_number(random_number_table(i,j,k))
end do
end do
Expand Down
9 changes: 6 additions & 3 deletions src/tcelsim/t_cell_s.f90
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,18 @@
! Local variables
integer i
double precision rr1,rr2,rr3
double precision scaling_factor

scaling_factor = 100.d0

! Assign initial positions to T cells randomly in a [100x100x100] grid
do i = 1,ncells
call random_number(rr1)
call random_number(rr2)
call random_number(rr3)
x(i,1) = rr1*100.d0
y(i,1) = rr2*100.d0
z(i,1) = rr3*100.d0
x(i,1) = rr1*scaling_factor
y(i,1) = rr2*scaling_factor
z(i,1) = rr3*scaling_factor
end do

end procedure initialize_positions
Expand Down