Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python3
- import math
- import json
- # test formulations
- # vel1 = '0 + (y - yc)*(eps/(2d0*pi))*exp(beta*(1d0 - (x - xc)**2 - (y - yc)**2))'
- # vel2 = '0 - (x - xc)*(eps/(2d0*pi))*exp(beta*(1d0 - (x - xc)**2 - (y - yc)**2))'
- # pres = '1*(1d0 - (patch_icpp(1)%rho/patch_icpp(1)%pres)*(eps/(2d0*pi))*(eps/(8d0*beta*(patch_icpp(1)%gamma + 1d0)*pi))*exp(2d0*beta*(1d0 - (x - xc)**2 - (y - yc)**2)))**(patch_icpp(1)%gamma + 1d0)'
- # alpha_rho1 = '1*(1d0 - (patch_icpp(1)%rho/patch_icpp(1)%pres)*(eps/(2d0*pi))*(eps/(8d0*beta*(patch_icpp(1)%gamma + 1d0)*pi))*exp(2d0*beta*(1d0 - (x - xc)**2 - (y - yc)**2)))**patch_icpp(1)%gamma'
- # original formulation
- # vel1 = 'patch_icpp(1)%vel(1) + (y - yc)*(eps/(2d0*pi))*exp(beta*(1d0 - (x - xc)**2 - (y - yc)**2))'
- # vel2 = 'patch_icpp(1)%vel(2) - (x - xc)*(eps/(2d0*pi))*exp(beta*(1d0 - (x - xc)**2 - (y - yc)**2))'
- # pres = 'patch_icpp(1)%pres*(1d0 - (patch_icpp(1)%rho/patch_icpp(1)%pres)*(eps/(2d0*pi))*(eps/(8d0*beta*(patch_icpp(1)%gamma + 1d0)*pi))*exp(2d0*beta*(1d0 - (x - xc)**2 - (y - yc)**2)))**(patch_icpp(1)%gamma + 1d0)'
- # alpha_rho1 = 'patch_icpp(1)%rho*(1d0 - (patch_icpp(1)%rho/patch_icpp(1)%pres)*(eps/(2d0*pi))*(eps/(8d0*beta*(patch_icpp(1)%gamma + 1d0)*pi))*exp(2d0*beta*(1d0 - (x - xc)**2 - (y - yc)**2)))**patch_icpp(1)%gamma'
- # temperature formulation
- # T = '1 - ((patch_icpp(1)%gamma - 1d0) * beta**2)/(8d0 * patch_icpp(1)%gamma * pi**2) * exp(1d0 - (x - xc)**2 - (y - yc)**2)'
- # T = '1'
- # alpha_rho1 = f'1 + {T}**(1d0/(patch_icpp(1)%gamma - 1d0))'
- # pres = f'patch_icpp(1)%rho * {T}'
- # pres = f'1 + patch_icpp(1)%rho ** patch_icpp(1)%gamma'
- vel1 = '0'
- vel2 = '0'
- pres = '1d0'
- alpha_rho1 = '1d0'
- # Numerical setup
- Nx = 400
- dx = 1./(1.*(Nx+1))
- c = 600
- C = 0.3
- mydt = C * dx / c
- Nt = 10000
- Tend = 1
- # Configuring case dictionary
- print(json.dumps({
- # Logistics ================================================================
- 'run_time_info' : 'T',
- # ==========================================================================
- # Computational Domain Parameters ==========================================
- 'x_domain%beg' : -5.,
- 'x_domain%end' : 5.,
- 'y_domain%beg' : -5.,
- 'y_domain%end' : 5.,
- 'm' : Nx,
- 'n' : Nx,
- 'p' : 0,
- 'dt' : mydt,
- 't_step_start' : 0,
- 't_step_stop' : int(Nt),
- 't_step_save' : math.ceil(Nt/10.),
- # ==========================================================================
- # Simulation Algorithm Parameters ==========================================
- 'num_patches' : 1,
- 'model_eqns' : 3,
- 'alt_soundspeed' : 'F',
- 'num_fluids' : 1,
- 'adv_alphan' : 'T',
- 'mpp_lim' : 'F',
- 'mixture_err' : 'F',
- 'time_stepper' : 3,
- 'weno_order' : 3,
- 'weno_eps' : 1.E-16,
- 'mapped_weno' : 'T',
- 'null_weights' : 'F',
- 'mp_weno' : 'F',
- 'riemann_solver' : 2,
- 'wave_speeds' : 1,
- 'avg_state' : 2,
- 'bc_x%beg' : -1,
- 'bc_x%end' : -1,
- 'bc_y%beg' : -1,
- 'bc_y%end' : -1,
- # ==========================================================================
- # Formatted Database Files Structure Parameters ============================
- 'format' : 1,
- 'precision' : 2,
- 'prim_vars_wrt' :'T',
- 'parallel_io' :'T',
- # ==========================================================================
- # Patch 1 ==================================================================
- 'patch_icpp(1)%geometry' : 6,
- 'patch_icpp(1)%x_centroid' : 0.,
- 'patch_icpp(1)%y_centroid' : 0.,
- 'patch_icpp(1)%epsilon' : 5.,
- 'patch_icpp(1)%beta' : 5.,
- 'patch_icpp(1)%radius' : 5.,
- 'patch_icpp(1)%length_x' : 10.,
- 'patch_icpp(1)%length_y' : 10.,
- 'patch_icpp(1)%vel(1)' : vel1,
- 'patch_icpp(1)%vel(2)' : vel2,
- 'patch_icpp(1)%pres' : pres,
- 'patch_icpp(1)%rho' : 1,
- 'patch_icpp(1)%alpha_rho(1)' : alpha_rho1,
- 'patch_icpp(1)%alpha(1)' : 1.,
- # ==========================================================================
- # Fluids Physical Parameters ===============================================
- 'fluid_pp(1)%gamma' : 1.E+00/(1.4-1.E+00),
- 'fluid_pp(1)%pi_inf' : 0.0,
- # ==========================================================================
- }))
- # ==============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement