Esempio n. 1
0
 public EllipticReInitUpwindForm_Laplace(double PenaltyBase, LevelSetTracker LSTrck) : base(PenaltyBase, LSTrck.GridDat.Cells.PenaltyLengthScales, VariableNames.LevelSet)
 {
     this.D          = LSTrck.GridDat.SpatialDimension;
     this.m_CutCells = LSTrck.Regions.GetCutCellMask().GetBitMask();
     this.LSTrck     = LSTrck;
     LSTrck.Subscribe(this);
 }
Esempio n. 2
0
 /// <summary>
 /// CTOR
 /// </summary>
 /// <param name="PenaltyBase">Penalty Mutliplier based on Polynomial Degree</param>
 /// <param name="IsotropicViscosity"></param>
 /// <param name="LSTrck">Level-Set Tracker</param>
 public EllipticExtVelForm(double PenaltyBase, double IsotropicViscosity, LevelSetTracker LSTrck)
 {
     this.PenaltyBase        = PenaltyBase;
     this.IsotropicViscosity = IsotropicViscosity;
     this.LSTrck             = LSTrck;
     this.D  = LSTrck.GridDat.SpatialDimension;
     this.cj = LSTrck.GridDat.Cells.cj;
     LSTrck.Subscribe(this);
     CutCellMask = LSTrck.Regions.GetCutCellMask().GetBitMaskWithExternal();
 }
Esempio n. 3
0
        /// <summary>
        /// Constructs a new species map using the level set information
        /// provided by <paramref name="levelSet"/>.
        /// </summary>
        /// <param name="control"></param>
        /// <param name="levelSet"></param>
        /// <param name="material"></param>
        public ImmersedSpeciesMap(IBMControl control, LevelSet levelSet, Material material)
        {
            this.Control  = control;
            this.material = material;

            this.tracker = new LevelSetTracker(
                (GridData)levelSet.GridDat,
                Control.CutCellQuadratureType,
                0,
                new string[] { Control.VoidSpeciesName, Control.FluidSpeciesName },
                levelSet);
            tracker.Subscribe(this);
        }
Esempio n. 4
0
        public LineSegment[] GetReferenceLineSegments()
        {
            Stack <Simplex> simplexHierarchy = new Stack <Simplex>();
            Simplex         currentSimplex   = Simplex;
            int             spatialDimension = Simplex.SpatialDimension;

            int n = 0;

            while (currentSimplex.GetType() != lineSimplex.GetType())
            {
                if (n > MAX_SIMPLEX_LEVELS)
                {
                    throw new ApplicationException("Something went terribly wrong. Please contact Björn");
                }

                simplexHierarchy.Push(currentSimplex);

                currentSimplex = currentSimplex.EdgeSimplex;
                n++;
            }

            MultidimensionalArray vertexCoordinates = MultidimensionalArray.Create(2, 1);

            vertexCoordinates[0, 0] = -1.0;
            vertexCoordinates[1, 0] = 1.0;

            while (simplexHierarchy.Count > 0)
            {
                currentSimplex = simplexHierarchy.Pop();

                int noOfVertices = vertexCoordinates.GetLength(0);
                int D            = currentSimplex.SpatialDimension;
                MultidimensionalArray volumeCoordinates = MultidimensionalArray.Create(
                    noOfVertices * currentSimplex.NoOfEdges, currentSimplex.SpatialDimension);

                for (int e = 0; e < currentSimplex.NoOfEdges; e++)
                {
                    MultidimensionalArray coordinates = MultidimensionalArray.Create(noOfVertices, D);
                    currentSimplex.EdgeToVolumeCoordinates(e, vertexCoordinates, coordinates);

                    for (int i = 0; i < noOfVertices; i++)
                    {
                        for (int d = 0; d < D; d++)
                        {
                            volumeCoordinates[e * noOfVertices + i, d] = coordinates[i, d];
                        }
                    }
                }

                vertexCoordinates = volumeCoordinates;
            }

            Debug.Assert(
                vertexCoordinates.GetLength(0) % 2 == 0,
                "Even number of vertices expected");
            int initialNumberOfLineSegments = vertexCoordinates.GetLength(0) / 2;

            List <LineSegment> lineSegments = new List <LineSegment>(initialNumberOfLineSegments);

            for (int i = 0; i < initialNumberOfLineSegments; i++)
            {
                LineSegment newSegment = new LineSegment(spatialDimension, RootFindingAlgorithm);
                for (int d = 0; d < spatialDimension; d++)
                {
                    newSegment.Start[d] = vertexCoordinates[2 * i + 0, d];
                    newSegment.End[d]   = vertexCoordinates[2 * i + 1, d];
                }

                if (!lineSegments.Contains(newSegment))
                {
                    lineSegments.Add(newSegment);
                    tracker.Subscribe(newSegment);
                }
            }

            foreach (LineSegment segment in lineSegments)
            {
                LevelSet levelSetField = tracker.LevelSets[levSetIndex] as LevelSet;
                if (levelSetField != null)
                {
                    segment.ProjectBasisPolynomials(levelSetField.Basis);
                }
            }

            return(lineSegments.ToArray());
        }
Esempio n. 5
0
 public EllipticReInitUpwindForm_RHS(double PenaltyBase, LevelSetTracker LSTrck) : base(PenaltyBase, LSTrck)
 {
     this.D = LSTrck.GridDat.SpatialDimension;
     LSTrck.Subscribe(this);
 }