public static Element buildlocals(Element[] e, CalcData cd, Data d, int ip, int ie, double[] W, double[] N1, double[] N2) { if (ip != 1) { e[ie].localH[0, 0] += d.K * cd.Rp * W[ip] / cd.dR + d.c * d.ro * cd.dR * cd.Rp * W[ip] * N1[ip] * N1[ip] / cd.dtau; e[ie].localH[0, 1] += (-1) * d.K * cd.Rp * W[ip] / cd.dR + d.c * d.ro * cd.dR * cd.Rp * W[ip] * N1[ip] * N2[ip] / cd.dtau; e[ie].localH[1, 0] = e[ie].localH[0, 1]; e[ie].localH[1, 1] += d.K * cd.Rp * W[ip] / cd.dR + d.c * d.ro * cd.dR * cd.Rp * W[ip] * N2[ip] * N2[ip] / cd.dtau; e[ie].localP[0] += d.c * d.ro * cd.dR * cd.tptau * cd.Rp * W[ip] * N1[ip] / cd.dtau; e[ie].localP[1] += d.c * d.ro * cd.dR * cd.tptau * cd.Rp * W[ip] * N2[ip] / cd.dtau; } else { e[ie].localH[0, 0] += d.K * cd.Rp * W[ip] / cd.dR + d.c * d.ro * cd.dR * cd.Rp * W[ip] * N1[ip] * N1[ip] / cd.dtau; e[ie].localH[0, 1] += (-1) * d.K * cd.Rp * W[ip] / cd.dR + d.c * d.ro * cd.dR * cd.Rp * W[ip] * N1[ip] * N2[ip] / cd.dtau; e[ie].localH[1, 0] = e[ie].localH[0, 1]; e[ie].localH[1, 1] += d.K * cd.Rp * W[ip] / cd.dR + d.c * d.ro * cd.dR * cd.Rp * W[ip] * N2[ip] * N2[ip] / cd.dtau + 2 * cd.alfa * d.rmax; e[ie].localP[0] += d.c * d.ro * cd.dR * cd.tptau * cd.Rp * W[ip] * N1[ip] / cd.dtau; e[ie].localP[1] += d.c * d.ro * cd.dR * cd.tptau * cd.Rp * W[ip] * N2[ip] / cd.dtau + 2 * cd.alfa * d.rmax * d.tempair; } return(e[ie]); }
public static double[] buildglobalp(int ie, Element[] el, CalcData cd) { cd.globalP[ie] += el[ie].localP[0]; cd.globalP[ie + 1] += el[ie].localP[1]; return(cd.globalP); }
public static double[,] buildglobalh(int ie, Element[] el, CalcData cd) { cd.globalH[ie, ie] += +el[ie].localH[0, 0]; cd.globalH[ie, ie + 1] += el[ie].localH[0, 1]; cd.globalH[ie + 1, ie] += el[ie].localH[1, 0]; cd.globalH[ie + 1, ie + 1] += el[ie].localH[1, 1]; return(cd.globalH); }
public static double[,] mergematrix(CalcData cd) { for (int i = 0; i < nh; i++) { for (int j = 0; j < nh; j++) { cd.matrix[i, j] = cd.globalH[i, j]; } } for (int i = 0; i < nh; i++) { cd.matrix[i, nh] = cd.globalP[i]; } return(cd.matrix); }