|
|
| Author |
Message |
Marc Dansereau science forum beginner
Joined: 27 May 2005
Posts: 11
|
Posted: Fri May 27, 2005 12:19 am Post subject:
interpolation and derivative approximation
|
|
|
I am new in this forum. I am working on a particle system where
physical quantities like velocity or diffusion coefficient are specified on
points in a cubic 3D grid. I use trilinear interpolation to get the value
of the fields at the particle position. My code is based on the explanation
found in the book "Graphics Gems IV" (this code is availlable on
http://www.soe.ucsc.edu/~pang/160/f99/Gems/GemsIV/trilerp.c).
For some fields like diffusion coefficients, I also want to compute the
partial derivative relative to the variable X, Y or Z. What is the best way
to compute this derivative. I think it is possible to compute it dunring
the interpolation, but I don't know how to do.
Thank you very much for your time.
Marc |
|
| Back to top |
|
 |
Peter Spellucci science forum Guru
Joined: 29 Apr 2005
Posts: 702
|
Posted: Fri May 27, 2005 2:35 pm Post subject:
Re: interpolation and derivative approximation
|
|
|
In article <zrvle.23513$Ot6.1325950@news20.bellglobal.com>,
Marc Dansereau <bouloumag@hotmail.com> writes:
| Quote: | I am new in this forum. I am working on a particle system where
physical quantities like velocity or diffusion coefficient are specified on
points in a cubic 3D grid. I use trilinear interpolation to get the value
of the fields at the particle position. My code is based on the explanation
found in the book "Graphics Gems IV" (this code is availlable on
http://www.soe.ucsc.edu/~pang/160/f99/Gems/GemsIV/trilerp.c).
For some fields like diffusion coefficients, I also want to compute the
partial derivative relative to the variable X, Y or Z. What is the best way
to compute this derivative. I think it is possible to compute it dunring
the interpolation, but I don't know how to do.
Thank you very much for your time.
Marc
|
the derivatives of the piecewise linear continuous interpolant give you
approximations to the partial derivatives of the true solution of
order O(max element diameter) provided your discretization is quasiuniform.
you can obtain superconvergence on the nodes by proper linear combinations of the
gradients at the neighboring elements. look up the literature for this
hth
peter |
|
| Back to top |
|
 |
Fred Krogh science forum beginner
Joined: 02 May 2005
Posts: 24
|
Posted: Fri May 27, 2005 6:53 pm Post subject:
Re: interpolation and derivative approximation
|
|
|
Marc Dansereau wrote:
| Quote: | I am new in this forum. I am working on a particle system where
physical quantities like velocity or diffusion coefficient are specified on
points in a cubic 3D grid. I use trilinear interpolation to get the value
of the fields at the particle position. My code is based on the explanation
found in the book "Graphics Gems IV" (this code is availlable on
http://www.soe.ucsc.edu/~pang/160/f99/Gems/GemsIV/trilerp.c).
For some fields like diffusion coefficients, I also want to compute the
partial derivative relative to the variable X, Y or Z. What is the best way
to compute this derivative. I think it is possible to compute it dunring
the interpolation, but I don't know how to do.
Thank you very much for your time.
Marc
The code at http://mathalacarte.com/cb/mom.fcg/ya59 will interpolate and |
compute partial derivatives.
Fred |
|
| Back to top |
|
 |
Marc Dansereau science forum beginner
Joined: 27 May 2005
Posts: 11
|
Posted: Fri May 27, 2005 9:06 pm Post subject:
Re: interpolation and derivative approximation
|
|
|
Fred Krogh wrote:
| Quote: | Marc Dansereau wrote:
I am new in this forum. I am working on a particle system where
physical quantities like velocity or diffusion coefficient are specified
on points in a cubic 3D grid. I use trilinear interpolation to get the
value of the fields at the particle position. My code is based on the
explanation found in the book "Graphics Gems IV" (this code is availlable
on http://www.soe.ucsc.edu/~pang/160/f99/Gems/GemsIV/trilerp.c).
For some fields like diffusion coefficients, I also want to compute the
partial derivative relative to the variable X, Y or Z. What is the best
way to compute this derivative. I think it is possible to compute it
dunring the interpolation, but I don't know how to do.
Thank you very much for your time.
Marc
The code at http://mathalacarte.com/cb/mom.fcg/ya59 will interpolate and
compute partial derivatives.
Fred
|
This code should be a good candidate for the "International Obfuscated C
Code Contest" (http://www.ioccc.org/main.html) ... ;-)
Seriously, do you have something more readable to suggest or a web site that
explain how I can implement my own algorithm. I don't want to just pick up
a code somewhere, I also want to be able to understand what it does.
Marc |
|
| Back to top |
|
 |
Fred Krogh science forum beginner
Joined: 02 May 2005
Posts: 24
|
Posted: Mon May 30, 2005 7:25 pm Post subject:
Re: interpolation and derivative approximation
|
|
|
Marc Dansereau wrote:
| Quote: | Fred Krogh wrote:
Marc Dansereau wrote:
I am new in this forum. I am working on a particle system where
physical quantities like velocity or diffusion coefficient are specified
on points in a cubic 3D grid. I use trilinear interpolation to get the
value of the fields at the particle position. My code is based on the
explanation found in the book "Graphics Gems IV" (this code is availlable
on http://www.soe.ucsc.edu/~pang/160/f99/Gems/GemsIV/trilerp.c).
For some fields like diffusion coefficients, I also want to compute the
partial derivative relative to the variable X, Y or Z. What is the best
way to compute this derivative. I think it is possible to compute it
dunring the interpolation, but I don't know how to do.
Thank you very much for your time.
Marc
The code at http://mathalacarte.com/cb/mom.fcg/ya59 will interpolate and
compute partial derivatives.
Fred
This code should be a good candidate for the "International Obfuscated C
Code Contest" (http://www.ioccc.org/main.html) ... ;-)
Seriously, do you have something more readable to suggest or a web site that
explain how I can implement my own algorithm. I don't want to just pick up
a code somewhere, I also want to be able to understand what it does.
Marc
As is explained on the site, the code you saw was the "mangled" version. |
You need to pay for clean source. The mangled version gets identical
results to the clean one.
The documentation for the code (which fortunately is not mangled)
describes the method. If your orignal post had indicated you wanted to
code your own version, I would not have responded in the first place.
Regards,
Fred |
|
| Back to top |
|
 |
Han de Bruijn science forum Guru
Joined: 18 May 2005
Posts: 1285
|
Posted: Tue May 31, 2005 6:18 am Post subject:
Re: interpolation and derivative approximation
|
|
|
Marc Dansereau wrote:
| Quote: | For some fields like diffusion coefficients, I also want to compute the
partial derivative relative to the variable X, Y or Z. What is the best way
to compute this derivative. I think it is possible to compute it during
the interpolation, but I don't know how to do.
|
I would advise to use a comb of bell-shapes (Gaussian distributions):
f(x,y,z) = sum_(i,j,k) f(i,j,k) exp(-1/2.[(x-x_i)^2 + (y-y_j)^2 +
(z-z_k)^2]/sigma^2) . norm
where norm = [1/(sigma.sqrt(2.pi))]^3
Here sigma is _twice_ the grid spacing; Shannon's theorem now guarantees
that f(x,y,z) is sufficiently accurate. Be smart and don't calculate any
contributions outside the intervals +/- 2.pi.sigma around a gridpoint.
http://huizen.dto.tudelft.nl/deBruijn/programs/delphi.htm#ND
Herewith it's easy to infer any partial derivatives, up to any order.
Han de Bruijn |
|
| Back to top |
|
 |
Google
|
|
| Back to top |
|
 |
|
|
The time now is Fri Jul 30, 2010 5:32 am | All times are GMT
|
|
Copyright © 2004-2005 DeniX Solutions SRL
|
|
Other DeniX Solutions sites:
Electronics forum |
Medicine forum |
Unix/Linux blog |
Unix/Linux documentation |
Unix/Linux forums
|
Powered by phpBB © 2001, 2005 phpBB Group
|
|