# Create the application. app = Application(domain=domain) # Create the kernel kernel = WendlandQuintic(dim=2) integrator = EulerIntegrator(fluid=EulerStep()) # Create a solver. solver = Solver(kernel=kernel, dim=2, integrator=integrator) # Setup default parameters. solver.set_time_step(1e-3) solver.set_final_time(T) equations = [ # Update velocities and advect Group(equations=[ MixingVelocityUpdate(dest='fluid', sources=None, T=T), Advect(dest='fluid', sources=None) ]) ] # Setup the application and solver. This also generates the particles. app.setup(solver=solver, equations=equations, particle_factory=create_particles) app.run()
def get_equations(self, scheme=None, summation_density=False, edactvf=True): from pysph.sph.equation import Group from pysph.sph.bc.interpolate import ( UpdateMomentMatrix, EvaluateUhat, EvaluateP, ExtrapolateUhat, ExtrapolateP, CopyUhatFromGhost, CopyPFromGhost) from pysph.sph.bc.inlet_outlet_manager import ( UpdateNormalsAndDisplacements, CopyNormalsandDistances) all_pairs = {**self.inlet_pairs, **self.outlet_pairs} umax = [] for info in self.inletinfo: umax.append(info.umax) equations = [] g00 = [] i = 0 for info in self.inletinfo: g00.append(UpdateNormalsAndDisplacements( dest=info.pa_name, sources=None, xn=info.normal[0], yn=info.normal[1], zn=info.normal[2], xo=info.refpoint[0], yo=info.refpoint[1], zo=info.refpoint[2] )) g00.append(CopyNormalsandDistances( dest=all_pairs[info.pa_name], sources=[info.pa_name])) i = i + 1 equations.append(Group(equations=g00, real=False)) g02 = [] for name in self.fluids: g02.append(CopyTimeValues(dest=name, sources=None, rho=scheme.rho0, c0=scheme.c0, u0=min(umax))) g02.append((EvalauteCharacterisctics(dest=name, sources=None, c0=scheme.c0, rho0=scheme.rho0))) for name in self.ghost_inlets: g02.append(UpdateMomentMatrix( dest=name, sources=self.fluids, dim=self.dim)) equations.append(Group(equations=g02, real=False)) g02a = [] for name in self.fluids: g02a.append(ComputeTimeAverage(dest=name, sources=None)) for name in self.outlets: g02a.append(EvalauteNumberdensity(dest=name, sources=self.fluids)) g02a.append(ShepardInterpolateCharacteristics(dest=name, sources=self.fluids)) equations.append(Group(equations=g02a, real=False)) g03 = [] for name in self.ghost_inlets: g03.append(EvaluateUhat(dest=name, sources=self.fluids, dim=self.dim)) g03.append(EvaluateP(dest=name, sources=self.fluids, dim=self.dim)) equations.append(Group(equations=g03, real=False)) g04 = [] for name in self.ghost_inlets: g04.append(ExtrapolateUhat(dest=name, sources=None)) g04.append(ExtrapolateP(dest=name, sources=None)) for name in self.outlets: g04.append(EvaluatePropertyfromCharacteristics( dest=name, sources=None, c0=scheme.c0, rho0=scheme.rho0)) equations.append(Group(equations=g04, real=False)) g05 = [] for io in self.inlet_pairs.keys(): g05.append(CopyUhatFromGhost( dest=io, sources=[all_pairs[io]])) g05.append(CopyPFromGhost( dest=io, sources=[all_pairs[io]])) equations.append(Group(equations=g05, real=False)) g07 = [] for inlet in self.inletinfo: for eqn in inlet.equations: g07.append(eqn) for outlet in self.outletinfo: for eqn in outlet.equations: g07.append(eqn) equations.append(Group(equations=g07, real=False)) g08 = [] for name in self.ghost_inlets: g08.append(MoveGhostInlet(dest=name, sources=None)) equations.append(Group(equations=g08, real=False)) return equations
def create_equations(self): equations = [ # update smoothing length # Group( # equations = [ # UpdateSmoothingLengthFromVolume(dest='plate', sources=['plate', 'projectile'], dim=2, k=hdx), # UpdateSmoothingLengthFromVolume(dest='projectile', sources=['plate', 'projectile'], dim=2, k=hdx), # ], # update_nnps=True, # ), # compute properties from the current state Group(equations=[ # EOS (compute the pressure using one of the EOSs) #MieGruneisenEOS(dest='plate', sources=None, gamma=gamma1, r0=ro1 , c0=C1, S=S1), #MieGruneisenEOS(dest='projectile', sources=None, gamma=gamma2, r0=ro2 , c0=C2, S=S2), StiffenedGasEOS( dest='plate', sources=None, gamma=gamma1, r0=ro1, c0=C1), StiffenedGasEOS(dest='projectile', sources=None, gamma=gamma2, r0=ro2, c0=C2), # compute the velocity gradient tensor VelocityGradient2D(dest='plate', sources=['plate']), VelocityGradient2D(dest='projectile', sources=['projectile']), # stress VonMisesPlasticity2D( dest='plate', sources=None, flow_stress=Yo1), VonMisesPlasticity2D( dest='projectile', sources=None, flow_stress=Yo2), # artificial stress to avoid clumping MonaghanArtificialStress(dest='plate', sources=None, eps=0.3), MonaghanArtificialStress( dest='projectile', sources=None, eps=0.3), ]), # accelerations (rho, u, v, ...) Group(equations=[ # continuity equation ContinuityEquation(dest='plate', sources=['projectile', 'plate']), ContinuityEquation(dest='projectile', sources=['projectile', 'plate']), # momentum equation MomentumEquationWithStress(dest='projectile', sources=[ 'projectile', 'plate', ]), MomentumEquationWithStress(dest='plate', sources=[ 'projectile', 'plate', ]), # energy equation: EnergyEquationWithStress(dest='plate', sources=[ 'projectile', 'plate', ], alpha=avisc_alpha, beta=avisc_beta, eta=avisc_eta), EnergyEquationWithStress(dest='projectile', sources=[ 'projectile', 'plate', ], alpha=avisc_alpha, beta=avisc_beta, eta=avisc_eta), # avisc MonaghanArtificialViscosity(dest='plate', sources=['projectile', 'plate'], alpha=avisc_alpha, beta=avisc_beta), MonaghanArtificialViscosity(dest='projectile', sources=['projectile', 'plate'], alpha=avisc_alpha, beta=avisc_beta), # updates to the stress term HookesDeviatoricStressRate(dest='plate', sources=None), HookesDeviatoricStressRate(dest='projectile', sources=None), # position stepping XSPHCorrection(dest='plate', sources=['plate'], eps=xsph_eps), XSPHCorrection( dest='projectile', sources=['projectile'], eps=xsph_eps), ]), ] # End Group list return equations
output_at_times=[0.0033, 0.0052]) # select True if you want to dump out remote particle properties in # parallel runs. This can be over-ridden with the --output-remote # command line option solver.set_output_only_real(True) solver.set_print_freq(5) # Define the SPH equations used to solve this problem equations = [ ##################################################################### # "Predict advection" step as per algorithm 1 in paper. Group( equations=[ SummationDensity(dest='fluid', sources=['fluid']), ], real=False ), Group( equations=[ AdvectionAcceleration(dest='fluid', sources=None), ComputeDII(dest='fluid', sources=['fluid']), ] ), Group( equations=[ ComputeRhoAdvection(dest='fluid', sources=['fluid']), ComputeAII(dest='fluid', sources=['fluid']), ]
def create_equations(self): tvf_equations = [ # We first compute the mass and number density of the fluid # phase. This is used in all force computations henceforth. The # number density (1/volume) is explicitly set for the solid phase # and this isn't modified for the simulation. Group(equations=[ SummationDensity(dest='fluid', sources=['fluid', 'wall']) ]), # Given the updated number density for the fluid, we can update # the fluid pressure. Additionally, we can extrapolate the fluid # velocity to the wall for the no-slip boundary # condition. Also compute the smoothed color based on the color # index for a particle. Group(equations=[ StateEquation( dest='fluid', sources=None, rho0=rho0, p0=p0, b=1.0), SetWallVelocity(dest='wall', sources=['fluid']), SmoothedColor(dest='fluid', sources=['fluid']), ]), ################################################################# # Begin Surface tension formulation ################################################################# # Scale the smoothing lengths to determine the interface # quantities. The NNPS need not be updated since the smoothing # length is decreased. Group(equations=[ ScaleSmoothingLength(dest='fluid', sources=None, factor=0.8) ], update_nnps=False), # Compute the gradient of the color function with respect to the # new smoothing length. At the end of this Group, we will have the # interface normals and the discretized dirac delta function for # the fluid-fluid interface. Group(equations=[ ColorGradientUsingNumberDensity(dest='fluid', sources=['fluid', 'wall'], epsilon=0.01 / h0), ], ), # Compute the interface curvature using the modified smoothing # length and interface normals computed in the previous Group. Group(equations=[ InterfaceCurvatureFromNumberDensity( dest='fluid', sources=['fluid'], with_morris_correction=True), ], ), # Now rescale the smoothing length to the original value for the # rest of the computations. Group( equations=[ ScaleSmoothingLength(dest='fluid', sources=None, factor=1.25) ], update_nnps=False, ), ################################################################# # End Surface tension formulation ################################################################# # Once the pressure for the fluid phase has been updated via the # state-equation, we can extrapolate the pressure to the wall # ghost particles. After this group, the density and pressure of # the boundary particles has been updated and can be used in the # integration equations. Group(equations=[ SolidWallPressureBC(dest='wall', sources=['fluid'], p0=p0, rho0=rho0, gy=gy), ], ), # The main acceleration block Group( equations=[ # Gradient of pressure for the fluid phase using the # number density formulation. No penetration boundary # condition using Adami et al's generalized wall boundary # condition. The extrapolated pressure and density on the # wall particles is used in the gradient of pressure to # simulate a repulsive force. MomentumEquationPressureGradient(dest='fluid', sources=['fluid', 'wall'], pb=p0, gy=gy), # Artificial viscosity for the fluid phase. MomentumEquationViscosity(dest='fluid', sources=['fluid'], nu=nu), # No-slip boundary condition using Adami et al's # generalized wall boundary condition. This equation # basically computes the viscous contribution on the fluid # from the wall particles. SolidWallNoSlipBC(dest='fluid', sources=['wall'], nu=nu), # Surface tension force for the SY11 formulation ShadlooYildizSurfaceTensionForce(dest='fluid', sources=None, sigma=sigma), # Artificial stress for the fluid phase MomentumEquationArtificialStress(dest='fluid', sources=['fluid']), ], ) ] return tvf_equations
def _get_internal_flow_equations(self): from pysph.sph.wc.transport_velocity import ( VolumeSummation, SolidWallNoSlipBC, SummationDensity, MomentumEquationArtificialStress, MomentumEquationArtificialViscosity, MomentumEquationViscosity) edac_nu = self._get_edac_nu() all = self.fluids + self.solids equations = [] group1 = [] avg_p_group = [] has_solids = len(self.solids) > 0 for fluid in self.fluids: group1.append(SummationDensity(dest=fluid, sources=all)) if self.bql: eq = ComputeAveragePressure(dest=fluid, sources=all) if has_solids: avg_p_group.append(eq) else: group1.append(eq) for solid in self.solids: group1.extend([ VolumeSummation(dest=solid, sources=all), SolidWallPressureBC(dest=solid, sources=self.fluids, gx=self.gx, gy=self.gy, gz=self.gz), SetWallVelocity(dest=solid, sources=self.fluids), ]) equations.append(Group(equations=group1, real=False)) # Compute average pressure *after* the wall pressure is setup. if self.bql and has_solids: equations.append(Group(equations=avg_p_group, real=True)) group2 = [] for fluid in self.fluids: group2.append( MomentumEquationPressureGradient(dest=fluid, sources=all, pb=self.pb, gx=self.gx, gy=self.gy, gz=self.gz, tdamp=self.tdamp)) if self.alpha > 0.0: group2.append( MomentumEquationArtificialViscosity(dest=fluid, sources=all, alpha=self.alpha, c0=self.c0)) if self.nu > 0.0: group2.append( MomentumEquationViscosity(dest=fluid, sources=self.fluids, nu=self.nu)) if len(self.solids) > 0 and self.nu > 0.0: group2.append( SolidWallNoSlipBC(dest=fluid, sources=self.solids, nu=self.nu)) group2.extend([ MomentumEquationArtificialStress(dest=fluid, sources=self.fluids), EDACEquation(dest=fluid, sources=all, nu=edac_nu, cs=self.c0, rho0=self.rho0), ]) equations.append(Group(equations=group2)) return equations
def _get_external_flow_equations(self): from pysph.sph.basic_equations import XSPHCorrection from pysph.sph.wc.transport_velocity import ( VolumeSummation, SolidWallNoSlipBC, SummationDensity, MomentumEquationArtificialViscosity, MomentumEquationViscosity) all = self.fluids + self.solids edac_nu = self._get_edac_nu() equations = [] group1 = [] for fluid in self.fluids: group1.append(SummationDensity(dest=fluid, sources=all)) for solid in self.solids: group1.extend([ VolumeSummation(dest=solid, sources=all), SolidWallPressureBC(dest=solid, sources=self.fluids, gx=self.gx, gy=self.gy, gz=self.gz), SetWallVelocity(dest=solid, sources=self.fluids), ]) if self.clamp_p: group1.append(ClampWallPressure(dest=solid, sources=None)) equations.append(Group(equations=group1, real=False)) group2 = [] for fluid in self.fluids: group2.append( MomentumEquation(dest=fluid, sources=all, gx=self.gx, gy=self.gy, gz=self.gz, c0=self.c0, tdamp=self.tdamp)) if self.alpha > 0.0: group2.append( MomentumEquationArtificialViscosity(dest=fluid, sources=all, alpha=self.alpha, c0=self.c0)) if self.nu > 0.0: group2.append( MomentumEquationViscosity(dest=fluid, sources=self.fluids, nu=self.nu)) if len(self.solids) > 0 and self.nu > 0.0: group2.append( SolidWallNoSlipBC(dest=fluid, sources=self.solids, nu=self.nu)) group2.extend([ EDACEquation(dest=fluid, sources=all, nu=edac_nu, cs=self.c0, rho0=self.rho0), XSPHCorrection(dest=fluid, sources=[fluid], eps=self.eps) ]) equations.append(Group(equations=group2)) return equations
def get_equations(self, scheme=None, summation_density=False, edactvf=False): from pysph.sph.equation import Group from pysph.sph.bc.interpolate import (UpdateMomentMatrix, EvaluateUhat, EvaluateP, ExtrapolateUhat, ExtrapolateP, CopyUhatFromGhost, CopyPFromGhost) from pysph.sph.bc.inlet_outlet_manager import ( UpdateNormalsAndDisplacements, CopyNormalsandDistances) equations = [] g00 = [] i = 0 for info in self.inletinfo: g00.append( UpdateNormalsAndDisplacements(dest=info.pa_name, sources=None, xn=info.normal[0], yn=info.normal[1], zn=info.normal[2], xo=info.refpoint[0], yo=info.refpoint[1], zo=info.refpoint[2])) g00.append( CopyNormalsandDistances(dest=self.inlet_pairs[info.pa_name], sources=[info.pa_name])) i = i + 1 equations.append(Group(equations=g00, real=False)) g02 = [] for name in self.ghost_inlets: g02.append( UpdateMomentMatrix(dest=name, sources=self.fluids, dim=self.dim)) equations.append(Group(equations=g02, real=False)) g03 = [] for name in self.ghost_inlets: g03.append( EvaluateUhat(dest=name, sources=self.fluids, dim=self.dim)) g03.append(EvaluateP(dest=name, sources=self.fluids, dim=self.dim)) for name in self.outlets: g03.append(EvalauteNumberdensity(dest=name, sources=self.fluids)) g03.append(ExtrapolateUfromFluid(dest=name, sources=self.fluids)) equations.append(Group(equations=g03, real=False)) g04 = [] for name in self.ghost_inlets: g04.append(ExtrapolateUhat(dest=name, sources=None)) g04.append(ExtrapolateP(dest=name, sources=None)) equations.append(Group(equations=g04, real=False)) g05 = [] for io in self.inlet_pairs.keys(): g05.append( CopyUhatFromGhost(dest=io, sources=[self.inlet_pairs[io]])) g05.append(CopyPFromGhost(dest=io, sources=[self.inlet_pairs[io]])) equations.append(Group(equations=g05, real=False)) g06 = [] for inlet in self.inletinfo: for eqn in inlet.equations: g06.append(eqn) for outlet in self.outletinfo: for eqn in outlet.equations: g06.append(eqn) equations.append(Group(equations=g06, real=False)) return equations
def create_equations(self): equations = [ # Properties computed set from the current state Group( equations=[ # p IsothermalEOS(dest='solid', sources=None, rho0=rho0, c0=c0, p0=0.0), # vi,j : requires properties v00, v01, v10, v11 VelocityGradient2D(dest='solid', sources=[ 'solid', ]), # rij : requires properties r00, r01, r02, r11, r12, r22, # s00, s01, s02, s11, s12, s22 MonaghanArtificialStress(dest='solid', sources=None, eps=0.3), ], ), # Acceleration variables are now computed Group(equations=[ # arho ContinuityEquation(dest='solid', sources=[ 'solid', ]), # au, av MomentumEquationWithStress(dest='solid', sources=[ 'solid', ], n=4, wdeltap=self.wdeltap), # au, av MonaghanArtificialViscosity(dest='solid', sources=[ 'solid', ], alpha=1.0, beta=1.0), # a_s00, a_s01, a_s11 HookesDeviatoricStressRate(dest='solid', sources=None, shear_mod=G), # ax, ay, az XSPHCorrection(dest='solid', sources=[ 'solid', ], eps=0.5), ]) # End Acceleration Group ] # End Group list return equations
def create_equations(self): # Formulation for REF1 equations1 = [ Group(equations=[ HarmonicOscilllator(dest='spoon', sources=None, A=3, omega=0.5), # Translate acceleration to positions XSPHCorrection(dest='spoon', sources=['spoon'], eps=0.0) ], real=False), # Water Faucet Equations Group(equations=[ H2OFaucet(dest='tahini', sources=None, x=0.5, y=tahiniH, z=1, r=0.1, fill_rate=8), DiffuseH2O(dest='tahini', sources=['tahini'], diffusion_speed=0.025), ]), # For the multi-phase formulation, we require an estimate of the # particle volume. This can be either defined from the particle # number density or simply as the ratio of mass to density. Group(equations=[ VolumeFromMassDensity(dest='tahini', sources=None) ], ), # Equation of state is typically the Tait EOS with a suitable # exponent gamma Group(equations=[ TaitEOSHGCorrection( dest='tahini', sources=None, rho0=rho0, c0=c0, gamma=gamma), ], ), # The boundary conditions are imposed by extrapolating the tahini # pressure, taking into considering the bounday acceleration Group(equations=[ SolidWallPressureBC(dest='bowl', sources=['tahini'], b=1.0, gy=gy, rho0=rho0, p0=p0), SolidWallPressureBC(dest='spoon', sources=['tahini'], b=1.0, gy=gy, rho0=rho0, p0=p0), ], ), # Main acceleration block Group(equations=[ TahiniEquation(dest='tahini', sources=['tahini'], sigma=dx / 1.122), # Continuity equation ContinuityEquation( dest='tahini', sources=[ 'tahini', 'bowl', 'spoon']), # Pressure gradient with acceleration damping. MomentumEquationPressureGradient( dest='tahini', sources=['tahini', 'bowl', 'spoon'], pb=0.0, gy=gy, tdamp=tdamp), # artificial viscosity for stability MomentumEquationArtificialViscosity( dest='tahini', sources=['tahini', 'bowl', 'spoon'], alpha=1, c0=c0), # Position step with XSPH XSPHCorrection(dest='tahini', sources=['tahini'], eps=0.0) ]), ] # Formulation for REF3 equations3 = [ # Spoon Equations Group(equations=[ HarmonicOscilllator(dest='spoon', sources=None, A=3, omega=0.333), # Translate acceleration to positions XSPHCorrection(dest='spoon', sources=['spoon'], eps=0.0) ], real=False), # Water Faucet Equations Group(equations=[ H2OFaucet(dest='tahini', sources=None, x=0.5, y=tahiniH, z=1, r=0.1, fill_rate=25), DiffuseH2O(dest='tahini', sources=['tahini'], diffusion_speed=0.025), ]), # For the multi-phase formulation, we require an estimate of the # particle volume. This can be either defined from the particle # number density or simply as the ratio of mass to density. Group(equations=[ VolumeFromMassDensity(dest='tahini', sources=None) ], ), # Equation of state is typically the Tait EOS with a suitable # exponent gamma. The solid phase is treated just as a fluid and # the pressure and density operations is updated for this as well. Group(equations=[ TaitEOS( dest='tahini', sources=None, rho0=rho0, c0=c0, gamma=gamma), TaitEOS( dest='bowl', sources=None, rho0=rho0, c0=c0, gamma=gamma), TaitEOS( dest='spoon', sources=None, rho0=rho0, c0=c0, gamma=gamma), ], ), # Main acceleration block. The boundary conditions are imposed by # peforming the continuity equation and gradient of pressure # calculation on the bowl phase, taking contributions from the # tahini phase Group(equations=[ TahiniEquation(dest='tahini', sources=['tahini'], sigma=dx / 1.122), # Continuity equation ContinuityEquation( dest='tahini', sources=[ 'tahini', 'bowl', 'spoon']), ContinuityEquation(dest='bowl', sources=['tahini']), ContinuityEquation(dest='spoon', sources=['tahini']), # Pressure gradient with acceleration damping. MomentumEquationPressureGradient( dest='tahini', sources=['tahini', 'bowl', 'spoon'], pb=0.0, gy=gy, tdamp=tdamp), # artificial viscosity for stability MomentumEquationArtificialViscosity( dest='tahini', sources=['tahini', 'bowl', 'spoon'], alpha=1, c0=c0), # Position step with XSPH XSPHCorrection(dest='tahini', sources=['tahini'], eps=0.5) ]), ] if self.options.bc_type == 1: return equations1 elif self.options.bc_type == 3: return equations3
def create_equations(self): equations = [ Group(equations=[ RemoveFluidParticlesWithNoNeighbors(dest='fluid', sources=['fluid']) ], update_nnps=True), Group(equations=[ RemoveOutofDomainParticles(dest='fluid', x_min=self.x_max_inlet, x_max=self.le, y_min=0, y_max=self.w) ], update_nnps=True), Group(equations=[ RemoveCloseParticlesAtOpenBoundary( min_dist_ob=self.min_dist_ob, dest='inlet', sources=['inlet']) ], update_nnps=True), Group(equations=[ Group(equations=[ GatherDensityEvalNextIteration( dest='fluid', sources=['inlet', 'fluid', 'boundary']), ]), Group(equations=[NonDimensionalDensityResidual(dest='fluid')]), Group(equations=[UpdateSmoothingLength(dim=dim, dest='fluid')], update_nnps=True), Group(equations=[ CheckConvergenceDensityResidual(dest='fluid') ], ) ], iterate=True, max_iterations=10), Group(equations=[ CorrectionFactorVariableSmoothingLength( dest='fluid', sources=['fluid', 'inlet', 'boundary']), ], ), Group(equations=[ RemoveParticlesWithZeroAlpha(dest='fluid'), ], update_nnps=True), Group(equations=[ SWEOS(dest='fluid'), ]), Group(equations=[ BoundaryInnerReimannStateEval(dest='inlet', sources=['fluid']), ]), Group(equations=[ SubCriticalTimeVaryingOutFlow(dest='inlet'), ]), Group(equations=[ BedFrictionSourceEval(dest='fluid', sources=['bed']) ]), Group(equations=[ FluidBottomElevation(dest='fluid', sources=['bed']) ]), Group( equations=[FluidBottomGradient(dest='fluid', sources=['bed']) ]), Group(equations=[ FluidBottomCurvature(dest='fluid', sources=['bed']) ]), Group(equations=[ ParticleAcceleration( dim=dim, dest='fluid', sources=['fluid', 'inlet', 'boundary'], ), ]), ] return equations
def create_equations(self): co = 10.0 * self.geom.get_max_speed(g=9.81) gamma = 7.0 alpha = 0.5 beta = 0.0 equations = [ Group(equations=[ BodyForce(dest='obstacle', sources=None, gz=-9.81), NumberDensity(dest='obstacle', sources=['obstacle']), NumberDensity(dest='boundary', sources=['boundary']), ], ), # Equation of state Group(equations=[ TaitEOS( dest='fluid', sources=None, rho0=rho0, c0=co, gamma=gamma ), TaitEOSHGCorrection( dest='boundary', sources=None, rho0=rho0, c0=co, gamma=gamma ), TaitEOSHGCorrection( dest='obstacle', sources=None, rho0=rho0, c0=co, gamma=gamma ), ], real=False), # Continuity, momentum and xsph equations Group(equations=[ ContinuityEquation( dest='fluid', sources=['fluid', 'boundary', 'obstacle'] ), ContinuityEquation(dest='boundary', sources=['fluid']), ContinuityEquation(dest='obstacle', sources=['fluid']), MomentumEquation(dest='fluid', sources=['fluid', 'boundary'], alpha=alpha, beta=beta, gz=-9.81, c0=co, tensile_correction=True), PressureRigidBody( dest='fluid', sources=['obstacle'], rho0=rho0 ), XSPHCorrection(dest='fluid', sources=['fluid']), RigidBodyForceGPUGems( dest='obstacle', sources=['boundary'], k=1.0, d=2.0, eta=0.1, kt=0.1 ), ]), Group(equations=[RigidBodyMoments(dest='obstacle', sources=None)]), Group(equations=[RigidBodyMotion(dest='obstacle', sources=None)]), ] return equations
def get_equations(self): # fix copy pasta later from pysph.sph.equation import Group from pysph.sph.wc.transport_velocity import ( SummationDensity, StateEquation, MomentumEquationPressureGradient, MomentumEquationArtificialViscosity, MomentumEquationViscosity, MomentumEquationArtificialStress, SolidWallPressureBC, SolidWallNoSlipBC, SetWallVelocity) equations = [] all = self.fluids + self.solids g1 = [] for fluid in self.fluids: g1.append(SummationDensity(dest=fluid, sources=all)) equations.append(Group(equations=g1, real=False)) g2 = [] for fluid in self.fluids: g2.append( StateEquationVariableRho0(dest=fluid, sources=None, b=1.0)) for solid in self.solids: g2.append(SetWallVelocity(dest=solid, sources=self.fluids)) equations.append(Group(equations=g2, real=False)) g3 = [] for solid in self.solids: g3.append( SolidWallPressureBC(dest=solid, sources=self.fluids, b=1.0, rho0=self.rho0, p0=self.p0, gx=self.gx, gy=self.gy, gz=self.gz)) equations.append(Group(equations=g3, real=False)) g4 = [] for fluid in self.fluids: g4.append( MomentumEquationPressureGradient(dest=fluid, sources=all, pb=self.pb, gx=self.gx, gy=self.gy, gz=self.gz, tdamp=self.tdamp)) if self.alpha > 0.0: g4.append( MomentumEquationArtificialViscosity(dest=fluid, sources=all, c0=self.c0, alpha=self.alpha)) if self.nu > 0.0: g4.append( MomentumEquationViscosity(dest=fluid, sources=self.fluids, nu=self.nu)) if len(self.solids) > 0: g4.append( SolidWallNoSlipBC(dest=fluid, sources=self.solids, nu=self.nu)) g4.append( MomentumEquationArtificialStress(dest=fluid, sources=self.fluids)) equations.append(Group(equations=g4)) return equations
def create_equations(self): equations = [ Group(equations=[ Group(equations=[ GatherDensityEvalNextIteration( dest='fluid', sources=['inlet', 'fluid', 'outlet', 'boundary']), ]), Group(equations=[NonDimensionalDensityResidual(dest='fluid')]), Group(equations=[UpdateSmoothingLength(dim=dim, dest='fluid')], update_nnps=True), Group(equations=[ CheckConvergenceDensityResidual(dest='fluid') ], ) ], iterate=True, max_iterations=10), Group(equations=[ CorrectionFactorVariableSmoothingLength( dest='fluid', sources=['fluid', 'inlet', 'outlet', 'boundary']) ]), Group(equations=[ SWEOS(dest='fluid'), ]), Group(equations=[ BoundaryInnerReimannStateEval(dest='inlet', sources=['fluid']), BoundaryInnerReimannStateEval(dest='outlet', sources=['fluid']) ]), Group(equations=[ SubCriticalInFlow(dest='inlet'), SubCriticalOutFlow(dest='outlet') ]), Group(equations=[ BedFrictionSourceEval(dest='fluid', sources=['bed']) ]), Group(equations=[ ParticleAcceleration( dim=dim, dest='fluid', sources=['fluid', 'inlet', 'outlet', 'boundary']) ]), ] return equations