General

General

Using a CFD-Post Perl script, how can I determine if a point is in the domain?

    • FAQFAQ
      Participant

      To see if a point is inside a domain, you could check whether the nearest vertex parameter is defined for the Point. When inside the domain, CFD-Post populates this parameter with the nearest vertex. If the point is outside the domain, it will still find the nearest point but only within a limited tolerance (~0.01 x Mesh Extents by default) The parameter name is “Nearest Node Number” but it’s a hidden CCL parameter, so you won’t see it in the CCL editor. If the point is too far from the domain to find the nearest node, the parameter value is -1. So any positive value indicates the point is inside one of the domains in which it is defined. The Perl script for this is: !$nearestNode = getValue(‘Point 1′,’Nearest Node Number’); ! if ($nearestNode>0) { ! $inside = ‘true’; ! print(“I’m in!n”); ! } else { ! $inside = ‘false’; ! print(“I’m out!n”); !}