示例#1
0
    def __init__(self, app, arr_names, corr='shepard', freq=10, kernel=None):
        """
        Parameters
        ----------

        app : pysph.solver.application.Application.
            The application instance.
        arr_names : array
            Names of the particle arrays whose densities needs to be
            reinitialized.
        corr : str
            Name of the density reinitialization operation.
            corr='shepard' for using zeroth order shepard filter
        freq : int
            Frequency of reinitialization.
        kernel: any kernel from pysph.base.kernels

        """
        from pysph.solver.utils import get_array_by_name
        self.freq = freq
        self.corr = corr
        self.names = arr_names
        self.count = 1
        self._sph_eval = None
        self.kernel = kernel
        self.dim = app.solver.dim
        self.particles = app.particles
        self.arrs = [get_array_by_name(self.particles, i) for i in self.names]
        options = ['shepard', 'mls2d_1', 'mls3d_1']
        assert self.corr in options, 'corr should be one of %s' % options
示例#2
0
    def __init__(self, app, array_name, freq=1, shift_kind='simple',
                 correct_velocity=False, parameter=None):
        """
        Parameters
        ----------

        app : pysph.solver.application.Application.
            The application instance.
        arr_name : array
            Name of the particle array whose position needs to be
            shifted.
        freq : int
            Frequency to apply particle position shift.
        shift_kind: str
            Kind to shift to apply available are "simple" and "fickian".
        correct_velocity: bool
            Correct velocities after shift in particle position.
        parameter: float
            Correct velocities after shift in particle position.
        """
        from pysph.solver.utils import get_array_by_name
        self.particles = app.particles
        self.dt = app.solver.dt
        self.dim = app.solver.dim
        self.kernel = app.solver.kernel
        self.array = get_array_by_name(self.particles, array_name)
        self.freq = freq
        self.kind = shift_kind
        self.correct_velocity = correct_velocity
        self.parameter = parameter
        self.count = 1
        self._sph_eval = None
        options = ['simple', 'fickian']
        assert self.kind in options, 'shift_kind should be one of %s' % options
示例#3
0
    def __init__(self,
                 app,
                 array_name,
                 props,
                 freq=100,
                 xi=None,
                 yi=None,
                 zi=None,
                 kernel=None,
                 equations=None):
        """Constructor.

        Parameters
        ----------

        app : pysph.solver.application.Application
            The application instance.
        array_name: str
            Name of the particle array that needs to be remeshed.
        props : list(str)
            List of properties to interpolate.
        freq : int
            Frequency of remeshing operation.
        xi, yi, zi : ndarray
            Positions to remesh the properties onto.  If not specified they
            are taken from the particle arrays at the time of construction.
        kernel: any kernel from pysph.base.kernels

        equations: list or None
            Equations to use for the interpolation, passed to the interpolator.

        """
        from pysph.solver.utils import get_array_by_name
        self.app = app
        self.particles = app.particles
        self.array = get_array_by_name(self.particles, array_name)
        self.props = props
        if xi is None:
            xi = self.array.x
        if yi is None:
            yi = self.array.y
        if zi is None:
            zi = self.array.z
        self.xi, self.yi, self.zi = xi.copy(), yi.copy(), zi.copy()
        self.freq = freq
        from pysph.tools.interpolator import Interpolator
        if kernel is None:
            kernel = app.solver.kernel
        self.interp = Interpolator(self.particles,
                                   x=self.xi,
                                   y=self.yi,
                                   z=self.zi,
                                   kernel=kernel,
                                   domain_manager=app.create_domain(),
                                   equations=equations)
    def __init__(self, app, freq=10):
        """
        Parameters
        ----------

        app : pysph.solver.application.Application.
            The application instance.
        freq : int
            Frequency of reinitialization.
        satellite : object

        """
        from pysph.solver.utils import get_array_by_name
        self.freq = freq
        self.satellite = app.satellite
        self.particles = app.particles
        self.boundary_l = get_array_by_name(self.particles, 'boundary_l')
        self.boundary_r = get_array_by_name(self.particles, 'boundary_r')
        self.boundary_t = get_array_by_name(self.particles, 'boundary_t')
        self.boundary_b = get_array_by_name(self.particles, 'boundary_b')
        self.boundary_ft = get_array_by_name(self.particles, 'boundary_ft')
        self.boundary_bk = get_array_by_name(self.particles, 'boundary_bk')
        self.SOLAR_CONST = SOLAR_CONST

        # initial run
        self._flux_update(t_i=0)