Peano
Loading...
Searching...
No Matches
plotSolution Namespace Reference

Functions

 calc_a (g, nu=3)
 exponents of the polynomials of the sedov solution g - the polytropic gamma nu - the dimension
 
 calc_beta (v, g, nu=3)
 beta values for the sedov solution (coefficients of the polynomials of the similarity variables) v - the similarity variable g - the polytropic gamma nu- the dimension
 
 sedov (t, E0, rho0, g, n=1000, nu=3)
 solve the sedov problem t - the time E0 - the initial energy rho0 - the initial density n - number of points (10000) nu - the dimension g - the polytropic gas gamma
 

Variables

float gas_gamma = 5.0 / 3.0
 This file is part of SWIFT.
 
float rho0 = 1.0
 
float P0 = 1.0e-6
 
int v0 = 1
 
float time = 0.2
 
str pvdfile = "particles.pvd"
 
 reader = ParticleVTUReader(pvdfile=pvdfile, snapshot_time=time)
 
 partData = reader.load()
 
 x = partData.x[:, 0]
 
 y = partData.x[:, 1]
 
 vx = partData.v[:, 0]
 
 vy = partData.v[:, 1]
 
 u = partData.u
 
 P = partData.pressure
 
 rho = partData.density
 
 r = np.sqrt((x - 1.0) ** 2 + (y - 1.0) ** 2)
 
 v = -np.sqrt(vx**2 + vy**2)
 
 r_bin_edge = np.arange(0.0, 1.0, 0.02)
 
float r_bin = 0.5 * (r_bin_edge[1:] + r_bin_edge[:-1])
 
 rho_bin
 
 _
 
 statistic
 
 bins
 
 v_bin
 
 P_bin
 
 u_bin
 
 rho2_bin
 
 v2_bin
 
 P2_bin
 
 u2_bin
 
 rho_sigma_bin = np.sqrt(rho2_bin - rho_bin**2)
 
 v_sigma_bin = np.sqrt(v2_bin - v_bin**2)
 
 P_sigma_bin = np.sqrt(P2_bin - P_bin**2)
 
 u_sigma_bin = np.sqrt(u2_bin - u_bin**2)
 
int N = 1000
 
float x_s = np.arange(0, 2.0, 2.0 / N) - 1.0
 
float rho_s = np.ones(N) * rho0
 
float P_s = np.ones(N) * rho0
 
int v_s = np.ones(N) * v0
 
float u0 = rho0 * P0 * (gas_gamma - 1)
 
float us = 0.5 * (gas_gamma - 1) * v0
 
float rs = us * time
 
float u_s = P_s / (rho_s * (gas_gamma - 1.0))
 
float s_s = P_s / rho_s**gas_gamma
 
 figsize
 
str line_color = "C4"
 
str binned_color = "C2"
 
int binned_marker_size = 4
 
 scatter_props
 
 errorbar_props = dict(color=binned_color, ms=binned_marker_size, fmt=".", lw=1.2)
 
int rows = 2
 
int cols = 2
 
 color
 
 alpha
 
 lw
 
 yerr
 
 labelpad
 
str fname = f"NohProfile{time:.4f}.png"
 
 dpi
 
bool plot_errorbars = False
 
 z = partData.x[:, 2]
 
 vz = partData.v[:, 2]
 
 fig = plt.figure(figsize=(7, 7 / 1.6))
 
float boxsize = 1.0
 
 vel_x = partData.v[:, 0]
 
 pressure = partData.pressure
 
 density = partData.density
 
 mass = partData.mass
 
 energy = partData.u
 
float v_r = x * vel_x / r
 
float rho_0 = 1.0
 
float P_0 = 1.0e-6
 
float E_0 = 1.0
 
 r_s = np.insert(r_s, np.size(r_s), [r_shock, r_shock * 3])
 
 r_shock
 
dict sim_props
 
dict solution_props
 
 ax1 = fig.add_subplot(2, 2, 1)
 
 ax2 = fig.add_subplot(2, 2, 2)
 
 ax3 = fig.add_subplot(2, 2, 3)
 
 ax4 = fig.add_subplot(2, 2, 4)
 
 direction
 
 top
 
 True
 
 right
 
 vel_y = partData.v[:, 1]
 
 vel_z = partData.v[:, 2]
 
float rho_L = 1.0
 
float rho_R = 0.125
 
float v_L = 0.0
 
float v_R = 0.0
 
float P_L = 1.0
 
float P_R = 0.1
 
float x_min = 0.0
 
float x_max = 2.0
 
 solver = sphtools.RiemannSolver(gas_gamma)
 
tuple delta_x = (x_max - x_min) / N
 
