|
|
Please don't respond with x=b/A. :) I've been looking at and thinking
about the "Visual Simulation of Smoke" paper (you can search for it on
google) for quite some time, and I have it coded except for one part.
If no one can suggest an answer, than can anyone recommend me to a site
or newsgroup where I could find the answer?
THIS NEXT PART IS IRRELEVANT UNLESS YOU CARE ABOUT WHY I'M TRYING TO DO
THIS.
You can skip past this part
/
| notation.) u* is the velocity and p is pressure.
| Then, as it appears on the paper, I'm having trouble
| with solving for the pressure gradient:
|
|
| For simplification, the 1-d discretized version looks like:
|
|
|
V
Assuming you've understood any of this so far, you know that it has to
be set up in matrix form: Ax=b. It's far too complex to do A^-1*A*x =
A^-1*b and it has a sparse, symmetric matrix, so it has to be solved
with Jacobi's algorithm or the conjugate gradient method. Calling x'
the transpose of x, the cg method is as follows:
x = initial guess for inv(A)*b - matrix containing zeros?
r = b - A*x ... residual, to be made small
p = r ... initial "search direction"
repeat
v = A*p
a = ( r'*r ) / ( p'*v )
x = x + a*p
new_r = new_r - a*v
g = ( new_r'*new_r ) / ( r'*r )
p = new_r + g*p
r = new_r
until ( new_r'*new_r small enough )
Unless I'm wrong, x, b, r, p, new_r, and v are n x 1 matricies,
containing float values. A is a n x n matrix, and a and g are float
values.
Here's the problem: I haven't tried it out yet because I don't think
it will work. I have plenty of macros for matrix operations on arrays,
and based on what I would put into it, I would only get a matrix, x, of
float values. That wouldn't be equal to the pressure gradient. Does
anyone have the faintest idea what I'm doing wrong?
Thanks in advance...
- Ricky
Post a reply to this message
|
|
|
|
In article <091120022309334327%reu### [at] chorusnet>, Reusser
<reu### [at] chorusnet> wrote:
> Here's the problem: I haven't tried it out yet because I don't think
> it will work. I have plenty of macros for matrix operations on arrays,
> and based on what I would put into it, I would only get a matrix, x, of
> float values. That wouldn't be equal to the pressure gradient. Does
> anyone have the faintest idea what I'm doing wrong?
NEVERMIND! I found the answer, I forgot I have to take the gradient
once I find the pressure. Stupid question, wasted time, etc...
-Ricky
Post a reply to this message
|
|