private void DataUpdateActive() { if (this.cb_VelocityMethod.SelectedIndex == 0) { this.velocityMethod = VelocityMethod.MagnitudeAndDirection; this.velocityMagnitude = this.tb_VelocityMethond1_Magnitude.Text.ToString(); } else if (this.cb_VelocityMethod.SelectedIndex == 1) { this.velocityMethod = VelocityMethod.Components; } else { this.velocityMethod = VelocityMethod.Magnitude_NormalToBoundary; this.velocityMagnitude = this.tb_VelocityMethond3_Magnitude.Text.ToString(); } if (this.cb_ReferenceFrame.SelectedIndex == 0) { this.referenceFrame = ReferenceFrame.Absolute; } else { this.referenceFrame = ReferenceFrame.Relative; } this.gaugePressure = this.tb_GaugePressure.Text.ToString(); this.xyzDirctionOrComponent = new float[] { Convert.ToSingle(this.tb_VelocityMethond1_X.Text.ToString()), Convert.ToSingle(this.tb_VelocityMethond1_Y.Text.ToString()), Convert.ToSingle(this.tb_VelocityMethond1_Z.Text.ToString()) }; turbulenceSet = new TurbulenceSet(); turbulenceSet.turbulenceOrder = TurbulenceOrder.SecondOrder; if (this.cb_TurbulenceMethod.SelectedIndex == 0) { turbulenceSet.secondOrder_TurbulenceMethod = SecondOrder_TurbulenceMethod.KAndEpsilon; } else if (this.cb_TurbulenceMethod.SelectedIndex == 1) { turbulenceSet.secondOrder_TurbulenceMethod = SecondOrder_TurbulenceMethod.IntensityAndLengthScale; } else if (this.cb_TurbulenceMethod.SelectedIndex == 2) { turbulenceSet.secondOrder_TurbulenceMethod = SecondOrder_TurbulenceMethod.IntensityAndViscosityRatio; } else { turbulenceSet.secondOrder_TurbulenceMethod = SecondOrder_TurbulenceMethod.IntensityAndHydraulicDiameter; } turbulenceSet.TurbulenceP1 = this.tb_TurbulenceP1.Text.ToString(); turbulenceSet.TurbulenceP2 = this.tb_TurbulenceP2.Text.ToString(); }
private void DataUpdateActive() { if (this.cb_ReferenceFrame.SelectedIndex == 0) { this.referenceFrame = ReferenceFrame.Absolute; } else { this.referenceFrame = ReferenceFrame.Relative; } if (this.cb_BackflowDirection.SelectedIndex == 0) { this.directionMethond = PI_DirectionMethond.DirectionVector; } else { this.directionMethond = PI_DirectionMethond.NormalToBoundary; } this.guageTotalPressure = this.tb_GaugeTotalPressure.Text.ToString(); this.guageInitialPressure = this.tb_InitialGaugePressure.Text.ToString(); this.turbulenceSet = new TurbulenceSet(); turbulenceSet.turbulenceOrder = TurbulenceOrder.SecondOrder; if (this.cb_TurbulenceMethod.SelectedIndex == 0) { turbulenceSet.secondOrder_TurbulenceMethod = SecondOrder_TurbulenceMethod.KAndEpsilon; } else if (this.cb_TurbulenceMethod.SelectedIndex == 1) { turbulenceSet.secondOrder_TurbulenceMethod = SecondOrder_TurbulenceMethod.IntensityAndLengthScale; } else if (this.cb_TurbulenceMethod.SelectedIndex == 2) { turbulenceSet.secondOrder_TurbulenceMethod = SecondOrder_TurbulenceMethod.IntensityAndViscosityRatio; } else { turbulenceSet.secondOrder_TurbulenceMethod = SecondOrder_TurbulenceMethod.IntensityAndHydraulicDiameter; } turbulenceSet.TurbulenceP1 = this.tb_TurbulenceP1.Text.ToString(); turbulenceSet.TurbulenceP2 = this.tb_TurbulenceP2.Text.ToString(); this.xyzDirection = new float[] { Convert.ToSingle(this.tb_FlowDirection_X.Text.ToString()), Convert.ToSingle(this.tb_FlowDirection_Y.Text.ToString()), Convert.ToSingle(this.tb_FlowDirection_Z.Text.ToString()) }; }
/// <summary> /// 湍流设置TUI /// </summary> /// <param name="turbulenceSet">湍流设置参数</param> /// <returns></returns> private string TurbulenceSetTUI(TurbulenceSet turbulenceSet) { StringBuilder sb = new StringBuilder(); if (turbulenceSet.turbulenceOrder == TurbulenceOrder.SecondOrder) { if ((int)turbulenceSet.secondOrder_TurbulenceMethod == 0) { sb.Append("y n " + turbulenceSet.TurbulenceP1 + " n " + turbulenceSet.TurbulenceP2 + " "); } else if ((int)turbulenceSet.secondOrder_TurbulenceMethod == 1) { sb.Append("n y n " + turbulenceSet.TurbulenceP1 + " n " + turbulenceSet.TurbulenceP2 + " "); } else if ((int)turbulenceSet.secondOrder_TurbulenceMethod == 2) { sb.Append("n n y n " + turbulenceSet.TurbulenceP1 + " n " + turbulenceSet.TurbulenceP2 + " "); } else { sb.Append("n n n y n " + turbulenceSet.TurbulenceP1 + " n " + turbulenceSet.TurbulenceP2 + " "); } } else { if ((int)turbulenceSet.firstOrder_TurbulenceMethod == 0) { sb.Append("y n " + turbulenceSet.TurbulenceP1 + " "); } else if ((int)turbulenceSet.firstOrder_TurbulenceMethod == 1) { sb.Append("n y " + turbulenceSet.TurbulenceP1 + " " + turbulenceSet.TurbulenceP2 + " "); } else if ((int)turbulenceSet.firstOrder_TurbulenceMethod == 2) { sb.Append("n n y n " + turbulenceSet.TurbulenceP1 + " "); } else { sb.Append("n n n y " + turbulenceSet.TurbulenceP1 + " " + turbulenceSet.TurbulenceP2 + " "); } } return(sb.ToString()); }
/// <summary> /// 压力出口 /// </summary> /// <param name="boundaryName">边界名</param> /// <param name="referenceFrame">参考框架</param> /// <param name="bfDirectionM">回流方向方法</param> /// <param name="bfPressure">回流压力类型</param> /// <param name="gaugePressure">表压</param> /// <param name="isCheck">复选情况</param> /// <param name="turbulenceSet">湍流设置</param> /// <param name="temperature">热量温度设置</param> /// <param name="speciesMassFractions">组分质量分数设置</param> /// <param name="xyzDirection">[xyz方向矢量],bfdm为DirectionVector时,需要在指定</param> /// <param name="massFlowParameter">[目标质量流率的参数],目标质量流率复选时,需要在指定</param> /// <returns>TUI命令</returns> string IEnON_ViscousON_RadiationOFF_SpeciesON.PO(string boundaryName, ReferenceFrame referenceFrame, BackflowDirectionMethond bfDirectionM, BackflowPressure bfPressure, string gaugePressure, PO_MomentumCheck isCheck, TurbulenceSet turbulenceSet, string temperature, List <string> speciesMassFractions, float[] xyzDirection, float[] massFlowParameter) { string bounaryType = BoundaryTypeE.pressure_outlet.ToString(); StringBuilder sb = new StringBuilder(); if (bfDirectionM == BackflowDirectionMethond.DirectionVector) { if (xyzDirection == null) { MessageBox.Show("当前指定方向的方法,xyzDirction不可为null"); return(null); } } sb.Append(m_boundaryConditionInitialTUI + bounaryType + " " + boundaryName + " "); if ((int)referenceFrame == 0) { sb.Append("y "); } else { sb.Append("n y "); } sb.Append("n " + gaugePressure + " "); //热量TUI sb.Append("n " + temperature + " "); if ((int)bfDirectionM == 0) { sb.Append("y y n " + xyzDirection[0].ToString() + " n " + xyzDirection[1].ToString() + " n " + xyzDirection[2].ToString() + " "); } else if ((int)bfDirectionM == 1) { sb.Append("n y "); } else { sb.Append("n n y "); } //湍流TUI sb.Append(TurbulenceSetTUI(turbulenceSet)); //组分TUI sb.Append("n "); foreach (string specieMassFractions in speciesMassFractions) { sb.Append("n " + specieMassFractions + " "); } if (bfPressure == 0) { sb.Append("y "); } else { sb.Append("n y "); } if (isCheck.RadialEquilibriumPD) { sb.Append("y "); } else { sb.Append("n "); } if (isCheck.AverageP) { sb.Append("y "); } else { sb.Append("n "); } if (isCheck.TargetMassFlow) { sb.Append("y n " + massFlowParameter[0].ToString() + " n " + massFlowParameter[1].ToString() + " n " + massFlowParameter[2].ToString() + " "); } else { sb.Append("n "); } return(sb.ToString()); }
/// <summary> /// 质量流入口 /// </summary> /// <param name="boundaryName">边界名</param> /// <param name="referenceFrame">参考框架</param> /// <param name="massFlowMethond">质量流方法</param> /// <param name="dirctionMethond">指定方向方法</param> /// <param name="massFlowRateOrFlux">质量流率或质量流量</param> /// <param name="initialGaugePress">初始表压</param> /// <param name="turbulenceSet">湍流设置</param> /// <param name="temperature">热量温度设置</param> /// <param name="speciesMassFractions">组分质量分数设置</param> /// <param name="averageFlux">[平均质量流量]根据质量流方法确定该值是否为null</param> /// <param name="xyzDirection">[xyz方向矢量]根据指定方向方法确定确定该值是否为null</param> /// <returns>TUI命令</returns> string IEnON_ViscousON_RadiationOFF_SpeciesON.MI(string boundaryName, ReferenceFrame referenceFrame, MassFlowMethond massFlowMethond, PI_DirectionMethond directionMethond, string massFlowRateOrFlux, string initialGaugePress, TurbulenceSet turbulenceSet, string temperature, List <string> speciesMassFractions, string averageFlux, float[] xyzDirection) { string bounaryType = BoundaryTypeE.mass_flow_inlet.ToString(); StringBuilder sb = new StringBuilder(); if (massFlowMethond == MassFlowMethond.MassFluxWithAverageMassFlux) { if (averageFlux == null) { MessageBox.Show("当前质量流方法,averageFlux不能为null"); } } if (directionMethond == PI_DirectionMethond.DirectionVector) { if (xyzDirection == null) { MessageBox.Show("当前指定方向的方法,xyzDirction不可为null"); return(null); } } sb.Append(m_boundaryConditionInitialTUI + bounaryType + " " + boundaryName + " "); if ((int)referenceFrame == 0) { sb.Append("y "); } else { sb.Append("n y "); } if ((int)massFlowMethond == 0) { sb.Append("y " + "n " + massFlowRateOrFlux + " "); } else if ((int)massFlowMethond == 1) { sb.Append("n y " + "n " + massFlowRateOrFlux + " "); } else { sb.Append("n n y n " + massFlowRateOrFlux + " " + averageFlux + " "); } //热量TUI sb.Append("n " + temperature + " "); sb.Append("n " + initialGaugePress + " "); if (directionMethond == 0) { sb.Append("y y n " + xyzDirection[0].ToString() + " n " + xyzDirection[1].ToString() + " n " + xyzDirection[2].ToString() + " "); } else { sb.Append("n y "); } //湍流TUI string TUI = TurbulenceSetTUI(turbulenceSet); sb.Append(TUI); //组分TUI sb.Append("n "); foreach (string specieMassFractions in speciesMassFractions) { sb.Append("n " + specieMassFractions + " "); } return(sb.ToString()); }
/// <summary> /// 设置压力入口边界条件 /// </summary> /// <param name="boundaryName">边界名</param> /// <param name="referenceFrame">参考框架</param> /// <param name="directionMethond">指定方向的方法</param> /// <param name="guageTotalPressure">总表压</param> /// <param name="guageInitialPressure">初始表压</param> /// <param name="turbulenceSet">湍流设置</param> /// <param name="temperature">热量温度设置</param> /// <param name="speciesMassFractions">组分质量分数设置</param> /// <param name="xyzDirection">[xyz方向矢量] 指定方向方法为矢量时,此值不能为空</param> /// <returns>TUI命令</returns> string IEnON_ViscousON_RadiationOFF_SpeciesON.PI(string boundaryName, ReferenceFrame referenceFrame, PI_DirectionMethond directionMethond, string guageTotalPressure, string guageInitialPressure, TurbulenceSet turbulenceSet, string temperature, List <string> speciesMassFractions, float[] xyzDirection) { string bounaryType = BoundaryTypeE.pressure_inlet.ToString(); StringBuilder sb = new StringBuilder(); if (directionMethond == PI_DirectionMethond.DirectionVector) { if (xyzDirection == null) { MessageBox.Show("当前指定方向的方法,xyzDirction不可为null"); return(null); } } sb.Append(m_boundaryConditionInitialTUI + bounaryType + " " + boundaryName + " "); if ((int)referenceFrame == 0) { sb.Append("y "); } else { sb.Append("n y "); } sb.Append("n " + guageTotalPressure + " n " + guageInitialPressure + " "); //热量TUI sb.Append("n " + temperature + " "); if ((int)directionMethond == 0) { sb.Append("y y n " + xyzDirection[0].ToString() + " n " + xyzDirection[1].ToString() + " n " + xyzDirection[2].ToString() + " "); } else { sb.Append("n y "); } //湍流TUI string TUI = TurbulenceSetTUI(turbulenceSet); sb.Append(TUI); //组分TUI sb.Append("n "); foreach (string specieMassFractions in speciesMassFractions) { sb.Append("n " + specieMassFractions + " "); } return(sb.ToString()); }
/// <summary> /// 设置速度入口边界条件 /// </summary> /// <param name="boundaryName">边界名</param> /// <param name="velocityMethod">速度方法</param> /// <param name="referenceFrame">参考框架</param> /// <param name="velocityMagnitude">速度大小</param> /// <param name="gaugePressure">初始表压</param> /// <param name="turbulenceSet">湍流设置</param> /// <param name="temperature">热量温度设置</param> /// <param name="speciesMassFractions">组分质量分数设置</param> /// <param name="xyzDirctionOrComponent ">[xyz方向或者xyz速度分量](根据速度方法而定,如果速度方法选择:大小和方向则该参数代表速度方向;如果速度方法选择:速度分量的矢量和则该参数代表速度分量(m/s),否则默认为null)</param> /// <returns>TUI命令</returns> string IEnON_ViscousON_RadiationOFF_SpeciesON.VI(string boundaryName, VelocityMethod velocityMethod, ReferenceFrame referenceFrame, string velocityMagnitude, string gaugePressure, TurbulenceSet turbulenceSet, string temperature, List <string> speciesMassFractions, float[] xyzDirctionOrComponent) { StringBuilder sb = new StringBuilder(); BoundaryConditionImp BC = new BoundaryConditionImp(); IEnOFF_ViscousOFF iEnOFF_ViscousOFF = BC; //动量TUI string TUI = iEnOFF_ViscousOFF.VI(boundaryName, velocityMethod, referenceFrame, velocityMagnitude, gaugePressure, xyzDirctionOrComponent); sb.Append(TUI); //热量TUI sb.Append("n " + temperature + " "); //湍流TUI TUI = TurbulenceSetTUI(turbulenceSet); sb.Append(TUI); //组分TUI sb.Append("n "); foreach (string specieMassFractions in speciesMassFractions) { sb.Append("n " + specieMassFractions + " "); } return(sb.ToString()); }
/// <summary> /// 质量流入口 /// </summary> /// <param name="boundaryName">边界名</param> /// <param name="referenceFrame">参考框架</param> /// <param name="massFlowMethond">质量流方法</param> /// <param name="dirctionMethond">指定方向方法</param> /// <param name="massFlowRateOrFlux">质量流率或质量流量</param> /// <param name="initialGaugePress">初始表压</param> /// <param name="turbulenceSet">湍流设置</param> /// <param name="averageFlux">[平均质量流量]根据质量流方法确定该值是否为null</param> /// <param name="xyzDirection">[xyz方向矢量]根据指定方向方法确定确定该值是否为null</param> /// <returns>TUI命令</returns> string IEnOFF_ViscousON.MI(string boundaryName, ReferenceFrame referenceFrame, MassFlowMethond massFlowMethond, PI_DirectionMethond dirctionMethond, string massFlowRateOrFlux, string initialGaugePress, TurbulenceSet turbulenceSet, string averageFlux, float[] xyzDirection) { StringBuilder sb = new StringBuilder(); BoundaryConditionImp BC = new BoundaryConditionImp(); IEnOFF_ViscousOFF iEnOFF_ViscousOFF = BC; //动量TUI string TUI = iEnOFF_ViscousOFF.MI(boundaryName, referenceFrame, massFlowMethond, dirctionMethond, massFlowRateOrFlux, initialGaugePress, averageFlux, xyzDirection); sb.Append(TUI); //湍流TUI TUI = TurbulenceSetTUI(turbulenceSet); sb.Append(TUI); return(sb.ToString()); }
/// <summary> /// 设置压力入口边界条件 /// </summary> /// <param name="boundaryName">边界名</param> /// <param name="referenceFrame">参考框架</param> /// <param name="directionMethond">指定方向的方法</param> /// <param name="guageTotalPressure">总表压</param> /// <param name="guageInitialPressure">初始表压</param> /// <param name="turbulenceSet">湍流设置</param> /// <param name="xyzDirection">[xyz方向矢量] 指定方向方法为矢量时,此值不能为空</param> /// <returns>TUI命令</returns> string IEnOFF_ViscousON.PI(string boundaryName, ReferenceFrame referenceFrame, PI_DirectionMethond directionMethond, string guageTotalPressure, string guageInitialPressure, TurbulenceSet turbulenceSet, float[] xyzDirection) { StringBuilder sb = new StringBuilder(); BoundaryConditionImp BC = new BoundaryConditionImp(); IEnOFF_ViscousOFF iEnOFF_ViscousOFF = BC; //动量TUI string TUI = iEnOFF_ViscousOFF.PI(boundaryName, referenceFrame, directionMethond, guageTotalPressure, guageInitialPressure, xyzDirection); sb.Append(TUI); //湍流TUI TUI = TurbulenceSetTUI(turbulenceSet); sb.Append(TUI); return(sb.ToString()); }
/// <summary> /// 设置速度入口边界条件 /// </summary> /// <param name="boundaryName">边界名</param> /// <param name="velocityMethod">速度方法</param> /// <param name="referenceFrame">参考框架</param> /// <param name="velocityMagnitude">速度大小</param> /// <param name="gaugePressure">初始表压</param> /// <param name="turbulenceSet">湍流设置</param> /// <param name="xyzDirctionOrComponent ">[xyz方向或者xyz速度分量](根据速度方法而定,如果速度方法选择:大小和方向则该参数代表速度方向;如果速度方法选择:速度分量的矢量和则该参数代表速度分量(m/s),否则默认为null)</param> /// <returns>TUI命令</returns> string IEnOFF_ViscousON.VI(string boundaryName, VelocityMethod velocityMethod, ReferenceFrame referenceFrame, string velocityMagnitude, string gaugePressure, TurbulenceSet turbulenceSet, float[] xyzDirctionOrComponent = null) { StringBuilder sb = new StringBuilder(); BoundaryConditionImp BC = new BoundaryConditionImp(); IEnOFF_ViscousOFF iEnOFF_ViscousOFF = BC; //动量TUI string TUI = iEnOFF_ViscousOFF.VI(boundaryName, velocityMethod, referenceFrame, velocityMagnitude, gaugePressure, xyzDirctionOrComponent); sb.Append(TUI); //湍流TUI TUI = TurbulenceSetTUI(turbulenceSet); sb.Append(TUI); return(sb.ToString()); }
/// <summary> /// 更新控件值 /// </summary> private void DataUpdateAction() { if (this.cb_ReferenceFrame.SelectedIndex == 0) { this.referenceFrame = ReferenceFrame.Absolute; } else { this.referenceFrame = ReferenceFrame.Relative; } if (cb_BackflowDirection.SelectedIndex == 0) { this.bfDirectionM = BackflowDirectionMethond.DirectionVector; this.xyzDirection = new float[] { Convert.ToSingle(this.tb_FlowDirection_X.Text.ToString()), Convert.ToSingle(this.tb_FlowDirection_Y.Text.ToString()), Convert.ToSingle(this.tb_FlowDirection_Z.Text.ToString()) }; } else if (cb_BackflowDirection.SelectedIndex == 1) { this.bfDirectionM = BackflowDirectionMethond.NormalToBoundary; } else { this.bfDirectionM = BackflowDirectionMethond.FromNeighboringCell; } if (this.cb_BackflowPressure.SelectedIndex == 0) { this.bfPressure = BackflowPressure.TotalPressure; } else { this.bfPressure = BackflowPressure.StaticPressure; } this.gaugePressure = this.tb_GaugePressure.Text.ToString(); isCheck = new PO_MomentumCheck(); if (ckb_RadialEP.Checked) { isCheck.RadialEquilibriumPD = true; } if (ckb_AverageP.Checked) { isCheck.AverageP = true; } if (ckb_TargetMassFlow.Checked) { isCheck.TargetMassFlow = true; this.massFlowParameter = new float[] { Convert.ToSingle(this.tb_TargetMassFlow.Text.ToString()), Convert.ToSingle(this.tb_UpPressure.Text.ToString()), Convert.ToSingle(this.tb_LowPressure.Text.ToString()) }; } turbulenceSet = new TurbulenceSet(); turbulenceSet.turbulenceOrder = TurbulenceOrder.SecondOrder; if (this.cb_TurbulenceMethod.SelectedIndex == 0) { turbulenceSet.secondOrder_TurbulenceMethod = SecondOrder_TurbulenceMethod.KAndEpsilon; } else if (this.cb_TurbulenceMethod.SelectedIndex == 1) { turbulenceSet.secondOrder_TurbulenceMethod = SecondOrder_TurbulenceMethod.IntensityAndLengthScale; } else if (this.cb_TurbulenceMethod.SelectedIndex == 2) { turbulenceSet.secondOrder_TurbulenceMethod = SecondOrder_TurbulenceMethod.IntensityAndViscosityRatio; } else { turbulenceSet.secondOrder_TurbulenceMethod = SecondOrder_TurbulenceMethod.IntensityAndHydraulicDiameter; } turbulenceSet.TurbulenceP1 = this.tb_TurbulenceP1.Text.ToString(); turbulenceSet.TurbulenceP2 = this.tb_TurbulenceP2.Text.ToString(); }