Git Product home page Git Product logo

Comments (14)

doyubkim avatar doyubkim commented on June 27, 2024 1

Hi @uljadberdica1000! When running the simulation app, you should pass "--format pos" to export the binary files. By default it will use xyz ASCII format. You can pass -h option to see all the input parameters.

from fluid-engine-dev.

doyubkim avatar doyubkim commented on June 27, 2024

Hi @uljadberdica1000! The particles2obj CLI tool assumes the input file is in a binary file format generated by other example apps such as hybrid_liquid_sim or sph_sim.

If you want to use your own app to generate compatible files, please take a look at main.cpp file in hybrid_liquid_sim example:

void saveParticleAsPos(const ParticleSystemData3Ptr& particles,
                       const std::string& rootDir, int frameCnt) {
    Array1<Vector3D> positions(particles->numberOfParticles());
    copyRange1(particles->positions(), particles->numberOfParticles(),
               &positions);
    char basename[256];
    snprintf(basename, sizeof(basename), "frame_%06d.pos", frameCnt);
    std::string filename = pystring::os::path::join(rootDir, basename);
    std::ofstream file(filename.c_str(), std::ios::binary);
    if (file) {
        printf("Writing %s...\n", filename.c_str());
        std::vector<uint8_t> buffer;
        serialize(positions.constAccessor(), &buffer);
        file.write(reinterpret_cast<char*>(buffer.data()), buffer.size());
        file.close();
    }
}

from fluid-engine-dev.

uljadberdica1000 avatar uljadberdica1000 commented on June 27, 2024

Thank you so much for your help and great work. Is there any way I can generate a partio file (or any particle information saving file format) and most importanly, use it to perform the Zhu-Bridson or the anisotropic algorithms on?

from fluid-engine-dev.

doyubkim avatar doyubkim commented on June 27, 2024

We currently do not support partio format, so you probably should right a converter which both links to Jet Framework and partio library.

from fluid-engine-dev.

uljadberdica1000 avatar uljadberdica1000 commented on June 27, 2024

tried running :
~/fluid-engine-dev/build/bin$ ./particles2obj -i hybrid_liquid_sim_output/frame_000001.xyz -o out.obj

and I got that there is segmentation error (core dumped). Could you give me an example of how to run the code?

from fluid-engine-dev.

uljadberdica1000 avatar uljadberdica1000 commented on June 27, 2024

Could you please provide me with an example? I keep getting the error of dumped cores. Do I red the entire folder of the hybrid output?
./particles2obj -i /home/uljad1b/fluid-engine-dev/build/bin/hybrid_liquid_sim_output -o out.obj gave me the following:
terminate called after throwing an instance of 'std::__ios_failure'
what(): basic_filebuf::underflow error reading the file: iostream error
Aborted (core dumped)

from fluid-engine-dev.

doyubkim avatar doyubkim commented on June 27, 2024

Hi @uljadberdica1000!

Sure, so here's an example. You can first run the hybrid_liquid_sim like this:

PS C:\Users\doyub\Codes\fluid-engine-dev> .\build\bin\Release\hybrid_liquid_sim.exe -h
usage:
  hybrid_liquid_sim.exe  options

where options are:
  -r, --resx <resolutionX>         grid resolution in x-axis (default is 50)
  -f, --frames <numberOfFrames>    total number of frames (default is 100)
  -p, --fps <fps>                  frames per second (default is 60.0)
  -e, --example <exampleNum>       example number (between 1 and 6, default
                                   is 1)
  -l, --log <logFilename>          log file name (default is
                                   hybrid_liquid_sim.log)
  -o, --output <outputDir>         output directory name (default is
                                   hybrid_liquid_sim_output)
  -m, --format <format>            particle output format (xyz or pos.
                                   default is xyz)

PS C:\Users\doyub\Codes\fluid-engine-dev> .\build\bin\Release\hybrid_liquid_sim.exe -f 10 -m pos
Running example 1 (water-drop with FLIP)
Domain: [0.000000, 0.000000, 0.000000] x [1.000000, 2.000000, 1.000000]
Grid spacing: [0.020000, 0.020000, 0.020000]
Writing hybrid_liquid_sim_output\frame_000000.pos...
Writing hybrid_liquid_sim_output\frame_000001.pos...
Writing hybrid_liquid_sim_output\frame_000002.pos...
Writing hybrid_liquid_sim_output\frame_000003.pos...
Writing hybrid_liquid_sim_output\frame_000004.pos...
Writing hybrid_liquid_sim_output\frame_000005.pos...
Writing hybrid_liquid_sim_output\frame_000006.pos...
Writing hybrid_liquid_sim_output\frame_000007.pos...
Writing hybrid_liquid_sim_output\frame_000008.pos...
Writing hybrid_liquid_sim_output\frame_000009.pos...

