/// <summary>Realizes a sample function for respective stochastic domain mapper and parameters.</summary>
        /// <param name="iteration">The iteration.</param>
        /// <param name="domainMapper">The domain mapper.</param>
        /// <param name="parameters">The parameters.</param>
        /// <returns></returns>
        public double Realize(int iteration, IStochasticDomainMapper domainMapper, double[] parameters)
        {
            ResetGeneration = (PreviousIteration != iteration);
            if (ResetGeneration)
            {
                ResetSampleGeneration();
            }
            double[] stochasticDomainPoint = domainMapper.Map(parameters);
            var      dw = wu / (double)frequencyIntervals;
            int      i  = 0;
            double   randomCoefficient = 0;

            while (i < frequencyIntervals)
            {
                randomCoefficient += Math.Sqrt(2) * Math.Sqrt(2 * SpectralDensity(dw / 2 + i * dw) * dw) *
                                     (Math.Cos((dw / 2 + i * dw) * stochasticDomainPoint[0] +
                                               phi[i]));
                i++;
            }

            if (randomCoefficient >= .9)
            {
                randomCoefficient = .9;
            }
            else if (randomCoefficient <= -.9)
            {
                randomCoefficient = -.9;
            }

            PreviousIteration = iteration;
            return(MeanValue / (1 + randomCoefficient));
        }
예제 #2
0
 /// <summary>Initializes a new instance of the <see cref="StructuralSystemEvaluator"/> class.</summary>
 /// <param name="youngModulus">The young modulus.</param>
 /// <param name="domainMapper">The domain mapper.</param>
 public StructuralSystemEvaluator(double youngModulus, IStochasticDomainMapper domainMapper)
 {
     YoungModulus          = youngModulus;
     DomainMapper          = domainMapper;
     ModelBuilder          = new GiannisModelBuilder();
     StochasticRealization = new KarhunenLoeveCoefficientsProvider(partition, youngModulus, midpointMethod,
                                                                   isGaussian, karLoeveTerms, domainBounds, sigmaSquare, correlationLength);
 }
        //public StructuralStochasticEvaluator(double youngModulus, IStochasticDomainMapper domainMapper)
        //{
        //    YoungModulus = youngModulus;
        //    DomainMapper = domainMapper;
        //    ModelBuilder = new ModelBuilder();
        //    StochasticRealization = new RandomVariable(youngModulus, domainMapper);
        //}

        /// <summary>Initializes a new instance of the <see cref="StructuralStochasticEvaluator"/> class.</summary>
        /// <param name="youngModulus">The young modulus.</param>
        /// <param name="domainMapper">The domain mapper.</param>
        public StructuralStochasticEvaluator(double youngModulus, IStochasticDomainMapper domainMapper)
        {
            YoungModulus          = youngModulus;
            DomainMapper          = domainMapper;
            ModelBuilder          = new GiannisModelBuilder();
            StochasticRealization = new KarhunenLoeveCoefficientsProvider(partition, youngModulus, midpointMethod,
                                                                          isGaussian, karLoeveTerms, domainBounds, sigmaSquare, correlationLength);
            //StochasticRealization = new SpectralRepresentation1DRandomFieldGenerator(10, 0.1, youngModulus, .05, 0.1, 256);
        }
예제 #4
0
        /// <summary>Realizes the specified iteration based on a stochastic domain mapper and the respective domain parameters.</summary>
        /// <param name="iteration">The iteration.</param>
        /// <param name="domainMapper">The domain mapper.</param>
        /// <param name="parameters">The parameters.</param>
        /// <returns></returns>
        public double Realize(int iteration, IStochasticDomainMapper domainMapper, double[] parameters)
        {
            ResetGeneration = (PreviousIteration != iteration);
            if (ResetGeneration)
            {
                ResetSampleGeneration();
            }
            var stochasticDomainPoint = domainMapper.Map(parameters);

            double[] eigenModesAtPoint = CalculateEigenmodesAtPoint(Xcoordinates, Eigenvectors, stochasticDomainPoint[0]);
            var      value             = KarhunenLoeveFredholm1DSampleGenerator(stochasticDomainPoint, Lambda, eigenModesAtPoint, MeanValue, MidpointMethod, IsGaussian);

            PreviousIteration = iteration;
            return(value);
        }
