from dolfin import * import matplotlib.pyplot as plt import numpy as np import os from argpar import parse from postproses import postpro from solvers import Newton_manual parameters['allow_extrapolation'] = True args = parse() v_deg = args.v_deg p_deg = args.p_deg d_deg = args.d_deg theta = args.theta discr = args.discr T = args.T dt = args.dt fig = False def Venant_Kirchhof(d): I = Identity(2) F = I - grad(d) J = det(F) E = 0.5 * ((inv(F.T) * inv(F)) - I) return inv(F) * (2. * mu_s * E + lamda * tr(E) * I) * inv(F.T) def integrateFluidStress(p, u, geo): ds_g = Measure("ds", subdomain_data=geo) # surface of geometry
import argpar import sys import copy def links_get(baselink): ret = [] for i in range( 1, int( re.findall( "page=([0-9]+)", requests.get(baselink).headers["Link"].split(",")[1])[0]) + 1): ret.append(baselink + "?page=" + str(i)) return ret def pages_get(links): ret = [] for link in links: ret.extend(requests.get(link).json()) return ret if __name__ == '__main__': args = argpar.parse({"u": "https://api.github.com/users/{}/repos"}, copy.copy(sys.argv), posarg={"user": None}) for repo in pages_get(links_get(args["u"].format(args["user"]))): print(repo["html_url"])
def postpro(Lift, Drag, dis_x, dis_y, time, Re, m, U_dof, run_time, mesh_cells, case): args = parse() T = args.T dt = args.dt v_deg = args.v_deg p_deg = args.p_deg d_deg = args.d_deg theta = args.theta fig = False count = 1 count = 1 while os.path.exists("./experiments/fsi1/" + str(count)): count += 1 os.makedirs("./experiments/fsi1/" + str(count)) print("Creating report file ./experiments/fsi1/" + str(count) + "/report.txt") name = "./experiments/fsi1/" + str( count) + "/report.txt" # Name of text file coerced with +.txt f = open(name, 'w') f.write( "FSI1 Turek parameters\n" "Re = %(Re)g \nmesh = %(m)s\nDOF = %(U_dof)d\nT = %(T)g\ndt = %(dt)g\nv_deg = %(v_deg)g\n,d_deg%(d_deg)g\np_deg = %(p_deg)g\n" "theta_scheme = %(theta).1f\n" % vars()) f.write("Runtime = %f \n\n" % run_time) f.write("Steady Forces:\nLift Force = %g\n" "Drag Force = %g\n\n" % (Lift[-1], Drag[-1])) f.write("Steady Displacement:\ndisplacement_x = %g \n" "displacement_y = %g \n" % (dis_x[-1], dis_y[-1])) f.close() np.savetxt("./experiments/fsi1/" + str(count) + "/Lift.txt", Lift, delimiter=',') np.savetxt("./experiments/fsi1/" + str(count) + "/Drag.txt", Drag, delimiter=',') np.savetxt("./experiments/fsi1/" + str(count) + "/time.txt", time, delimiter=',') plt.figure(1) plt.title("LIFT \n Re = %.1f, dofs = %d, cells = %d" % (Re, U_dof, mesh_cells)) plt.xlabel("Time Seconds") plt.ylabel("Lift force Newton") plt.plot(time, Lift, label='dt %g' % dt) plt.legend(loc=4) plt.savefig("./experiments/fsi1/" + str(count) + "/lift.png") plt.figure(2) plt.title("DRAG \n Re = %.1f, dofs = %d, cells = %d" % (Re, U_dof, mesh_cells)) plt.xlabel("Time Seconds") plt.ylabel("Drag force Newton") plt.plot(time, Drag, label='dt %g' % dt) plt.legend(loc=4) plt.savefig("./experiments/fsi1/" + str(count) + "/drag.png") #plt.show() plt.figure(3) plt.title("Dis_x \n Re = %.1f, dofs = %d, cells = %d" % (Re, U_dof, mesh_cells)) plt.xlabel("Time Seconds") plt.ylabel("Drag force Newton") plt.plot(time, dis_x, label='dt %g' % dt) plt.legend(loc=4) plt.savefig("./experiments/fsi1/" + str(count) + "/dis_x.png") plt.figure(4) plt.title("Dis_y \n Re = %.1f, dofs = %d, cells = %d" % (Re, U_dof, mesh_cells)) plt.xlabel("Time Seconds") plt.ylabel("Drag force Newton") plt.plot(time, dis_y, label='dt %g' % dt) plt.legend(loc=4) plt.savefig("./experiments/fsi1/" + str(count) + "/dis_y.png") #vel_file << u print "Discretization theta = %g" % theta print "Lift %g" % Lift[-1] print "Drag %g" % Drag[-1] print "Displacement x %g" % dis_x[-1] print "displacement_y %g" % dis_y[-1]
#!/usr/bin/python3 import sys import argpar import os if __name__ == '__main__': args = argpar.parse({"t": sys.stdout}, sys.argv, posarg={"path": "./"}) if type(args["t"]) == str: args["t"] = open(args["t"], "w") sys.argv.append(args["path"]) print("(fp_lib_table", file=args["t"], flush=True) for directory in sys.argv[1:]: for lib in os.listdir(directory): if lib.endswith(".pretty"): print( " (lib (name {})(type KiCad)(uri {})(options \"\")(descr \"\"))" .format(lib[:-7], os.path.abspath(lib)), file=args["t"], flush=True) print(")", file=args["t"], flush=True) args["t"].close()