|
[Fortran] 纯文本查看 复制代码 001 | subroutine single_step ( itimestep , dt , ntotal , hsml , mass , x , vx , |
002 | & u , s , rho , p , t , tdsdt , dx , dvx , du , ds , drho , itype , av ) |
004 | c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
005 | c Subroutine to determine the right hand side of a differential |
006 | c equation in a single step for performing time integration |
008 | c In this routine and its subroutines the SPH algorithms are performed. |
009 | c itimestep : Current timestep number [ in ] |
011 | c ntotal : Number of particles [ in ] |
012 | c hsml : Smoothing Length [ in ] |
013 | c mass : Particle masses [ in ] |
014 | c x : Particle position [ in ] |
015 | c vx : Particle velocity [ in ] |
016 | c u : Particle internal energy [ in ] |
017 | c s : Particle entropy ( not used here ) [ in ] |
018 | c rho : Density [ in / out ] |
020 | c t : Temperature [ in / out ] |
021 | c tdsdt : Production of viscous entropy t * ds / dt [ out ] |
022 | c dx : dx = vx = dx / dt [ out ] |
023 | c dvx : dvx = dvx / dt , force per unit mass [ out ] |
024 | c du : du = du / dt [ out ] |
025 | c ds : ds = ds / dt [ out ] |
026 | c drho : drho = drho / dt [ out ] |
027 | c itype : Type of particle [ in ] |
028 | c av : Monaghan average velocity [ out ] |
033 | integer itimestep , ntotal , itype ( maxn ) |
034 | double precision dt , hsml ( maxn ) , mass ( maxn ) , x ( dim , maxn ) , |
035 | & vx ( dim , maxn ) , u ( maxn ) , s ( maxn ) , rho ( maxn ) , p ( maxn ) , |
036 | & t ( maxn ) , tdsdt ( maxn ) , dx ( dim , maxn ) , dvx ( dim , maxn ) , |
037 | & du ( maxn ) , ds ( maxn ) , drho ( maxn ) , av ( dim , maxn ) |
038 | integer i , d , nvirt , niac , pair_i ( max_interaction ) , |
039 | & pair_j ( max_interaction ) , ns ( maxn ) |
040 | double precision w ( max_interaction ) , dwdx ( dim , max_interaction ) , |
041 | & indvxdt ( dim , maxn ) , exdvxdt ( dim , maxn ) , ardvxdt ( dim , maxn ) , |
042 | & avdudt ( maxn ) , ahdudt ( maxn ) , c ( maxn ) , eta ( maxn ) |
054 | c - - - Positions of virtual ( boundary ) particles : |
057 | if ( virtual_part ) then |
058 | call virt_part ( itimestep , ntotal , nvirt , hsml , mass , x , vx , |
062 | c - - - Interaction parameters , calculating neighboring particles |
063 | c and optimzing smoothing length |
066 | call direct_find ( itimestep , ntotal + nvirt , hsml , x , niac , pair_i , |
068 | else if ( nnps .eq. 2 ) then |
069 | call link_list ( itimestep , ntotal + nvirt , hsml ( 1 ) , x , niac , pair_i , |
071 | else if ( nnps .eq. 3 ) then |
072 | call tree_search ( itimestep , ntotal + nvirt , hsml , x , niac , pair_i , |
076 | c - - - Density approximation or change rate |
078 | if ( summation_density ) then |
079 | call sum_density ( ntotal + nvirt , hsml , mass , niac , pair_i , pair_j , w , |
082 | call con_density ( ntotal + nvirt , mass , niac , pair_i , pair_j , |
083 | & dwdx , vx , itype , x , rho , drho ) |
086 | c - - - Dynamic viscosity : |
088 | if ( visc ) call viscosity ( ntotal + nvirt , itype , x , rho , eta ) |
092 | call int_force ( itimestep , dt , ntotal + nvirt , hsml , mass , vx , niac , rho , |
093 | & eta , pair_i , pair_j , dwdx , u , itype , x , t , c , p , indvxdt , tdsdt , du ) |
095 | c - - - Artificial viscosity : |
097 | if ( visc_artificial ) call art_visc ( ntotal + nvirt , hsml , |
098 | & mass , x , vx , niac , rho , c , pair_i , pair_j , w , dwdx , ardvxdt , avdudt ) |
102 | if ( ex_force ) call ext_force ( ntotal + nvirt , mass , x , niac , |
103 | & pair_i , pair_j , itype , hsml , exdvxdt ) |
106 | c Calculating the neighboring particles and undating HSML |
108 | if ( sle .ne. 0 ) call h_upgrade ( dt , ntotal , mass , vx , rho , niac , |
109 | & pair_i , pair_j , dwdx , hsml ) |
111 | if ( heat_artificial ) call art_heat ( ntotal + nvirt , hsml , |
112 | & mass , x , vx , niac , rho , u , c , pair_i , pair_j , w , dwdx , ahdudt ) |
114 | c Calculating average velocity of each partile for avoiding penetration |
116 | if ( average_velocity ) call av_vel ( ntotal , mass , niac , pair_i , |
117 | & pair_j , w , vx , rho , av ) |
119 | c - - - Convert velocity , force , and energy to f and dfdt |
123 | c dvx ( d , i ) = indvxdt ( d , i ) + exdvxdt ( d , i ) + ardvxdt ( d , i ) |
125 | du ( i ) = du ( i ) + avdudt ( i ) + ahdudt ( i ) |
128 | if ( mod ( itimestep , print_step ) .eq. 0 ) then |
130 | write ( * , * ) '**** Information for particle ****' , |
132 | write ( * , 101 ) 'internal a ' , 'artifical a=' , |
133 | & 'external a ' , 'total a ' |
134 | write ( * , 100 ) indvxdt ( 1 , moni_particle ) , ardvxdt ( 1 , moni_particle ) , |
135 | & exdvxdt ( 1 , moni_particle ) , dvx ( 1 , moni_particle ) |
137 | 101 format ( 1 x , 4 ( 2 x , a 12 ) ) |
138 | 100 format ( 1 x , 4 ( 2 x , e 12.6 ) ) |
|
|