예제 #5
0
        public Model GetModel(RandomVariable randomVariable, IStochasticDomainMapper domainMapper, int iteration)
        {
            var m = new Model();

            m.NodesDictionary.Add(0, new Node(id: 0, x: 0, y:  0, z: 0));
            m.NodesDictionary.Add(1, new Node(id: 1, x: 1, y:  0, z: 0));
            m.ElementsDictionary.Add(1, new Element()
            {
                ID          = 1,
                ElementType = new EulerBeam3D(randomVariable.Realize(iteration, domainMapper, null), 0.3)
            });
            m.Loads.Add(new Load()
            {
                Amount = 10, DOF = StructuralDof.TranslationX, Node = m.NodesDictionary[1]
            });

            return(m);
        }
예제 #6
0
        /// <summary>Realizes the specified iteration for given stochasti domain mapper and domain prameters.</summary>
        /// <param name="iteration">The iteration.</param>
        /// <param name="domainMapper">The domain mapper.</param>
        /// <param name="parameters">The parameters.</param>
        /// <returns></returns>
        /// <exception cref="System.NotImplementedException"></exception>
        public double Realize(int iteration, IStochasticDomainMapper domainMapper, double[] parameters)
        {
            switch (_distributionType)
            {
            case RandomVariableDistributionType.Normal:
                var normalDistribution = new NormalDistribution(_meanValue, _standardDeviation);
                return(_randomVariable = normalDistribution.NextDouble());

                break;

            case RandomVariableDistributionType.Lognormal:
                var lognormal = new LognormalDistribution(_meanValue, _standardDeviation * _meanValue);
                return(_randomVariable = lognormal.NextDouble());

                break;

            default:
                return(0);

                throw new NotImplementedException();
                break;
            }
        }
예제 #7
0
        public double[] GetDerivative(IStochasticDomainMapper domainMapper, double[] parameters)
        {
            double[] stochasticDomainPoint = domainMapper.Map(parameters);
            var      dk = kupper / (double)frequencyIntervals;

            double[] derivative = { 0, 0 };
            for (int i = 0; i < frequencyIntervals; i++)
            {
                for (int j = 0; j < frequencyIntervals; j++)
                {
                    derivative[0] += -(dk / 2 + i * dk) * Math.Sqrt(2) * (Math.Sqrt(2 * SpectralDensity(dk / 2 + i * dk, dk / 2 + j * dk) * dk) *
                                                                          (Math.Sin((dk / 2 + i * dk) * stochasticDomainPoint[0] + (dk / 2 + j * dk) * stochasticDomainPoint[1] + phi1[i, j])) +
                                                                          Math.Sqrt(2 * SpectralDensity(dk / 2 + i * dk, -(dk / 2 + j * dk)) * dk) *
                                                                          (Math.Sin((dk / 2 + i * dk) * stochasticDomainPoint[0] - (dk / 2 + j * dk) * stochasticDomainPoint[1] + phi2[i, j])));
                    derivative[1] += -(dk / 2 + j * dk) * Math.Sqrt(2) * (Math.Sqrt(2 * SpectralDensity(dk / 2 + i * dk, dk / 2 + j * dk) * dk) *
                                                                          (Math.Sin((dk / 2 + i * dk) * stochasticDomainPoint[0] + (dk / 2 + j * dk) * stochasticDomainPoint[1] + phi1[i, j])) -
                                                                          Math.Sqrt(2 * SpectralDensity(dk / 2 + i * dk, -(dk / 2 + j * dk)) * dk) *
                                                                          (Math.Sin((dk / 2 + i * dk) * stochasticDomainPoint[0] - (dk / 2 + j * dk) * stochasticDomainPoint[1] + phi2[i, j])));
                }
            }

            return(derivative);
        }