tuple center = (x_max + x_min) / 2
 
 c_R = np.sqrt(gas_gamma * P_R / rho_R)
 
tuple x_shock = (c_R + v_R) * time
 
 ms
 

Function Documentation

◆ calc_a()

plotSolution.calc_a (   g,
  nu = 3 
)

exponents of the polynomials of the sedov solution g - the polytropic gamma nu - the dimension

Definition at line 82 of file plotSolution.py.

Referenced by sedov().

Here is the caller graph for this function:

◆ calc_beta()

plotSolution.calc_beta (   v,
  g,
  nu = 3 
)

beta values for the sedov solution (coefficients of the polynomials of the similarity variables) v - the similarity variable g - the polytropic gamma nu- the dimension

Definition at line 104 of file plotSolution.py.

Referenced by sedov().

Here is the caller graph for this function:

◆ sedov()

plotSolution.sedov (   t,
  E0,
  rho0,
  g,
  n = 1000,
  nu = 3 
)

solve the sedov problem t - the time E0 - the initial energy rho0 - the initial density n - number of points (10000) nu - the dimension g - the polytropic gas gamma

Definition at line 141 of file plotSolution.py.

References calc_a(), and calc_beta().

Here is the call graph for this function:

Variable Documentation

◆ _

plotSolution._
protected

Definition at line 70 of file plotSolution.py.

◆ alpha

plotSolution.alpha

Definition at line 139 of file plotSolution.py.

◆ ax1

plotSolution.ax1 = fig.add_subplot(2, 2, 1)

Definition at line 255 of file plotSolution.py.

◆ ax2

plotSolution.ax2 = fig.add_subplot(2, 2, 2)

Definition at line 256 of file plotSolution.py.

◆ ax3

plotSolution.ax3 = fig.add_subplot(2, 2, 3)

Definition at line 257 of file plotSolution.py.

◆ ax4

plotSolution.ax4 = fig.add_subplot(2, 2, 4)

Definition at line 258 of file plotSolution.py.

◆ binned_color

str plotSolution.binned_color = "C2"

Definition at line 118 of file plotSolution.py.

◆ binned_marker_size

int plotSolution.binned_marker_size = 4

Definition at line 119 of file plotSolution.py.

◆ bins

plotSolution.bins

Definition at line 70 of file plotSolution.py.

◆ boxsize

float plotSolution.boxsize = 1.0

Definition at line 64 of file plotSolution.py.

◆ c_R

plotSolution.c_R = np.sqrt(gas_gamma * P_R / rho_R)

Definition at line 74 of file plotSolution.py.

◆ center

tuple plotSolution.center = (x_max + x_min) / 2

Definition at line 64 of file plotSolution.py.

◆ color

plotSolution.color

Definition at line 139 of file plotSolution.py.

◆ cols

int plotSolution.cols = 2

Definition at line 134 of file plotSolution.py.

◆ delta_x

tuple plotSolution.delta_x = (x_max - x_min) / N

Definition at line 63 of file plotSolution.py.

◆ density

plotSolution.density = partData.density

Definition at line 69 of file plotSolution.py.

◆ direction

plotSolution.direction

Definition at line 281 of file plotSolution.py.

◆ dpi

plotSolution.dpi

Definition at line 179 of file plotSolution.py.

◆ E_0

float plotSolution.E_0 = 1.0

Definition at line 214 of file plotSolution.py.

◆ energy

plotSolution.energy = partData.u

Definition at line 71 of file plotSolution.py.

◆ errorbar_props

plotSolution.errorbar_props = dict(color=binned_color, ms=binned_marker_size, fmt=".", lw=1.2)

Definition at line 131 of file plotSolution.py.

◆ fig

plotSolution.fig = plt.figure(figsize=(7, 7 / 1.6))

Definition at line 129 of file plotSolution.py.

◆ figsize

plotSolution.figsize

Definition at line 115 of file plotSolution.py.

◆ fname

str plotSolution.fname = f"NohProfile{time:.4f}.png"

Definition at line 178 of file plotSolution.py.

◆ gas_gamma

float plotSolution.gas_gamma = 5.0 / 3.0

This file is part of SWIFT.

Copyright (c) 2016 Matthieu Schaller (schal.nosp@m.ler@.nosp@m.strw..nosp@m.leid.nosp@m.enuni.nosp@m.v.nl)

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Copyright (c) 2016 Matthieu Schaller (schal.nosp@m.ler@.nosp@m.strw..nosp@m.leid.nosp@m.enuni.nosp@m.v.nl) Modified to fit the purposes of the Peano4 Noh 3D benchmark.

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Definition at line 25 of file plotSolution.py.

◆ labelpad

plotSolution.labelpad

