← Back to team overview

yade-users team mailing list archive

Re: [Question #230216]: How to apply boundary of seismic acceleration

 

Question #230216 on Yade changed:
https://answers.launchpad.net/yade/+question/230216

Jan Stránský proposed the following answer:
Hello Henry,

I personally don't know about any implemented function for your situation.
However, you can write your own python code :-) something like:

class AccelerogramApplier:
  def __init__(self,bodies,accelerogram):
     self.accelerogram = accelerogram
     self.bodies = bodies
     for b in self.bodies:
       b.state.fixedDOFs = 'xyzXYZ' # fix all the bodies
  def getDeltaVel(self): # computes current acceleration and computes
velocity increment
    ac = self.accelerogam
    assert O.time < ac[-1][0]
    for i,(t,a) in enumerate(ac):
      if O.time > t: break
    t0,t1 = ac[i][0],ac[i+1][0]
    a0,a1 = ax[i][1],ac[i+1][1]
    a = a0 + (O.time-t0)*(a1-a0)/(t0-t1)
    dv = a*O.dt
    return dv
  def applyAccel(self):
     dv = self.getDeltaVel()
     for b in self.bodies:
        b.state.vel += dv # add velocity increment to bodies

accelerogram = [(0.0,0.0),(0.4,2.0),(0.8,3.2),(1.2,0.9),(1.6,-0.4),...] #
time-acceleration pairs, the format may be any other, possibly loaded from
file
bodiesToAllpyAccel = [...] # somelsit of bodies for acceleration to be
applied
aaplier
= AccelerogramApplier(accelerogram,bodiesToAllpyAccelbodiesToAllpyAccel)

O.engines = [
  ...
  PyRunner(iterperiod=1,command="applier.applyAccel()"), # in this quick
answer, I think this PyRunner should be before NewtonIntegrator, but I
don't have enough time to think about it carefully :-)
  ...
  NewtonIntegrator(...),
  ...
]

I don't know your problem, so I can't tell if this apprach is sufficient
for you or not, but at least it can give you some hints :-) If this type of
code is what you want and your python code works fine, you/we can
reimplement it as C++ engine.
cheers
Jan

PS: I am sorry for my previous (incomplete) answer, it was sent by mistake,
just ignore it



2013/6/5 Jan Stránský <honzik.stransky@xxxxxxxxx>

> Hello Henry,
>
> I personally don't know about any implemented function for your situation.
> However, you can write your own python code :-) something like:
>
> class AccelerogramApplier:
>   def __init__(self,bodies,accelerogram):
>      self.accelerogram = accelerogram
>      self.bodies = bodies
>   def getAccel(self):
>
> for t,a in self.acceleration:
>         if O.time > t: break
>
>   def applyAccel(self):
>      a = self.getAceleration()
>      for b in self.bodies:
>         O.forces.addF(b.id,a*b.state.mass)
> accelerogram = [(0.0,0.0),(0.4,2.0),(0.8,3.2),(1.2,0.9),(1.6,-0.4),...] #
> time-acceleration pairs, the format may be any other , possibly loaded from
> file
>
>
>
> 2013/6/5 Henry <question230216@xxxxxxxxxxxxxxxxxxxxx>
>
>> New question #230216 on Yade:
>> https://answers.launchpad.net/yade/+question/230216
>>
>> Hi, All,
>>    I want to use the Yade to simulate the failure process of the slope
>> under earthquake conditions. However, I can't find the function for the
>> application of the seismic acceleration?
>>  Is there anyone who has used this function? Thanks a lot!
>>   Henry!
>>
>> --
>> You received this question notification because you are a member of
>> yade-users, which is an answer contact for Yade.
>>
>> _______________________________________________
>> Mailing list: https://launchpad.net/~yade-users
>> Post to     : yade-users@xxxxxxxxxxxxxxxxxxx
>> Unsubscribe : https://launchpad.net/~yade-users
>> More help   : https://help.launchpad.net/ListHelp
>>
>
>

-- 
You received this question notification because you are a member of
yade-users, which is an answer contact for Yade.