Example #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="LinearizedFlux"/> class.
        /// </summary>
        /// <param name="baseFlux">The base flux.</param>
        public LinearizedFlux(INonlinearFlux baseFlux)
        {
            this.baseFlux = baseFlux;

            if (baseFlux.ParameterOrdering != null && baseFlux.ParameterOrdering.Count > 0)
            {
                throw new NotImplementedException(
                          "Linearized flux currently does not support fluxes with parameters");
            }
        }
Example #2
0
 /// <summary>
 /// constructor;
 /// </summary>
 /// <param name="a_Flux">
 /// affine-linear flux functions, implemented as
 /// <see cref="INonlinearFlux"/>
 /// </param>
 /// <param name="a_FluxTimeInDependent"><see cref="ILinearFlux.FluxTimeInDependent"/></param>
 /// <param name="a_FluxSpaceInDependent"><see cref="ILinearFlux.FluxSpaceInDependent"/></param>
 /// <param name="a_BorderFluxSpaceInDependent"><see cref="ILinearFlux.BorderFluxSpaceInDependent"/></param>
 /// <param name="a_BorderFluxTimeInDependent"><see cref="ILinearFlux.FluxTimeInDependent"/></param>
 public LinearFluxBuilder(INonlinearFlux a_Flux,
                          bool a_FluxTimeInDependent, bool a_FluxSpaceInDependent,
                          bool a_BorderFluxTimeInDependent, bool a_BorderFluxSpaceInDependent)
 {
     m_Flux                       = a_Flux;
     p_ArgumentOrdering           = m_Flux.ArgumentOrdering;
     m_Arguments                  = new double[p_ArgumentOrdering.Length];
     m_Arguments2                 = new double[p_ArgumentOrdering.Length];
     p_FluxTimeInDependent        = a_FluxTimeInDependent;
     p_FluxSpaceInDependent       = a_FluxSpaceInDependent;
     p_BorderFluxSpaceInDependent = a_BorderFluxSpaceInDependent;
     p_BorderFluxTimeInDependent  = a_BorderFluxTimeInDependent;
 }
Example #3
0
        /// <summary>
        /// Initializes the integral
        /// </summary>
        /// <param name="grdDat">Information about the grid</param>
        /// <param name="edgeTag">
        /// The edge tag of the boundary edges to be considered in the integral
        /// </param>
        /// <param name="flux">
        /// The integrand. To be more specific,
        /// <see cref="INonlinearFlux.BorderEdgeFlux"/> will be evaluated on
        /// every relevant edge to compute the value of the integrand
        /// </param>
        /// <param name="mapping">
        /// The coordinate mapping that maps field values to the arguments of
        /// <paramref name="flux"/> (see
        /// <see cref="IEquationComponent.ArgumentOrdering"/>)
        /// </param>
        /// <param name="integrationOrder">
        /// The desired order of the applied quadrature rule
        /// </param>
        public EdgeIntegral(GridData grdDat, byte edgeTag, INonlinearFlux flux, CoordinateMapping mapping, int integrationOrder)
        {
            byte[]   edgeTags = grdDat.Edges.EdgeTags;
            BitArray mask     = new BitArray(edgeTags.Length);

            int numberOfRelevantEdges = 0;

            for (int i = 0; i < edgeTags.Length; i++)
            {
                if (edgeTag == edgeTags[i])
                {
                    mask[i] = true;
                    numberOfRelevantEdges++;
                }
            }

            relevantEdgesMask = new EdgeMask(grdDat, mask);
            // Just use first ref element for the moment
            edgeQuadrature = new MyEdgeQuadrature(grdDat, integrationOrder, flux, mapping, 0, relevantEdgesMask);
        }
 /// <summary>
 /// Constructs a new source term for a given
 /// <paramref name="boundaryCondition"/>
 /// </summary>
 /// <param name="config">
 /// Configuration options
 /// </param>
 /// <param name="speciesMap">
 /// Information about the location of the immersed boundary
 /// </param>
 /// <param name="boundaryCondition">
 /// The boundary condition to be enforced
 /// </param>
 /// <param name="fluxFunction">
 /// The flux function to be used to evaluate the flux across the zero
 /// level set (by making use of
 /// <see cref="NonlinearFlux.InnerEdgeFlux(double, int, MultidimensionalArray, MultidimensionalArray, MultidimensionalArray[], MultidimensionalArray[], int, int, MultidimensionalArray)"/>)
 /// </param>
 public BoundaryConditionSourceFromINonlinearFlux(
     CNSControl config, ISpeciesMap speciesMap, BoundaryCondition boundaryCondition, INonlinearFlux fluxFunction)
     : base(config, speciesMap, boundaryCondition)
 {
     this.fluxFunction = fluxFunction;
 }
