コード例 #1
0
 def __init__(self, dx, dy, hdcoef, hacoef, vdcoef, **kwds):
     Cvode.__init__(self, **kwds)
     
     self.dx = dx
     self.dy = dy
     self.hdcoef = hdcoef
     self.hacoef = hacoef
     self.vdcoef = vdcoef
コード例 #2
0
ファイル: harmonic_ad.py プロジェクト: jetuk/cython-sundials
 def __init__(self, mx, dx, hdcoef, hacoef, freq, **kwds):
     Cvode.__init__(self, **kwds)
     
     self.mx = mx
     self.dx = dx
     self.hdcoef = hdcoef
     self.hacoef = hacoef
     self.freq = freq
コード例 #3
0
    def __init__(self, *args, **kwds):
        Cvode.__init__(self, *args, **kwds)

        # Allocate memory for data structure of type UserData

        self.P = np.empty((MX, MY, NUM_SPECIES, NUM_SPECIES))
        self.Jbd = np.empty((MX, MY, NUM_SPECIES, NUM_SPECIES))
        self.pivot = np.empty((MX, MY, NUM_SPECIES), dtype=np.int64)

        # Load problem constants in data

        self.om = PI / HALFDAY
        self.dx = (XMAX - XMIN) / (MX - 1)
        self.dy = (YMAX - YMIN) / (MY - 1)
        self.hdco = KH / self.dx**2
        self.haco = VEL / (TWO * self.dx)
        self.vdco = (ONE / self.dy**2) * KV0
コード例 #4
0
    def __init__(self, *args, **kwds):
        Cvode.__init__(self,*args,**kwds)
    
        # Allocate memory for data structure of type UserData 
    
        self.P = np.empty( (MX,MY,NUM_SPECIES, NUM_SPECIES) )
        self.Jbd = np.empty( (MX,MY,NUM_SPECIES, NUM_SPECIES) )
        self.pivot = np.empty( (MX,MY,NUM_SPECIES), dtype=np.int64 )


        # Load problem constants in data 

        self.om = PI/HALFDAY
        self.dx = (XMAX-XMIN)/(MX-1)
        self.dy = (YMAX-YMIN)/(MY-1)
        self.hdco = KH/self.dx**2
        self.haco = VEL/(TWO*self.dx)
        self.vdco = (ONE/self.dy**2)*KV0
コード例 #5
0
    def __init__(self, *args, **kwds):
        """
        Initialise User Data
        """
        Cvode.__init__(self, **kwds)

        ns = self.ns = NS

        self.P = np.empty((NGX, NGY, NS, NS))
        self.pivot = np.empty(NS, dtype=np.int64)

        self.rewt = NvectorNdarrayFloat64(SHP)

        self.jgx = np.empty(NGX + 1, dtype=np.int64)
        self.jgy = np.empty(NGY + 1, dtype=np.int64)
        self.jigx = np.empty(MX, dtype=np.int64)
        self.jigy = np.empty(MY, dtype=np.int64)

        self.jxr = np.empty(NGX, dtype=np.int64)
        self.jyr = np.empty(NGY, dtype=np.int64)

        self.acoef = np.empty((NS, NS))
        self.bcoef = np.empty(NS)
        self.diff = np.empty(NS)
        self.cox = np.empty(NS)
        self.coy = np.empty(NS)
        self.fsave = np.empty(SHP)

        for j in range(NS):
            for i in range(NS):
                self.acoef[i, j] = 0.

        for j in range(NP):
            for i in range(NP):
                self.acoef[NP + i][j] = EE
                self.acoef[i][NP + j] = -GG
            self.acoef[j, j] = -AA
            self.acoef[NP + j, NP + j] = -AA
            self.bcoef[j] = BB
            self.bcoef[NP + j] = -BB
            self.diff[j] = DPREY
            self.diff[NP + j] = DPRED

        # Set remaining problem parameters

        self.mxns = MXNS
        dx = self.dx = DX
        dy = self.dy = DY
        for i in range(ns):
            self.cox[i] = self.diff[i] / np.sqrt(dx)
            self.coy[i] = self.diff[i] / np.sqrt(dy)

        # Set remaining method parameters

        self.mp = MP
        self.mq = MQ
        self.mx = MX
        self.my = MY
        self.srur = np.sqrt(UNIT_ROUNDOFF)
        self.mxmp = MXMP
        self.ngrp = NGRP
        self.ngx = NGX
        self.ngy = NGY
        self.SetGroups(MX, NGX, self.jgx, self.jigx, self.jxr)
        self.SetGroups(MY, NGY, self.jgy, self.jigy, self.jyr)