def applyStrongBCNonlinearSystem(self, U, r, J): A = self.dof_handler.A[self.k] aA1 = self.dof_handler.aA1(U, self.k) vf, dvf_daA1 = computeVolumeFraction(aA1, A, self.phase, self.model_type) arhoA = U[self.i_arhoA] arhouA = U[self.i_arhouA] arhoEA_solution = U[self.i_arhoEA] u, du_darhoA, du_darhouA = computeVelocity(arhoA, arhouA) rho, drho_dvf, drho_darhoA, _ = computeDensity(vf, arhoA, A) drho_daA1 = drho_dvf * dvf_daA1 v, dv_drho = computeSpecificVolume(rho) dv_daA1 = dv_drho * drho_daA1 dv_darhoA = dv_drho * drho_darhoA e, de_dv, de_dp = self.eos.e(v, self.p) de_daA1 = de_dv * dv_daA1 de_darhoA = de_dv * dv_darhoA arhoEA = arhoA * (e + 0.5 * u * u) darhoEA_daA1 = arhoA * de_dv * dv_daA1 darhoEA_darhoA = (e + 0.5 * u * u) + arhoA * (de_dv * dv_darhoA + u * du_darhoA) darhoEA_darhouA = arhoA * u * du_darhouA # energy r[self.i_arhoEA] = arhoEA_solution - arhoEA J[self.i_arhoEA,:] = 0 if (self.model_type == ModelType.TwoPhase): J[self.i_arhoEA,self.i_aA1] = - darhoEA_daA1 J[self.i_arhoEA,self.i_arhoA] = - darhoEA_darhoA J[self.i_arhoEA,self.i_arhouA] = - darhoEA_darhouA J[self.i_arhoEA,self.i_arhoEA] = 1
def applyWeakBC(self, U, r, J): A = self.dof_handler.A[self.k] aA1 = self.dof_handler.aA1(U, self.k) arhoA = U[self.i_arhoA] arhouA = U[self.i_arhouA] arhoEA = U[self.i_arhoEA] vf, dvf_daA1 = computeVolumeFraction(aA1, A, self.phase, self.model_type) u, du_darhoA, du_darhouA = computeVelocity(arhoA, arhouA) rho, drho_dvf, drho_darhoA, _ = computeDensity(vf, arhoA, A) drho_daA1 = drho_dvf * dvf_daA1 v, dv_drho = computeSpecificVolume(rho) dv_daA1 = dv_drho * drho_daA1 dv_darhoA = dv_drho * drho_darhoA E, dE_darhoA, dE_darhoEA = computeSpecificTotalEnergy(arhoA, arhoEA) e, de_du, de_dE = computeSpecificInternalEnergy(u, E) de_darhoA = de_du * du_darhoA + de_dE * dE_darhoA de_darhouA = de_du * du_darhouA de_darhoEA = de_dE * dE_darhoEA p, dp_dv, dp_de = self.eos.p(v, e) dp_daA1 = dp_dv * dv_daA1 dp_darhoA = dp_dv * dv_darhoA + dp_de * de_darhoA dp_darhouA = dp_de * de_darhouA dp_darhoEA = dp_de * de_darhoEA # mass r[self.i_arhoA] += arhouA * self.nx J[self.i_arhoA, self.i_arhouA] += self.nx # momentum r[self.i_arhouA] += (arhouA * u + vf * p) * self.nx if (self.model_type == ModelType.TwoPhase): J[self.i_arhouA, self.i_aA1] += (dvf_daA1 * p + vf * dp_daA1) * self.nx J[self.i_arhouA, self.i_arhoA] += (arhouA * du_darhoA + vf * dp_darhoA) * self.nx J[self.i_arhouA, self.i_arhouA] += (arhouA * du_darhouA + u + vf * dp_darhouA) * self.nx J[self.i_arhouA, self.i_arhoEA] += vf * dp_darhoEA * self.nx # energy r[self.i_arhoEA] += (arhoEA + vf * p) * u * self.nx if (self.model_type == ModelType.TwoPhase): J[self.i_arhoEA, self.i_aA1] += (dvf_daA1 * p + vf * dp_daA1) * u * self.nx J[self.i_arhoEA, self.i_arhoA] += ( (arhoEA + vf * p) * du_darhoA + vf * dp_darhoA * u) * self.nx J[self.i_arhoEA, self.i_arhouA] += ( (arhoEA + vf * p) * du_darhouA + vf * dp_darhouA * u) * self.nx J[self.i_arhoEA, self.i_arhoEA] += (1 + vf * dp_darhoEA) * u * self.nx
def applyStrongBCLinearSystemRHSVector(self, U_old, b): A = self.dof_handler.A[self.k] aA1 = self.dof_handler.aA1(U_old, self.k) vf, dvf_daA1 = computeVolumeFraction(aA1, A, self.phase, self.model_type) arhoA = U_old[self.i_arhoA] arhouA = U_old[self.i_arhouA] u, du_darhoA, du_darhouA = computeVelocity(arhoA, arhouA) rho, drho_dvf, drho_darhoA = computeDensity(vf, arhoA) v, dv_drho = computeSpecificVolume(rho) e, de_dv, de_dp = self.eos.e(v, self.p) arhoEA = arhoA * (e + 0.5 * u * u) b[self.i_arhoEA] = arhoEA
def applyStronglyToNonlinearSystem(self, U_new, U_old, r, J): n_values = 6 L = 0 R = 1 L_old = 2 R_old = 3 LL_old = 4 RR_old = 5 k = [0] * n_values k[L] = self.k_left k[R] = self.k_right k[L_old] = self.k_left k[R_old] = self.k_right k[LL_old] = self.k_left_adjacent k[RR_old] = self.k_right_adjacent i_arhoA = [0] * n_values i_arhoA[L] = self.i_arhoL i_arhoA[R] = self.i_arhoR i_arhoA[L_old] = self.i_arhoL i_arhoA[R_old] = self.i_arhoR i_arhoA[LL_old] = self.i_arhoLL i_arhoA[RR_old] = self.i_arhoRR i_arhouA = [0] * n_values i_arhouA[L] = self.i_arhouAL i_arhouA[R] = self.i_arhouAR i_arhouA[L_old] = self.i_arhouAL i_arhouA[R_old] = self.i_arhouAR i_arhouA[LL_old] = self.i_arhouALL i_arhouA[RR_old] = self.i_arhouARR i_arhoEA = [0] * n_values i_arhoEA[L] = self.i_arhoEAL i_arhoEA[R] = self.i_arhoEAR i_arhoEA[L_old] = self.i_arhoEAL i_arhoEA[R_old] = self.i_arhoEAR i_arhoEA[LL_old] = self.i_arhoEALL i_arhoEA[RR_old] = self.i_arhoEARR U = [0] * n_values U[L] = U_new U[R] = U_new U[L_old] = U_old U[R_old] = U_old U[LL_old] = U_old U[RR_old] = U_old # initialize lists rho = [0] * n_values drho_daA1 = [0] * n_values drho_darhoA = [0] * n_values u = [0] * n_values du_darhoA = [0] * n_values du_darhouA = [0] * n_values e = [0] * n_values de_darhoA = [0] * n_values de_darhouA = [0] * n_values de_darhoEA = [0] * n_values p = [0] * n_values dp_daA1 = [0] * n_values dp_darhoA = [0] * n_values dp_darhouA = [0] * n_values dp_darhoEA = [0] * n_values c = [0] * n_values dc_daA1 = [0] * n_values dc_darhoA = [0] * n_values dc_darhouA = [0] * n_values dc_darhoEA = [0] * n_values if not self.use_momentum_flux_balance: p0 = [0] * n_values dp0_daA1 = [0] * n_values dp0_darhoA = [0] * n_values dp0_darhouA = [0] * n_values dp0_darhoEA = [0] * n_values # loop over subscript/superscript combinations for i in xrange(n_values): A = self.dof_handler.A[k[i]] aA1 = self.dof_handler.aA1(U[i], k[i]) vf, dvf_daA1 = computeVolumeFraction(aA1, A, self.phase, self.model_type) arhoA = U[i][i_arhoA[i]] arhouA = U[i][i_arhouA[i]] arhoEA = U[i][i_arhoEA[i]] rho[i], drho_dvf, drho_darhoA[i], _ = computeDensity(vf, arhoA, A) drho_daA1[i] = drho_dvf * dvf_daA1 u[i], du_darhoA[i], du_darhouA[i] = computeVelocity(arhoA, arhouA) v, dv_drho = computeSpecificVolume(rho[i]) dv_daA1 = dv_drho * drho_daA1[i] dv_darhoA = dv_drho * drho_darhoA[i] E, dE_darhoA, dE_darhoEA = computeSpecificTotalEnergy(arhoA, arhoEA) e[i], de_du, de_dE = computeSpecificInternalEnergy(u[i], E) de_darhoA[i] = de_du * du_darhoA[i] + de_dE * dE_darhoA de_darhouA[i] = de_du * du_darhouA[i] de_darhoEA[i] = de_dE * dE_darhoEA p[i], dp_dv, dp_de = self.eos.p(v, e[i]) dp_daA1[i] = dp_dv * dv_daA1 dp_darhoA[i] = dp_dv * dv_darhoA + dp_de * de_darhoA[i] dp_darhouA[i] = dp_de * de_darhouA[i] dp_darhoEA[i] = dp_de * de_darhoEA[i] c[i], dc_dv, dc_de = self.eos.c(v, e[i]) dc_daA1[i] = dc_dv * dv_daA1 dc_darhoA[i] = dc_dv * dv_darhoA + dc_de * de_darhoA[i] dc_darhouA[i] = dc_de * de_darhouA[i] dc_darhoEA[i] = dc_de * de_darhoEA[i] if not self.use_momentum_flux_balance: s, ds_dv, ds_de = self.eos.s(v, e[i]) ds_daA1 = ds_dv * dv_daA1 ds_darhoA = ds_dv * dv_darhoA + ds_de * de_darhoA[i] ds_darhouA = ds_de * de_darhouA[i] ds_darhoEA = ds_de * de_darhoEA[i] h, dh_de, dh_dp, dh_drho = computeSpecificEnthalpy(e[i], p[i], rho[i]) dh_daA1 = dh_dp * dp_daA1[i] dh_darhoA = dh_de * de_darhoA[i] + dh_dp * dp_darhoA[i] + dh_drho * drho_darhoA[i] dh_darhouA = dh_de * de_darhouA[i] + dh_dp * dp_darhouA[i] dh_darhoEA = dh_de * de_darhoEA[i] + dh_dp * dp_darhoEA[i] h0 = h + 0.5 * u[i]**2 dh0_daA1 = dh_daA1 dh0_darhoA = dh_darhoA + u[i] * du_darhoA[i] dh0_darhouA = dh_darhouA + u[i] * du_darhouA[i] dh0_darhoEA = dh_darhoEA p0[i], dp0_dh0, dp0_ds = self.eos.p_from_h_s(h0, s) dp0_daA1[i] = dp0_dh0 * dh0_daA1 + dp0_ds * ds_daA1 dp0_darhoA[i] = dp0_dh0 * dh0_darhoA + dp0_ds * ds_darhoA dp0_darhouA[i] = dp0_dh0 * dh0_darhouA + dp0_ds * ds_darhouA dp0_darhoEA[i] = dp0_dh0 * dh0_darhoEA + dp0_ds * ds_darhoEA # compute old average quantities rhoL = 0.5 * (rho[L_old] + rho[LL_old]) rhoR = 0.5 * (rho[R_old] + rho[RR_old]) uL = 0.5 * (u[L_old] + u[LL_old]) uR = 0.5 * (u[R_old] + u[RR_old]) pL = 0.5 * (p[L_old] + p[LL_old]) pR = 0.5 * (p[R_old] + p[RR_old]) cL = 0.5 * (c[L_old] + c[LL_old]) cR = 0.5 * (c[R_old] + c[RR_old]) # residual indices i1 = self.i_arhoL i2 = self.i_arhouAL i3 = self.i_arhoEAL i4 = self.i_arhoR i5 = self.i_arhouAR i6 = self.i_arhoEAR # reset Jacobian rows J[i1,:] = 0 J[i2,:] = 0 J[i3,:] = 0 J[i4,:] = 0 J[i5,:] = 0 J[i6,:] = 0 # compute residuals and Jacobians r[i1] = p[L] - pL + rhoL * (cL - uL) * (u[L] - uL) J_i1_vf1L = dp_daA1[L] J[i1,self.i_arhoL] = dp_darhoA[L] + rhoL * (cL - uL) * du_darhoA[L] J[i1,self.i_arhouAL] = dp_darhouA[L] + rhoL * (cL - uL) * du_darhouA[L] J[i1,self.i_arhoEAL] = dp_darhoEA[L] r[i2] = p[R] - pR - rhoR * (cR - uR) * (u[R] - uR) J_i2_vf1R = dp_daA1[R] J[i2,self.i_arhoR] = dp_darhoA[R] - rhoR * (cR - uR) * du_darhoA[R] J[i2,self.i_arhouAR] = dp_darhouA[R] - rhoR * (cR - uR) * du_darhouA[R] J[i2,self.i_arhoEAR] = dp_darhoEA[R] if u[L] >= 0: if u[R] < 0: error("Assumption violated: Both velocity conditions were true.") r[i3] = rho[L] - rhoL - (p[L] - pL) / cL**2 J_i3_vf1L = drho_daA1[L] - dp_daA1[L] / cL**2 J_i3_vf1R = 0 J[i3,self.i_arhoL] = drho_darhoA[L] - dp_darhoA[L] / cL**2 J[i3,self.i_arhouAL] = - dp_darhouA[L] / cL**2 J[i3,self.i_arhoEAL] = - dp_darhoEA[L] / cL**2 elif u[R] < 0: r[i3] = rho[R] - rhoR - (p[R] - pR) / cR**2 J_i3_vf1R = drho_daA1[R] - dp_daA1[R] / cR**2 J_i3_vf1L = 0 J[i3,self.i_arhoR] = drho_darhoA[R] - dp_darhoA[R] / cR**2 J[i3,self.i_arhouAR] = - dp_darhouA[R] / cR**2 J[i3,self.i_arhoEAR] = - dp_darhoEA[R] / cR**2 else: error("Assumption violated: Neither velocity condition was true.") r[i4] = rho[L] * u[L] - rho[R] * u[R] J_i4_vf1L = drho_daA1[L] * u[L] J[i4,self.i_arhoL] = drho_darhoA[L] * u[L] + rho[L] * du_darhoA[L] J[i4,self.i_arhouAL] = rho[L] * du_darhouA[L] J_i4_vf1R = -drho_daA1[R] * u[R] J[i4,self.i_arhoR] = -(drho_darhoA[R] * u[R] + rho[R] * du_darhoA[R]) J[i4,self.i_arhouAR] = -rho[R] * du_darhouA[R] r[i5] = e[L] + p[L] / rho[L] + 0.5 * u[L]**2 - (e[R] + p[R] / rho[R] + 0.5 * u[R]**2) J_i5_vf1L = dp_daA1[L] / rho[L] - p[L] / rho[L]**2 * drho_daA1[L] J[i5,self.i_arhoL] = de_darhoA[L] + dp_darhoA[L] / rho[L] - p[L] / rho[L]**2 * drho_darhoA[L] + u[L] * du_darhoA[L] J[i5,self.i_arhouAL] = de_darhouA[L] + dp_darhouA[L] / rho[L] + u[L] * du_darhouA[L] J[i5,self.i_arhoEAL] = de_darhoEA[L] + dp_darhoEA[L] / rho[L] J_i5_vf1R = -(dp_daA1[R] / rho[R] - p[R] / rho[R]**2 * drho_daA1[R]) J[i5,self.i_arhoR] = -(de_darhoA[R] + dp_darhoA[R] / rho[R] - p[R] / rho[R]**2 * drho_darhoA[R] + u[R] * du_darhoA[R]) J[i5,self.i_arhouAR] = -(de_darhouA[R] + dp_darhouA[R] / rho[R] + u[R] * du_darhouA[R]) J[i5,self.i_arhoEAR] = -(de_darhoEA[R] + dp_darhoEA[R] / rho[R]) if self.use_momentum_flux_balance: r[i6] = rho[L] * u[L]**2 + p[L] - (rho[R] * u[R]**2 + p[R]) J_i6_vf1L = drho_daA1[L] * u[L]**2 + dp_daA1[L] J[i6,self.i_arhoL] = drho_darhoA[L] * u[L]**2 + rho[L] * 2.0 * u[L] * du_darhoA[L] + dp_darhoA[L] J[i6,self.i_arhouAL] = rho[L] * 2.0 * u[L] * du_darhouA[L] + dp_darhouA[L] J[i6,self.i_arhoEAL] = dp_darhoEA[L] J_i6_vf1R = -(drho_daA1[R] * u[R]**2 + dp_daA1[R]) J[i6,self.i_arhoR] = -(drho_darhoA[R] * u[R]**2 + rho[R] * 2.0 * u[R] * du_darhoA[R] + dp_darhoA[R]) J[i6,self.i_arhouAR] = -(rho[R] * 2.0 * u[R] * du_darhouA[R] + dp_darhouA[R]) J[i6,self.i_arhoEAR] = -dp_darhoEA[R] else: r[i6] = p0[L] - p0[R] J_i6_vf1L = dp0_daA1[L] J[i6,self.i_arhoL] = dp0_darhoA[L] J[i6,self.i_arhouAL] = dp0_darhouA[L] J[i6,self.i_arhoEAL] = dp0_darhoEA[L] J_i6_vf1R = -dp0_daA1[R] J[i6,self.i_arhoR] = -dp0_darhoA[R] J[i6,self.i_arhouAR] = -dp0_darhouA[R] J[i6,self.i_arhoEAR] = -dp0_darhoEA[R] if self.model_type == ModelType.TwoPhase: J[i1,self.i_aA1L] = J_i1_vf1L J[i2,self.i_aA1R] = J_i2_vf1R J[i3,self.i_aA1L] = J_i3_vf1L J[i3,self.i_aA1R] = J_i3_vf1R J[i4,self.i_aA1L] = J_i4_vf1L J[i4,self.i_aA1R] = J_i4_vf1R J[i5,self.i_aA1L] = J_i5_vf1L J[i5,self.i_aA1R] = J_i5_vf1R J[i6,self.i_aA1L] = J_i6_vf1L J[i6,self.i_aA1R] = J_i6_vf1R
def computeFluxes(self, U): self.f_mass = [0] * self.n_meshes self.df_mass_darhouA = [0] * self.n_meshes self.f_momentum = [0] * self.n_meshes self.df_momentum_daA1 = [0] * self.n_meshes self.df_momentum_darhoA = [0] * self.n_meshes self.df_momentum_darhouA = [0] * self.n_meshes self.df_momentum_darhoEA = [0] * self.n_meshes self.f_energy = [0] * self.n_meshes self.df_energy_daA1 = [0] * self.n_meshes self.df_energy_darhoA = [0] * self.n_meshes self.df_energy_darhouA = [0] * self.n_meshes self.df_energy_darhoEA = [0] * self.n_meshes for i in xrange(self.n_meshes): nx = self.nx[i] A = self.dof_handler.A[self.node_indices[i]] aA1 = self.dof_handler.aA1(U, self.node_indices[i]) vf, dvf_daA1 = computeVolumeFraction(aA1, A, self.phase, self.model_type) arhoA = U[self.i_arhoA[i]] arhouA = U[self.i_arhouA[i]] arhoEA = U[self.i_arhoEA[i]] u, du_darhoA, du_darhouA = computeVelocity(arhoA, arhouA) rho, drho_dvf, drho_darhoA, _ = computeDensity(vf, arhoA, A) drho_daA1 = drho_dvf * dvf_daA1 v, dv_drho = computeSpecificVolume(rho) dv_daA1 = dv_drho * drho_daA1 dv_darhoA = dv_drho * drho_darhoA E, dE_darhoA, dE_darhoEA = computeSpecificTotalEnergy( arhoA, arhoEA) e, de_du, de_dE = computeSpecificInternalEnergy(u, E) de_darhoA = de_du * du_darhoA + de_dE * dE_darhoA de_darhouA = de_du * du_darhouA de_darhoEA = de_dE * dE_darhoEA p, dp_dv, dp_de = self.eos.p(v, e) dp_daA1 = dp_dv * dv_daA1 dp_darhoA = dp_dv * dv_darhoA + dp_de * de_darhoA dp_darhouA = dp_de * de_darhouA dp_darhoEA = dp_de * de_darhoEA self.f_mass[i] = arhouA * nx self.df_mass_darhouA[i] = nx self.f_momentum[i] = (arhouA * u + vf * p) * nx self.df_momentum_daA1[i] = (dvf_daA1 * p + vf * dp_daA1) * nx self.df_momentum_darhoA[i] = (arhouA * du_darhoA + vf * dp_darhoA) * nx self.df_momentum_darhouA[i] = (arhouA * du_darhouA + u + vf * dp_darhouA) * nx self.df_momentum_darhoEA[i] = vf * dp_darhoEA * nx self.f_energy[i] = (arhoEA + vf * p) * u * nx self.df_energy_daA1[i] = (dvf_daA1 * p + vf * dp_daA1) * u * nx self.df_energy_darhoA[i] = ( (arhoEA + vf * p) * du_darhoA + vf * dp_darhoA * u) * nx self.df_energy_darhouA[i] = ( (arhoEA + vf * p) * du_darhouA + vf * dp_darhouA * u) * nx self.df_energy_darhoEA[i] = (1 + vf * dp_darhoEA) * u * nx
def run(self, U): vf1, arhoA1, arhouA1, arhoEA1 = self.dof_handler.getPhaseSolution(U, 0) if (self.model_type != ModelType.OnePhase): vf2, arhoA2, arhouA2, arhoEA2 = self.dof_handler.getPhaseSolution( U, 1) # compute aux quantities n = self.dof_handler.n_node rho1 = computeDensity(vf1, arhoA1, self.dof_handler.A)[0] u1 = computeVelocity(arhoA1, arhouA1)[0] v1 = computeSpecificVolume(rho1)[0] E1 = computeSpecificTotalEnergy(arhoA1, arhoEA1)[0] e1 = computeSpecificInternalEnergy(u1, E1)[0] eos1 = self.eos_list[0] p1 = eos1.p(v1, e1)[0] T1 = eos1.T(v1, e1)[0] if (self.model_type != ModelType.OnePhase): rho2 = computeDensity(vf2, arhoA2, self.dof_handler.A)[0] u2 = computeVelocity(arhoA2, arhouA2)[0] v2 = computeSpecificVolume(rho2)[0] E2 = computeSpecificTotalEnergy(arhoA2, arhoEA2)[0] e2 = computeSpecificInternalEnergy(u2, E2)[0] eos2 = self.eos_list[1] p2 = eos2.p(v2, e2)[0] T2 = eos2.T(v2, e2)[0] # print solution if (self.print_solution): print if (self.model_type == ModelType.OnePhase): print("%15s%15s%15s") % ("rho", "u", "p") for k in xrange(n): print("%15g%15g%15g") % (rho1[k], u1[k], p1[k]) elif (self.model_type == ModelType.TwoPhaseNonInteracting): print("%15s%15s%15s%15s%15s%15s") % ("rho1", "u1", "p1", "rho2", "u2", "p2") for k in xrange(n): print("%15g%15g%15g%15g%15g%15g") % (rho1[k], u1[k], p1[k], rho2[k], u2[k], p2[k]) elif (self.model_type == ModelType.TwoPhase): print("%15s%15s%15s%15s%15s%15s%15s") % ( "vf1", "rho1", "u1", "p1", "rho2", "u2", "p2") for k in xrange(n): print("%15g%15g%15g%15g%15g%15g%15g") % ( vf1[k], rho1[k], u1[k], p1[k], rho2[k], u2[k], p2[k]) # save solution to file if self.save_solution: # create the data dictionary data = OrderedDict() data["x"] = self.dof_handler.x if self.model_type == ModelType.OnePhase: data["rho"] = rho1 data["u"] = u1 data["p"] = p1 else: if self.model_type == ModelType.TwoPhase: data["vf1"] = vf1 data["rho1"] = rho1 data["u1"] = u1 data["p1"] = p1 data["rho2"] = rho2 data["u2"] = u2 data["p2"] = p2 # write to file writeCSVFile(data, self.solution_file, self.output_precision) # plot solution if (self.plot_solution): x_label = "Position, $x$" if (self.model_type == ModelType.OnePhase): plotter = Plotter("", "Density, $\\rho$", (2, 2)) plotter.setXRange(self.dof_handler.x_min, self.dof_handler.x_max) plotter.addSet(self.dof_handler.x, rho1, "$\\rho$") plotter.fixNearConstantPlot() plotter.nextSubplot("", "Velocity, $u$") plotter.addSet(self.dof_handler.x, u1, "$u$") plotter.fixNearConstantPlot() plotter.nextSubplot(x_label, "Pressure, $p$ [kPa]") plotter.addSet(self.dof_handler.x, p1, "$p$", scale=1e-3) plotter.fixNearConstantPlot() plotter.nextSubplot(x_label, "Temperature, $T$ [K]") plotter.addSet(self.dof_handler.x, T1, "$T$") plotter.fixNearConstantPlot() elif (self.model_type == ModelType.TwoPhaseNonInteracting): plotter = Plotter(x_label, "Density, $\\rho$", (2, 2)) plotter.setXRange(self.dof_handler.x_min, self.dof_handler.x_max) plotter.addSet(self.dof_handler.x, rho1, "$\\rho_1$") plotter.fixNearConstantPlot() plotter.nextSubplot(x_label, "Density, $\\rho$") plotter.addSet(self.dof_handler.x, rho2, "$\\rho_2$") plotter.fixNearConstantPlot() plotter.nextSubplot(x_label, "Velocity, $u$") plotter.addSet(self.dof_handler.x, u1, "$u_1$") plotter.addSet(self.dof_handler.x, u2, "$u_2$") plotter.fixNearConstantPlot() plotter.nextSubplot(x_label, "Pressure, $p$ [kPa]") plotter.addSet(self.dof_handler.x, p1, "$p_1$", scale=1e-3) plotter.addSet(self.dof_handler.x, p2, "$p_2$", scale=1e-3) plotter.fixNearConstantPlot() elif (self.model_type == ModelType.TwoPhase): plotter = Plotter(x_label, "Volume Fraction, $\\alpha$", (2, 2)) plotter.setXRange(self.dof_handler.x_min, self.dof_handler.x_max) plotter.addSet(self.dof_handler.x, vf1, "$\\alpha_1$") plotter.fixNearConstantPlot() plotter.nextSubplot(x_label, "Density, $\\rho$") plotter.addSet(self.dof_handler.x, rho1, "$\\rho_1$") plotter.addSet(self.dof_handler.x, rho2, "$\\rho_2$") plotter.fixNearConstantPlot() plotter.nextSubplot(x_label, "Velocity, $u$") plotter.addSet(self.dof_handler.x, u1, "$u_1$") plotter.addSet(self.dof_handler.x, u2, "$u_2$") plotter.fixNearConstantPlot() plotter.nextSubplot(x_label, "Pressure, $p$ [kPa]") plotter.addSet(self.dof_handler.x, p1, "$p_1$", scale=1e-3) plotter.addSet(self.dof_handler.x, p2, "$p_2$", scale=1e-3) plotter.fixNearConstantPlot() # save plot plotter.save(self.plot_file)