Example #5
0
 /// <summary>
 /// Initializes the quadrature
 /// </summary>
 /// <param name="grdDat">
 /// The omnipresent Grid
 /// </param>
 /// <param name="quadratureOrder">
 /// The order of the applied quadrature rule
 /// </param>
 /// <param name="flux">
 /// A flux function representing the integrand
 /// </param>
 /// <param name="mapping">
 /// The coordinate mapping for the arguments of
 /// <paramref name="flux"/>.
 /// </param>
 /// <param name="iKref">
 /// Reference element index
 /// </param>
 /// <param name="edgeMask">
 /// An optional restriction of the domain
 /// </param>
 public MyEdgeQuadrature(GridData grdDat, int quadratureOrder, INonlinearFlux flux, CoordinateMapping mapping, int iKref, EdgeMask edgeMask)
     : base(new int[] { 1 }, grdDat, (new EdgeQuadratureScheme(true, edgeMask)).Compile(grdDat, quadratureOrder))
 {
     evaluators = mapping.Fields.ToArray();
     this.flux  = flux;
 }
Example #6
0
 /// <summary>
 /// Variant of
 /// <see cref="EdgeIntegral(GridData, byte, INonlinearFlux, CoordinateMapping, int)"/>
 /// where the edge tag is derived from <paramref name="edgeTagName"/>
 /// </summary>
 /// <param name="grdDat">
 /// <see cref="EdgeIntegral(GridData, byte, INonlinearFlux, CoordinateMapping, int)"/>
 /// </param>
 /// <param name="edgeTagName">
 /// <see cref="EdgeIntegral(GridData, byte, INonlinearFlux, CoordinateMapping, int)"/>
 /// </param>
 /// <param name="flux">
 /// <see cref="EdgeIntegral(GridData, byte, INonlinearFlux, CoordinateMapping, int)"/>
 /// </param>
 /// <param name="mapping">
 /// <see cref="EdgeIntegral(GridData, byte, INonlinearFlux, CoordinateMapping, int)"/>
 /// </param>
 /// <param name="integrationOrder">
 /// <see cref="EdgeIntegral(GridData, byte, INonlinearFlux, CoordinateMapping, int)"/>
 /// </param>
 public EdgeIntegral(GridData grdDat, string edgeTagName, INonlinearFlux flux, CoordinateMapping mapping, int integrationOrder)
     : this(grdDat, GetEdgeTag(grdDat, edgeTagName), flux, mapping, integrationOrder)
 {
 }
Example #7
0
 /// <summary>
 /// Variant of
 /// <see cref="EdgeIntegral(GridData, byte, INonlinearFlux, CoordinateMapping)"/>
 /// where the edge tag is derived from <paramref name="edgeTagName"/>
 /// </summary>
 /// <param name="grdDat">
 /// <see cref="EdgeIntegral(GridData, byte, INonlinearFlux, CoordinateMapping, int)"/>
 /// </param>
 /// <param name="edgeTagName">
 /// The name of the considered edge
 /// </param>
 /// <param name="flux">
 /// <see cref="EdgeIntegral(GridData, byte, INonlinearFlux, CoordinateMapping, int)"/>
 /// </param>
 /// <param name="mapping">
 /// <see cref="EdgeIntegral(GridData, byte, INonlinearFlux, CoordinateMapping, int)"/>
 /// </param>
 public EdgeIntegral(GridData grdDat, string edgeTagName, INonlinearFlux flux, CoordinateMapping mapping)
     : this(grdDat, GetEdgeTag(grdDat, edgeTagName), flux, mapping, mapping.BasisS.Max(basis => basis.Degree))
 {
 }
Example #8
0
 /// <summary>
 /// Variant of
 /// <see cref="EdgeIntegral(GridData, byte, INonlinearFlux, CoordinateMapping, int)"/>
 /// where the integration order is set to the maximum order of any
 /// <see cref="DGField"/> in <paramref name="mapping"/>.
 /// </summary>
 /// <param name="grdDat">
 /// <see cref="EdgeIntegral(GridData, byte, INonlinearFlux, CoordinateMapping, int)"/>
 /// </param>
 /// <param name="edgeTag">
 /// <see cref="EdgeIntegral(GridData, byte, INonlinearFlux, CoordinateMapping, int)"/>
 /// </param>
 /// <param name="flux">
 /// <see cref="EdgeIntegral(GridData, byte, INonlinearFlux, CoordinateMapping, int)"/>
 /// </param>
 /// <param name="mapping">
 /// <see cref="EdgeIntegral(GridData, byte, INonlinearFlux, CoordinateMapping, int)"/>
 /// </param>
 public EdgeIntegral(GridData grdDat, byte edgeTag, INonlinearFlux flux, CoordinateMapping mapping)
     : this(grdDat, edgeTag, flux, mapping, mapping.BasisS.Max(basis => basis.Degree))
 {
 }