Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pyro/advection/problems/smooth.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

def init_data(my_data, rp):
""" initialize the smooth advection problem """
del rp # this problem doesn't use runtime params

msg.bold("initializing the smooth advection problem...")

Expand Down
1 change: 1 addition & 0 deletions pyro/advection/problems/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

def init_data(my_data, rp):
""" an init routine for unit testing """
del rp # this problem doesn't use runtime params

# make sure that we are passed a valid patch object
if not isinstance(my_data, patch.CellCenterData2d):
Expand Down
1 change: 1 addition & 0 deletions pyro/advection/problems/tophat.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

def init_data(myd, rp):
""" initialize the tophat advection problem """
del rp # this problem doesn't use runtime params

msg.bold("initializing the tophat advection problem...")

Expand Down
1 change: 1 addition & 0 deletions pyro/advection_fv4/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ def states(a, ng, idir):
out : ndarray, ndarray
The state predicted to the left and right edges.
"""
# pylint: disable=too-many-nested-blocks

qx, qy = a.shape

Expand Down
1 change: 1 addition & 0 deletions pyro/advection_fv4/problems/smooth.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

def init_data(my_data, rp):
""" initialize the smooth advection problem """
del rp # this problem doesn't use runtime params

msg.bold("initializing the smooth FV advection problem...")

Expand Down
1 change: 1 addition & 0 deletions pyro/advection_nonuniform/problems/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

def init_data(my_data, rp):
""" an init routine for unit testing """
del rp # this problem doesn't use runtime params

# make sure that we are passed a valid patch object
if not isinstance(my_data, patch.CellCenterData2d):
Expand Down
7 changes: 5 additions & 2 deletions pyro/analysis/convergence.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ def compare(fine, coarse):
return float(np.abs(e).max()), e.norm()


if __name__ == "__main__":

def main():
if len(sys.argv) != 3:
print(usage)
sys.exit(2)
Expand All @@ -40,3 +39,7 @@ def compare(fine, coarse):
result = compare(ff.cc_data, cc.cc_data)

print("inf norm of density: ", result)


if __name__ == "__main__":
main()
2 changes: 1 addition & 1 deletion pyro/analysis/dam_compare.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def abort(string):
h0 = rp.get_param("dam.h_right")


def find_h2(h2):
def find_h2(h2): # pylint: disable=redefined-outer-name
return (h2/h1)**3 - 9*(h2/h1)**2*(h0/h1) + \
16*(h2/h1)**1.5*(h0/h1) - (h2/h1)*(h0/h1)*(h0/h1+8) + \
(h0/h1)**3
Expand Down
7 changes: 5 additions & 2 deletions pyro/analysis/gauss_diffusion_compare.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,7 @@ def process(file):
return bin_centers, phi_exact, phi_bin


if __name__ == "__main__":

def main():
if len(sys.argv) < 2:
print(usage)
sys.exit(2)
Expand Down Expand Up @@ -137,3 +136,7 @@ def process(file):

plt.savefig("gauss_diffusion_compare.png", bbox_inches="tight")
plt.savefig("gauss_diffusion_compare.pdf", bbox_inches="tight", dpi=100)


if __name__ == "__main__":
main()
6 changes: 5 additions & 1 deletion pyro/analysis/incomp_converge_error.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def get_errors(file):
return udiff.norm(), vdiff.norm()


if __name__ == "__main__":
def main():
if len(sys.argv) != 2:
print(usage)
sys.exit(2)
Expand All @@ -55,3 +55,7 @@ def get_errors(file):

errors = get_errors(file)
print("errors: ", errors[0], errors[1])


if __name__ == "__main__":
main()
7 changes: 5 additions & 2 deletions pyro/analysis/plot_thumbnail.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ def makeplot(myd, variable):
plt.show()


if __name__ == "__main__":

def main():
print(sys.argv)

file = sys.argv[1]
Expand All @@ -43,3 +42,7 @@ def makeplot(myd, variable):
sim = io.read(file)

makeplot(sim.cc_data, variable)


if __name__ == "__main__":
main()
4 changes: 1 addition & 3 deletions pyro/analysis/plotcompact.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,7 @@ def get_args():
parser.add_argument("variable", type=str, nargs=1,
help="the name of the solver used to run the simulation")

args = parser.parse_args()

return args
return parser.parse_args()


if __name__ == "__main__":
Expand Down
4 changes: 1 addition & 3 deletions pyro/analysis/plotvar.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,7 @@ def get_args():
parser.add_argument("variable", type=str, nargs=1,
help="the name of the solver used to run the simulation")

args = parser.parse_args()

return args
return parser.parse_args()


if __name__ == "__main__":
Expand Down
1 change: 1 addition & 0 deletions pyro/compressible/BC.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ def user(bc_name, bc_edge, variable, ccdata):
The data object

"""
# pylint: disable=too-many-nested-blocks

