Solver: CDIFS
Description: Taylor-Green vortex
References: Abdelsamiei A., et al. The Taylor–Green vortex as a benchmark for high-fidelity combustion simulations using low-Mach solvers. Computers & Fluids, Volume 223, 2021.
| Type | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|
| type(block_obj) | :: | block |
Block object manages the Cartesian grid |
|||
| type(parallel_obj) | :: | parallel |
Utility that handles parallel (MPI) functions |
|||
| type(parser_obj) | :: | parser |
Utility that parses input files |
Defines boundary conditions.
Builds and writes block file.
Builds and writes initial fields.
program main !>-------------------------------------------------------------------------- ! Program: Taylor Green ! Author: Mohamed Houssem Kasbaoui ! ! Solver: CDIFS ! ! Description: Taylor-Green vortex ! ! References: ! Abdelsamiei A., et al. The Taylor–Green vortex as a benchmark for ! high-fidelity combustion simulations using low-Mach solvers. ! Computers & Fluids, Volume 223, 2021. ! -------------------------------------------------------------------------- use leapKinds use leapParser use leapParallel use leapBlock use leapEulerian implicit none type(parallel_obj) :: parallel !! Utility that handles parallel (MPI) functions type(parser_obj) :: parser !! Utility that parses input files type(block_obj) :: block !! Block object manages the Cartesian grid ! Initialize parser call parser%Initialize() ! Parse input file call parser%ParseFile() ! Initialize parallel environment call parallel%Initialize() ! Set the block info call SetUpCaseBlock() ! Set the initial fields call SetUpCaseFields() ! Set boundary conditions call SetUpCaseBCS() ! Free up data call block%Finalize() call parser%Finalize() call parallel%Finalize() contains subroutine SetUpCaseBlock() !> Builds and writes block file. implicit none ! Work variables character(str64) :: filename real(wp) :: L(3) integer :: N(3) integer :: ngc integer :: Nb(3) real(wp) :: xlo(3) real(wp) :: xhi(3) integer :: ilo(3) integer :: ihi(3) ! Get info from parser call parser%Get("Block file", filename) call parser%Get("Domain size", L ) call parser%Get("Grid points", N ) call parser%Get("Ghost cells", ngc ) call parser%Get("Partition", Nb ) ! Domain extents xlo=-0.5_wp*L ; xhi= 0.5_wp*L ilo=[1,1,1] ; ihi=N ! Initialize the main block call block%Initialize(ngc,parallel) ! Setup the domain periodicity call block%SetPeriodicity([.true.,.true.,.true.]) ! Create a uniform block call block%SetupUniformGrid(xlo,xhi,ilo,ihi) ! Partition block for parallel initializations call block%Partition(Nb) ! Write block to disk call block%Write(filename) return end subroutine SetUpCaseBlock subroutine SetUpCaseFields() !> Builds and writes initial fields. implicit none ! Work variables type(Eulerian_set) :: fields type(eulerian_obj_r) :: V(3) type(eulerian_obj_r) :: P character(str64) :: filename real(wp) :: L(3) real(wp) :: Vamp real(wp) :: rho real(wp) :: mu real(wp) :: Rey integer :: i,j,k real(wp),parameter :: twoPi=8.0_wp*atan(1.0_wp) ! Get info from parser call parser%Get("Fields IC file", filename) call parser%Get("Domain size", L ) call parser%Get("Velocity amplitude", Vamp ) call parser%Get("Fluid density", rho ) call parser%Get("Fluid viscosity", mu ) ! Initialize fields container call fields%Initialize(block,parallel) ! Add fields to container (this will allocate data) call fields%Add('V1', 1, V(1)) call fields%Add('V2', 2, V(2)) call fields%Add('V3', 3, V(3)) call fields%Add('P', 0, P ) associate (lo => block%lo, hi=> block%hi, & x =>block%x , y =>block%y, z => block%z, & xm=>block%xm, ym=>block%ym, zm=> block%zm) L=L/twoPi do k=lo(3),hi(3) do j=lo(2),hi(2) do i=lo(1),hi(1) V(1)%cell(i,j,k) = Vamp*sin(x (i)/L(1))*cos(ym(j)/L(2))*cos(zm(k)/L(3)) V(2)%cell(i,j,k) =-Vamp*cos(xm(i)/L(1))*sin(y (j)/L(2))*cos(zm(k)/L(3)) V(3)%cell(i,j,k) = 0.0_wp end do end do end do P = 0.0_wp end associate ! Write some info to stdout if (parallel%RankIsRoot()) then ! Reynolds number Rey = rho/mu*Vamp*maxval(L) write(*,*) "Reynolds number = ", Rey write(*,*) "Reference time = ", maxval(L)/Vamp end if ! Write data to disk call fields%SetWriteFileName(filename) call fields%Write(0,0.0_wp) ! Clear data call fields%Finalize() return end subroutine SetUpCaseFields subroutine SetUpCaseBCS() !> Defines boundary conditions. use leapBC implicit none ! Work variables type(bc_set) :: bcs ! Initialize utility that handles boundary conditions call bcs%Initialize(block,parallel) ! Fully-periodic, nothing to do ! Write boundary conditions call bcs%Write(0,0.0_wp) ! Clear data call bcs%Finalize() return end subroutine SetUpCaseBCS end program main