Пример #1
0
    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
Пример #2
0
 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
Пример #3
0
import cProfile
import matplotlib.pyplot as plt
import numpy as np 

import flowdyn.mesh2d as mesh2d
from flowdyn.field import *
from flowdyn.xnum  import *
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
Пример #4
0
import flowdyn.mesh2d as mesh2d
from flowdyn.field import *
import flowdyn.xnum as xn
import flowdyn.integration as tn
import flowdyn.modelphy.euler as euler
import flowdyn.modeldisc as modeldisc
#import flowdyn.solution.euler_riemann as sol

nx = 100
ny = 100
lx = 10
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,