Commit ad3473ed authored by Jonathan Lambrechts's avatar Jonathan Lambrechts
Browse files

remove state in all .py files

parent 8668533f
Pipeline #8535 failed with stages
in 1 minute and 33 seconds
......@@ -114,7 +114,7 @@ class Darcy(unittest.TestCase) :
fluid.set_wall_boundary("Bottom",velocity=[0,0])
fluid.set_wall_boundary("Top",velocity=[0,0])
fp = np.zeros_like(fluid.porosity())
fluid.set_particles(p.mass(), p.volume(), p.state(),p.contact_forces(),init=True)
fluid.set_particles(p.mass(), p.volume(), p.position(), p.velocity(), p.contact_forces(),init=True)
fluid.export_vtk(outputdir,0,0)
t = 0
......
......@@ -59,8 +59,7 @@ class Inclined2d(unittest.TestCase) :
#
vit = []
ref = np.array([1,2,3,4,5,6,7,8,9,10])*0.55278468635
state = p.state()
G = np.zeros_like(state.v)
G = np.zeros_like(p.velocity())
G[:,1] = g[1]*p.mass()[:,0]*cos(radians(25))
G[:,0] = -g[1]*p.mass()[:,0]*sin(radians(25))
while t < tEnd :
......@@ -68,7 +67,7 @@ class Inclined2d(unittest.TestCase) :
t += dt
ii += 1
if ii%200==0:
vit.append(np.sqrt(np.sum(p.state().v**2)))
vit.append(np.sqrt(np.sum(p.velocity()**2)))
print("%i : %.5g/%.5g" % (ii, t, tEnd))
error = max(abs(ref - np.array(vit))/ref)
self.assertLess(error,.5/100., "error is too large in inclined2d")
......@@ -60,8 +60,7 @@ class Inclined3d(unittest.TestCase) :
#
vit = []
ref = np.array([1,2,3,4,5,6,7,8,9,10])*0.59226930681
state = p.state()
G = np.zeros_like(state.v)
G = np.zeros_like(p.velocity())
G[:,2] = g[2]*p.mass()[:,0]*cos(radians(25))
G[:,0] = -g[2]*p.mass()[:,0]*sin(radians(25))*2**0.5/2
G[:,1] = -g[2]*p.mass()[:,0]*sin(radians(25))*2**0.5/2
......@@ -70,7 +69,7 @@ class Inclined3d(unittest.TestCase) :
t += dt
ii += 1
if ii%200==0:
vit.append(np.sqrt(np.sum(p.state().v**2)))
vit.append(np.sqrt(np.sum(p.velocity()**2)))
print("%i : %.5g/%.5g" % (ii, t, tEnd))
error = max(abs(ref - np.array(vit))/ref)
self.assertLess(error,.5/100., "error is too large in inclined3d")
......@@ -86,7 +86,7 @@ class Poiseuille(unittest.TestCase) :
t = 0
fluid.set_particles(p.mass(), p.volume(), p.state(),p.contact_forces())
fluid.set_particles(p.mass(), p.volume(), p.position(), p.velocity(), p.contact_forces())
fluid.export_vtk(outputdir,0,0)
......@@ -103,7 +103,7 @@ class Poiseuille(unittest.TestCase) :
p.write_vtk(outputdir, ioutput, t)
ii += 1
print("%i : %.2g/%.2g (cpu %.6g)" % (ii, t, tEnd, time.time() - tic))
V.append(abs(p.state().v[0,1]))
V.append(abs(p.velocity()[0,1]))
V = np.array(V)
Vref = np.array(Vref)
......
......@@ -105,9 +105,7 @@ class Weight(unittest.TestCase) :
p = scontact.ParticleProblem(2,True,True)
p.set_friction_coefficient(0.)
p.read_vtk(outputdir,0)
state = p.state()
state.v[:,0] = np.random.uniform(0,1e-3,state.v.shape[0])
p.set_state(state)
p.velocity()[:,0] = np.random.uniform(0,1e-3,p.velocity().shape[0])
# Initial time and iteration
t = 0
ii = 0
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment