Skip to content

upqdb

Due to recent bot attacks we have changed the sign-up process. If you want to participate in our forum please send a message via our contact form.

Forum Replies Created

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • in reply to: Rotating cuboid not working correctly in 1.8 #10393
    upqdb
    Participant

    Hello,

    When using the IndicatorRotate class, at the moment it is not possible to use the union and intersection operators. This, however can be solved by upcasting the IndicatorRotate to an IndicatorF2D when creating the pointer for the rotated geometry. I have added a comment in the following code.

    
      // ramp
      Vector<T, 2> straightCubeExtend(6.43, 1.85);
      Vector<T, 2> straightCubeOrigin;
      straightCubeOrigin[0] = 2;
      Vector<T, 2> tiltedCubeExtend(8.43, 1.27);
      Vector<T, 2> tiltedCubeOrigin;
      tiltedCubeOrigin[0] = 1;
      tiltedCubeOrigin[1] = 0;
      Vector<T, 2> lowerCubeExtend(6.43, .71);
      Vector<T, 2> lowerCubeOrigin;
      lowerCubeOrigin[0] = 2;
      std::shared_ptr<IndicatorCuboid2D<T>> straightCube(new IndicatorCuboid2D<T>(straightCubeExtend, straightCubeOrigin));
      IndicatorCuboid2D<T> tiltedCube(tiltedCubeExtend, tiltedCubeOrigin);
    
      auto                 rotX = tiltedCubeOrigin[0] + tiltedCubeExtend[0] / 2.0;
      auto                 rotY = tiltedCubeOrigin[1] + tiltedCubeExtend[1] / 2.0;
      Vector<T, 2>         rotationPoint(rotX, rotY);
    
      // Use IndicatorF2D as template argument for Pointer, thereby upcasting IndicatorRotate to IndicatorF2D
      std::shared_ptr<IndicatorF2D<T>> rotatedCube(new IndicatorRotate<T, 2>(rotationPoint, 0.174533, tiltedCube));
      std::shared_ptr<IndicatorCuboid2D<T>> lowerCube(new IndicatorCuboid2D<T>(lowerCubeExtend, lowerCubeOrigin));
    
      // * is intersection + is union
      std::shared_ptr<IndicatorF2D<T>> ramp((straightCube * rotatedCube) + lowerCube);
    
      // Set Material Numbers
      superGeometry.rename(0, 2, ramp);
    
      superGeometry.getStatistics().print();
    

    This should result in the same geometry that you created in the 1.7 version.

    in reply to: airfoil2d example case diverges after some time steps #10375
    upqdb
    Participant

    Hello,

    with the default setup the simulation diverges, this is not unintended. The angle of attack is to high and the airfoil stalls. Try to play around with the simulation parameters, mainly the angle and the airfoil profile and you should see that with a lower angle and/or a different airfoil the simulation does not diverge.

    in reply to: Rotating cuboid not working correctly in 1.8 #10374
    upqdb
    Participant

    Hello,

    the problem does not actually come from wrong rotation. In the current version, both the IndicatorCuboid2D class and the IndicatorRotate class have their bounding boxes not respecting the rotation correctly, this results in the geometry being cut off. This problem was already noticed and fixed, however it is not yet in the release branch.

    For now I will provide you the updated getMin and getMax functions for the IndicatorRotate Class.

    
    template <typename S, unsigned D>
    Vector<S,D>& IndicatorRotate<S,D>::getMin()
    {
      if constexpr (D == 2){
        const S inMin[2] = {_indicator.getMin()[0], _indicator.getMin()[1]};
        const S inMax[2] = {_indicator.getMax()[0], _indicator.getMax()[1]};
        const S radius = util::sqrt(util::pow(inMax[0] - inMin[0], 2) + util::pow(inMax[1] - inMin[1], 2));
        _min[0] = _rotationPoint[0] - radius;
        _min[1] = _rotationPoint[1] - radius;
        return _min;
      }
      else if constexpr (D == 3){
        const S inMin[3] = {_indicator.getMin()[0], _indicator.getMin()[1], _indicator.getMin()[2]};
        const S inMax[3] = {_indicator.getMax()[0], _indicator.getMax()[1], _indicator.getMax()[2]};
        const S radius = util::sqrt(util::pow(inMax[0] - inMin[0], 2) + util::pow(inMax[1] - inMin[1], 2) + util::pow(inMax[2] - inMin[2], 2));
        _min[0] = _rotationPoint[0] - radius;
        _min[1] = _rotationPoint[1] - radius;
        _min[2] = _rotationPoint[2] - radius;
        return _min;
      }
    }
    
    template <typename S, unsigned D>
    Vector<S,D>& IndicatorRotate<S,D>::getMax()
    {
      if constexpr (D == 2){
        const S inMin[2] = {_indicator.getMin()[0], _indicator.getMin()[1]};
        const S inMax[2] = {_indicator.getMax()[0], _indicator.getMax()[1]};
    
        const S radius = util::sqrt(util::pow(inMax[0] - inMin[0], 2) + util::pow(inMax[1] - inMin[1], 2));
        _max[0] = _rotationPoint[0] + radius;
        _max[1] = _rotationPoint[1] + radius;
        return _max;
      }
      else if constexpr (D == 3){
        const S inMin[3] = {_indicator.getMin()[0], _indicator.getMin()[1], _indicator.getMin()[2]};
        const S inMax[3] = {_indicator.getMax()[0], _indicator.getMax()[1], _indicator.getMax()[2]};
        const S radius = util::sqrt(util::pow(inMax[0] - inMin[0], 2) + util::pow(inMax[1] - inMin[1], 2) + util::pow(inMax[2] - inMin[2], 2));
        _max[0] = _rotationPoint[0] + radius;
        _max[1] = _rotationPoint[1] + radius;
        _max[2] = _rotationPoint[2] + radius;
    
        return _max;
      }
    }
    

    This should fix your problem, please report if you run into any more issues!

Viewing 3 posts - 1 through 3 (of 3 total)