Learning Fluid Simulation

Be it designing, analysis visualisation is a big part of engineering discipline. Such is it’s important that entire industries are based on providing physics based softwares.

But now we have a new toolkit to understand the complex behaviours of fluids and other. Neural networks are able to learn the patterns of smoke simulation etc without any pde’s. This is going to be a huge step in the industry.

Watch the video.

Can’t wait to see this technology to come to production.

Advertisements

Using HDF5 lib with Visual Studio

During October last year, my work involved using HDF library with FORTRAN and C and use them to store mounds of data other systems were generating.

The first step was to use the library with visual studio 2008 in windows. Companywide HDF5 had many users in Linux cluster but no formal implementation was available to use in visual studio. While that made the library available but building, a program using them in visual studio was a different matter. I faced couple of issues and with much googling and stack overflowing, solved them, here is the running note I took for one of the issue, just in case someone else is in the same situation.

Hope this helps.

1>libhdf5.lib(H5I.c.obj) : error LNK2001: unresolved external symbol _forceCRTManifestCUR

1>libhdf5.lib(H5.c.obj) : error LNK2001: unresolved external symbol _forceCRTManifestCUR

1>libhdf5.lib(H5D.c.obj) : error LNK2001: unresolved external symbol _forceCRTManifestCUR

1>libhdf5.lib(H5F.c.obj) : error LNK2001: unresolved external symbol _forceCRTManifestCUR

1>libhdf5.lib(H5S.c.obj) : error LNK2001: unresolved external symbol _forceCRTManifestCUR

From: https://social.msdn.microsoft.com/Forums/vstudio/en-US/af6796af-a1bf-4904-9923-15101956d882/linking-error-with-vc9-error-lnk2001-unresolved-external-symbol-forcecrtmanifestcur?forum=vcgeneral

  • The various header files associated with the visual C++ runtime embed a number of directives into the compiled code. This power used to be used for good: appropriate #pragma’s could ensure that the resulting .lib file automatically had a dependency on the correct runtime libraries.

    However, a kind of dependency ____ comes about when one tries to mix projects built with different build settings in the same version of dev studio, and becomes even worse when pre-built libs made by another version of Dev Studio are used.

    The best thing to do, frankly, would be to rebuild your .libs in the same version of Dev Studio. There are some project settings that can be used when building a .lib that can ‘sanitize it’ a bit and make it’s use more compatible with different versions of dev studio – libraries should generally be built with the multi threaded runtime selected (NOT the DLL runtime) and the option “Omit Default Library Names” selected.

    In this case, __forceCRTManifestCUR, is a result of a #pragma comment(linker, “/INCLUDE=__forceCRTManifestCUR”) directive in one of the c-runtime header files.

    You can work around this by simply including a like like this in your main.cpp file:

    int __forceCRTManifestCUR=0;

    Doing this will “defeat” an attempt by the headers to get a manifest dependency to the “current” version of the CRT dlls embedded – but don’t worry – the correct CRT manifest is already specified correctly using a different mechanism, so you can generally quite safely define this symbol (by declaring it as an int or anything really) without causing any problems for the project.

What in Uncertainty Quantification?

“If a man will begin with certainties, he shall end in doubts;
but if he will be content to begin with doubts, he shall end in certainties.” – F. Bacon – 1605.
The availability of powerful computational resources and general purpose numerical algorithms creates increasing opportunities to attempt simulations in complex systems. How accurate are the resulting predictions? Are the mathematical and physical models correct? Do we have sufficient information to define relevant operating conditions? In general, how can we establish error bars on the results?
 
error_bars
Uncertainty Quantification (UQ) aims at developing rigorous methods to characterize the impact of limited knowledge on quantities of interest. At the interface between physics, mathematics, probability and optimization, and although quite mature in the experimental community, UQ efforts are in their infancy in computational science.
Proud to be part of this. Hope to continue to work with it.

Building fasttext with Visual Studio

While working on classifying knowledge management documents needed word embedding, and this required me to build fasttext on windows using visual studio, as cmake was not available.

Here’s a visual summary of the steps with few things I faced while building fasttext with visual studio 2013.

 

 

 

 

 

 

 

 

 

 

 

Error    4    error C2146: syntax error : missing ‘;’ before identifier ‘size’    d:\project\fasttext-master\fasttext-master\src\utils.h    19    1    fasttext

Error    5    error C4430: missing type specifier – int assumed. Note: C++ does not support default-int    d:\project\fasttext-master\fasttext-master\src\utils.h    19    1    fasttext

Error    6    error C2061: syntax error : identifier ‘int64_t’    d:\project\fasttext-master\fasttext-master\src\utils.h    20    1    fasttext

Error    7    error C2146: syntax error : missing ‘;’ before identifier ‘size’    d:\project\fasttext-master\fasttext-master\src\utils.cc    18    1    fasttext

Error    8    error C4430: missing type specifier – int assumed. Note: C++ does not support default-int    d:\project\fasttext-master\fasttext-master\src\utils.cc    18    1    fasttext

Error    9    error C2086: ‘int fasttext::utils::int64_t’ : redefinition    d:\project\fasttext-master\fasttext-master\src\utils.cc    18    1    fasttext

 

Error    11    error C2061: syntax error : identifier ‘int64_t’    d:\project\fasttext-master\fasttext-master\src\utils.cc    23    1    fasttext

Error    12    error C2065: ‘pos’ : undeclared identifier    d:\project\fasttext-master\fasttext-master\src\utils.cc    25    1    fasttext

Error    24    error C2039: ‘iota’ : is not a member of ‘std’    d:\project\fasttext-master\fasttext-master\src\productquantizer.cc    115    1    fasttext

Error    25    error C3861: ‘iota’: identifier not found    d:\project\fasttext-master\fasttext-master\src\productquantizer.cc    115    1    fasttext

Error    26    error C2039: ‘iota’ : is not a member of ‘std’    d:\project\fasttext-master\fasttext-master\src\productquantizer.cc    134    1    fasttext

Error    27    error C3861: ‘iota’: identifier not found    d:\project\fasttext-master\fasttext-master\src\productquantizer.cc    134    1    fasttext

Error    55    error C2039: ‘iota’ : is not a member of ‘std’    d:\project\fasttext-master\fasttext-master\src\fasttext.cc    207    1    fasttext

Error    56    error C3861: ‘iota’: identifier not found    d:\project\fasttext-master\fasttext-master\src\fasttext.cc    207    1    fasttext

 

 

 

 

 

 

 

Patran Neutral Mesh File Writer updated

Sphere

A recent comment from a blog reader made me relook at the patran neutral mesh file writer routine that I had on this blog.

Since the code was pasted on this blog, it lacked proper update and ability to have a test case or example file.

So spent this weekend, creating an example file and have uploaded the code and the example on github.

The entire writer is now availabe at https://github.com/sukhbinder/PatranMeshWriter

Hope to add and update the code more often. 🙂

 

Intersection Of two curves in Pure Numpy

Faced the following problem a few months back: Have two sets of curves in Cartesian coordinates, want to find if they intersect and where?

No straight forward solution was available, could find various solution using functions but none available with x, y coordinates.

Solution, found a matlab implementation that did just that, ported it to python. This is a pure python numpy implementation of interaction of two curves.

 

Example Usage:

Produces the picture at the start of this post. As always the entire code freely available at this github repo.