def get_equations(self): all = self.fluids all_eqns = [] # Compute Viscous and Body forces stg1 = self._get_viscous_eqns() all_eqns.append(stg1) stg2 = self._get_ppe() # Compute acceleration due to pressure, initialize au/av/aw to 0. eq4 = [] for fluid in self.fluids: if self.symmetric: eq4.append( MomentumEquationPressureGradientSymmetric( dest=fluid, sources=all ) ) else: eq4.append( MomentumEquationPressureGradient(dest=fluid, sources=all) ) stg2.append(Group(equations=eq4)) all_eqns.append(stg2) return MultiStageEquations(all_eqns)
def get_equations(self): all = self.fluids + self.solids stage0 = [] eq1 = [] if self.solids: for solid in self.solids: eq1.append(EvaluateNumberDensity(dest=solid, sources=self.fluids)) for fluid in self.fluids: eq1.append(GradientCorrectionPreStep(dest=fluid, sources=all, dim=self.dim)) eq1.append(GradientCorrection(dest=fluid, sources=all, dim=self.dim)) eq1.append(ContinuityEquationDeltaSPHPreStep(dest=fluid, sources=all)) stage0.append(Group(equations=eq1, real=False)) eq2 = [] for fluid in self.fluids: eq2.append(ContinuityEquation(dest=fluid, sources=all)) eq2.append(ContinuityEquationDeltaSPH(dest=fluid, sources=all, c0=self.c0)) stage0.append(Group(equations=eq2, real=False)) eq3 = [] for fluid in self.fluids: eq3.append(IsothermalEOS(dest=fluid, sources=None, rho0=self.rho0, c0=self.c0, p0=0.0)) stage0.append(Group(equations=eq3, real=False)) if self.solids: eq4 = [] for solid in self.solids: eq4.append(SetWallVelocity(dest=solid, sources=self.fluids)) eq4.append(SetPressureSolid(dest=solid, sources=self.fluids, rho0=self.rho0, p0=self.p0)) stage0.append(Group(equations=eq4, real=False)) eq5 = [] for fluid in self.fluids: eq5.append(LaminarViscosityDeltaSPHPreStep(dest=fluid, sources=self.fluids)) eq5.append(LaminarViscosityDeltaSPH(dest=fluid, sources=self.fluids, dim=self.dim, rho0=self.rho0, nu=self.nu)) if self.solids: eq5.append(SolidWallNoSlipBC(dest=fluid, sources=self.solids, nu=self.nu)) eq5.append(Spatial_Acceleration(dest=fluid, sources=self.fluids)) stage0.append(Group(equations=eq5, real=True)) stage1 = [] eq6 = [] for fluid in self.fluids: eq6.append(GradientCorrectionPreStep(dest=fluid, sources=all, dim=self.dim)) eq6.append(GradientCorrection(dest=fluid, sources=all, dim=self.dim)) eq6.append(PST_PreStep_1(dest=fluid, sources=all, dim=self.dim, boundedFlow=self.boundedFlow)) eq6.append(PST_PreStep_2(dest=fluid, sources=all, boundedFlow=self.boundedFlow)) stage1.append(Group(equations=eq6, real=False)) eq7 = [] for fluid in self.fluids: eq7.append(PST(dest=fluid, sources=all, h=self.h0, dt=self.dt, dx=self.dx, c0=self.c0, boundedFlow=self.boundedFlow, gamma=self.gamma)) stage1.append(Group(equations=eq7, real=False)) return MultiStageEquations([stage0,stage1])
def create_equations(self): equations = [ Group(equations=[ circular_velocity(dest='fluid', sources=None, R=self.R), circular_acceleration(dest='fluid', sources=None, R=self.R), ], real=True), ] return MultiStageEquations([ equations, ])
def create_equations(self): ''' Set-up governing equations ''' stage1 = [ Group( equations=[ EOS_DPSPH( dest='fluid', sources=['fluid'],rho0=self.rho0, c0= self.c0 ), ], real=False ), Group( equations=[ RenormalizationTensor2D_DPSPH( dest='fluid', sources=['fluid'], dim=2 ), RDGC_DPSPH( dest='fluid', sources=['fluid'], dim=2 ), ContinuityEquation_RDGC_DPSPH( dest='fluid', sources=['fluid'], delta=0.1, c0=self.c0, H=self.h0, dim=2 ), MomentumEquation_DPSPH( dest='fluid', sources=['fluid'], dim=2, mu=self.mu ), ], real=True ) ] stage2 = [ Group( equations=[ AverageSpacing( dest='fluid', sources=['fluid'], dim=2 ), ParticleShiftingTechnique( dest='fluid', sources=['fluid'], H=self.h0, dim=2 ) ], real=True ) ] return MultiStageEquations([stage1, stage2])
def _make_integrator(self): arrays = [self.pa] kernel = CubicSpline(dim=self.dim) eqs = [[Eq1(dest='fluid', sources=['fluid'])], [Eq2(dest='fluid', sources=['fluid'])]] meqs = MultiStageEquations(eqs) a_evals = make_acceleration_evals(arrays, meqs, kernel, backend=self.backend) integrator = MyIntegrator(fluid=MyStepper()) comp = SPHCompiler(a_evals, integrator=integrator) comp.compile() nnps = self.NNPS_cls(dim=kernel.dim, particles=arrays) nnps.update() for ae in a_evals: ae.set_nnps(nnps) return integrator
def get_equations(self): all = self.fluids + self.solids all_solids = self.solids stg1 = [] if all_solids: g0 = self._get_velocity_bc() stg1.append(g0) stg1.extend(self._get_viscous_eqns()) stg2 = [] if all_solids: g0 = self._get_velocity_bc() stg2.append(g0) stg2.extend(self._get_ppe()) if all_solids: g3 = self._get_pressure_bc() stg2.append(g3) if all_solids: g0 = self._get_velocity_bc() stg2.append(g0) eq4 = [] for fluid in self.fluids: if self.symmetric: eq4.append( MomentumEquationPressureGradientSymmetric(fluid, all)) else: eq4.append(MomentumEquationPressureGradient(fluid, sources=all)) if self.gtvf: eq4.append( GTVFAcceleration(dest=fluid, sources=all, pref=self.pref, internal_flow=self.internal_flow, use_pref=self.use_pref)) stg2.append(Group(equations=eq4)) return MultiStageEquations([stg1, stg2])
def get_equations(self): from pysph.sph.wc.transport_velocity import StateEquation sources = self.fluids eq1, stage1 = [], [] for fluid in self.fluids: eq1.append(DensityEvolution(dest=fluid, sources=sources)) stage1.append(Group(equations=eq1, real=False)) eq2, stage2 = [], [] for fluid in self.fluids: eq2.append(CorrectDensity(dest=fluid, sources=sources)) stage2.append(Group(equations=eq2, real=False)) eq3 = [] for fluid in self.fluids: eq3.append( StateEquation(dest=fluid, sources=None, p0=self.p0, rho0=self.rho0, b=1.0) ) stage2.append(Group(equations=eq3, real=False)) eq4 = [] for fluid in self.fluids: eq4.append( MomentumEquationPressureGradient( dest=fluid, sources=sources, pref=self.pref, gx=self.gx, gy=self.gy, gz=self.gz )) if self.nu > 0.0: eq4.append( MomentumEquationViscosity( dest=fluid, sources=sources, nu=self.nu )) eq4.append( MomentumEquationArtificialStress( dest=fluid, sources=sources, dim=self.dim )) stage2.append(Group(equations=eq4, real=True)) return MultiStageEquations([stage1, stage2])
def get_equations(self): from pysph.sph.wc.transport_velocity import ( StateEquation, SetWallVelocity, SolidWallPressureBC, VolumeSummation, SolidWallNoSlipBC, MomentumEquationArtificialViscosity, ContinuitySolid) all = self.fluids + self.solids stage1 = [] if self.solids: eq0 = [] for solid in self.solids: eq0.append(SetWallVelocity(dest=solid, sources=self.fluids)) stage1.append(Group(equations=eq0, real=False)) eq1 = [] for fluid in self.fluids: eq1.append(ContinuityEquationGTVF(dest=fluid, sources=self.fluids)) if self.solids: eq1.append(ContinuitySolid(dest=fluid, sources=self.solids)) stage1.append(Group(equations=eq1, real=False)) eq2, stage2 = [], [] for fluid in self.fluids: eq2.append(CorrectDensity(dest=fluid, sources=all)) stage2.append(Group(equations=eq2, real=False)) eq3 = [] for fluid in self.fluids: eq3.append( StateEquation(dest=fluid, sources=None, p0=self.pref, rho0=self.rho0, b=1.0)) stage2.append(Group(equations=eq3, real=False)) g2_s = [] for solid in self.solids: g2_s.append(VolumeSummation(dest=solid, sources=all)) g2_s.append( SolidWallPressureBC(dest=solid, sources=self.fluids, b=1.0, rho0=self.rho0, p0=self.pref, gx=self.gx, gy=self.gy, gz=self.gz)) if g2_s: stage2.append(Group(equations=g2_s, real=False)) eq4 = [] for fluid in self.fluids: eq4.append( MomentumEquationPressureGradient(dest=fluid, sources=all, pref=self.pref, gx=self.gx, gy=self.gy, gz=self.gz)) if self.alpha > 0.0: eq4.append( MomentumEquationArtificialViscosity(dest=fluid, sources=all, c0=self.c0, alpha=self.alpha)) if self.nu > 0.0: eq4.append( MomentumEquationViscosity(dest=fluid, sources=all, nu=self.nu)) if self.solids: eq4.append( SolidWallNoSlipBC(dest=fluid, sources=self.solids, nu=self.nu)) eq4.append( MomentumEquationArtificialStress(dest=fluid, sources=self.fluids, dim=self.dim)) stage2.append(Group(equations=eq4, real=True)) return MultiStageEquations([stage1, stage2])
def get_equations(self): from pysph.sph.wc.viscosity import LaminarViscosity all = self.fluids equations_stage1 = [] equations_stage2 = [] eq00 = [] for fluid in self.fluids: eq00.append( StateEquation(dest=fluid, sources=None, gamma=self.gamma)) eq00.append( SpeedOfSound(dest=fluid, sources=None, gamma=self.gamma)) equations_stage1.append(Group(equations=eq00)) gh = [] for fluid in self.fluids: gh.append( CRKSPHUpdateGhostProps(dest=fluid, sources=None, dim=self.dim)) equations_stage1.append(Group(equations=gh, real=False)) eq0 = [] for fluid in self.fluids: eq0.append(NumberDensity(dest=fluid, sources=all)) equations_stage1.append(Group(equations=eq0, real=False)) if self.has_ghosts: gh = [] for fluid in self.fluids: gh.append( CRKSPHUpdateGhostProps(dest=fluid, sources=None, dim=self.dim)) equations_stage1.append(Group(equations=gh, real=False)) eq1 = [] for fluid in self.fluids: eq1.append(CRKSPHPreStep(dest=fluid, sources=all, dim=self.dim)) equations_stage1.append(Group(equations=eq1, real=False)) if self.has_ghosts: gh = [] for fluid in self.fluids: gh.append( CRKSPHUpdateGhostProps(dest=fluid, sources=None, dim=self.dim)) equations_stage1.append(Group(equations=gh, real=False)) eq2 = [] for fluid in self.fluids: eq2.extend([ CRKSPHSymmetric(dest=fluid, sources=all, dim=self.dim, tol=self.tol), SummationDensityCRKSPH(dest=fluid, sources=all) ]) equations_stage1.append(Group(equations=eq2, real=False)) eq3 = [] for fluid in self.fluids: eq3.append( StateEquation(dest=fluid, sources=None, gamma=self.gamma)) eq3.append(SpeedOfSound(dest=fluid, sources=None, gamma=self.gamma)) equations_stage1.append(Group(equations=eq3)) if self.has_ghosts: gh = [] for fluid in self.fluids: gh.append( CRKSPHUpdateGhostProps(dest=fluid, sources=None, dim=self.dim)) equations_stage1.append(Group(equations=gh, real=False)) eq4 = [] for fluid in self.fluids: eq4.extend([ CRKSPHSymmetric(dest=fluid, sources=all, dim=self.dim, tol=self.tol), VelocityGradient(dest=fluid, sources=all, dim=self.dim) ]) equations_stage1.append(Group(equations=eq4)) if self.has_ghosts: gh = [] for fluid in self.fluids: gh.append( CRKSPHUpdateGhostProps(dest=fluid, sources=None, dim=self.dim)) equations_stage1.append(Group(equations=gh, real=False)) eq5 = [] for fluid in self.fluids: eq5.append( CRKSPHSymmetric(dest=fluid, sources=all, dim=self.dim, tol=self.tol)) eq5.append( MomentumEquation(dest=fluid, sources=all, dim=self.dim, gx=self.gx, gy=self.gy, gz=self.gz, cl=self.cl, cq=self.cq, eta_crit=self.eta_crit, eta_fold=self.eta_fold)) if abs(self.nu) > 1e-14: eq5.append( LaminarViscosity(dest=fluid, sources=self.fluids, nu=self.nu)) equations_stage1.append(Group(equations=eq5)) if self.has_ghosts: gh = [] for fluid in self.fluids: gh.append( CRKSPHUpdateGhostProps(dest=fluid, sources=None, dim=self.dim)) equations_stage2.append(Group(equations=gh, real=False)) eq6 = [] for fluid in self.fluids: eq6.append( CRKSPHSymmetric(dest=fluid, sources=all, dim=self.dim, tol=self.tol)) eq6.append( EnergyEquation(dest=fluid, sources=all, dim=self.dim, gamma=self.gamma)) equations_stage2.append(Group(equations=eq6)) return MultiStageEquations([equations_stage1, equations_stage2])