Giter Site home page Giter Site logo

Comments (2)

ProjectPhysX avatar ProjectPhysX commented on May 17, 2024

Hi @VijayN10,

apologies for the delayed response! This is a very interesting setup and I wanted to give a very detailed response, but my schedule was too busy until now. I hope this helps you, and please let me know if there is still something unclear.

The size parameter in lbm.voxelize_stl(...) must be a scalar (float) value, not a float3 vector. It's value describes the longest side of the bounding box of the geometry in LBM units, in your case 30.0f cells.

You want to place the geometry such that it is sitting flush on the bottom (-z) and right (+y) walls of the simulation box, also taking into account the one grid layer for the simulation box walls.. Here it is easiest to split the stl voxelization into 2 parts:

  1. loading the stl geometry into a Mesh* and scaling it to the desired size (30.0f), and
  2. translating it to the correct position.

The loading step puts it in the center of the simulation box, and then we need to translate it from the center by mesh_translation:

Mesh* mesh = read_stl(get_exe_path()+"../stl/kyoto.stl", lbm.size(), lbm.center(), 30.0f);
const float3 mesh_size = mesh->pmax-mesh->pmin;
const float3 mesh_translation = float3(0.0f, -1.0f+0.5f*lbm.size().y-0.5f*mesh_size.y, 1.0f-0.5f*lbm.size().z+0.5f*mesh_size.z); // "+-1.0f" to account for simulation box boundary
mesh->translate(mesh_translation);
lbm.voxelize_mesh_on_device(mesh);

To your specific questions:

  1. There is no local refinement on the lattice. If you need a finer grid at one region in the box, you have to make it finer everywhere. This is admittedly rather unfortunate; since a lot of users have requested this already, I'm planning to find a solution for local mesh refinement in the future.
  2. The size parameter (scalar float) in the lbm.voxelize_stl(...) or read_stl(...) functions sets the largest length of the bounding box of the geometry. If you set size=0.0f, the geometry is scaled such that it fits in the simulation box exactly at largest possible inflation. You can also assign the size parameter a negative value; then it becomes a scaling factor relative to the original coordinates in the .stl file, such that no auto-scaling is applied.
  3. The center parameter (vector float3) defines the center of the bounding box of the stl geometry in the simulation box. (0,0,0) here is the back left bottom corner of the simulation box, and (0.5f*(float)Nx-0.5f, 0.5f*(float)Ny-0.5f, 0.5f*(float)Nz-0.5f) or lbm.center() is the middle of the simulation box.
  4. Your box is 4m high and fluid should be < 0.75m. The simulation box in LBM units has a hight of 40 cells, so the water level in LBM units must be < 0.75m/4m * 40 = 7.5.

Note that you also need to set a volume force in the LBM cionstructor such that the water stays at the bottom and does not start to float around in zero-g. Have a look at the "raindrop" sample setup, and also how the unit conversion is done there with the aid of the units struct.

Thank you for using FluidX3D, have fun with it!

from fluidx3d.

VijayN10 avatar VijayN10 commented on May 17, 2024

@ProjectPhysX , thank you so much for the detailed explanation!

I will definitely try this out and will update you sooner.

from fluidx3d.

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.