def case_solver(self, nx, ny, xnum, flux): meshsim = mesh2d.unimesh(nx, ny) bcper = {'type': 'per'} bclist = {tag: bcper for tag in meshsim.list_of_bctags()} model = euler.euler2d() rhs = modeldisc.fvm2d(model, meshsim, num=xnum, numflux=flux, bclist=bclist) solver = integ.rk3ssp(meshsim, rhs) def fuv(x, y): return euler.datavector(0. * x + .4, 0. * x + .2) def fp(x, y): # gamma = 1.4 return 0. * x + 1. def frho(x, y): return 1.4 * (1 + .2 * np.exp(-((x - .5)**2 + (y - .5)**2) / (.1)**2)) xc, yc = meshsim.centers() finit = rhs.fdata_fromprim([frho(xc, yc), fuv(xc, yc), fp(xc, yc)]) # rho, (u,v), p return solver, finit
def case_solver(self, nx, ny, xnum, flux, bcL, bcR): meshsim = mesh2d.unimesh(nx, ny) bcsym = {'type': 'sym'} bclist = {'top': bcsym, 'bottom': bcsym, 'left': bcL, 'right': bcR} model = euler.euler2d() rhs = modeldisc.fvm2d(model, meshsim, num=xnum, numflux=flux, bclist=bclist) solver = integ.rk3ssp(meshsim, rhs) finit = rhs.fdata_fromprim([1., [0.8, 0.], 1.]) # rho, (u,v), p return solver, finit
import flowdyn.integration as integ import flowdyn.modelphy.euler as euler import flowdyn.modeldisc as modeldisc #import flowdyn.solution.euler_riemann as sol nx = 100 ny = 100 meshsim = mesh2d.unimesh(nx, ny) model = euler.euler2d() #bcL = { 'type': 'insub', 'ptot': 1.4, 'rttot': 1. } bcR = { 'type': 'outsub', 'p': 1. } rhs = modeldisc.fvm2d(model, meshsim, num=None, numflux='centered', bclist={} ) solver = integ.rk4(meshsim, rhs) # computation # endtime = 5. cfl = 2. # initial functions def fuv(x,y): vmag = .01 ; k = 10. return euler.datavector(0.*x+.4, 0.*x+.2) def fp(x,y): # gamma = 1.4 return 0.*x+1. def frho(x,y): return 1.4 * (1.+.5*np.exp(-((x-.5)**2+(y-.5)**2)/(.1)**2))
nx = 50 ny = 50 meshsim = mesh2d.unimesh(nx, ny) model = euler.euler2d() #bcL = { 'type': 'insub', 'ptot': 1.4, 'rttot': 1. } #bcR = { 'type': 'outsub', 'p': 1. } bcper = { 'type': 'per' } bcsym = { 'type': 'sym' } rhs = modeldisc.fvm2d(model, meshsim, num=xn.extrapol2dk(1./3.), # num=xn.extrapol2d1(), numflux='hlle', bclist={'left': bcper, 'right': bcper, 'top': bcsym, 'bottom': bcsym} ) # bclist={'left': bcsym, 'right': bcsym, 'top': bcsym, 'bottom': bcsym} ) solver = integ.rk3ssp(meshsim, rhs) # computation # endtime = 5. cfl = 1. # initial functions def fuv(x,y): #vmag = .01 ; k = 10. return euler.datavector(0.*x+.4, 0.*x) def fp(x,y): # gamma = 1.4 return 0.*x+1.
ly = 10 gam = 1.4 b = 1.5 meshsim = mesh2d.unimesh(nx, ny, lx, ly) model = euler.euler2d() bcper = {'type': 'per'} bcsym = {'type': 'sym'} xnum = xn.extrapol2dk(k=1. / 3.) #xnum=xn.extrapol2d1() rhs = modeldisc.fvm2d(model, meshsim, num=xnum, numflux='hlle', bclist={ 'left': bcper, 'right': bcper, 'top': bcper, 'bottom': bcper }) solver = tn.rk3ssp(meshsim, rhs) # computation # endtime = 20. cfl = 1. # initial functions def fuv(x, y): r = np.sqrt((x - lx / 2)**2 + (y - ly / 2)**2)