myg = ccdata.grid

Expand Down
4 changes: 2 additions & 2 deletions pyro/compressible/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -996,7 +996,7 @@ def riemann_hllc(idir, ng,
F[i, j, :] = consFlux(idir, gamma, idens, ixmom, iymom, iener, irhoX, nspec,
U_state)

elif S_r > 0.0 and S_c <= 0:
elif S_c <= 0.0 < S_r:
# R* region
HLLCfactor = rho_r * (S_r - un_r) / (S_r - S_c)

Expand Down Expand Up @@ -1024,7 +1024,7 @@ def riemann_hllc(idir, ng,
# correct the flux
F[i, j, :] = F[i, j, :] + S_r * (U_state[:] - U_r[i, j, :])

elif S_c > 0.0 and S_l < 0.0:
elif S_l < 0.0 < S_c:
# L* region
HLLCfactor = rho_l * (S_l - un_l) / (S_l - S_c)

Expand Down
6 changes: 2 additions & 4 deletions pyro/compressible/problems/advect.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,5 @@ def init_data(my_data, rp):
def finalize():
""" print out any information to the user at the end of the run """

msg = """
"""

print(msg)
print("""
""")
6 changes: 2 additions & 4 deletions pyro/compressible/problems/logo.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,9 @@ def init_data(my_data, rp):
def finalize():
""" print out any information to the user at the end of the run """

msg = """
print("""
The script analysis/sedov_compare.py can be used to analyze these
results. That will perform an average at constant radius and
compare the radial profiles to the exact solution. Sample exact
data is provided as analysis/cylindrical-sedov.out
"""

print(msg)
""")
6 changes: 2 additions & 4 deletions pyro/compressible/problems/sedov.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,9 @@ def init_data(my_data, rp):
def finalize():
""" print out any information to the user at the end of the run """

msg = """
print("""
The script analysis/sedov_compare.py can be used to analyze these
results. That will perform an average at constant radius and
compare the radial profiles to the exact solution. Sample exact
data is provided as analysis/cylindrical-sedov.out
"""

print(msg)
""")
6 changes: 2 additions & 4 deletions pyro/compressible/problems/sod.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,8 @@ def init_data(my_data, rp):
def finalize():
""" print out any information to the user at the end of the run """

msg = """
print("""
The script analysis/sod_compare.py can be used to compare
this output to the exact solution. Some sample exact solution
data is present as analysis/sod-exact.out
"""

print(msg)
""")
1 change: 1 addition & 0 deletions pyro/compressible/problems/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

def init_data(my_data, rp):
""" an init routine for unit testing """
del rp # this problem doesn't use runtime params

# make sure that we are passed a valid patch object
if not isinstance(my_data, patch.CellCenterData2d):
Expand Down
4 changes: 2 additions & 2 deletions pyro/compressible_fv4/simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ class Simulation(compressible_rk.Simulation):
def __init__(self, solver_name, problem_name, rp, timers=None, data_class=fv.FV2d):
super().__init__(solver_name, problem_name, rp, timers=timers, data_class=data_class)

def initialize(self, ng=5):
super().initialize(ng=ng)
def initialize(self, extra_vars=None, ng=5):
super().initialize(extra_vars=extra_vars, ng=ng)

