This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Suggested to run this script from terminal, | |
`abaqus cae noGUI="/path/to/this/file"` | |
""" | |
from visualization import * | |
import numpy as np | |
import os | |
import sys | |
import inspect |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
This module places spheres of known radius and volume fraction | |
in a cube of known min and max bounds using | |
Random Sequential Adsorption (RSA) logic. | |
""" | |
import numpy as np | |
from math import pi | |
def rsa_spheres(r,vf,bounds, min_sep=0.00, max_attempts=1000): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
This code writes nodal coordinates and mesh connectivity data of a part, to text file | |
""" | |
from abaqus import * | |
from abaqusConstants import * | |
import mesh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# source: this stackoverflow thread : https://stackoverflow.com/questions/8218608/scipy-savefig-without-frames-axes-only-content/8218887#8218887 | |
# | |
width_pixels = 5 | |
height_pixels = 5 | |
using matplotlib.pyplot as plt | |
fig = plt.figure(frameon=False) | |
fig.set_size_inches(width_pixels, height_pixels) | |
# | |
ax = plt.Axes(fig, [0., 0., 1., 1.]) | |
ax.set_axis_off() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
h5open(data_set_path, "w") do h5file_id | |
attributes(h5file_id)["eqrad"] = 1.0 | |
attributes(h5file_id)["inclusion_volume_fraction"] = 32.0 | |
attributes(h5file_id)["rve_xlb"] = bbox[1] | |
attributes(h5file_id)["rve_ylb"] = bbox[2] | |
attributes(h5file_id)["rve_xub"] = bbox[3] | |
attributes(h5file_id)["rve_yub"] = bbox[4] | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import matplotlib.pyplot as plt | |
from PIL import Image | |
import os | |
num_chunks = 6 | |
img_size = (64, 64) | |
container_ID = "CIRCLES_VF10_RS10_R5" | |
cfd = os.path.dirname(__vsc_ipynb_file__) | |
container_dir = os.path.join(cfd, "containers", "rve", f"container_{container_ID}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
import os | |
class ProgressBar: | |
def __init__(self, num_iters, header=None) -> None: | |
self.t0 = time.time() | |
self.n = num_iters | |
self.term_cols = (os.get_terminal_size().columns)*0.25 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import matplotlib.pyplot as plt | |
def clip_histogram(data, get_indices=False, **hist_kwargs): | |
n, bns = np.histogram(data, **hist_kwargs) | |
bin_pairs = [(bns[i], bns[i+1]) for i in range(len(bns)-1)] | |
new_data = [] | |
indices = [] | |
for (i, (bnl, bnu)) in enumerate(bin_pairs): | |
bin_width = bnu - bnl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import matplotlib.pyplot as plt | |
import os | |
from scipy import integrate | |
CFD = os.path.dirname(__file__) | |
def get_chunks(x: np.ndarray[float], y: np.ndarray[float], pivot: float = 0.0): | |
sort_indices = np.argsort(x) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
# shuffling arrays concurrently | |
def shuffle_arrays(*arr, order=1): | |
num_rows = arr[0].shape[0] | |
assert all([i.shape[0] == num_rows for i in arr]) | |
indicies = np.array(list(range(num_rows)), dtype=np.int64) |
OlderNewer