Example #1
0
 public PhasePortraitMult(Parameters p, ReactDiffSolving task)
 {
     this.p    = p;
     this.task = task;
     InitializeComponent();
     Plot.Series[0].Points.Clear();
     Plot.ChartAreas[0].AxisX.MajorGrid.LineDashStyle = System.Windows.Forms.DataVisualization.Charting.ChartDashStyle.Dot;
     Plot.ChartAreas[0].AxisY.MajorGrid.LineDashStyle = System.Windows.Forms.DataVisualization.Charting.ChartDashStyle.Dot;
     Plot.Series[0].IsVisibleInLegend = false;
     Plot.Series[0].Color             = Color.Blue;
     Plot.ChartAreas[0].AxisY.Title   = "Активатор";
     Plot.ChartAreas[0].AxisX.Title   = "Ингибитор";
     for (int j = 0; j <= p.maxStepsT; j++)
     {
         for (int i = 0; i <= p.n; i++)
         {
             if (maxV1 < task.V1[i, j])
             {
                 maxV1 = task.V1[i, j];
             }
             if (maxV2 < task.V2[i, j])
             {
                 maxV2 = task.V2[i, j];
             }
         }
     }
     Plot.ChartAreas[0].AxisX.Minimum           = 0;
     Plot.ChartAreas[0].AxisY.Minimum           = 0;
     Plot.ChartAreas[0].AxisX.Maximum           = maxV2 + 0.1;
     Plot.ChartAreas[0].AxisY.Maximum           = maxV1 + 0.1;
     Plot.ChartAreas[0].AxisX.LabelStyle.Format = "{0:0.00}";
     Plot.ChartAreas[0].AxisY.LabelStyle.Format = "{0:0.00}";
     progressBar1.Minimum = 0;
     progressBar1.Maximum = p.maxStepsT;
 }
Example #2
0
        public PhasePortrait(Parameters p, ReactDiffSolving task)
        {
            InitializeComponent();
            this.p    = p;
            this.task = task;
            Plot.Series[0].Points.Clear();
            Plot.ChartAreas[0].AxisX.MajorGrid.LineDashStyle = System.Windows.Forms.DataVisualization.Charting.ChartDashStyle.Dot;
            Plot.ChartAreas[0].AxisY.MajorGrid.LineDashStyle = System.Windows.Forms.DataVisualization.Charting.ChartDashStyle.Dot;
            Plot.Series[0].IsVisibleInLegend = false;
            Plot.Series[0].Color             = Color.Blue;
            Plot.ChartAreas[0].AxisY.Title   = "Активатор";
            Plot.ChartAreas[0].AxisX.Title   = "Ингибитор";

            PlotV1.Series[0].Points.Clear();
            PlotV1.ChartAreas[0].AxisX.MajorGrid.LineDashStyle = System.Windows.Forms.DataVisualization.Charting.ChartDashStyle.Dot;
            PlotV1.ChartAreas[0].AxisY.MajorGrid.LineDashStyle = System.Windows.Forms.DataVisualization.Charting.ChartDashStyle.Dot;
            PlotV1.Series[0].IsVisibleInLegend = false;
            PlotV1.Series[0].Color             = Color.Green;
            PlotV1.ChartAreas[0].AxisY.Title   = "Активатор";
            PlotV1.ChartAreas[0].AxisX.Title   = "t";

            PlotV2.Series[0].Points.Clear();
            PlotV2.ChartAreas[0].AxisX.MajorGrid.LineDashStyle = System.Windows.Forms.DataVisualization.Charting.ChartDashStyle.Dot;
            PlotV2.ChartAreas[0].AxisY.MajorGrid.LineDashStyle = System.Windows.Forms.DataVisualization.Charting.ChartDashStyle.Dot;
            PlotV2.Series[0].IsVisibleInLegend = false;
            PlotV2.Series[0].Color             = Color.Red;
            PlotV2.ChartAreas[0].AxisY.Title   = "Ингибитор";
            PlotV2.ChartAreas[0].AxisX.Title   = "t";

            x    = 1;
            step = p.maxStepsT / 100;
            StepLayerTextBox.Text = (p.maxStepsT / 100).ToString();
            XValuetextBox.Text    = "1";
        }
