Comments (9)
Fortunately, I've also tried another one symplectic method (1st order) - semi-implicit Euler method.
Surprisingly, it does not suffer from finite precision problem - the solution is very close to analytical one at timeStep values up to 1e-04 s (previously we were able to use timeStep up to 5e-6 s).
In this simple test it really works at this timeStep, but in a simulation including liquid I see stable behavior of the system only at timeStep values up to 1e-05 s, but even this is twice better than 5e-06. Our recent worm body model and liquid around it works fine with this 1st order semi-implicit Euler method. So, I consider it as a good solution which singificanly improved adequacy of Sibernetic and I plan to update the master branch of the Sibernetic code soon with this new method.
Also there is one more variant - we should keep it in mind for the case if even better precision will be necessary. It is 2nd order symplectic LeapFrog algorithm, which works only if we use double values for accelerations, velocities and positions, but right now, in my opinion, it is not necessary.
from sibernetic.
What is the computation cost per step of semi-implicit Euler vs the existing method? The total computation time to advance the simulation by time delta-t is the important metric.
Double precision calculations do take longer than 32 bit, but if we are able to use a simpler numerical method, or to significantly increase the time step, then the trade-off may be worth it.
from sibernetic.
@a-palyanov believes we have the best option for floats but we may need a different option for doubles
from sibernetic.
@a-palyanov thanks for the update on this today in the hangout -- feel free to write a bit more to illustrate where this is so other folks can get the update too.
from sibernetic.
Float_max = 3.402823e+038
Float_min = 1.175494e-038
Double_max = 1.797693e+308
Double_min = 2.225074e-308
Float:
As we can see at this example, -118.625 is composed of [-1] * [118625] * [1e-03].
So, for fraction part we can work with values from 0 to some MAX_VALUE.
from sibernetic.
And here is an illustration of how this influences on precision which is available for us in case of calculations (numerical integration).
from sibernetic.
My calculations showed that for 32bit float coordinates (in all three dimensions) inside the interval ~ (-100000_r0...100000_r0) (r0 = 'radius' of the SPH particle) the maximal integral error connected with this effect will be limited by ~0.002_r0 per 100 integration steps (or ~0.00002_r0 per 1 integration step), which will not be noticeable. This numbers are for integration time step = 3.00e-05 s.
We currently use in simulation 5e-06 s. I hope I will soon recalculate for this value too, but anyway results shouldn't be worse.
from sibernetic.
Remember to ensure that every stage of calculation must stay within the
bounds 1E38 1E-38. There are some places in the original kernel that
violate this restriction.
Also when summing you need to ensure that the operands are of a similar
magnitude.
On Jun 19, 2014 12:54 AM, "a-palyanov" [email protected] wrote:
My calculations showed that for 32bit float coordinates (in all three
dimensions) inside the interval ~ -100000_r0...100000_r0
http://r0%20=%20'radius'%20of%20the%20SPH%20particle the maximal
integral error connected with this effect will be limited by ~0.002_r0 per
100 integration steps (or ~0.00002_r0 per 1 integration step), which will
not be noticeable.—
Reply to this email directly or view it on GitHub
#19 (comment)
.
from sibernetic.
More precisely, we must stay within the bounds (3.40e+38...1.17e-38, 0.00e+00 , -1.17e-38...-3.40e+38)
And I hope in this new code (https://github.com/openworm/Smoothed-Particle-Hydrodynamics/tree/development) which I committed today this restrictions are satisfied.
from sibernetic.
Related Issues (20)
- Steps towards integration of touch sensation HOT 6
- Performance changes in latest development branch HOT 8
- Pressure file format issue HOT 2
- How to expand the liquid particles? HOT 2
- Document the way to access the body position on each step? HOT 1
- Double text in README HOT 4
- Rerun (-l_from) simulation inside openworm container HOT 4
- Pressure buffer file issue HOT 6
- Add more molecular in sibernetic?
- User-defined geometries and muscle models HOT 18
- Asking for simulation HOT 13
- Segmentation fault when pressing 1 or 2 to select demo simulation HOT 5
- Segmentation fault when running Sibernetic built on WSL2 HOT 11
- Header files explicitly links a path to Python.h
- Ubuntu 20.04: free(): double free detected in tchache 2 when replaying simulation HOT 1
- No such file or directory muscles_activity_buffer.txt HOT 1
- Exception: The provided 'key_property' entry does not appear to be a property HOT 4
- Use python-config script for Python libraries in makefile
- Resolve compiler warnings
- Add simulation video recording utility
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sibernetic.