Sign in to follow this  

An "energy" field simulation with flows and energy production/consumption

This topic is 400 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey,

 

Is there any algorithm or math function which allows to calculate a more-less uniform distribution based on coordinates (2d or 3d) and, maybe, time?

With possibility to "drain"/add energy from/to any point of the field and in such cases dynamically calculate flows of the energy from "high" points to "low" points.

 

I've already tried to play with Gaussian function – it's pretty good in this case, and allow to make multiple peaks, both positive (energy production) or negative ("consumption"), but I'm not sure how to calculate dynamic flows (the field should tend to be uniform).

 

The main disadvantage in case of Gaussian is that it's pretty heavy to calculate, especially if I have lot of peaks.

 

Is there any other similar/suitable functions? Or, maybe, I'm thinking in a wrong way and there are different approaches exist to calculate such things?

Edited by norlin

Share this post


Link to post
Share on other sites

I am not sure what you mean by the field to be uniform. You can use any function with a peak in the point to create production or consumption. Different functions will obviously look different. A good candidate can probably be cubic B-spline basis functions. They are quite fast to evaluate and they have a local support. Their derivative is also very easy to compute (which makes it easier to compute the flow).

Share this post


Link to post
Share on other sites

I am not sure what you mean by the field to be uniform. You can use any function with a peak in the point to create production or consumption. Different functions will obviously look different. A good candidate can probably be cubic B-spline basis functions. They are quite fast to evaluate and they have a local support. Their derivative is also very easy to compute (which makes it easier to compute the flow).

Sorry, I'm not strong in math and also english is not my native language...

"Uniform" – I mean it should have more-less "flat" surface, except peaks, similar to the Gaussian function – it tends to "0":

[attachment=33893:Normal_Distribution_PDF.svg.png]

 

Could you please write an example of cubic B-spline basis function with 2 peaks?

Edited by norlin

Share this post


Link to post
Share on other sites
: http://pd.chem.ucl.ac.uk/pdnn/peaks

 

broken link


particle based water or airflow simulations might be a good approach.

 

 

particles start uniformly distributed over a grid.   You can then add positive and negative influence points to the grid, and move the particles based on the influences, resulting in different particle densities in different places - IE peaks and valleys.

 

Similar to a paint program type editor for a heightmap.

Edited by Norman Barrows

Share this post


Link to post
Share on other sites

I can't open your link but the basic approach is to define your field as a sum of basis functions centered at the maximum and minimum points. Many different functions can be used. Some additional examples include rational functions like 1/(1 + x^2) or piece-wise polynomial or trigonometric functions like F(x) = cos(x) + 1 in [-pi, pi] and zero outside. What other properties do you want from your peaks?

 

A cubic B-spline basis function is a piece-wise polynomial function which is used as the basis for B-spline curve and surfaces. It is defined recursively and they can be defined for any order/degree. The cubic B-spline basis functions are the more common ones. The local support property can be useful in this case since it means the function is zero outside some distance from these points (thus reducing the amount of computation required).

Share this post


Link to post
Share on other sites
broken link

Thanks, fixed. (and here it is as well: http://pd.chem.ucl.ac.uk/pdnn/peaks/peakindx.htm )

 

 

particle based water or airflow simulations might be a good approach.

Yes, I'm thinking about this way as well, but it could be much more complicated both for implementation and computing time requirements.

Also, the main disadvantage, it will not allow to calculate a value at random coordinates without knowing all previous calculations. (In case of Gaussian function I need only last known peaks coefficients).

 

 

cubic B-spline basis

I've fixed the link; And thanks for this suggestion, it looks exactly what I'm looking for... Will try to learn about those functions, since for now I don't yet understand exactly about it...

Am I understand it correctly – I need to calculate multiple functions (one for each peak) and then make some interpolation to combine the results?

Edited by norlin

Share this post


Link to post
Share on other sites

This topic is 400 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this