Definition at line 141 of file plotSolution.py.

◆ line_color

str plotSolution.line_color = "C4"

Definition at line 117 of file plotSolution.py.

◆ lw

plotSolution.lw

Definition at line 139 of file plotSolution.py.

◆ mass

plotSolution.mass = partData.mass

Definition at line 70 of file plotSolution.py.

◆ ms

plotSolution.ms

Definition at line 85 of file plotSolution.py.

◆ N

int plotSolution.N = 1000

Definition at line 87 of file plotSolution.py.

◆ P

plotSolution.P = partData.pressure

Definition at line 60 of file plotSolution.py.

◆ P0

float plotSolution.P0 = 1.0e-6

Definition at line 27 of file plotSolution.py.

◆ P2_bin

plotSolution.P2_bin

Definition at line 77 of file plotSolution.py.

◆ P_0

float plotSolution.P_0 = 1.0e-6

Definition at line 213 of file plotSolution.py.

◆ P_bin

plotSolution.P_bin

Definition at line 72 of file plotSolution.py.

◆ P_L

float plotSolution.P_L = 1.0

Definition at line 27 of file plotSolution.py.

◆ P_R

float plotSolution.P_R = 0.1

Definition at line 28 of file plotSolution.py.

◆ P_s

float plotSolution.P_s = np.ones(N) * rho0

Definition at line 91 of file plotSolution.py.

◆ P_sigma_bin

plotSolution.P_sigma_bin = np.sqrt(P2_bin - P_bin**2)

Definition at line 82 of file plotSolution.py.

◆ partData

plotSolution.partData = reader.load()

Definition at line 48 of file plotSolution.py.

◆ plot_errorbars

bool plotSolution.plot_errorbars = False

Definition at line 39 of file plotSolution.py.

◆ pressure

plotSolution.pressure = partData.pressure

Definition at line 68 of file plotSolution.py.

◆ pvdfile

str plotSolution.pvdfile = "particles.pvd"

Definition at line 46 of file plotSolution.py.

◆ r

plotSolution.r = np.sqrt((x - 1.0) ** 2 + (y - 1.0) ** 2)

Definition at line 64 of file plotSolution.py.

◆ r_bin

float plotSolution.r_bin = 0.5 * (r_bin_edge[1:] + r_bin_edge[:-1])

Definition at line 69 of file plotSolution.py.

◆ r_bin_edge

plotSolution.r_bin_edge = np.arange(0.0, 1.0, 0.02)

Definition at line 68 of file plotSolution.py.

◆ r_s

plotSolution.r_s = np.insert(r_s, np.size(r_s), [r_shock, r_shock * 3])

Definition at line 218 of file plotSolution.py.

◆ r_shock

plotSolution.r_shock

Definition at line 218 of file plotSolution.py.

◆ reader

plotSolution.reader = ParticleVTUReader(pvdfile=pvdfile, snapshot_time=time)

Definition at line 47 of file plotSolution.py.

◆ rho

plotSolution.rho = partData.density

Definition at line 61 of file plotSolution.py.

◆ rho0

float plotSolution.rho0 = 1.0

Definition at line 26 of file plotSolution.py.

◆ rho2_bin

plotSolution.rho2_bin

Definition at line 75 of file plotSolution.py.

◆ rho_0

float plotSolution.rho_0 = 1.0

Definition at line 212 of file plotSolution.py.

◆ rho_bin

plotSolution.rho_bin

Definition at line 70 of file plotSolution.py.

◆ rho_L

float plotSolution.rho_L = 1.0

Definition at line 23 of file plotSolution.py.

◆ rho_R

float plotSolution.rho_R = 0.125

Definition at line 24 of file plotSolution.py.

◆ rho_s

float plotSolution.rho_s = np.ones(N) * rho0

Definition at line 90 of file plotSolution.py.

◆ rho_sigma_bin

plotSolution.rho_sigma_bin = np.sqrt(rho2_bin - rho_bin**2)

Definition at line 80 of file plotSolution.py.

◆ right

plotSolution.right

Definition at line 281 of file plotSolution.py.

◆ rows

int plotSolution.rows = 2

Definition at line 133 of file plotSolution.py.

◆ rs

float plotSolution.rs = us * time

Definition at line 97 of file plotSolution.py.

◆ s_s

float plotSolution.s_s = P_s / rho_s**gas_gamma

Definition at line 112 of file plotSolution.py.

◆ scatter_props

plotSolution.scatter_props
Initial value:
1= dict(
2 marker=".",
3 ms=1,
4 markeredgecolor="none",
5 alpha=0.2,
6 zorder=-1,
7 rasterized=True,
8 linestyle="none",
9)