Then, you can run the particle2obj like this:

PS C:\Users\doyub\Codes\fluid-engine-dev> .\build\bin\Release\particles2obj.exe -i .\hybrid_liquid_sim_output\frame_000000.pos -m zhu_bridson
  particles2obj.exe  options

where options are:
  -?, -h, --help                      display usage information
  -i, --input <inputFilename>         input obj file name
  -o, --output <outputFilename>       output obj file name
  -r, --resolution <resolution>       grid resolution in CSV format (default
                                      is 100,100,100)
  -g, --grid_spacing <gridSpacing>    grid spacing in CSV format (default is
                                      0.01,0.01,0.01)
                                      0,0,0)
  -m, --method <method>               spherical, sph, zhu_bridson, and
                                      anisotropic followed by optional
                                      method-dependent parameters (default is
                                      anisotropic)
  -k, --kernel <kernelRadius>         interpolation kernel radius (default is
                                      0.2)

PS C:\Users\doyub\Codes\fluid-engine-dev> .\build\bin\Release\particles2obj.exe -i .\hybrid_liquid_sim_output\frame_000000.pos -r 100,200,100 -g 0.01 -k 0.04 -m zhu_bridson -o .\hybrid_liquid_sim_output\frame_000000.obj
Resolution: 100 x 200 x 100
Domain: [0.000000, 0.000000, 0.000000] x [1.000000, 2.000000, 1.000000]
Grid spacing: [0.010000, 0.010000, 0.010000]
Number of particles: 534361
Reconstruction method: zhu_bridson
[INFO] 2020-07-14 01:35:59 [C:\Users\doyub\Codes\fluid-engine-dev\src\jet\point_parallel_hash_grid_searcher3.cpp:141 (build)] Average number of points per non-empty bucket: 428.861
[INFO] 2020-07-14 01:35:59 [C:\Users\doyub\Codes\fluid-engine-dev\src\jet\point_parallel_hash_grid_searcher3.cpp:144 (build)] Max number of points per bucket: 729
[INFO] 2020-07-14 01:35:59 [C:\Users\doyub\Codes\fluid-engine-dev\src\jet\particle_system_data3.cpp:220 (buildNeighborSearcher)] Building neighbor searcher took: 0.05554 seconds
Writing .\hybrid_liquid_sim_output\frame_000000.obj..

Then, you will get results something like:

frame_000000

from fluid-engine-dev.

douysu avatar douysu commented on June 27, 2024

I'm glad to see this issue. It would be better written the issue step in the README.

from fluid-engine-dev.

uljadberdica1000 avatar uljadberdica1000 commented on June 27, 2024

Is there any way I could use the xyz file for that? I want to use it as a plugin for something else and need to put the xyz from another simulation.

from fluid-engine-dev.

doyubkim avatar doyubkim commented on June 27, 2024

@uljadberdica1000: you mean you want to generate xyz files externally and use particles2obj to generate mesh, right? Adding xyz support shouldn't be too hard. Let me see what I can do.

from fluid-engine-dev.

uljadberdica1000 avatar uljadberdica1000 commented on June 27, 2024

Yes thank you so much! I just want to use your work since I will never be able to write a better one anyway! I want to be able to use xyz to generate the mesh with the particles2obj.

from fluid-engine-dev.

doyubkim avatar doyubkim commented on June 27, 2024

@uljadberdica1000: the requested feature is now up for PR. Feel free to test it from the branch (xyz).

from fluid-engine-dev.

uljadberdica1000 avatar uljadberdica1000 commented on June 27, 2024

It worked great. Thank you so much. Do you have any literature you could suggest on the trade offs of using each method both computationally and geometrically. I cannot find a proper source! The xyz input works great!

from fluid-engine-dev.

doyubkim avatar doyubkim commented on June 27, 2024

Hi @uljadberdica1000 ,

I would definitely start from Yu and Turk paper (https://www.cc.gatech.edu/~turk/my_papers/particle_surfaces_tog.pdf). I don't know if there are any survey papers on that topic, but that paper should cover most of your questions. The computational cost is something could be reevaluated with modern hardwares including GPUs.

from fluid-engine-dev.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.