Example #3
0
        public CompareTwoLayers(Parameters p, ReactDiffSolving task)
        {
            this.p    = p;
            this.task = task;
            InitializeComponent();

            PlotActiv.Series[0].Points.Clear();
            PlotActiv.Series[1].Points.Clear();
            PlotActiv.ChartAreas[0].AxisX.MajorGrid.LineDashStyle = System.Windows.Forms.DataVisualization.Charting.ChartDashStyle.Dot;
            PlotActiv.ChartAreas[0].AxisY.MajorGrid.LineDashStyle = System.Windows.Forms.DataVisualization.Charting.ChartDashStyle.Dot;
            PlotActiv.ChartAreas[0].AxisX.Minimum = 0;
            PlotActiv.ChartAreas[0].AxisX.Maximum = 1;
            PlotActiv.Series[0].IsVisibleInLegend = false;
            PlotActiv.Series[0].Color             = Color.Green;
            PlotActiv.Series[1].IsVisibleInLegend = false;
            PlotActiv.Series[1].Color             = Color.Blue;
            PlotActiv.ChartAreas[0].AxisY.Title   = "Активатор";

            PlotIngib.Series[0].Points.Clear();
            PlotIngib.Series[1].Points.Clear();
            PlotIngib.ChartAreas[0].AxisX.MajorGrid.LineDashStyle = System.Windows.Forms.DataVisualization.Charting.ChartDashStyle.Dot;
            PlotIngib.ChartAreas[0].AxisY.MajorGrid.LineDashStyle = System.Windows.Forms.DataVisualization.Charting.ChartDashStyle.Dot;
            PlotIngib.ChartAreas[0].AxisX.Minimum = 0;
            PlotIngib.ChartAreas[0].AxisX.Maximum = 1;
            PlotIngib.Series[0].IsVisibleInLegend = false;
            PlotIngib.Series[0].Color             = Color.Red;
            PlotIngib.Series[1].IsVisibleInLegend = false;
            PlotIngib.Series[1].Color             = Color.Blue;
            PlotIngib.ChartAreas[0].AxisY.Title   = "Ингибитор";

            PlotActivDiff.Series[0].Points.Clear();
            PlotActivDiff.ChartAreas[0].AxisX.MajorGrid.LineDashStyle = System.Windows.Forms.DataVisualization.Charting.ChartDashStyle.Dot;
            PlotActivDiff.ChartAreas[0].AxisY.MajorGrid.LineDashStyle = System.Windows.Forms.DataVisualization.Charting.ChartDashStyle.Dot;
            PlotActivDiff.ChartAreas[0].AxisX.Minimum = 0;
            PlotActivDiff.ChartAreas[0].AxisX.Maximum = 1;
            PlotActivDiff.ChartAreas[0].AxisY.Minimum = 0;
            PlotActivDiff.ChartAreas[0].AxisY.Maximum = 1e-3;
            PlotActivDiff.Series[0].IsVisibleInLegend = false;
            PlotActivDiff.Series[0].Color             = Color.Black;
            PlotActivDiff.ChartAreas[0].AxisY.Title   = "Разность";

            PlotIngibDiff.Series[0].Points.Clear();
            PlotIngibDiff.ChartAreas[0].AxisX.MajorGrid.LineDashStyle = System.Windows.Forms.DataVisualization.Charting.ChartDashStyle.Dot;
            PlotIngibDiff.ChartAreas[0].AxisY.MajorGrid.LineDashStyle = System.Windows.Forms.DataVisualization.Charting.ChartDashStyle.Dot;
            PlotIngibDiff.ChartAreas[0].AxisX.Minimum = 0;
            PlotIngibDiff.ChartAreas[0].AxisX.Maximum = 1;
            PlotIngibDiff.ChartAreas[0].AxisY.Minimum = 0;
            PlotIngibDiff.ChartAreas[0].AxisY.Maximum = 1e-3;
            PlotIngibDiff.Series[0].IsVisibleInLegend = false;
            PlotIngibDiff.Series[0].Color             = Color.Black;
            PlotIngibDiff.ChartAreas[0].AxisY.Title   = "Разность";

            Layer1TextBox.Text = (p.maxStepsT - 1).ToString();
            Layer2TextBox.Text = p.maxStepsT.ToString();
            layer_1            = p.maxStepsT - 1;
            layer_2            = p.maxStepsT;
        }
