Closed VijayN10 closed 1 year ago
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:
Mesh*
and scaling it to the desired size (30.0f
), andThe 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:
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.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.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!
@ProjectPhysX , thank you so much for the detailed explanation!
I will definitely try this out and will update you sooner.
Hello!
I want to simulate fluid - structure interactions for coastal waves. But have few queries regarding creation of simulation box (domain) and locating stl file in the simulation box. The desired set up would look like as in figure below with a domain size of 6m x 30m x 4m. It is having fluid below 0.75m.
The stl file would look like following image, where blue coordinate symbol represents origin -
I have used following code -
But, when I run the case. The set up appears as below image -
Here, the stl gets scaled up uneven. And also the water level seems not correct.
I have written my doubts in the respective code lines
Thank you for your time and assistance and look forward to hearing back from you!