private void DefineBulkOperator(LevelSetTracker LSTrck, ILevelSetForm InterfaceFlux, int D, double PenaltyBase) { foreach (Foundation.Grid.RefElements.RefElement r in LevelSetTracker.GridDat.Grid.RefElements) { if (r is Foundation.Grid.RefElements.Triangle && this.Control.FluxVariant == FluxVariant.ValueBased) { throw new NotSupportedException("Level-Set Based flux direction does not work on triangular grids "); } } switch (Control.FluxVariant) { case FluxVariant.GradientBased: /// Flux Based on Mean LevelSetGradient this.Operator_bulk = (new EllipticExtVelFormDirected(PenaltyBase, Control.IsotropicViscosity, InterfaceFlux, LSTrck)).Operator(2); break; case FluxVariant.ValueBased: /// Flux Based on Cell-Averaged Level-Set Value this.Operator_bulk = (new EllipticExtVelFormLevelSetBased(PenaltyBase, Control.IsotropicViscosity, LSTrck)).Operator(2); break; case FluxVariant.SWIP: this.Operator_bulk = (new EllipticExtVelFormSWIP(PenaltyBase, Control.IsotropicViscosity, LSTrck)).Operator(0); break; default: throw new NotImplementedException(); } }
/// <summary> /// Based on the Ideas by /// C. Basting and D. Kuzmin, /// “A minimization-based finite element formulation for interface-preserving level set reinitialization”, /// Computing, vol. 95, no. 1, pp. 13–25, Dec. 2012. /// </summary> /// <param name="LSTrck"></param> /// <param name="bcmap">Boundary Conditions for the LevelSet Equations</param> /// <param name="Control">various parameters <paramref name="EllipticReinitControl"/></param> public Extender(SinglePhaseField Extension, LevelSetTracker LSTrck, ILevelSetForm InterfaceFlux, List <DGField> InterfaceParams, VectorField <SinglePhaseField> LevelSetGradient, EllipticExtVelAlgoControl Control) { if (InterfaceFlux.ParameterOrdering.Count != InterfaceParams.Count) { throw new ArgumentException("Missmatch in Number of Parameters and expected amount in the given flux."); } this.InterfaceParams = InterfaceParams; this.Control = Control; int D = LSTrck.GridDat.SpatialDimension; //this.InterfaceValue = InterfaceValue; //InterfaceValue.Identification = "InterfaceValue"; this.Extension = Extension; this.LevelSetTracker = LSTrck; Phi = LevelSetTracker.LevelSets[0] as LevelSet; this.LevelSetGradient = LevelSetGradient; switch (Control.FluxVariant) { case FluxVariant.GradientBased: // Flux Direction based on Mean Level Set Gradient MeanLevelSetGradient = new VectorField <SinglePhaseField>( D.ForLoop( d => new SinglePhaseField( new Basis(LSTrck.GridDat, 0), VariableNames.MeanLevelSetGradientComponent(d) ) ) ); BulkParams = new List <DGField> { }; BulkParams = ArrayTools.Cat(BulkParams, LevelSetGradient.ToArray(), Phi, MeanLevelSetGradient.ToArray(), InterfaceParams.ToArray()); break; case FluxVariant.ValueBased: // Flux Direction Based on Cell-Averaged Level-Set Value MeanLevelSet = new SinglePhaseField(new Basis(LSTrck.GridDat, 0), "MeanLevelSet"); BulkParams = ArrayTools.Cat(LevelSetGradient.ToArray(), Phi, MeanLevelSet); break; case FluxVariant.SWIP: BulkParams = LevelSetGradient.ToArray(); break; default: throw new NotImplementedException(); } this.D = LevelSetTracker.GridDat.SpatialDimension; double PenaltyBase = Control.PenaltyMultiplierFlux * ((double)((Phi.Basis.Degree + 1) * (Phi.Basis.Degree + D))) / ((double)D); DefineBulkOperator(LSTrck, InterfaceFlux, D, PenaltyBase); Operator_interface = InterfaceFlux.XOperator(new[] { "A" }, QuadOrderFunc.FixedOrder(2 * Extension.Basis.Degree + 2)); }
/// <summary> /// ctor. /// </summary> public LinearLevelSetFormVectorizer(ILevelSetForm _OrgComponent) { this.ArgumentOrdering = _OrgComponent.ArgumentOrdering.ToArray(); this.ParameterOrdering = _OrgComponent.ParameterOrdering != null?_OrgComponent.ParameterOrdering.ToArray() : null; this.LevelSetIndex = _OrgComponent.LevelSetIndex; this.PositiveSpecies = _OrgComponent.PositiveSpecies; this.NegativeSpecies = _OrgComponent.NegativeSpecies; this.LevelSetTerms = _OrgComponent.LevelSetTerms; this.OrgComponent = _OrgComponent; }
/// <summary> /// ctor. /// </summary> public NonlinearLevelSetFormVectorizer(ILevelSetForm _OrgComponent, LevelSetTracker _lsTrk) { this.ArgumentOrdering = _OrgComponent.ArgumentOrdering.ToArray(); this.ParameterOrdering = _OrgComponent.ParameterOrdering != null?_OrgComponent.ParameterOrdering.ToArray() : null; this.LevelSetIndex = _OrgComponent.LevelSetIndex; this.PositiveSpecies = _OrgComponent.PositiveSpecies; this.NegativeSpecies = _OrgComponent.NegativeSpecies; this.LevelSetTerms = _OrgComponent.LevelSetTerms; this.OrgComponent = _OrgComponent; //this.lsTrk = _lsTrk; }
private bool Compfilter(IEquationComponent c) { ILevelSetForm b = (ILevelSetForm)c; if (this.m_LevSetIdx != b.LevelSetIndex) { // component is not relevant for this level-set return(false); } if (!(this.SpeciesA == b.NegativeSpecies && this.SpeciesB == b.PositiveSpecies)) { // component is not relevant for this level-set return(false); } // filter passed return(true); }