Skip to content

Commit

Permalink
Merging with the current head
Browse files Browse the repository at this point in the history
  • Loading branch information
kunal-puri committed May 6, 2011
2 parents 25ba822 + f5f993f commit 9a1ad9c
Show file tree
Hide file tree
Showing 7 changed files with 108 additions and 128 deletions.
25 changes: 20 additions & 5 deletions examples/shock-tube/sigalotti_shock_tube.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
name='fluid', type=Fluid)

pa = particles.get_named_particle_array('fluid')
pa.add_property({'name':'rhop'})
pa.add_property({'name':'div'})

# ensure that the array 'q' is available

Expand All @@ -42,19 +44,33 @@

s.add_operation(solver.SPHOperation(

sph.ADKESmoothingUpdate.withargs(h0=h0, k=k, eps=eps),
on_types=[Fluid], from_types=[Fluid], updates=['h'], id='adke'),
sph.ADKEPilotRho.withargs(h0=h0),
on_types=[Fluid], from_types=[Fluid], updates=['rhop'], id='adke_rho'),

before=True, id="density")

before=True, id="density")
s.add_operation(solver.SPHOperation(

sph.ADKESmoothingUpdate.withargs(h0=h0, k=k, eps=eps),
on_types=[Fluid], updates=['h'], id='adke'),

before=True, id="density")

# add the update conduction coefficient after the density calculation

s.add_operation(solver.SPHOperation(

sph.VelocityDivergence.withargs(),
on_types=[Fluid], from_types=[Fluid], updates=['div'], id='vdivergence'),

before=False, id='density')

s.add_operation(solver.SPHOperation(

sph.ADKEConductionCoeffUpdate.withargs(g1=g1, g2=g2),
on_types=[Fluid], from_types=[Fluid], updates=['q'], id='qcoeff'),

before=False, id='density')
before=False, id='vdivergence')


# add the artificial heat term after the energy equation
Expand All @@ -66,7 +82,6 @@

before=False, id="enr")


s.set_final_time(0.15)
s.set_time_step(3e-4)

Expand Down
2 changes: 1 addition & 1 deletion source/pysph/base/kernels.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ cdef class DummyKernel(KernelBase):
return 1.0

cpdef double radius(self):
return 1.0
return 2.0

##############################################################################
#`CubicSplineKernel`
Expand Down
65 changes: 16 additions & 49 deletions source/pysph/solver/integrator.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,8 @@ def setup_integrator(self):

self.initial_props[calc.id].append(prop_initial)

# set the step properties for non integrating calcs

for l in range(self.nsteps):
k_num = 'k'+str(l+1)

Expand Down Expand Up @@ -442,66 +444,31 @@ def eval(self, calcs):
for i in range(ncalcs):
calc = calcs[i]

updates = calc.updates
nupdates = calc.nupdates

# get the destination particle array for this calc

pa = self.arrays[calc.dnum]

if logger.level < 30:
logger.info("Integrator:eval: operating on calc %d, %s"%(
i, calc.id))

# Evaluate the calc
if calc.integrates:
calc.sph(*calc.dst_writes[k_num])

calc.sph(*self.step_props)

for j in range(nupdates):
update_prop = updates[j]
step_prop = self.step_props[j]

step_array = pa.get(step_prop)

if not calc.integrates:

#set the evaluated property
if logger.level < 30:
logger.info("""Integrator:eval: setting the prop
%s for calc %d, %s"""
%(update_prop, i, calc.id))

pa.set(**{update_prop:step_array.copy()})

# ensure that all processes have reached this point

particles.barrier()

# update neighbor information if 'h' has been updated
else:
calc.sph(*calc.updates)

if calc.tag == "h":
particles.update()
# ensure all processes have reached this point
particles.barrier()

# update the remote particle properties
# update the remote particle properties

self.rupdate_list[calc.dnum] = [update_prop]
self.rupdate_list[calc.dnum] = [calc.updates]

if logger.level < 30:
logger.info("""Integrator:eval: updating remote particle
properties %s"""%(self.rupdate_list))
if logger.level < 30:
logger.info("""Integrator:eval: updating remote particle
properties %s"""%(self.rupdate_list))

particles.update_remote_particle_properties(
self.rupdate_list)

else:
k_prop = self.k_props[calc.id][k_num][j]

pa.set(**{k_prop:step_array.copy()})

pass

#ensure that the eval phase is completed for all processes

particles.update_remote_particle_properties(
self.rupdate_list)

particles.barrier()

def step(self, calcs, dt):
Expand Down
11 changes: 7 additions & 4 deletions source/pysph/sph/funcs/adke_funcs.pxd
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
""" Declarations for the adke functions """

#sph imports
from pysph.sph.sph_func cimport SPHFunctionParticle, CSPHFunctionParticle
from pysph.sph.sph_func cimport SPHFunctionParticle, CSPHFunctionParticle,\
SPHFunction

#base imports
from pysph.base.particle_array cimport ParticleArray
Expand All @@ -20,9 +21,10 @@ cdef class ADKEPilotRho(CSPHFunctionParticle):
###############################################################################
# `ADKESmoothingUpdate` class.
###############################################################################
cdef class ADKESmoothingUpdate(ADKEPilotRho):
cdef class ADKESmoothingUpdate(SPHFunction):
""" Compute the new smoothing length for the ADKE algorithm """
cdef double k, eps
cdef double k, eps, h0
cdef DoubleArray d_rhop


###############################################################################
Expand All @@ -35,6 +37,7 @@ cdef class SPHVelocityDivergence(SPHFunctionParticle):
###############################################################################
# `ADKEConductionCoeffUpdate` class.
###############################################################################
cdef class ADKEConductionCoeffUpdate(SPHVelocityDivergence):
cdef class ADKEConductionCoeffUpdate(SPHFunction):
""" Compute the new smoothing length for the ADKE algorithm """
cdef double g1, g2
cdef DoubleArray d_div
Loading

0 comments on commit 9a1ad9c

Please sign in to comment.