public override double InnerEdgeForm(ref Foundation.CommonParams inp, double[] _uA, double[] _uB, double[,] _Grad_uA, double[,] _Grad_uB, double _vA, double _vB, double[] _Grad_vA, double[] _Grad_vB) { double Acc = 0.0; double pnlty = this.penalty(inp.jCellIn, inp.jCellOut);//, inp.GridDat.Cells.cj); double muA = this.Viscosity(inp.Parameters_IN); double muB = this.Viscosity(inp.Parameters_OUT); switch (base.m_implMode) { case ViscosityImplementation.H: { for (int i = 0; i < inp.D; i++) { // consistency term Acc += 0.5 * (muA * _Grad_uA[i, i] + muB * _Grad_uB[i, i]) * (_vA - _vB) * inp.Normale[m_iComp]; // symmetry term switch (ViscSolverMode) { case ViscositySolverMode.FullyCoupled: Acc += 0.5 * (muA * _Grad_vA[m_iComp] + muB * _Grad_vB[m_iComp]) * (_uA[i] - _uB[i]) * inp.Normale[i]; break; case ViscositySolverMode.Segregated: if (i == m_iComp) { Acc += 0.5 * (muA * _Grad_vA[m_iComp] + muB * _Grad_vB[m_iComp]) * (_uA[i] - _uB[i]) * inp.Normale[i]; } break; default: throw new NotImplementedException(); } } Acc *= base.m_alpha; // penalty term double muMax = (Math.Abs(muA) > Math.Abs(muB)) ? muA : muB; Acc -= (_uA[m_iComp] - _uB[m_iComp]) * (_vA - _vB) * pnlty * muMax; return(Acc * (2.0 / 3.0)); } case ViscosityImplementation.SWIP: { for (int i = 0; i < inp.D; i++) { Acc += (muB * muA * _Grad_uA[i, i] + muA * muB * _Grad_uB[i, i]) / (muA + muB) * (_vA - _vB) * inp.Normale[m_iComp]; // consistency term Acc += (muB * muA * _Grad_vA[m_iComp] + muA * muB * _Grad_vB[m_iComp]) / (muA + muB) * (_uA[i] - _uB[i]) * inp.Normale[i]; // symmetry term } Acc *= base.m_alpha; Acc -= (_uA[m_iComp] - _uB[m_iComp]) * (_vA - _vB) * pnlty * 2 * muA * muB / (muA + muB); // penalty term return(Acc * (2.0 / 3.0)); } default: throw new NotImplementedException(); } }
public override double InnerEdgeForm(ref Foundation.CommonParams inp, double[] _uA, double[] _uB, double[,] _Grad_uA, double[,] _Grad_uB, double _vA, double _vB, double[] _Grad_vA, double[] _Grad_vB) { double Acc = 0.0; double pnlty = this.penalty(inp.jCellIn, inp.jCellOut);//, inp.GridDat.Cells.cj); double muA = this.Viscosity(inp.Parameters_IN); double muB = this.Viscosity(inp.Parameters_OUT); for (int d = 0; d < inp.D; d++) { //Acc += 0.5 * (muA * _Grad_uA[0, d] + muB * _Grad_uB[0, d]) * (_vA - _vB) * inp.Normale[d]; // consistency term //Acc += 0.5 * (muA * _Grad_vA[d] + muB * _Grad_vB[d]) * (_uA[0] - _uB[0]) * inp.Normale[d]; // symmetry term Acc += 0.5 * (muA * _Grad_uA[m_iComp, d] + muB * _Grad_uB[m_iComp, d]) * (_vA - _vB) * inp.Normale[d]; // consistency term Acc += 0.5 * (muA * _Grad_vA[d] + muB * _Grad_vB[d]) * (_uA[m_iComp] - _uB[m_iComp]) * inp.Normale[d]; // symmetry term } Acc *= base.m_alpha; double muMax = (Math.Abs(muA) > Math.Abs(muB)) ? muA : muB; //Acc -= (_uA[0] - _uB[0]) * (_vA - _vB) * pnlty * muMax; // penalty term Acc -= (_uA[m_iComp] - _uB[m_iComp]) * (_vA - _vB) * pnlty * muMax; // penalty term return(-Acc); }
protected override double InnerEdgeFlux(ref Foundation.CommonParams inp, double[] Uin, double[] Uout) { double res = 0.0; switch (Bcmap.PhysMode) { case PhysicsMode.Incompressible: res = 0.5 * (Uin[0] + Uout[0]) * inp.Normale[Component]; break; case PhysicsMode.LowMach: case PhysicsMode.Multiphase: res = 0.5 * (EoS.GetDensity(inp.Parameters_IN[0]) * Uin[0] + EoS.GetDensity(inp.Parameters_OUT[0]) * Uout[0]) * inp.Normale[Component]; break; case PhysicsMode.Combustion: res = 0.5 * (EoS.GetDensity(inp.Parameters_IN) * Uin[0] + EoS.GetDensity(inp.Parameters_OUT) * Uout[0]) * inp.Normale[Component]; break; default: throw new ApplicationException("PhysicsMode not implemented"); } return(res); }
protected override double InnerEdgeFlux(ref Foundation.CommonParams inp, double[] Uin, double[] Uout) { double res = 0.0; // Calculate Lambda // ================ IList <double> _VelocityMeanIn = new List <double>(); IList <double> _VelocityMeanOut = new List <double>(); for (int d = 0; d < SpatDimension; d++) { _VelocityMeanIn.Add(inp.Parameters_IN[SpatDimension + d]); _VelocityMeanOut.Add(inp.Parameters_OUT[SpatDimension + d]); } double[] VelocityMeanIn = _VelocityMeanIn.ToArray(); double[] VelocityMeanOut = _VelocityMeanOut.ToArray(); double ScalarMeanIn = inp.Parameters_IN[2 * SpatDimension + 1]; double ScalarMeanOut = inp.Parameters_OUT[2 * SpatDimension + 1]; double LambdaIn = EoS.GetLambda(VelocityMeanIn, inp.Normal, ScalarMeanIn); double LambdaOut = EoS.GetLambda(VelocityMeanOut, inp.Normal, ScalarMeanOut); double Lambda = Math.Max(LambdaIn, LambdaOut); // Calculate central part // ====================== double Scalar0In = inp.Parameters_IN[2 * SpatDimension]; double Scalar0Out = inp.Parameters_OUT[2 * SpatDimension]; double rhoIn = EoS.GetDensity(Scalar0In); double rhoOut = EoS.GetDensity(Scalar0Out); double ScalarIn = Uin[0]; double ScalarOut = Uout[0]; for (int j = 0; j < SpatDimension; j++) { double u_j_In = inp.Parameters_IN[j]; double u_j_Out = inp.Parameters_OUT[j]; res += 0.5 * rhoIn * ScalarIn * u_j_In * inp.Normal[j]; res += 0.5 * rhoOut * ScalarOut * u_j_Out * inp.Normal[j]; } // Calculate dissipative part // ========================== // Jump scalar double Jump_Scalar = ScalarIn - ScalarOut; double TransformationFactorScalar = GetTransformationFactorScalar(ScalarMeanIn, ScalarMeanOut); res += 0.5 * Lambda * TransformationFactorScalar * Jump_Scalar; return(res); }
public double InnerEdgeForm(ref Foundation.CommonParams inp, double[] _uA, double[] _uB, double[,] _Grad_uA, double[,] _Grad_uB, double _vA, double _vB, double[] _Grad_vA, double[] _Grad_vB) { double R = 0; int D = inp.D; for (int d = 0; d < D; d++) { R -= (_Grad_uA[0, d] - _Grad_uB[0, d]) * (_Grad_vA[d] - _Grad_vB[d]); } return(R); }
double InnerEdgeFlux(ref Foundation.CommonParams inp, double[] Uin, double[] Uout) { double res = 0.0; double[] DensityArguments_In; // Arguments used to calculate the density with the EoS double[] DensityArguments_Out; // Arguments used to calculate the density with the EoS double densityIn; double densityOut; switch (Bcmap.PhysMode) { case PhysicsMode.Incompressible: res = 0.5 * (Uin[Component] + Uout[Component]) * inp.Normal[Component]; break; case PhysicsMode.MixtureFraction: densityIn = EoS.getDensityFromZ(Uin[inp.D]); densityOut = EoS.getDensityFromZ(Uout[inp.D]); res = 0.5 * (densityIn * Uin[Component] + densityOut * Uout[Component]) * inp.Normal[Component]; break; case PhysicsMode.LowMach: case PhysicsMode.Multiphase: DensityArguments_In = Uin.GetSubVector(m_SpatialDimension, 1); DensityArguments_Out = Uout.GetSubVector(m_SpatialDimension, 1); densityIn = (EoS.GetDensity(DensityArguments_In)); densityOut = (EoS.GetDensity(DensityArguments_Out)); if (double.IsNaN(densityIn) || double.IsInfinity(densityIn) || double.IsNaN(densityOut) || double.IsInfinity(densityOut)) { throw new NotFiniteNumberException(); } res = 0.5 * (densityIn * Uin[Component] + densityOut * Uout[Component]) * inp.Normal[Component]; break; case PhysicsMode.Combustion: DensityArguments_In = Uin.GetSubVector(m_SpatialDimension, NumberOfSpecies); DensityArguments_Out = Uout.GetSubVector(m_SpatialDimension, NumberOfSpecies); densityIn = (EoS.GetDensity(DensityArguments_In)); densityOut = (EoS.GetDensity(DensityArguments_Out)); if (double.IsNaN(densityIn) || double.IsInfinity(densityIn) || double.IsNaN(densityOut) || double.IsInfinity(densityOut)) { throw new NotFiniteNumberException(); } res = 0.5 * (densityIn * Uin[Component] + densityOut * Uout[Component]) * inp.Normal[Component]; break; default: throw new ApplicationException("PhysicsMode not implemented"); } return(res); }
public override double InnerEdgeForm(ref Foundation.CommonParams inp, double[] _uA, double[] _uB, double[,] _Grad_uA, double[,] _Grad_uB, double _vA, double _vB, double[] _Grad_vA, double[] _Grad_vB) { double Acc = 0.0; double pnlty = this.penalty(inp.jCellIn, inp.jCellOut);//, inp.GridDat.Cells.cj); double muA = this.Viscosity(inp.Parameters_IN); double muB = this.Viscosity(inp.Parameters_OUT); switch (base.m_implMode) { case ViscosityImplementation.H: // { for (int d = 0; d < inp.D; d++) { //Acc += 0.5 * (muA * _Grad_uA[0, d] + muB * _Grad_uB[0, d]) * (_vA - _vB) * inp.Normale[d]; // consistency term //Acc += 0.5 * (muA * _Grad_vA[d] + muB * _Grad_vB[d]) * (_uA[0] - _uB[0]) * inp.Normale[d]; // symmetry term Acc += 0.5 * (muA * _Grad_uA[m_iComp, d] + muB * _Grad_uB[m_iComp, d]) * (_vA - _vB) * inp.Normale[d]; // consistency term Acc += 0.5 * (muA * _Grad_vA[d] + muB * _Grad_vB[d]) * (_uA[m_iComp] - _uB[m_iComp]) * inp.Normale[d]; // symmetry term } Acc *= base.m_alpha; double muMax = (Math.Abs(muA) > Math.Abs(muB)) ? muA : muB; //Acc -= (_uA[0] - _uB[0]) * (_vA - _vB) * pnlty * muMax; // penalty term Acc -= (_uA[m_iComp] - _uB[m_iComp]) * (_vA - _vB) * pnlty * muMax; // penalty term return(-Acc); } case ViscosityImplementation.SWIP: // { for (int d = 0; d < inp.D; d++) { //Acc += (muB * muA * _Grad_uA[0, d] + muA * muB * _Grad_uB[0, d]) / (muA + muB) * (_vA - _vB) * inp.Normale[d]; // consistency term //Acc += (muB * muA * _Grad_vA[d] + muA * muB * _Grad_vB[d]) / (muA + muB) * (_uA[0] - _uB[0]) * inp.Normale[d]; // symmetry term Acc += (muB * muA * _Grad_uA[m_iComp, d] + muA * muB * _Grad_uB[m_iComp, d]) / (muA + muB) * (_vA - _vB) * inp.Normale[d]; // consistency term Acc += (muB * muA * _Grad_vA[d] + muA * muB * _Grad_vB[d]) / (muA + muB) * (_uA[m_iComp] - _uB[m_iComp]) * inp.Normale[d]; // symmetry term } Acc *= base.m_alpha; //Acc -= (_uA[0] - _uB[0]) * (_vA - _vB) * pnlty * (2 * muA * muB) / (muA + muB); // penalty term Acc -= (_uA[m_iComp] - _uB[m_iComp]) * (_vA - _vB) * pnlty * (2 * muA * muB) / (muA + muB); // penalty term return(-Acc); } default: throw new NotImplementedException(); } }
protected override double InnerEdgeFlux(ref Foundation.CommonParams inp, double[] Uin, double[] Uout) { //switch (m_varMode) { // case EquationAndVarMode.u_p: // return base.InnerEdgeFlux(ref inp, Uin, Uout)*oneOverRho; // case EquationAndVarMode.u_p_2: // case EquationAndVarMode.mom_p: // case EquationAndVarMode.u_Psi: return(base.InnerEdgeFlux(ref inp, Uin, Uout)); // default: // throw new NotImplementedException(); //} }
public double InnerEdgeForm(ref Foundation.CommonParams inp, double[] _uA, double[] _uB, double[,] _Grad_uA, double[,] _Grad_uB, double _vA, double _vB, double[] _Grad_vA, double[] _Grad_vB) { double R = 0; if (h_min == null) { h_min = ((GridData)(inp.GridDat)).Cells.h_min; } int jCell1 = inp.jCellIn; int jCell2 = inp.jCellOut; double h1 = h_min[jCell1]; double h2 = h_min[jCell2]; double penalty = 100.0 / Math.Min(h1, h2); R -= (_uA[0] - _uB[0]) * (_vA - _vB) * penalty; return(R); }
public double InnerEdgeForm(ref Foundation.CommonParams inp, double[] _uA, double[] _uB, double[,] _Grad_uA, double[,] _Grad_uB, double _vA, double _vB, double[] _Grad_vA, double[] _Grad_vB) { double R = 0; int D = inp.D; for (int d = 0; d < D; d++) { if (ATerm) { R -= (_Grad_uA[0, d] - _Grad_uB[0, d]) * inp.Normale[d] * (_vA - _vB); } if (BTerm) { R -= (_uA[0] - _uB[0]) * inp.Normale[d] * (_Grad_vA[d] - _Grad_vB[d]); } } return(R); }
public double InnerEdgeForm(ref Foundation.CommonParams inp, double[] _uA, double[] _uB, double[,] _Grad_uA, double[,] _Grad_uB, double _vA, double _vB, double[] _Grad_vA, double[] _Grad_vB) { double Acc = 0.0; double pnlty = this.penalty(inp.jCellIn, inp.jCellOut); double muA = Viscosity; double muB = Viscosity; for (int d = 0; d < inp.D; d++) { Acc += 0.5 * (muA * _Grad_uA[0, d] + muB * _Grad_uB[0, d]) * (_vA - _vB) * inp.Normale[d]; // consistency term Acc += 0.5 * (muA * _Grad_vA[d] + muB * _Grad_vB[d]) * (_uA[0] - _uB[0]) * inp.Normale[d]; // symmetry term } double muMax = (Math.Abs(muA) > Math.Abs(muB)) ? muA : muB; Acc -= (_uA[0] - _uB[0]) * (_vA - _vB) * pnlty * muMax; // penalty term return(-Acc); }
public double InnerEdgeForm(ref Foundation.CommonParams inp, double[] _uA, double[] _uB, double[,] _Grad_uA, double[,] _Grad_uB, double _vA, double _vB, double[] _Grad_vA, double[] _Grad_vB) { double Acc = 0.0; double pnlty = this.penalty(inp.jCellIn, inp.jCellOut);//, inp.GridDat.Cells.cj); double kA = this.Conductivity(inp.Parameters_IN); double kB = this.Conductivity(inp.Parameters_OUT); for (int d = 0; d < inp.D; d++) { Acc += 0.5 * (kA * _Grad_uA[0, d] + kB * _Grad_uB[0, d]) * (_vA - _vB) * inp.Normale[d]; // consistency term Acc += 0.5 * (kA * _Grad_vA[d] + kB * _Grad_vB[d]) * (_uA[0] - _uB[0]) * inp.Normale[d]; // symmetry term } Acc *= this.m_alpha; double muMax = (Math.Abs(kA) > Math.Abs(kB)) ? kA : kB; Acc -= (_uA[0] - _uB[0]) * (_vA - _vB) * pnlty * muMax; // penalty term return(-Acc); }
virtual public double InnerEdgeForm(ref Foundation.CommonParams inp, double[] _uA, double[] _uB, double[,] _Grad_uA, double[,] _Grad_uB, double _vA, double _vB, double[] _Grad_vA, double[] _Grad_vB) { double Acc = 0.0; double pnlty = this.mu(inp.jCellIn, inp.jCellOut); double muA = this.Nu(inp.X, inp.Parameters_IN); double muB = this.Nu(inp.X, inp.Parameters_OUT); for (int d = 0; d < inp.D; d++) { Acc += 0.5 * (muA * _Grad_uA[0, d] + muB * _Grad_uB[0, d]) * (_vA - _vB) * inp.Normal[d]; // consistency term Acc += 0.5 * (muA * _Grad_vA[d] + muB * _Grad_vB[d]) * (_uA[0] - _uB[0]) * inp.Normal[d]; // symmetry term } Acc *= this.m_alpha; double muMax = (Math.Abs(muA) > Math.Abs(muB)) ? muA : muB; Acc -= (_uA[0] - _uB[0]) * (_vA - _vB) * pnlty * muMax; // penalty term return(Acc); }
protected override double InnerEdgeFlux(ref Foundation.CommonParams inp, double[] Uin, double[] Uout) { double res = 0.0; switch (Bcmap.PhysMode) { case PhysicsMode.Incompressible: res = 0.5 * (Uin[0] + Uout[0]) * inp.Normal[Component]; break; case PhysicsMode.LowMach: case PhysicsMode.Multiphase: double densityIn = (EoS.GetDensity(inp.Parameters_IN[0])); double densityOut = (EoS.GetDensity(inp.Parameters_OUT[0])); if (double.IsNaN(densityIn) || double.IsInfinity(densityIn)) { throw new NotFiniteNumberException(); } if (double.IsNaN(densityOut) || double.IsInfinity(densityOut)) { throw new NotFiniteNumberException(); } res = 0.5 * (densityIn * Uin[0] + densityOut * Uout[0]) * inp.Normal[Component]; break; case PhysicsMode.Combustion: res = 0.5 * (EoS.GetDensity(inp.Parameters_IN) * Uin[0] + EoS.GetDensity(inp.Parameters_OUT) * Uout[0]) * inp.Normal[Component]; break; default: throw new ApplicationException("PhysicsMode not implemented"); } return(res); }
/// <summary> /// flux at inner edges /// </summary> protected double InnerEdgeFlux(ref Foundation.CommonParams inp, double[] Uin, double[] Uout) { double r = 0; double ScalarIn = GetScalar(Uin); double ScalarOut = GetScalar(Uout); for (int i = 0; i < m_SpatialDimension; ++i) { r += 0.5 * ScalarIn * Uin[i] * inp.Normal[i]; r += 0.5 * ScalarOut * Uout[i] * inp.Normal[i]; } // Calculate dissipative part // ========================== double[] VelocityMeanIn = Uin.GetSubVector(0, m_SpatialDimension); ////////////////////////////TODO CHECK!!!!!!!!!!!!!!!!!!!! double[] VelocityMeanOut = Uout.GetSubVector(0, m_SpatialDimension); double LambdaIn; double LambdaOut; double TemperatureMeanIn = Uin[m_SpatialDimension]; double TemperatureMeanOut = Uout[m_SpatialDimension]; LambdaIn = LambdaConvection.GetLambda(VelocityMeanIn, inp.Normal, false, ScalarIn); LambdaOut = LambdaConvection.GetLambda(VelocityMeanOut, inp.Normal, false, ScalarOut); double Lambda = Math.Max(LambdaIn, LambdaOut); r += 0.5 * Lambda * (ScalarIn - ScalarOut); if (double.IsNaN(r)) { throw new NotFiniteNumberException(); } return(r); }
public override double InnerEdgeForm(ref Foundation.CommonParams inp, double[] _uA, double[] _uB, double[,] _Grad_uA, double[,] _Grad_uB, double _vA, double _vB, double[] _Grad_vA, double[] _Grad_vB) { double Acc = 0.0; double pnlty = this.penalty(inp.jCellIn, inp.jCellOut); double muA = this.Viscosity(inp.Parameters_IN); double muB = this.Viscosity(inp.Parameters_OUT); //switch (base.m_implMode) { // case ViscosityImplementation.H: { //only inner edges for (int d = 0; d < inp.D; d++) { //Acc += 0.5 * (muA * _Grad_uA[0, d] + muB * _Grad_uB[0, d]) * (_vA - _vB) * inp.Normale[d]; // consistency term //Acc += 0.5 * (muA * _Grad_vA[d] + muB * _Grad_vB[d]) * (_uA[0] - _uB[0]) * inp.Normale[d]; // symmetry term Acc += (muA * _Grad_uA[0, d]) * (_vA) * inp.Normale[d]; // consistency term //Acc += (muA * _Grad_vA[d]) * (_uA[0]) * inp.Normale[d]; // symmetry term } Acc *= base.m_alpha; double muMax = (Math.Abs(muA) > Math.Abs(muB)) ? muA : muB; //No Penalty Term for Localized Version -> no dependency on jump return(-Acc); // } // case ViscosityImplementation.SWIP: { // throw new NotImplementedException(); // } // default: throw new NotImplementedException(); //} }
protected override double InnerEdgeFlux(ref Foundation.CommonParams inp, double[] Uin, double[] Uout) { return(-alpha * 0.5 * (Uin[0] + Uout[0]) * inp.Normale[0]); }
/// <summary> /// flux at inner edges /// </summary> protected override double InnerEdgeFlux(ref Foundation.CommonParams inp, double[] Uin, double[] Uout) { double r = 0.0; // Calculate central part // ====================== // 2 * (rho u_j * scalar) * n_j double rhoIn = 0.0; double rhoOut = 0.0; switch (m_bcmap.PhysMode) { case PhysicsMode.LowMach: rhoIn = EoS.GetDensity(inp.Parameters_IN[2 * m_SpatialDimension]); rhoOut = EoS.GetDensity(inp.Parameters_OUT[2 * m_SpatialDimension]); break; case PhysicsMode.Combustion: double[] args_IN = new double[NumberOfReactants + 1]; for (int n = 0; n < NumberOfReactants + 1; n++) { args_IN[n] = inp.Parameters_IN[2 * m_SpatialDimension + n]; } double[] args_OUT = new double[NumberOfReactants + 1]; for (int n = 0; n < NumberOfReactants + 1; n++) { args_OUT[n] = inp.Parameters_OUT[2 * m_SpatialDimension + n]; } rhoIn = EoS.GetDensity(args_IN); rhoOut = EoS.GetDensity(args_OUT); break; default: throw new NotImplementedException("PhysicsMode not implemented"); } r += rhoIn * Uin[0] * (inp.Parameters_IN[0] * inp.Normal[0] + inp.Parameters_IN[1] * inp.Normal[1]); r += rhoOut * Uout[0] * (inp.Parameters_OUT[0] * inp.Normal[0] + inp.Parameters_OUT[1] * inp.Normal[1]); if (m_SpatialDimension == 3) { r += rhoIn * Uin[0] * inp.Parameters_IN[2] * inp.Normal[2] + rhoOut * Uout[0] * inp.Parameters_OUT[2] * inp.Normal[2]; } // Calculate dissipative part // ========================== IList <double> _VelocityMeanIn = new List <double>(); IList <double> _VelocityMeanOut = new List <double>(); for (int d = 0; d < m_SpatialDimension; d++) { _VelocityMeanIn.Add(inp.Parameters_IN[m_SpatialDimension + d]); _VelocityMeanOut.Add(inp.Parameters_OUT[m_SpatialDimension + d]); } double[] VelocityMeanIn = _VelocityMeanIn.ToArray(); double[] VelocityMeanOut = _VelocityMeanOut.ToArray(); double LambdaIn; double LambdaOut; switch (m_bcmap.PhysMode) { case PhysicsMode.Multiphase: LambdaIn = LambdaConvection.GetLambda(VelocityMeanIn, inp.Normal, false); LambdaOut = LambdaConvection.GetLambda(VelocityMeanOut, inp.Normal, false); break; case PhysicsMode.LowMach: double TemperatureMeanIn = inp.Parameters_IN[2 * m_SpatialDimension + 1]; double TemperatureMeanOut = inp.Parameters_OUT[2 * m_SpatialDimension + 1]; Debug.Assert(TemperatureMeanOut != 0); LambdaIn = LambdaConvection.GetLambda(VelocityMeanIn, inp.Normal, EoS, false, TemperatureMeanIn); LambdaOut = LambdaConvection.GetLambda(VelocityMeanOut, inp.Normal, EoS, false, TemperatureMeanOut); if (double.IsNaN(LambdaIn) || double.IsInfinity(LambdaIn)) { throw new NotFiniteNumberException(); } if (double.IsNaN(LambdaOut) || double.IsInfinity(LambdaOut)) { throw new NotFiniteNumberException(); } break; case PhysicsMode.Combustion: double[] ScalarMeanIn = new double[NumberOfReactants + 1]; double[] ScalarMeanOut = new double[NumberOfReactants + 1]; for (int n = 0; n < NumberOfReactants + 1; n++) { ScalarMeanIn[n] = inp.Parameters_IN[2 * m_SpatialDimension + NumberOfReactants + 1 + n]; ScalarMeanOut[n] = inp.Parameters_OUT[2 * m_SpatialDimension + NumberOfReactants + 1 + n]; } LambdaIn = LambdaConvection.GetLambda(VelocityMeanIn, inp.Normal, EoS, false, ScalarMeanIn); LambdaOut = LambdaConvection.GetLambda(VelocityMeanOut, inp.Normal, EoS, false, ScalarMeanOut); break; default: throw new NotImplementedException(); } double Lambda = Math.Max(LambdaIn, LambdaOut); r += Lambda * (Uin[0] - Uout[0]); r *= 0.5; if (double.IsNaN(r)) { throw new NotFiniteNumberException(); } return(r); }
abstract public double InnerEdgeForm(ref Foundation.CommonParams inp, double[] _uA, double[] _uB, double[,] _Grad_uA, double[,] _Grad_uB, double _vA, double _vB, double[] _Grad_vA, double[] _Grad_vB);
protected override void InnerEdgeFlux(ref Foundation.CommonParams inp, double[] Uin, double[] Uout, out double FluxInCell, out double FluxOutCell) { base.InnerEdgeFlux(ref inp, Uin, Uout, out FluxInCell, out FluxOutCell); FluxInCell *= scale; FluxOutCell *= scale; }
/// <summary> /// flux at inner edges /// </summary> double InnerEdgeFlux(ref Foundation.CommonParams inp, double[] Uin, double[] Uout) { double r = 0.0; int idx = argumentIndex; // Calculate central part // ====================== // 2 * (rho u_j * scalar) * n_j double rhoIn = 0.0; double rhoOut = 0.0; switch (m_bcmap.PhysMode) { case PhysicsMode.MixtureFraction: rhoIn = EoS.getDensityFromZ(Uin[inp.D]); rhoOut = EoS.getDensityFromZ(Uout[inp.D]); break; case PhysicsMode.LowMach: double[] DensityArgumentsIn = Uin.GetSubVector(m_SpatialDimension, 1); double[] DensityArgumentsOut = Uout.GetSubVector(m_SpatialDimension, 1); rhoIn = EoS.GetDensity(DensityArgumentsIn); rhoOut = EoS.GetDensity(DensityArgumentsOut); break; case PhysicsMode.Combustion: double[] DensityArgumentsIn2 = Uin.GetSubVector(m_SpatialDimension, NumberOfReactants); double[] DensityArgumentsOut2 = Uout.GetSubVector(m_SpatialDimension, NumberOfReactants); rhoIn = EoS.GetDensity(DensityArgumentsIn2); rhoOut = EoS.GetDensity(DensityArgumentsOut2); break; default: throw new NotImplementedException("PhysicsMode not implemented"); } Debug.Assert((rhoIn > 0.0) && (rhoOut > 0.0)); r += rhoIn * Uin[idx] * (Uin[0] * inp.Normal[0] + Uin[1] * inp.Normal[1]); r += rhoOut * Uout[idx] * (Uout[0] * inp.Normal[0] + Uout[1] * inp.Normal[1]); if (m_SpatialDimension == 3) { //r += rhoIn * Uin[idx] * (Uin[2] * inp.Normal[2] + Uout[2] * inp.Normal[2]); r += rhoIn * Uin[idx] * Uin[2] * inp.Normal[2] + rhoOut * Uout[idx] * Uout[2] * inp.Normal[2]; } // Calculate dissipative part // ========================== double[] VelocityMeanIn = Uin.GetSubVector(0, m_SpatialDimension); double[] VelocityMeanOut = Uout.GetSubVector(0, m_SpatialDimension); double LambdaIn; double LambdaOut; switch (m_bcmap.PhysMode) { case PhysicsMode.MixtureFraction: LambdaIn = LambdaConvection.GetLambda(VelocityMeanIn, inp.Normal, false, rhoIn); LambdaOut = LambdaConvection.GetLambda(VelocityMeanOut, inp.Normal, false, rhoOut); break; case PhysicsMode.Multiphase: LambdaIn = LambdaConvection.GetLambda(VelocityMeanIn, inp.Normal, false); LambdaOut = LambdaConvection.GetLambda(VelocityMeanOut, inp.Normal, false); break; case PhysicsMode.LowMach: double ScalarMeanIn = Uin[m_SpatialDimension]; double ScalarMeanOut = Uout[m_SpatialDimension]; LambdaIn = LambdaConvection.GetLambda(VelocityMeanIn, inp.Normal, EoS, false, ScalarMeanIn); LambdaOut = LambdaConvection.GetLambda(VelocityMeanOut, inp.Normal, EoS, false, ScalarMeanOut); break; case PhysicsMode.Combustion: { double[] ScalarMeanIn_vec = Uin.GetSubVector(m_SpatialDimension, NumberOfReactants - 1 + 1); double[] ScalarMeanOut_vec = Uout.GetSubVector(m_SpatialDimension, NumberOfReactants - 1 + 1); LambdaIn = LambdaConvection.GetLambda(VelocityMeanIn, inp.Normal, EoS, false, ScalarMeanIn_vec); LambdaOut = LambdaConvection.GetLambda(VelocityMeanOut, inp.Normal, EoS, false, ScalarMeanOut_vec); break; } default: throw new NotImplementedException(); } if (double.IsNaN(LambdaIn) || double.IsInfinity(LambdaIn) || double.IsNaN(LambdaOut) || double.IsInfinity(LambdaOut)) { throw new NotFiniteNumberException(); } double Lambda = Math.Max(LambdaIn, LambdaOut); r += Lambda * (Uin[idx] - Uout[idx]) * LaxFriedrichsSchemeSwitch; r *= 0.5; if (double.IsNaN(r)) { throw new NotFiniteNumberException(); } return(r); }
/// <summary> /// flux at inner edges /// </summary> protected override double InnerEdgeFlux(ref Foundation.CommonParams inp, double[] Uin, double[] Uout) { double r = 0.0; // Calculate central part // ====================== // 2 * {u_j * phi} * n_j for Level-Set advection // 2 * {rho u_j * T} * n_j for Low-Mach advection double rhoIn = 1.0; double rhoOut = 1.0; if (m_bcmap.PhysMode == PhysicsMode.LowMach) { rhoIn = EoS.GetDensity(inp.Parameters_IN[2 * m_SpatialDimension]); rhoOut = EoS.GetDensity(inp.Parameters_OUT[2 * m_SpatialDimension]); } r += rhoIn * Uin[0] * (inp.Parameters_IN[0] * inp.Normal[0] + inp.Parameters_IN[1] * inp.Normal[1]); r += rhoOut * Uout[0] * (inp.Parameters_OUT[0] * inp.Normal[0] + inp.Parameters_OUT[1] * inp.Normal[1]); if (m_SpatialDimension == 3) { r += rhoIn * Uin[0] * inp.Parameters_IN[2] * inp.Normal[2] + rhoOut * Uout[0] * inp.Parameters_OUT[2] * inp.Normal[2]; } // Calculate dissipative part // ========================== IList <double> _VelocityMeanIn = new List <double>(); IList <double> _VelocityMeanOut = new List <double>(); for (int d = 0; d < m_SpatialDimension; d++) { _VelocityMeanIn.Add(inp.Parameters_IN[m_SpatialDimension + d]); _VelocityMeanOut.Add(inp.Parameters_OUT[m_SpatialDimension + d]); } double[] VelocityMeanIn = _VelocityMeanIn.ToArray(); double[] VelocityMeanOut = _VelocityMeanOut.ToArray(); double LambdaIn; double LambdaOut; switch (m_bcmap.PhysMode) { case PhysicsMode.Multiphase: LambdaIn = LambdaConvection.GetLambda(VelocityMeanIn, inp.Normal, false); LambdaOut = LambdaConvection.GetLambda(VelocityMeanOut, inp.Normal, false); break; case PhysicsMode.LowMach: double ScalarMeanIn = inp.Parameters_IN[2 * m_SpatialDimension + 1]; double ScalarMeanOut = inp.Parameters_OUT[2 * m_SpatialDimension + 1]; LambdaIn = LambdaConvection.GetLambda(VelocityMeanIn, inp.Normal, EoS, false, ScalarMeanIn); LambdaOut = LambdaConvection.GetLambda(VelocityMeanOut, inp.Normal, EoS, false, ScalarMeanOut); break; case PhysicsMode.RANS: Func <IEnumerable <double>, IEnumerable <double>, double> ScalarProduct = (a, b) => (a.Zip(b, (ai, bi) => ai * bi)).Sum(); LambdaIn = ScalarProduct(VelocityMeanIn, inp.Normal); LambdaOut = ScalarProduct(VelocityMeanOut, inp.Normal); break; default: throw new NotImplementedException(); } double Lambda = Math.Max(LambdaIn, LambdaOut); double Scalar_Jump = Uin[0] - Uout[0]; r += Lambda * Scalar_Jump; r *= 0.5; return(r); }
public override double InnerEdgeForm(ref Foundation.CommonParams inp, double[] _uA, double[] _uB, double[,] _Grad_uA, double[,] _Grad_uB, double _vA, double _vB, double[] _Grad_vA, double[] _Grad_vB) { return(0); }
protected override double InnerEdgeFlux(ref Foundation.CommonParams inp, double[] Uin, double[] Uout) { return(base.InnerEdgeFlux(ref inp, Uin, Uout)); }