Custom geometry

Greetings Palabos & OpenLB community,

I’ve been reading the tutorials from the wiki but i am unable to find a way in which i can insert into a simulation a custom geometry (a 3D geometry like a car for example). I have seen that some threads on the forums point out to a MultiScalar3D in order to load a “custom geometry”?

pcout << “Reading the geometry file.” << endl;
MultiScalarField3D mediadomain(nx, ny, nz);
plb_ifstream fileinput(“sim.txt”);
if(!fileinput.is_open()) {
pcout << "Error: could not open geometry file " << endl;
return -1;
}
fileinput >> mediadomain;

If this is what i need how is the format of the file?

Thank you all very much.

Hi,

Yes, your code is valid and offers a way of reading a geometry from a text file. After this, you can instantiate bounce-back nodes in the interior of your obstacle through a command like the following:


// Create a bounce-back node wherever the mask "mediaDomain" evaluates to 1.
defineDynamics(lattice, mediaDomain, new BounceBack<T,DESCRIPTOR(), 1);

The file sim.txt must be a text file which contains a sequence of integer numbers, all in one line. There must be a total of nxnynz numbers, and they represent the content of the matrix “mediadomain”. A specific value of this integer number is then used to label the nodes which are inside the obstacle. Have a look at the example $PALABOS_ROOT/examples/codesByTopic/io/loadGeometry.cpp to understand better what’s going on.

This assumes that you have a volume (node-by-node) description of your obstacle/car. If instead your input uses a surface description (“a sequence of triangles”) of the obstacle, you can use the voxelizer, which reads STL files to create the geometry. Check out the user’s guide for further info: http://www.lbmethod.org/palabos/documentation.userguide/boundary-conditions.html#domain-creation-from-an-stl-file

Please note that so far we have only tested the voxelizer for interior domains (flow inside a channel, where the geometry of the channel comes from an STL file). Adapting the code to exterior domains shouldn’t be that hard, but requires some thinking.

Thank you very much jlatt,

I was a little bit confused on how to specify the point set… i will try what you told me and i will read the code on the voxelizer if i need to modify it.Anything ill show up again for help or for posting my results.

Thank you again.

Hi outerscorchy,

Maybe my fully commented version of the readStl code can help you: http://www.lbmethod.org/forum/read.php?4,2348

Thank you Arne and Jonas!

I have been poking these couple of weeks with loading geometries, changing the parameters and using different 3D models. I now feel confident enough to start simulating with Palabos, and i have a question or a few ones and also i hope that the experts and anyone can give me their advice.

First of all I will put everyone on context with my problem. I want to be able to simulate the process of an explosion (deflagration) caused by an accident of a fuel tanker. Suppouse the fuel tanker wrecks its fuel tank and that the fuel (gasoline) starts to spill out with certain speed. Then, suppose the fuel ignites and starts to heat up until it makes a gaseous layer on top of the burning fluid (this process is called combustion). When this mixtuer reaches certain temperature the actual explosion (BOOM) occurs.

What I want to be able to reproduce with Palabos are the following processes:
a) The fuel spilling from the container
- For this I tought that something like a model with buoyancy could help… Supposing a cubical container at first i could model say one of the faces as an outlet and make the fluid start going out…
b) The combustion process: Given certain volume of the fuel that spilled out from the container i want to be able to simulate something like a volume reduction and the separation of the two fluids: the remaining burning fuel and the gaseous layer created from the combustion process. I think i can make it work out with the Multi-Component or Multi-Fluid example. I don’t know is how to achieve the volume reduction of the fuel fluid…
c) The explosion : I think a Raylegh-Bernard model can help me perform this step, like in the boussinesq3D. I have read some papers in which using Raylegh-Bernard I can make some smoke fumes. Later on I would like to simulate the hot particles raising and less hot (colder like lead) dropping down. Raylegh*Bernard can helpme again and also using multi-fluid with gravity to drop down the heavy material.

Well, I hope I have been brief about it… any help and guidance is gratefully appreciated.