Example #4
0
        private void AllLayersCompute_Button_Click(object sender, EventArgs e)
        {
            try
            {
                LoadParameters();
            }
            catch (FormatException)
            {
                MessageBox.Show("Ошибка! Один или несколько параметров были неверно заданы.");
                return;
            }
            double tmp1, tmp2, h = 1.0 / (double)p.n;

            for (int i = 0; i <= p.n; i++)
            {
                tmp1 = p.Harmobic0[1] + p.Harmobic1[1] * Math.Cos(Math.PI * p.Harmobic1[0] * i * h) + p.Harmobic2[1] * Math.Cos(Math.PI * p.Harmobic2[0] * i * h)
                       + p.Harmobic2[1] * Math.Cos(Math.PI * p.Harmobic2[0] * i * h) + p.Harmobic3[1] * Math.Cos(Math.PI * p.Harmobic3[0] * i * h) +
                       p.Harmobic4[1] * Math.Cos(Math.PI * p.Harmobic4[0] * i * h) + p.Harmobic5[1] * Math.Cos(Math.PI * p.Harmobic5[0] * i * h);
                tmp2 = p.Harmobic0[2] + p.Harmobic1[2] * Math.Cos(Math.PI * p.Harmobic1[0] * i * h) + p.Harmobic2[2] * Math.Cos(Math.PI * p.Harmobic2[0] * i * h)
                       + p.Harmobic2[2] * Math.Cos(Math.PI * p.Harmobic2[0] * i * h) + p.Harmobic3[2] * Math.Cos(Math.PI * p.Harmobic3[0] * i * h) +
                       p.Harmobic4[2] * Math.Cos(Math.PI * p.Harmobic4[0] * i * h) + p.Harmobic5[2] * Math.Cos(Math.PI * p.Harmobic5[0] * i * h);
                if (tmp1 <= 0 || tmp2 <= 0)
                {
                    MessageBox.Show("Неверное задание начальных условий. Они дожны быть положительны");
                    return;
                }
            }

            task = new ExplicitReactDiff(p);
            if (Implicit_radioButton.Checked == true)
            {
                task = new ImplicitReactDiff(p);
            }

            if (Explicit_radioButton.Checked == true)
            {
                if (p.k >= (1.0 / (double)p.n) * (1.0 / (double)p.n) / 2)
                {
                    MessageBox.Show("На выбранной сетке явная схема неустойчива. Выберите другую сетку.");
                    return;
                }
            }

            task.solve();
            double maxV1 = 0, maxV2 = 0;

            for (int j = 0; j <= p.maxStepsT; j++)
            {
                for (int i = 0; i <= p.n; i++)
                {
                    if (maxV1 < task.V1[i, j])
                    {
                        maxV1 = task.V1[i, j];
                    }
                    if (maxV2 < task.V2[i, j])
                    {
                        maxV2 = task.V2[i, j];
                    }
                }
            }
            PlotActiv.ChartAreas[0].AxisY.Maximum      = maxV1 + 0.1;
            PlotIngib.ChartAreas[0].AxisY.Maximum      = maxV2 + 0.1;
            CompareTwoLayersToolStripMenuItem.Enabled  = true;
            PortraitToolStripMenuItem.Enabled          = true;
            PhasePortraitMultToolStripMenuItem.Enabled = true;

            PlotIngib.Series[0].Points.Clear();
            PlotActiv.Series[0].Points.Clear();
            for (int i = 0; i <= p.n; i++)
            {
                PlotActiv.Series[0].Points.AddXY((double)i / ((double)p.n), task.V1[i, p.maxStepsT]);
            }
            for (int i = 0; i <= p.n; i++)
            {
                PlotIngib.Series[0].Points.AddXY((double)i / ((double)p.n), task.V2[i, p.maxStepsT]);
            }
            currLayerOnPlotNum       = p.maxStepsT;
            CurrNumLayerTextBox.Text = currLayerOnPlotNum.ToString();
            InAllComputedLabel.Text  = "Всего подсчитано: " + task.InAllComputedLayers.ToString();
        }