protected override double BorderEdgeFlux(ref CommonParamsBnd inp, double[] Uin) { ThermalBcType edgType = EdgeTag2Type[inp.EdgeTag]; switch (edgType) { case ThermalBcType.ConstantTemperature: double Acc = 0.0; double T_D = tempFunction[inp.EdgeTag](inp.X, inp.time); // consistency term Acc += T_D * inp.Normal[m_d]; // penalty term double Tn = 0.0; //for (int d = 0; d < m_D; d++) { // Tn += C_12[d] * (Uin[0] - T_D) * inp.Normale[d]; //} Tn += C_12 * (Uin[0] - T_D); //Acc += Tn * inp.Normale[m_d]; return(k * Acc); case ThermalBcType.ZeroGradient: case ThermalBcType.ConstantHeatFlux: return(k * Uin[0] * inp.Normal[m_d]); default: throw new NotImplementedException(); } }
public double BoundaryEdgeForm(ref Foundation.CommonParamsBnd inp, double[] _uA, double[,] _Grad_uA, double _vA, double[] _Grad_vA) { double Acc = 0.0; double pnlty = 2 * this.penalty(inp.jCellIn, -1);//, inp.GridDat.Cells.cj); double muA = this.Conductivity(inp.Parameters_IN); ThermalBcType edgType = this.EdgeTag2Type[inp.EdgeTag]; switch (edgType) { case ThermalBcType.Dirichlet: { // inhom. Dirichlet b.c. // +++++++++++++++++++++ double g_D = this.g_Diri(inp.X, inp.time, inp.EdgeTag, 0); for (int d = 0; d < inp.D; d++) { double nd = inp.Normale[d]; Acc += (muA * _Grad_uA[0, d]) * (_vA) * nd; Acc += (muA * _Grad_vA[d]) * (_uA[0] - g_D) * nd; } Acc *= this.m_alpha; Acc -= muA * (_uA[0] - g_D) * (_vA - 0) * pnlty; break; } case ThermalBcType.ZeroGradient: { for (int d = 0; d < inp.D; d++) { double nd = inp.Normale[d]; Acc += (muA * _Grad_uA[0, d]) * (_vA) * nd; //Acc += (muA * _Grad_vA[d]) * (_uA[0] - g_D) * nd; } Acc *= this.m_alpha; //Acc -= muA * (_uA[0] - g_D) * (_vA - 0) * pnlty; break; } default: throw new NotImplementedException(); } return(-Acc); }
public double BoundaryEdgeForm(ref CommonParamsBnd inp, double[] _uA, double[,] _Grad_uA, double _vA, double[] _Grad_vA) { double Acc = 0.0; ThermalBcType edgType = this.EdgeTag2Type[inp.EdgeTag]; switch (edgType) { case ThermalBcType.ConstantTemperature: { for (int d = 0; d < m_D; d++) { Acc += (_uA[d]) * _vA * inp.Normale[d]; } break; } case ThermalBcType.ZeroGradient: { //for (int d = 0; d < m_D; d++) { // Acc += (_uA[d] - 0.0) * _vA * inp.Normale[d]; //} break; } case ThermalBcType.ConstantHeatFlux: { for (int d = 0; d < inp.D; d++) { double g_D = this.fluxFunction[d][inp.EdgeTag](inp.X, inp.time); Acc += (g_D) * (_vA) * inp.Normale[d]; } break; } default: throw new NotImplementedException(); } return(Acc); }
protected override double BorderEdgeFlux(ref CommonParamsBnd inp, double[] Uin) { double c = 0.0; for (int d = 0; d < m_SpatialDimension; d++) c += inp.Parameters_IN[d] * inp.Normal[d]; ThermalBcType edgeType = m_bcmap.EdgeTag2Type[inp.EdgeTag]; switch (edgeType) { case ThermalBcType.ConstantTemperature: { return (c * cap * TempFunction[inp.EdgeTag](inp.X, inp.time)); } case ThermalBcType.ZeroGradient: case ThermalBcType.ConstantHeatFlux: { return (c * cap * Uin[0]); } default: throw new NotImplementedException("Boundary condition not implemented!"); } }
public double BoundaryEdgeForm(ref CommonParamsBnd inp, double[] _uA, double[,] _Grad_uA, double _vA, double[] _Grad_vA) { ThermalBcType edgType = this.EdgeTag2Type[inp.EdgeTag]; switch (edgType) { case ThermalBcType.ConstantTemperature: { double T_D = tempFunction[inp.EdgeTag](inp.X, inp.time); return(2.0 * (_uA[0] - T_D) * (_vA) * inp.Normal[m_d]); } case ThermalBcType.ZeroGradient: case ThermalBcType.ConstantHeatFlux: { return(0.0); // -(_uA[0]) * (_vA) * alpha; } default: throw new NotImplementedException(); } }
protected override double BorderEdgeFlux(ref CommonParamsBnd inp, double[] Uin) { ThermalBcType edgType = EdgeTag2Type[inp.EdgeTag]; switch (edgType) { case ThermalBcType.ConstantTemperature: double T_D = tempFunction[inp.EdgeTag](inp.X, inp.time); return(k * T_D * inp.Normale[m_d]); case ThermalBcType.ZeroGradient: case ThermalBcType.ConstantHeatFlux: return(k * Uin[0] * inp.Normale[m_d]); default: throw new NotImplementedException(); } }
protected override double BorderEdgeFlux(ref CommonParamsBnd inp, Double[] Uin) { ThermalBcType edgeType = m_bcmap.EdgeTag2Type[inp.EdgeTag]; switch (edgeType) { case ThermalBcType.ConstantTemperature: { double r = 0.0; // Setup params // ============ Foundation.CommonParams inp2; inp2.GridDat = inp.GridDat; inp2.Normale = inp.Normale; inp2.iEdge = inp.iEdge; inp2.Parameters_IN = inp.Parameters_IN; inp2.X = inp.X; inp2.time = inp.time; // Specify Parameters_OUT // ====================== inp2.Parameters_OUT = new double[inp.Parameters_IN.Length]; // Dirichlet value for temperature double Uout = TempFunction[inp.EdgeTag](inp.X, inp.time); // Outer values for Velocity and VelocityMean for (int j = 0; j < m_SpatialDimension; j++) { inp2.Parameters_OUT[j] = inp2.Parameters_IN[j]; //velFunction[inp.EdgeTag, j](inp.X, inp.time); // Velocity0MeanVectorOut is set to zero, i.e. always LambdaIn is used. //inp2.Parameters_OUT[m_SpatialDimension + j] = 0.0; // VelocityMeanOut = VelocityMeanIn inp2.Parameters_OUT[m_SpatialDimension + j] = inp.Parameters_IN[m_SpatialDimension + j]; } // Calculate BorderEdgeFlux as InnerEdgeFlux // ========================================= r = InnerEdgeFlux(ref inp2, Uin, new double[] { Uout }); return(r); } case ThermalBcType.ZeroGradient: case ThermalBcType.ConstantHeatFlux: { double r = 0.0; double u1, u2, u3 = 0, u_d; u_d = Uin[0]; u1 = inp.Parameters_IN[0]; u2 = inp.Parameters_IN[1]; if (m_SpatialDimension == 3) { u3 = inp.Parameters_IN[2]; } r += u_d * (u1 * inp.Normale[0] + u2 * inp.Normale[1]); if (m_SpatialDimension == 3) { r += u_d * u3 * inp.Normale[2]; } return(r); } default: throw new NotImplementedException("Boundary condition not implemented!"); } }
public double BoundaryEdgeForm(ref CommonParamsBnd inp, double[] _uA, double[,] _Grad_uA, double _vA, double[] _Grad_vA) { double Acc = 0.0; ThermalBcType edgType = this.EdgeTag2Type[inp.EdgeTag]; switch (edgType) { case ThermalBcType.ConstantTemperature: { for (int d = 0; d < m_D; d++) { // consistency term Acc += (_uA[d]) * inp.Normal[d]; // penalty terms double T_D = tempFunction[inp.EdgeTag](inp.X, inp.time); //Acc += C_11 * (_uA[m_D] - T_D) * inp.Normale[d]; // double qn = 0.0; //for (int dd = 0; dd < m_D; dd++) { // qn += _uA[dd] * inp.Normale[dd]; //} //Acc -= C_12[d] * qn * inp.Normale[d]; //Acc += C_12 * qn; } break; } case ThermalBcType.ZeroGradient: { //for (int d = 0; d < m_D; d++) { // Acc += (_uA[d] - 0.0) * _vA * inp.Normale[d]; //} break; } case ThermalBcType.ConstantHeatFlux: { for (int d = 0; d < m_D; d++) { double g_D = this.fluxFunction[d][inp.EdgeTag](inp.X, inp.time); // consistency term Acc += (g_D) * inp.Normal[d]; // penalty terms double qn = 0.0; for (int dd = 0; dd < m_D; dd++) { g_D = this.fluxFunction[dd][inp.EdgeTag](inp.X, inp.time); qn += g_D * inp.Normal[dd]; } //Acc -= C_12[d] * qn * inp.Normale[d]; //Acc += C_12 * qn; } break; } default: throw new NotImplementedException(); } return(Acc * _vA); }