Definition at line 121 of file plotSolution.py.

◆ sim_props

dict plotSolution.sim_props
Initial value:
1= {
2 "marker": ".",
3 "ms": 4,
4 "markeredgecolor": "none",
5 "alpha": 1.0,
6 "zorder": -1,
7 "rasterized": True,
8 "linestyle": "none",
9}

Definition at line 235 of file plotSolution.py.

◆ solution_props

dict plotSolution.solution_props
Initial value:
1= {
2 "linestyle": "--",
3 "color": "C1",
4 "alpha": 0.6,
5 "linewidth": 2.0,
6}

Definition at line 244 of file plotSolution.py.

◆ solver

plotSolution.solver = sphtools.RiemannSolver(gas_gamma)

Definition at line 61 of file plotSolution.py.

◆ statistic

plotSolution.statistic

Definition at line 70 of file plotSolution.py.

◆ time

float plotSolution.time = 0.2

Definition at line 42 of file plotSolution.py.

◆ top

plotSolution.top

Definition at line 281 of file plotSolution.py.

◆ True

plotSolution.True

Definition at line 281 of file plotSolution.py.

◆ u

plotSolution.u = partData.u

Definition at line 58 of file plotSolution.py.

◆ u0

float plotSolution.u0 = rho0 * P0 * (gas_gamma - 1)

Definition at line 95 of file plotSolution.py.

◆ u2_bin

plotSolution.u2_bin

Definition at line 79 of file plotSolution.py.

◆ u_bin

plotSolution.u_bin

Definition at line 74 of file plotSolution.py.

◆ u_s

float plotSolution.u_s = P_s / (rho_s * (gas_gamma - 1.0))

Definition at line 111 of file plotSolution.py.

◆ u_sigma_bin

plotSolution.u_sigma_bin = np.sqrt(u2_bin - u_bin**2)

Definition at line 84 of file plotSolution.py.

◆ us

float plotSolution.us = 0.5 * (gas_gamma - 1) * v0

Definition at line 96 of file plotSolution.py.

◆ v

plotSolution.v = -np.sqrt(vx**2 + vy**2)

Definition at line 65 of file plotSolution.py.

◆ v0

int plotSolution.v0 = 1

Definition at line 28 of file plotSolution.py.

◆ v2_bin

plotSolution.v2_bin

Definition at line 76 of file plotSolution.py.

◆ v_bin

plotSolution.v_bin

Definition at line 71 of file plotSolution.py.

◆ v_L

float plotSolution.v_L = 0.0

Definition at line 25 of file plotSolution.py.

◆ v_r

tuple plotSolution.v_r = x * vel_x / r

Definition at line 74 of file plotSolution.py.

◆ v_R

float plotSolution.v_R = 0.0

Definition at line 26 of file plotSolution.py.

◆ v_s

int plotSolution.v_s = np.ones(N) * v0

Definition at line 92 of file plotSolution.py.

◆ v_sigma_bin

plotSolution.v_sigma_bin = np.sqrt(v2_bin - v_bin**2)

Definition at line 81 of file plotSolution.py.

◆ vel_x

plotSolution.vel_x = partData.v[:, 0]

Definition at line 67 of file plotSolution.py.

◆ vel_y

plotSolution.vel_y = partData.v[:, 1]

Definition at line 69 of file plotSolution.py.

◆ vel_z

plotSolution.vel_z = partData.v[:, 2]

Definition at line 71 of file plotSolution.py.

◆ vx

plotSolution.vx = partData.v[:, 0]

Definition at line 56 of file plotSolution.py.

◆ vy

plotSolution.vy = partData.v[:, 1]

Definition at line 57 of file plotSolution.py.

◆ vz

plotSolution.vz = partData.v[:, 2]

Definition at line 69 of file plotSolution.py.

◆ x

float plotSolution.x = partData.x[:, 0]

Definition at line 54 of file plotSolution.py.

◆ x_max

float plotSolution.x_max = 2.0

Definition at line 56 of file plotSolution.py.

◆ x_min

float plotSolution.x_min = 0.0

Definition at line 55 of file plotSolution.py.

◆ x_s

float plotSolution.x_s = np.arange(0, 2.0, 2.0 / N) - 1.0

Definition at line 89 of file plotSolution.py.

◆ x_shock

tuple plotSolution.x_shock = (c_R + v_R) * time

Definition at line 75 of file plotSolution.py.

◆ y

float plotSolution.y = partData.x[:, 1]

Definition at line 55 of file plotSolution.py.

◆ yerr

plotSolution.yerr

Definition at line 140 of file plotSolution.py.

◆ z

float plotSolution.z = partData.x[:, 2]

Definition at line 66 of file plotSolution.py.