Exemple #1
0
        /// <summary>
        /// common to more than one constructor
        /// </summary>
        protected void ConstructorCommon2(CoordinateMapping UnknownsMap, SpatialOperator rhsOperator, CoordinateMapping rhsDomainFields)
        {
            // verify input
            // ------------

            if (m_Mapping.Fields.Count != rhsOperator.CodomainVar.Count)
            {
                throw new ArgumentException("spatial differential operator and RHS obperator must have the same number of domain variables.", "rhsOperator");
            }

            // construct evaluator
            // -------------------

            m_rhsEvaluator = rhsOperator.GetEvaluator(rhsDomainFields, UnknownsMap);
        }
        /// <summary>
        /// Ctor
        /// </summary>
        /// <param name="VelocityMapping"></param>
        /// <param name="VelocityVectorMapping"></param>
        /// <param name="PressureMapping"></param>
        /// <param name="SolverConf"></param>
        /// <param name="Velocity0"></param>
        /// <param name="Velocity0Mean"></param>
        /// <param name="Phi0"></param>
        /// <param name="Phi0Mean"></param>
        /// <param name="eta">
        /// Dynamic viscosity for viscous (Laplace) operator.
        /// </param>
        public OperatorFactoryFlowFieldVariableDensity(UnsetteledCoordinateMapping VelocityMapping, UnsetteledCoordinateMapping VelocityVectorMapping,
                                                       UnsetteledCoordinateMapping PressureMapping,
                                                       SolverConfiguration SolverConf,
                                                       VectorField <SinglePhaseField> Velocity0, VectorField <SinglePhaseField> Velocity0Mean, SinglePhaseField Phi0, SinglePhaseField Phi0Mean,
                                                       SinglePhaseField eta, SinglePhaseField[] MassFractionsCurrent = null, SinglePhaseField[] MassFractionsMean = null)
        {
            this.Convection       = new SIMPLEOperator[SolverConf.SpatialDimension];
            this.Visc             = new SIMPLEOperator[SolverConf.SpatialDimension];
            this.Swip2            = new SIMPLEOperator[SolverConf.SpatialDimension];
            this.Swip3            = new SIMPLEOperator[SolverConf.SpatialDimension];
            this.PressureGradient = new SIMPLEOperator[SolverConf.SpatialDimension];
            this.DivergenceConti  = new SIMPLEOperator[SolverConf.SpatialDimension];

            for (int d = 0; d < SolverConf.SpatialDimension; d++)
            {
                switch (SolverConf.Control.PhysicsMode)
                {
                case PhysicsMode.Incompressible:
                    throw new ApplicationException("Wrong OperatorFactory");

                case PhysicsMode.LowMach:
                case PhysicsMode.Multiphase:
                    this.Convection[d] = new MomentumConvectionVariableDensityOperator(VelocityMapping, Velocity0, Velocity0Mean, Phi0, Phi0Mean, SolverConf, d);
                    break;

                default:
                    throw new NotImplementedException("PhysicsMode not implemented");
                }
                this.Visc[d]  = new MomentumViscousVariableDensityOperator(VelocityMapping, Phi0, SolverConf, d);
                this.Swip2[d] = new MomentumSwip2(VelocityMapping, VelocityVectorMapping, Phi0, SolverConf, d);
                switch (SolverConf.Control.PhysicsMode)
                {
                case PhysicsMode.LowMach:
                    this.Swip3[d]           = new MomentumSwip3(VelocityMapping, VelocityVectorMapping, Phi0, SolverConf, d);
                    this.DivergenceConti[d] = GetDivergenceContiOperator(PressureMapping, VelocityMapping, Phi0, SolverConf, d);
                    break;

                case PhysicsMode.Multiphase:
                    // Divergence of velocity is zero for smooth interface multiphase flows
                    this.Swip3[d]           = null;
                    this.DivergenceConti[d] = GetDivergenceContiOperator(PressureMapping, VelocityMapping, Phi0, SolverConf, d);
                    break;

                default:
                    throw new ApplicationException("PhysicsMode is not compatible with OperatorFactory.");
                }
                this.PressureGradient[d] = new MomentumPressureGradientOperator(VelocityMapping, PressureMapping, SolverConf, d);
            }

            VariableDensitySIMPLEControl varDensConf = SolverConf.Control as VariableDensitySIMPLEControl;

            if (varDensConf.Froude.HasValue)
            {
                this.BuoyantForce = new SpatialOperator.Evaluator[SolverConf.SpatialDimension];
                for (int d = 0; d < SolverConf.SpatialDimension; d++)
                {
                    SpatialOperator BuoyancyOperator = (new Buoyancy(varDensConf.GravityDirection,
                                                                     d,
                                                                     varDensConf.Froude.Value,
                                                                     varDensConf.EoS)).Operator();
                    this.BuoyantForce[d] = BuoyancyOperator.GetEvaluator(Phi0.Mapping, VelocityMapping);
                }
            }

            //this.PressureStabilization = new DivergencePressureStabilization(ctx, PressureMapping, SolverConf);
        }