I have overhauled the script, so that there are no globals, subiterations can be ended as needed etc. The traction() function is removed, the loading displacement is given simply by value. I hope it does what you intended.
It needs a patch to TimeStepper, that I will be able to upload first on Monday, so either just look at it, or fix it yourself... :)
r.
On Wed, 19 Jan 2011, Andre Smit wrote:
I would use brute force:Robert - I'm trying to change the displacement (disp) in the traction
function when the force stabilizes but for some reason the scope of disp
within traction() appears different to that within calc_force(), even
though disp is defined as global. Any ideas?
old_force = 0
def calc_force(pb, ts, state):
global disp,old_force
d = state()
pb.remove_bcs()
f = pb.evaluator.eval_residual(d)
pb.time_update()
f.shape = (pb.domain.mesh.n_nod, 3)
p = []
for n in pb.domain.regions['Top'].vertices[0]:
p.append(f[n][2])
p = nm.array(p)
if abs(old_force-p.sum()) < fvar:
my_output(disp,",",p.sum())
disp -= ddisp
old_force=p.sum()
def traction(ts, coors, bc=None):
global disp
#disp = -(ts.dt*(ts.step+1))
print "traction disp: ", disp
val = nm.empty_like(coors[:,0])
val.fill(disp)
return val
globals()['disp'] = ...
You cannot really change value of a global that is immutable (IMHO)...
A common idiom is to use list instead, like:
disp = [0]disp[0] = ...
def traction(ts, coors, bc=None):That might be the problem causing the oscillations...
What is the meaning of 'smix' stiffness, for strain rate
zero?
I'm not sure.
r.
--You received this message because you are subscribed to the Google Groups "sfepy-devel" group.
To post to this group, send email to sfepy...@googlegroups.com.
To unsubscribe from this group, send email to sfepy-devel...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/sfepy-devel?hl=en.