!!****if* source/Simulation/SimulationMain/CoronalLoop1D/Simulation_initBlock !! !! NAME !! !! Simulation_initBlock !! !! !! SYNOPSIS !! !! Simulation_initBlock(integer :: blockId, !! integer :: myPE) !! !! !! DESCRIPTION !! !! Initializes a single block for the 2MK benchmarking experiment !! It is copied from the FLASH3 NeiTest Simulation_initBlock.F90 routine. !! !! ARGUMENTS !! !! blockId - The number of the block to initialize !! myPE - current processor number !! !!*** subroutine Simulation_initBlock(blockID, myPE) #include "constants.h" #include "Flash.h" #include "Eos.h" use Simulation_data !! GFF - Don't know which of these Simulation_speciesData variables I !! actually need so I will keep all for now use Simulation_speciesData, ONLY : sim_specElementSymbol,sim_specElement,& sim_specSelected, sim_specNumElect, SPEC_NUM, SPEC_NIMAX, sim_specXfrac use Eos_interface, ONLY : Eos use Grid_interface, ONLY : Grid_getBlkIndexLimits, Grid_getCellCoords, & Grid_putRowData, Grid_putPointData !! GFF - Don't think I need the /sourceTerms/Ionize module !! use Ionize_interface, ONLY : Ionize_equil implicit none integer, intent(in) :: blockID integer, intent(in) :: myPE integer i,j,k,n real,allocatable,dimension(:) :: xCenter,yCenter,zCenter integer,dimension(LOW:HIGH,MDIM) :: blkLimits,blkLimitsGC integer :: iSize,jSize,kSize real, allocatable,dimension(:) :: rho, pres, temp, game, gamc, & vx, vy, vz, ener, eint !! GFF - 6 Sep 09 !! added eint variable real, dimension(NSPECIES) :: massFrac logical :: gcell = .true. integer :: vecLen=1 integer, dimension(1:MDIM) :: startingPos, cellIndex real :: xi, yj, zk real :: dist real :: temp_zone real, dimension(EOS_NUM) :: eosData ! variables needed for the eos call real :: gamma, xalfa, xxni, xxne, xxnp real :: entropy, dst, dsd !======================================================================= !! GFF - Don't need these variables since not using /sourceTerms/Ionize !!NEI integer :: id,nel,nion,inn !!NEI real zel !!NEI real,dimension(SPEC_NIMAX) :: delem call Grid_getBlkIndexLimits(blockId,blkLimits,blkLimitsGC) iSize = blkLimitsGC(HIGH,IAXIS) - blkLimitsGC(LOW,IAXIS) + 1 jSize = blkLimitsGC(HIGH,JAXIS) - blkLimitsGC(LOW,JAXIS) + 1 kSize = blkLimitsGC(HIGH,KAXIS) - blkLimitsGC(LOW,KAXIS) + 1 allocate(xCenter(iSize)) allocate(yCenter(jSize)) allocate(zCenter(kSize)) allocate(rho(iSize)) allocate(pres(iSize)) allocate(temp(iSize)) allocate(game(iSize)) allocate(gamc(iSize)) allocate(vx(iSize)) allocate(vy(iSize)) allocate(vz(iSize)) allocate(ener(iSize)) allocate(eint(iSize)) ! GFF - 6 Sep 09 xCenter(:) = 0.0 yCenter(:) = 0.0 zCenter(:) = 0.0 !Initialize vectors. If we don't do this, we store uninitialized data in the !guardcells. This probably does not matter as the internal data is !initialized, however, it stops uninitialized data run time warnings. rho(:) = 0.0; pres(:) = 0.0; temp(:) = 0.0; game(:) = 0.0; gamc(:) = 0.0; vx(:) = 0.0; vy(:) = 0.0; vz(:) = 0.0; ener(:) = 0.0; if (NDIM == 3) call Grid_getCellCoords & (KAXIS, blockId, CENTER, gcell, zCenter, kSize) if (NDIM >= 2) call Grid_getCellCoords & (JAXIS, blockId, CENTER,gcell, yCenter, jSize) call Grid_getCellCoords(IAXIS, blockId, CENTER, gcell, xCenter, iSize) !----------------------------------------------------------------------------- ! loop over all the zones in the current block and set the temperature, ! density, and thermodynamics variables. !----------------------------------------------------------------------------- do k = blkLimits(LOW,KAXIS),blkLimits(HIGH,KAXIS) zk = zCenter(k) do j = blkLimits(LOW,JAXIS),blkLimits(HIGH,JAXIS) yj = yCenter(j) do i = blkLimits(LOW,IAXIS),blkLimits(HIGH,IAXIS) xi = xCenter(i) !!====================================================================== !! Following Antiochus,et.al (1999) calculate the density and pressure !! using the barometric altitude formula for the gas pressure and the !! gas density in the chromosphere and corona. For now, set density !! and temperature here and calculate pressure using call to eos() if (xi <= sim_HeightChr) then rho(i) = sim_rho0Chr * exp(-xi / sim_scaleHgtChr) temp(i) = sim_TChr else rho(i) = sim_rho0Cor * exp(-(xi - sim_HeightChr) / sim_scaleHgtCor) temp(i) = sim_TCor endif !!====================================================================== !Copy in Electron & Hydrogen massFrac(1:2) = sim_specXfrac(1:2) !---------------------------------------------------------- ! get the pressure and internal energy corresponding to ! density and temperature. FLASH3 uses different interface to ! Eos call. ! FLASH2 FLASH3 ! input = 1: temperature, density given MODE_DENS_TEMP ! input = 2: internal energy, density given MODE_DENS_EI ! input = 3: density, pressure given MODE_DENS_PRESS eosData(:) = 0.0 eosData(EOS_DENS) = rho(i) !!NEI sim_rhoAmbient eosData(EOS_TEMP) = temp(i) !!NEI temp_zone call Eos(MODE_DENS_TEMP,vecLen,eosData,massFrac) vx(i) = sim_plasmaVel vy(i) = 0.0 vz(i) = 0.0 !! Get pressure, internal and total energy pres(i) = eosData(EOS_PRES) eint(i) = eosData(EOS_EINT) ! GFF - 6 Sep 09 ener(i) = eosData(EOS_EINT) + 0.5*(vx(i)**2 + vy(i)**2 + vz(i)**2) game(i) = sim_Gamma gamc(i) = sim_Gamma !----------------------------------------------------------------------------- ! finally, fill the solution array !----------------------------------------------------------------------------- cellIndex(IAXIS)=i; cellIndex(JAXIS)=j; cellIndex(KAXIS)=k do n = 1, NSPECIES call Grid_putPointData(blockID, CENTER, SPECIES_BEGIN+n-1, EXTERIOR, & cellIndex, massFrac(n)) enddo enddo startingPos(IAXIS)=blkLimitsGC(LOW,IAXIS); startingPos(JAXIS)=j; startingPos(KAXIS)=k call Grid_putRowData(blockID,CENTER,DENS_VAR,EXTERIOR,IAXIS,& startingPos,rho,iSize) call Grid_putRowData(blockID,CENTER,ENER_VAR,EXTERIOR,IAXIS,& startingPos,ener,iSize) call Grid_putRowData(blockID,CENTER,EINT_VAR,EXTERIOR,IAXIS,& ! GFF - 6 Sep 09 startingPos,ener,iSize) call Grid_putRowData(blockID,CENTER,TEMP_VAR,EXTERIOR,IAXIS,& startingPos,temp,iSize) call Grid_putRowData(blockID,CENTER,PRES_VAR,EXTERIOR,IAXIS,& startingPos,pres,iSize) call Grid_putRowData(blockID,CENTER,VELX_VAR,EXTERIOR,IAXIS,& startingPos,vx,iSize) call Grid_putRowData(blockID,CENTER,VELY_VAR,EXTERIOR,IAXIS,& startingPos,vy,iSize) call Grid_putRowData(blockID,CENTER,VELZ_VAR,EXTERIOR,IAXIS,& startingPos,vz,iSize) call Grid_putRowData(blockID,CENTER,GAME_VAR,EXTERIOR,IAXIS,& startingPos,game,iSize) call Grid_putRowData(blockID,CENTER,GAMC_VAR,EXTERIOR,IAXIS,& startingPos,gamc,iSize) enddo enddo deallocate(xCenter) deallocate(yCenter) deallocate(zCenter) deallocate(rho) deallocate(pres) deallocate(temp) deallocate(game) deallocate(gamc) deallocate(vx) deallocate(vy) deallocate(vz) deallocate(ener) deallocate(eint) ! GFF - 6 Sep 09 return end subroutine Simulation_initBlock