예제 #8
0
        public double Realize(int iteration, IStochasticDomainMapper domainMapper, double[] parameters)
        {
            ResetGeneration = (PreviousIteration != iteration);
            if (ResetGeneration)
            {
                ResetSampleGeneration();
            }
            double[] stochasticDomainPoint = domainMapper.Map(parameters);
            var      dk = kupper / (double)frequencyIntervals;
            double   randomCoefficient = 0;

            for (int i = 0; i < frequencyIntervals; i++)
            {
                for (int j = 0; j < frequencyIntervals; j++)
                {
                    randomCoefficient += Math.Sqrt(2) * (Math.Sqrt(2 * SpectralDensity(dk / 2 + i * dk, dk / 2 + j * dk) * dk) *
                                                         (Math.Cos((dk / 2 + i * dk) * stochasticDomainPoint[0] + (dk / 2 + j * dk) * stochasticDomainPoint[1] + phi1[i, j])) +
                                                         Math.Sqrt(2 * SpectralDensity(dk / 2 + i * dk, -(dk / 2 + j * dk)) * dk) *
                                                         (Math.Cos((dk / 2 + i * dk) * stochasticDomainPoint[0] - (dk / 2 + j * dk) * stochasticDomainPoint[1] + phi2[i, j])));
                }
            }

            return(randomCoefficient);
        }
        public Model GetModel(IUncertainParameterRealizer stochasticRealizer, IStochasticDomainMapper domainMapper, int iteration)
        {
            var m = new Model();

            m.SubdomainsDictionary.Add(0, new Subdomain(0));

            m.NodesDictionary.Add(0, new Node(id: 0, x: 0.0, y: 0, z: 0));
            m.NodesDictionary.Add(1, new Node(id: 1, x: 0.1, y: 0, z: 0));
            m.NodesDictionary.Add(2, new Node(id: 2, x: 0.2, y: 0, z: 0));
            m.NodesDictionary.Add(3, new Node(id: 3, x: 0.3, y: 0, z: 0));
            m.NodesDictionary.Add(4, new Node(id: 4, x: 0.4, y: 0, z: 0));
            m.NodesDictionary.Add(5, new Node(id: 5, x: 0.5, y: 0, z: 0));
            m.NodesDictionary.Add(6, new Node(id: 6, x: 0.6, y: 0, z: 0));
            m.NodesDictionary.Add(7, new Node(id: 7, x: 0.7, y: 0, z: 0));
            m.NodesDictionary.Add(8, new Node(id: 8, x: 0.8, y: 0, z: 0));
            m.NodesDictionary.Add(9, new Node(id: 9, x: 0.9, y: 0, z: 0));
            m.NodesDictionary.Add(10, new Node(id: 10, x: 1, y: 0, z: 0));

            for (int i = 0; i < m.NodesDictionary.Count - 1; i++)
            {
                var e = new Element()
                {
                    ID          = i,
                    ElementType = new EulerBeam3D(stochasticRealizer.Realize(iteration, domainMapper,
                                                                             new[]
                    {
                        (m.NodesDictionary[i + 1].X + m.NodesDictionary[i].X) / 2,
                        (m.NodesDictionary[i + 1].Y + m.NodesDictionary[i].Y) / 2,
                        (m.NodesDictionary[i + 1].Z + m.NodesDictionary[i].Z) / 2,
                    }), 0.3)
                    {
                        Density              = 7.85,
                        SectionArea          = 1,
                        MomentOfInertiaY     = 1,
                        MomentOfInertiaZ     = 1,
                        MomentOfInertiaPolar = 1,
                    }
                };
                e.AddNodes(new[] { m.NodesDictionary[i], m.NodesDictionary[i + 1] });

                m.ElementsDictionary.Add(i, e);
                m.SubdomainsDictionary[0].Elements.Add(e);
            }

            m.NodesDictionary[0].Constraints.Add(new Constraint {
                DOF = StructuralDof.TranslationX, Amount = 0
            });
            m.NodesDictionary[0].Constraints.Add(new Constraint {
                DOF = StructuralDof.TranslationY, Amount = 0
            });
            m.NodesDictionary[0].Constraints.Add(new Constraint {
                DOF = StructuralDof.TranslationZ, Amount = 0
            });
            m.NodesDictionary[0].Constraints.Add(new Constraint {
                DOF = StructuralDof.RotationX, Amount = 0
            });
            m.NodesDictionary[0].Constraints.Add(new Constraint {
                DOF = StructuralDof.RotationY, Amount = 0
            });
            m.NodesDictionary[0].Constraints.Add(new Constraint {
                DOF = StructuralDof.RotationZ, Amount = 0
            });

            m.Loads.Add(new Load()
            {
                Amount = 10, Node = m.NodesDictionary[10], DOF = StructuralDof.TranslationZ
            });

            //m.ConnectDataStructures();

            return(m);
        }