def create_equations(self): ''' Set-up governing equations ''' equations = [ Group(equations=[ IsothermalEOS(dest='fluid', sources=['fluid'], rho0=self.rho0, c0=self.c0, p0=0.0), GradientCorrectionPreStep(dest='fluid', sources=['fluid'], dim=2), ], real=False), Group( equations=[ GradientCorrection(dest='fluid', sources=['fluid'], dim=2, tol=0.1), ContinuityEquationDeltaSPHPreStep(dest='fluid', sources=['fluid']), #PST_PreStep_1(dest='fluid', sources=['fluid'], dim=2, boundedFlow=self.PST_boundedFlow), #PST_PreStep_2(dest='fluid', sources=['fluid'], dim=2, H=self.h0, boundedFlow=self.PST_boundedFlow), ], real=False), Group( equations=[ PST(dest='fluid', sources=['fluid'], H=self.h0, dt=self.dt, dx=self.dx, Uc0=self.PST_Uc0, Rh=self.PSR_Rh, boundedFlow=self.PST_boundedFlow), ContinuityEquation(dest='fluid', sources=['fluid']), ContinuityEquationDeltaSPH(dest='fluid', sources=['fluid'], c0=self.c0, delta=0.1), LaminarViscosityDeltaSPHPreStep(dest='fluid', sources=['fluid']), #LaminarViscosity(dest='fluid', sources=['fluid'], nu=self.nu), LaminarViscosityDeltaSPH(dest='fluid', sources=['fluid'], dim=2, rho0=self.rho0, nu=self.nu), Spatial_Acceleration(dest='fluid', sources=['fluid']), ], real=True), ] return equations
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 get_equations(self): from pysph.sph.equation import Group from pysph.sph.wc.basic import (MomentumEquation, TaitEOS, TaitEOSHGCorrection, UpdateSmoothingLengthFerrari) from pysph.sph.wc.basic import (ContinuityEquationDeltaSPH, MomentumEquationDeltaSPH) from pysph.sph.basic_equations import \ (ContinuityEquation, SummationDensity, XSPHCorrection) from pysph.sph.wc.viscosity import LaminarViscosity equations = [] g1 = [] all = self.fluids + self.solids if self.summation_density: g0 = [] for name in self.fluids: g0.append(SummationDensity(dest=name, sources=all)) equations.append(Group(equations=g0, real=False)) for name in self.fluids: g1.append( TaitEOS(dest=name, sources=None, rho0=self.rho0, c0=self.c0, gamma=self.gamma)) if self.hg_correction: # This correction applies only to solids. for name in self.solids: g1.append( TaitEOSHGCorrection(dest=name, sources=None, rho0=self.rho0, c0=self.c0, gamma=self.gamma)) equations.append(Group(equations=g1, real=False)) g2 = [] for name in self.solids: g2.append(ContinuityEquation(dest=name, sources=self.fluids)) for name in self.fluids: if self.delta_sph: other = all[:] other.remove(name) g2.append( ContinuityEquationDeltaSPH(dest=name, sources=[name], c0=self.c0, delta=self.delta)) if len(other) > 0: g2.append(ContinuityEquation(dest=name, sources=other)) g2.append( MomentumEquationDeltaSPH( dest=name, sources=[name], rho0=self.rho0, c0=self.c0, alpha=self.alpha, gx=self.gx, gy=self.gy, gz=self.gz, )) if len(other) > 0: g2.append( MomentumEquation( dest=name, sources=other, c0=self.c0, alpha=self.alpha, beta=self.beta, gx=self.gx, gy=self.gy, gz=self.gz, tensile_correction=self.tensile_correction)) g2.append(XSPHCorrection(dest=name, sources=[name])) else: if not self.summation_density: g2.append(ContinuityEquation(dest=name, sources=all)) g2.extend([ MomentumEquation( dest=name, sources=all, alpha=self.alpha, beta=self.beta, gx=self.gx, gy=self.gy, gz=self.gz, c0=self.c0, tensile_correction=self.tensile_correction), XSPHCorrection(dest=name, sources=[name]) ]) if abs(self.nu) > 1e-14: eq = LaminarViscosity(dest=name, sources=self.fluids, nu=self.nu) g2.insert(-1, eq) equations.append(Group(equations=g2)) if self.update_h: g3 = [ UpdateSmoothingLengthFerrari(dest=x, sources=None, dim=self.dim, hdx=self.hdx) for x in self.fluids ] equations.append(Group(equations=g3, real=False)) return equations
def create_equations(self): equations = [ Group(equations=[ BodyForce(dest='block', sources=None, gy=gy), NumberDensity(dest='block', sources=['block']), NumberDensity(dest='solid', sources=['solid']), ], ), # Equation of state is typically the Tait EOS with a suitable # exponent gamma Group(equations=[ TaitEOS(dest='fluid', sources=None, rho0=rho0, c0=c0, gamma=gamma), TaitEOSHGCorrection(dest='solid', sources=None, rho0=rho0, c0=c0, gamma=gamma), TaitEOSHGCorrection(dest='block', sources=None, rho0=rho0, c0=c0, gamma=gamma), ], ), # Main acceleration block Group(equations=[ # Continuity equation with dissipative corrections for fluid on fluid ContinuityEquationDeltaSPH( dest='fluid', sources=['fluid'], c0=c0, delta=0.1), ContinuityEquation(dest='fluid', sources=['solid', 'block']), ContinuityEquation(dest='solid', sources=['fluid']), ContinuityEquation(dest='block', sources=['fluid']), # Momentum equation MomentumEquation(dest='fluid', sources=['fluid', 'solid', 'block'], alpha=alpha, beta=beta, gy=-9.81, c0=c0, tensile_correction=True), PressureRigidBody(dest='fluid', sources=['block', 'solid'], rho0=rho0), ViscosityRigidBody( dest='fluid', sources=['block', 'solid' ], rho0=rho0, nu=nu), # Position step with XSPH XSPHCorrection(dest='fluid', sources=['fluid']), RigidBodyCollision(dest='block', sources=['solid'], k=1.0, d=2.0, eta=0.1, kt=0.1), ]), Group(equations=[RigidBodyMoments(dest='block', sources=None)]), Group(equations=[RigidBodyMotion(dest='block', sources=None)]), ] return equations
equations = [ # Equation of state Group(equations=[ TaitEOS(dest='fluid', sources=None, rho0=ro, c0=co, gamma=gamma), TaitEOSHGCorrection(dest='boundary', sources=None, rho0=ro, c0=co, gamma=gamma), ], real=False), Group(equations=[ # Continuity equation with dissipative corrections for fluid on fluid ContinuityEquationDeltaSPH( dest='fluid', sources=['fluid'], c0=co, delta=0.1), ContinuityEquation(dest='fluid', sources=['boundary']), ContinuityEquation(dest='boundary', sources=['fluid']), # Momentum equation MomentumEquation(dest='fluid', sources=['fluid', 'boundary'], alpha=alpha, beta=beta, gy=-9.81, c0=co, tensile_correction=True), # Position step with XSPH XSPHCorrection(dest='fluid', sources=['fluid']) ]),
def create_equations(self): ''' Set-up governing equations ''' if self.PST == False: equations = [ Group(equations=[ IsothermalEOS(dest='fluid', sources=['fluid'], rho0=self.rho0, c0=self.c0, p0=0.0), GradientCorrectionPreStep(dest='fluid', sources=['fluid'], dim=2), ],real=False ), Group(equations=[ GradientCorrection(dest='fluid', sources=['fluid'], dim=2, tol=0.1), ContinuityEquationDeltaSPHPreStep(dest='fluid', sources=['fluid']), ],real=True ), Group(equations=[ ContinuityEquation(dest='fluid', sources=['fluid']), ContinuityEquationDeltaSPH(dest='fluid', sources=['fluid'], c0=self.c0, delta=0.1), MomentumEquation(dest='fluid', sources=['fluid'], c0=self.c0, alpha=0.0, beta=0.0, gx=0.0, gy=0.0, gz=0.0, tensile_correction=False), #MomentumEquationDeltaSPH(dest='fluid', sources=['fluid'], rho0=self.rho0, c0=self.c0, alpha=0.0), #LaminarViscosityDeltaSPHPreStep(dest='fluid', sources=['fluid']), LaminarViscosityDeltaSPH(dest='fluid', sources=['fluid'], dim=2, rho0=self.rho0, nu=self.nu), Spatial_Acceleration(dest='fluid', sources=['fluid']), #XSPHCorrection(dest='fluid', sources=['fluid'], eps=0.5), ],real=True ), ] elif self.PST == True: equations = [ Group(equations=[ IsothermalEOS(dest='fluid', sources=['fluid'], rho0=self.rho0, c0=self.c0, p0=0.0), GradientCorrectionPreStep(dest='fluid', sources=['fluid'], dim=2), PST_PreStep_1(dest='fluid', sources=['fluid'], dim=2), ######AverageSpacing(dest='fluid', sources=['fluid'], dim=2), ],real=False ), Group(equations=[ GradientCorrection(dest='fluid', sources=['fluid'], dim=2, tol=0.1), ContinuityEquationDeltaSPHPreStep(dest='fluid', sources=['fluid']), PST_PreStep_2(dest='fluid', sources=['fluid'], dim=2, H=self.h0), PST(dest='fluid', sources=['fluid'], dim=2, H=self.h0, dt=self.dt, dx=self.dx, Uc0=self.PST_Uc0, Rh=self.PSR_Rh, saveAllDRh=True, R_coeff=self.PST_R_coeff, n_exp=self.PST_n_exp), ],real=True ), Group(equations=[ ContinuityEquation(dest='fluid', sources=['fluid']), ContinuityEquationDeltaSPH(dest='fluid', sources=['fluid'], c0=self.c0, delta=0.1), MomentumEquation(dest='fluid', sources=['fluid'], c0=self.c0, alpha=0.0, beta=0.0, gx=0.0, gy=0.0, gz=0.0, tensile_correction=False), #MomentumEquationDeltaSPH(dest='fluid', sources=['fluid'], rho0=self.rho0, c0=self.c0, alpha=0.0), #LaminarViscosityDeltaSPHPreStep(dest='fluid', sources=['fluid']), LaminarViscosityDeltaSPH(dest='fluid', sources=['fluid'], dim=2, rho0=self.rho0, nu=self.nu), Spatial_Acceleration(dest='fluid', sources=['fluid']), #XSPHCorrection(dest='fluid', sources=['fluid'], eps=0.5), ],real=True ), ] return equations