Created
January 16, 2022 00:40
-
-
Save shkiefer/202ead81f77fa8ab59a2e709c61d7b3e to your computer and use it in GitHub Desktop.
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
def make_pv_array(panel_w, panel_h, n_panels=2, nsm_pv = 0.002, tc=0.25, tfs=0.03, k_hinge=10e3, dx_panel=2.): | |
mapdl = launch_mapdl(override=True, license_type="ansys", cleanup_on_exit=True) | |
mapdl.clear() | |
mapdl.prep7() | |
mapdl.units("BIN") | |
mapdl.csys(kcn=0) | |
# material property definitions ommitted, See github repo for full file. | |
# create geometry (areas) | |
a1 = mapdl.blc4(xcorner=0., ycorner=-panel_w/2, width=panel_h, height=panel_w) | |
mapdl.agen(itime=n_panels, na1='ALL', dx=panel_h + dx_panel) | |
# mesh | |
mapdl.allsel() | |
mid=1 | |
mapdl.aatt(mat=mid, type_=mid, secn=mid) | |
mapdl.aesize('all', dx_panel / 2.) | |
mapdl.mshape(0, '2D') | |
mapdl.mopt('SPLIT', 'OFF') | |
mapdl.smrtsize(sizlvl=4) | |
mapdl.csys(kcn=0) | |
mapdl.amesh("all") | |
# base remote points | |
mapdl.lsel(type_='s', item='LOC', comp='X', vmin=0.) | |
mapdl.nsll(type_='s', nkey=1) | |
n_base_1, r_base = make_sbc(mapdl, 0., -panel_w/4., 0., pinb=dx_panel) | |
mapdl.lsel(type_='s', item='LOC', comp='X', vmin=0.) | |
mapdl.nsll(type_='s', nkey=1) | |
n_base_2, r_base = make_sbc(mapdl, 0., panel_w/4., 0., pinb=dx_panel) | |
if n_panels > 1: | |
for i in range(n_panels): | |
x_ref = panel_h * (i + 1) + dx_panel * i | |
x_mob = x_ref + dx_panel | |
# ref remote points | |
mapdl.lsel(type_='s', item='LOC', comp='X', vmin=x_ref) | |
mapdl.nsll(type_='s', nkey=1) | |
nr1, rr1 = make_sbc(mapdl, x_ref + dx_panel / 2., -panel_w / 4., 0., pinb=dx_panel) | |
mapdl.lsel(type_='s', item='LOC', comp='X', vmin=x_ref) | |
mapdl.nsll(type_='s', nkey=1) | |
nr2, rr2 = make_sbc(mapdl, x_ref + dx_panel / 2., panel_w / 4., 0., pinb=dx_panel) | |
# mob remote points | |
mapdl.lsel(type_='s', item='LOC', comp='X', vmin=x_mob) | |
mapdl.nsll(type_='s', nkey=1) | |
nm1, rm1 = make_sbc(mapdl, x_ref + dx_panel / 2., -panel_w / 4., 0., pinb=dx_panel) | |
mapdl.lsel(type_='s', item='LOC', comp='X', vmin=x_mob) | |
mapdl.nsll(type_='s', nkey=1) | |
nm2, rm2 = make_sbc(mapdl, x_ref + dx_panel / 2., panel_w / 4., 0., pinb=dx_panel) | |
# Add joints | |
mapdl.allsel() | |
mid = 10 | |
mapdl.mat(mid) | |
mapdl.type(mid) | |
mapdl.real(mid) | |
mapdl.e(nr1, nm1) | |
mapdl.e(nr2, nm2) | |
# make components | |
mapdl.esel(type_='s', item='TYPE', vmin=1) | |
mapdl.cm(cname='shell', entity='ELEM') | |
mapdl.esel(type_='s', item='TYPE', vmin=10) | |
mapdl.cm(cname='joint', entity='ELEM') | |
mapdl.allsel() | |
# solving | |
mapdl.allsel() | |
mapdl.slashsolu() | |
mapdl.outres(item='ALL', freq='NONE') | |
mapdl.outres(item='NSOL', freq='ALL') | |
mapdl.outres(item='RSOL', freq='ALL') | |
mapdl.outres(item='ESOL', freq='ALL') | |
mapdl.outres(item='VENG', freq='ALL') | |
mapdl.outres(item='MISC', freq='ALL') | |
mapdl.d(n_base_1, "ALL") | |
mapdl.d(n_base_2, "ALL") | |
mapdl.antype('MODAL') | |
mapdl.modopt('LANB', 3) | |
mapdl.mxpand(elcalc="YES") | |
o = mapdl.solve() | |
grid = mapdl.mesh.grid | |
result = mapdl.result | |
df_sene = get_sene_comps(mapdl, ['shell', 'joint']) | |
mapdl.exit() | |
return result, grid, df_sene |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment