Exemplo n.º 1
0
        public void Diffusion(DiffusionTypes dt, Fluid f, double md_t, double scale)
        {
            scale /= 100d;

            switch (dt)
            {
            case DiffusionTypes.Velocity:
                Diffusion(ref mp_xv0, ref mp_xv1, f, t_width, t_height, m_dt, scale);
                Engine.Calc.Math.Swap(ref mp_xv0, ref mp_xv1);
                Diffusion(ref mp_yv0, ref mp_yv1, f, t_width, t_height, m_dt, scale);
                Engine.Calc.Math.Swap(ref mp_yv0, ref mp_yv1);
                break;

            case DiffusionTypes.Pressure:
                Diffusion(ref mp_p0, ref mp_p1, f, t_width, t_height, m_dt, scale);
                Engine.Calc.Math.Swap(ref mp_p0, ref mp_p1);
                break;

            default:
                throw new ArgumentOutOfRangeException(String.Format("In FluidPlane.Diffusion() DiffusionType {0} is not supported.", dt.ToString()));
            }
        }
Exemplo n.º 2
0
        public void ForwardAdvection(DiffusionTypes dt, double scale)
        {
            scale /= 100d;

            switch (dt)
            {
            case DiffusionTypes.Velocity:
                ForwardAdvection(ref mp_xv0, ref mp_xv1, scale);
                ForwardAdvection(ref mp_yv0, ref mp_yv1, scale);

                // in original code, swapping for both x and y is done after x and y advection
                Engine.Calc.Math.Swap(ref mp_xv0, ref mp_xv1);
                Engine.Calc.Math.Swap(ref mp_yv0, ref mp_yv1);
                break;

            case DiffusionTypes.Pressure:
                ForwardAdvection(ref mp_p0, ref mp_p1, scale);
                Engine.Calc.Math.Swap(ref mp_p0, ref mp_p1);
                break;

            default:
                throw new ArgumentOutOfRangeException(String.Format("In FluidPlane.Diffusion() DiffusionType {0} is not supported.", dt.ToString()));
            }
        }