RealTimeAnalysis Subroutine

subroutine RealTimeAnalysis()

Uses

  • proc~~realtimeanalysis~~UsesGraph proc~realtimeanalysis RealTimeAnalysis module~basicmod basicmod proc~realtimeanalysis->module~basicmod module~boundarymod boundarymod proc~realtimeanalysis->module~boundarymod module~eosmod eosmod proc~realtimeanalysis->module~eosmod module~mpimod mpimod proc~realtimeanalysis->module~mpimod module~config config module~basicmod->module~config module~boundarymod->module~basicmod module~boundarymod->module~config module~mpimod->module~config mpi mpi module~mpimod->mpi

To mesure the growth rate of Kelvin-Helmholtz instability, compute the related variables. (1) < v^y v^y> (2) Note that simple analytic expression of the growth rate of KH is known only idealistic case. In the case of finite-length transition, it is not easy to estimate it. In Berlok and Pfrommer (2019), Gamma~1.6--1.8, in my setup Gamma~1.49. We take this value for evaluation metric.

Arguments

None

Calls

proc~~realtimeanalysis~~CallsGraph proc~realtimeanalysis RealTimeAnalysis proc~getmpisum GetMPIsum proc~realtimeanalysis->proc~getmpisum mpi_allreduce mpi_allreduce proc~getmpisum->mpi_allreduce

Source Code

subroutine RealTimeAnalysis
  !! To mesure the growth rate of Kelvin-Helmholtz instability, compute the related variables.
  !! (1) < v^y v^y>
  !! (2) <C*(1-C)>
  use basicmod
  use eosmod
  use mpimod
  use boundarymod
  implicit none
  integer::i,j,k
  real(8):: mix
  real(8):: avevy
  real(8):: dv,vol
  real(8),save:: Amp,Gamma
  integer,save:: unitevo
  integer,parameter:: vmax=3
  real(8),dimension(vmax):: local,global
  logical, save :: is_inited
  data is_inited / .false. /

  mix   = 0.0d0
  avevy = 0.0d0
  vol   = 0.0d0
!$omp parallel do collapse(3) private(dv) reduction(+:vol,mix,avevy) schedule(static)
  do k=ks,ke
  do j=js,je
  do i=is,ie
     dv     = (x1a(i+1)-x1a(i)) * (x2a(j+1)-x2a(j)) * (x3a(k+1)-x3a(k))
     vol    = vol    + dv
     mix    = mix    + Xcomp(1,i,j,k) * (1.0d0-Xcomp(1,i,j,k)) * dv
     avevy  = avevy  + v2(i,j,k) * v2(i,j,k)                    * dv
  enddo
  enddo
  enddo
!$omp end parallel do

  local(1) = vol
  local(2) = mix
  local(3) = avevy
  call GetMPIsum(vmax,local,global)
  vol   = global(1)
  mix   = global(2)/vol
  avevy = sqrt(global(3)/vol)

  if(myid_w ==0 ) then
     if(.not. is_inited)then
        !> Note that simple analytic expression of the growth rate of KH is known only idealistic case.
        !> In the case of finite-length transition, it is not easy to estimate it.
        !> In Berlok and Pfrommer (2019), Gamma~1.6--1.8, in my setup Gamma~1.49.
        !> We take this value for evaluation metric.
        Amp   = 1.2d-3
        Gamma = 1.49d0
        open(newunit = unitevo,file="t-prof.csv", action="write")
        write(unitevo,"(A,(1x,ES24.16E3))") "# Gamma=",Gamma
        write(unitevo,"(A)") "# 1:time 2:mix 3:v_y 4:A*exp(Gamma*t)"
        is_inited = .true.
     endif
     write(unitevo,"(*(1x,ES24.16E3))") time, mix, avevy, Amp*exp(Gamma*time)
  endif

end subroutine RealTimeAnalysis