Skip to content

Creating an IndicatorF from density

OpenLB – Open Source Lattice Boltzmann Code Forums on OpenLB General Topics Creating an IndicatorF from density

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #8551
    avrachan1
    Participant

    Dear Community,

    I would like to make an IndicatorF3D which is based on the densities at the lattice sites.

    For example if there are regions in the lattice whose density > 0.5, then I want the indicator functor to identify that region.

    I suppose I have to overload the operator() with a custom function.

    Any pointers would be of great help.

    Thank you

    #8564
    Adrian
    Keymaster

    For lattice-dependent indicators you’ll want to use the SuperIndicatorF3D interface as the base class and override the operator().

    #8574
    avrachan1
    Participant

    Dear Adrian,

    Thank you for your reply.

    I made the following class

    129 template <typename T, typename DESCRIPTOR>
    130 class myindicator : public SuperIndicatorF3D<T>
    131 {
    132 private :
    133 SuperLattice<T,DESCRIPTOR>& sLattice;
    134 public :
    135 myindicator(SuperLattice<T,DESCRIPTOR>& _sLattice, SuperGeometry<T,3>& superGeometry) : SuperIndicatorF3D<T>(superGeometry), sLattice(_sLattice)
    136 {
    137 ;
    138 this->getName() = “myindicator”;
    139 };
    140
    141 bool operator()(int iC,int iX,int iY,int iZ)
    142 {
    143 T phi=sLattice.getBlock(iC).get(iX,iY,iZ).computeRho();
    144 ;
    145 if(phi>0.5)
    146 return true;
    147 else
    148 return false;
    149 };
    150 };
    151

    What I need is an object of type IndicatorF3D to give as an argument for setResolvedArbitraryShape3D().

    Therefore I need to give (x,y,z) and get a true/false in return.

    But without the cuboid number, I cannot access the lattice site corresponding to (x,y,z).

    Am I understanding this correctly? How to go about this?

    Thanks again.

    PS: How do you paste code in this forum ?

    #8594
    mathias
    Keymaster

    from the instance “sLattice” you get the cuboidGeometry and there you get the lattice coordinates for the physical coordinates and vice versa.

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