def substep(self, myd):
"""
Expand Down
6 changes: 2 additions & 4 deletions pyro/compressible_react/problems/flame.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,9 @@ def init_data(my_data, rp):
def finalize():
""" print out any information to the user at the end of the run """

msg = """
print("""
The script analysis/sedov_compare.py can be used to analyze these
results. That will perform an average at constant radius and
compare the radial profiles to the exact solution. Sample exact
data is provided as analysis/cylindrical-sedov.out
"""

print(msg)
""")
4 changes: 2 additions & 2 deletions pyro/compressible_react/simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@

class Simulation(compressible.Simulation):

def initialize(self):
def initialize(self, extra_vars=None, ng=4):
"""
For the reacting compressible solver, our initialization of
the data is the same as the compressible solver, but we
supply additional variables.
"""
super().initialize(extra_vars=["fuel", "ash"])
super().initialize(extra_vars=["fuel", "ash"] + (extra_vars or []), ng=ng)

def burn(self, dt):
""" react fuel to ash """
Expand Down
1 change: 1 addition & 0 deletions pyro/compressible_sr/BC.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ def user(bc_name, bc_edge, variable, ccdata, ivars):
The data object

"""
# pylint: disable=too-many-nested-blocks

myg = ccdata.grid

Expand Down
20 changes: 5 additions & 15 deletions pyro/compressible_sr/c2p.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,21 +45,16 @@ def brentq(x1, b, U, gamma, idens, ixmom, iymom, iener,

# switch variables
if abs(fa) < abs(fb):
d = a
a = b
b = d

d = fa
fa = fb
fb = d
a, b = b, a
fa, fb = fb, fa

c = a
fc = fa

mflag = True

for _ in range(ITMAX):
if fa != fc and fb != fc:
if fa != fc and fb != fc: # pylint: disable=consider-using-in
s = a*fb*fc / ((fa-fb) * (fa-fc)) + b*fa*fc / ((fb-fa)*(fb-fc)) + \
c*fa*fb / ((fc-fa)*(fc-fb))
else:
Expand Down Expand Up @@ -92,13 +87,8 @@ def brentq(x1, b, U, gamma, idens, ixmom, iymom, iener,
fs = f(s, U, gamma, idens, ixmom, iymom, iener)

if abs(fa) < abs(fb):
d = a
a = b
b = d

d = fa
fa = fb
fb = d
a, b = b, a
fa, fb = fb, fa

d = c
c = b
Expand Down
18 changes: 9 additions & 9 deletions pyro/compressible_sr/eos.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"""


def pres(gamma, dens, eint):
def pres(gamma, rho, eint):
"""
Given the density and the specific internal energy, return the
pressure
Expand All @@ -13,7 +13,7 @@ def pres(gamma, dens, eint):
----------
gamma : float
The ratio of specific heats
dens : float
rho : float
The density
eint : float
The specific internal energy
Expand All @@ -24,10 +24,10 @@ def pres(gamma, dens, eint):
The pressure

"""
return dens*eint*(gamma - 1.0)
return rho * eint * (gamma - 1.0)


def dens(gamma, pres, eint):
def dens(gamma, p, eint):
"""
Given the pressure and the specific internal energy, return
the density
Expand All @@ -36,7 +36,7 @@ def dens(gamma, pres, eint):
----------
gamma : float
The ratio of specific heats
pres : float
p : float
The pressure
eint : float
The specific internal energy
Expand All @@ -47,18 +47,18 @@ def dens(gamma, pres, eint):
The density

"""
return pres/(eint*(gamma - 1.0))
return p / (eint * (gamma - 1.0))


def rhoe(gamma, pres):
def rhoe(gamma, p):
"""
Given the pressure, return (rho * e)

Parameters
----------
gamma : float
The ratio of specific heats
pres : float
p : float
The pressure

Returns
Expand All @@ -67,7 +67,7 @@ def rhoe(gamma, pres):
The internal energy density, rho e

"""
return pres/(gamma - 1.0)
return p / (gamma - 1.0)


def h_from_eps(gamma, eint):
Expand Down
Loading