File: ed0.py

package info (click to toggle)
pysph 0~20180411.git1ae58e1-2.1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 6,348 kB
  • sloc: python: 34,214; sh: 459; cpp: 206; makefile: 193; ansic: 168
file content (25 lines) | stat: -rw-r--r-- 614 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import numpy as np
from pysph.base.utils import get_particle_array
from pysph.solver.application import Application


class EllipticalDrop(Application):
    def create_particles(self):
        dx = 0.025
        x, y = np.mgrid[-1.05:1.05:dx, -1.05:1.05:dx]
        mask = x*x + y*y < 1
        x = x[mask]
        y = y[mask]
        rho = 1.0
        h = 1.3*dx
        m = rho*dx*dx
        pa = get_particle_array(
            name='fluid', x=x, y=y, u=-100*x, v=100*y, rho=rho,
            m=m, h=h
        )
        return [pa]


if __name__ == '__main__':
    app = EllipticalDrop(fname='ed')
    app.run()