Skip to content

How to add 2d vtk files as geometrical models

OpenLB – Open Source Lattice Boltzmann Code Forums on OpenLB General Topics How to add 2d vtk files as geometrical models

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #8822
    Bobbie
    Participant

    Dear community, how can we import a VTK format file with a 2D geometric model of a complex structure to replace the current simple and regular models in the examples?

    #8826
    mathias
    Keymaster

    We dont have a 2d example, but 3d (cf. resolvedRock3d). You can set one dimension to zero in the vtk file or extent OpenLB.

    #8830
    Bobbie
    Participant

    Thank you for your help. Best wishes!

    #8914
    nipinl
    Participant

    Hi Bobbie,
    Have you tried the resolvedRock3d case? or have you tried any geometric model with vtk? Because, I faces some problems in running resolvedRock3d with vti file. Just curious!!
    Regards,
    Nipin

    #8947
    jan
    Participant

    Dear Bobbie,

    if your 2D structure can be converted to a VTI, then you can use an approach such as this, which uses the IndicatorBlockData2D:

    
        std::shared_ptr<BlockVTIreader3D<T, T>> vtiReader(
            new BlockVTIreader3D<T, T>(vtiFile, "Elevation"));
        vtiReader->printInfo();
        auto           cuboidSample     = vtiReader->getCuboid();
        T              deltaRsample     = cuboidSample.getDeltaR() * sourceScale;
        Vector<int, 3> extentSample     = cuboidSample.getExtent();
        Vector<T, 3>   originSamplePhys = cuboidSample.getOrigin() * sourceScale;
        Vector<T, 3>   extentSamplePhys = {deltaRsample * T(extentSample[0] + 0.5),
                                           deltaRsample * T(extentSample[1] + 0.5),
                                           deltaRsample * T(extentSample[2] + 0.5)};
        std::shared_ptr<IndicatorBlockData2D<T>> ind(
            new IndicatorBlockData2D<T>(vtiReader->getBlockData(), extentSamplePhys,
                                        originSamplePhys, deltaRsample, false));
    

    Best regards,
    Jan

    #8960
    Bobbie
    Participant

    Dear Nipin(Nipinl)
    You are quite right and the case you mentioned seems incomplete. I have also appeared problems when I tried to make and run it. I’m also trying to improve it, but I haven’t made much progress yet. Perhaps the answer Jan gave is feasible, but I haven’t had a chance to try it. You can try it. And do you have any new findings that I hope we can continue to communicate.
    Best regards,
    Bobbie

    #8963
    Bobbie
    Participant

    Dear Jan,
    Thank you for sharing your method with great respect! I’ll give it a try and I hope it will succeed.
    Best wishes,
    Bobbie

    #8969
    nipinl
    Participant

    Hi Bobbie,
    I forgot to update here that my issue is resolved. I was writing vti in different format than ascii, which caused the issue. With right format, the simulation is working. I’m new to openLB, and now getting familiar with it going through the examples that are relevant to my case. Happy to communicate.

    Best Regards,
    Nipin

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.