Skip to content

Commit

Permalink
Implemented rescaling of velocity for decayling isotropic turbulence …
Browse files Browse the repository at this point in the history
…runs.

The line in the input file that deals with rescales contains two numbers: TRESCALE (when to rescale) and NRESCALE (how many times to rescale).  The rescaling happens at times TRESCALE*1, TRESCALE*2, ..., TRESCALE*NRESCALE.

Rescaling means that the Fourier components of velocity are multipled in such a way that the energy spectrum takes the shape prescribed in the input file by the variables ips_type and peak_wavenum.
  • Loading branch information
schumakov committed Apr 30, 2009
1 parent 8f8e554 commit e4b7627
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 5 deletions.
2 changes: 1 addition & 1 deletion 00_example.in
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ INPUT FILE FOR THE SPECTRAL CODE WITH SCALARS (example for v.1.0.0)
500 IWRITE4 how often to write real*4 binary files
----------------------------------------------------------------------
10.0 TMAX the maximum simulation time
1000.0 TRESCALE time when to rescale the velocity (definct)
1.0 3 TRESCALE, NRESCALE rescale time and # of rescales
0.0 TSCALAR time when to start moving scalars in the flow
----------------------------------------------------------------------
1 ITYPV flow type: 0=decay, 1=forced
Expand Down
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ OBJ = main.o\
restart_io.o\
rhs_velocity.o\
rhs_scalars.o\
velocity_rescale.o\
write_tmp4.o


Expand Down
21 changes: 18 additions & 3 deletions m_parameters.f90
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
! M_PARAMETERS - module for all parameters in the calculation:
! such as array dimensions, reynolds numbers, switches/flags etc.
!
! Time-stamp: <2009-04-21 09:21:30 (chumakov)>
! Time-stamp: <2009-04-30 12:07:52 (chumakov)>
! Time-stamp: <2008-11-20 17:27:59 MST (vladimirova)>
!================================================================================

Expand All @@ -29,6 +29,9 @@ module m_parameters

real*8 :: TMAX, TRESCALE, TSCALAR, RE, nu, dt

! now many times to rescale teh velocities
integer :: NRESCALE

integer :: flow_type

logical :: variable_dt
Expand Down Expand Up @@ -238,8 +241,8 @@ subroutine read_input_file
read(in,*,ERR=9000,END=9000) TMAX
write(out,*) 'TMAX =',TMAX

read(in,*,ERR=9000,END=9000) TRESCALE
write(out,*) 'TRESCALE =',TRESCALE
read(in,*,ERR=8000,END=9000) TRESCALE, NRESCALE
100 write(out,*) 'TRESCALE, NRESCALE =',TRESCALE, NRESCALE

read(in,*,ERR=9000,END=9000) TSCALAR
write(out,*) 'TSCALAR =',TSCALAR
Expand Down Expand Up @@ -479,6 +482,18 @@ subroutine read_input_file
end if

return

!--------------------------------------------------------------------------------
! ERROR PROCESSING
!--------------------------------------------------------------------------------

8000 continue
NRESCALE = 0
if (TRESCALE.gt.zip) NRESCALE = 1
write(out,*) "*** NRESCALE IS AUTOMATICALLY ASSIGNED to be ONE"
call flush(out)
goto 100

9000 continue
write(out,*)'An error was encountered while reading input file'
call flush(out)
Expand Down
18 changes: 17 additions & 1 deletion main.f90
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,17 @@ program x_code
!--------------------------------------------------------------------------------
hydro: if (task.eq.'hydro') then

! taking care of rescaling
! if the time just was divisible by TRESCALE
if (floor((time-dt)/TRESCALE) .lt. floor(time/TRESCALE)) then
! ...and if we haven't rescaled NRESCALE times
if (floor(time/TRESCALE) .le. NRESCALE) then
write(out,*) "MAIN: Rescaling velocities"
call flush(out)
call velocity_rescale
end if
end if

! RHS for scalars
call rhs_scalars
!!$ write(out,*) "done with rhs_scalars"
Expand Down Expand Up @@ -214,7 +225,7 @@ program x_code
! requirements on the wrk array sizes in the particle interpolation routines.
!--------------------------------------------------------------------------------
particles: if (task.eq.'parts') then

call fields_to_parts

if (int_particles) then
Expand Down Expand Up @@ -251,7 +262,12 @@ program x_code
if (myid_world.eq.0) call m_timing_check
count = 1
call MPI_BCAST(cpu_min_total,count,MPI_INTEGER4,0,MPI_COMM_WORLD,mpi_err)

! allowing 5 extra minutes for writing restart file
! note that for large-scale calculations (e.g. 1024^3)
! the restart writing time can be long (up to 20 minutes or so).
! this should be taken care of in the job submission script
! via file job_parameters.txt
if (cpu_min_total+5 .gt. job_runlimit) call my_exit(2)

! user termination. If the file "stop" is in the directory, stop
Expand Down

0 comments on commit e4b7627

Please sign in to comment.