vectorized RK4 [message #51281] |
Thu, 09 November 2006 09:17  |
news.qwest.net
Messages: 137 Registered: September 2005
|
Senior Member |
|
|
I'm looking at a problem where we have to calculate
a Runge Kutta solution for a number of particles.
From some reading I did, I thought I could vectorize
the RK4 call over the number of particles.
From the help example, we have the following call,
> RK4(Y, allders, X, H, 'differential',/double)
For a single particle
x = 0.0
y = [4.0,6.0]
allders is a 2 element array
H = 0.5
"differential" is a defined function returns a 2 element array.
So, how does one go about vectorizing this for 1000 particles?
Is that possible?
I cannot just pass in vectors for x and y
(and of course have the appropriate differential function)
Cheers,
bob
|
|
|
Re: vectorized RK4 [message #51538 is a reply to message #51281] |
Tue, 21 November 2006 09:49  |
news.qwest.net
Messages: 137 Registered: September 2005
|
Senior Member |
|
|
"Kenneth Bowman" <k-bowman@tamu.edu> wrote in message
news:k-bowman-EF0484.10504321112006@news-new.tamu.edu...
> In article <45536299$0$498$815e3792@news.qwest.net>,
> Bob,
>
> You may have already solved this, but if not, RK4 is simple enough to code
> yourself. You lose a little flexibility, but you can vectorize across
> particles.
>
> Ken Bowman
Thanks, yeah the problem has been addressed (did it in fortran for
a speed up of approximately infinity, lol). This application was calling
the routine thousands of times, and it was very slow.
Actually I was confused about some posts I found in google groups
saying that one could vectorize across particles, and I had mistakenly
assumed it referred to the rk4 procedure that comes with IDL. So
I had wasted some time fiddling with it, trying to make it accept arrays
and stuff before realizing that the posts must have been referring to a
different
routine. (in fact I think it was an old message of yours that I had seen.)
Thanks for the response!
Cheers,
bob
|
|
|
Re: vectorized RK4 [message #51540 is a reply to message #51281] |
Tue, 21 November 2006 08:50  |
Kenneth Bowman
Messages: 86 Registered: November 2006
|
Member |
|
|
In article <45536299$0$498$815e3792@news.qwest.net>,
"R.G. Stockwell" <no@email.please> wrote:
> I'm looking at a problem where we have to calculate
> a Runge Kutta solution for a number of particles.
>
> From some reading I did, I thought I could vectorize
> the RK4 call over the number of particles.
>
> From the help example, we have the following call,
>> RK4(Y, allders, X, H, 'differential',/double)
>
> For a single particle
> x = 0.0
> y = [4.0,6.0]
> allders is a 2 element array
> H = 0.5
> "differential" is a defined function returns a 2 element array.
>
>
> So, how does one go about vectorizing this for 1000 particles?
> Is that possible?
> I cannot just pass in vectors for x and y
> (and of course have the appropriate differential function)
>
>
> Cheers,
> bob
Bob,
You may have already solved this, but if not, RK4 is simple enough to code
yourself. You lose a little flexibility, but you can vectorize across particles.
Ken Bowman
|
|
|