-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
44 changed files
with
985 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# VARIABLES = x y z fe_order components | ||
0.0 0.0 0.0 0 rbeam | ||
1.0 0.0 0.0 1 rbeam | ||
-1.0 0.0 0.0 2 lbeam |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# VARIABLES = x y z fe_order components | ||
0.0 0.0 0.0 0 rbeam | ||
1.0 0.0 0.0 1 rbeam | ||
-1.0 0.0 0.0 2 lbeam |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# VARIABLES = x y z fe_order components | ||
0.0 0.0 0.0 0 rbeam | ||
0.8660254 0.0 0.5 1 rbeam | ||
-0.866025 0.0 -0.5 2 lbeam |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# VARIABLES = x y z fe_order components | ||
0.0 0.0 0.0 0 rbeam | ||
0.8660254 0.0 0.5 1 rbeam | ||
-0.866025 0.0 -0.5 2 lbeam |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
SOL 103 | ||
CEND | ||
TITLE=Rafa's flying beam model # | ||
ECHO=NONE | ||
DISPLACEMENT=ALL | ||
METHOD = 900 | ||
BEGIN BULK | ||
EIGRL,900,,,18 | ||
PARAM,POST,-1 | ||
INCLUDE 'model1.bdf' | ||
ENDDATA |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
SOL 103 | ||
CEND | ||
TITLE=Rafa's flying beam model # | ||
ECHO=NONE | ||
DISPLACEMENT=ALL | ||
METHOD = 900 | ||
BEGIN BULK | ||
EIGRL,900,,,18 | ||
PARAM,EXTOUT,DMIGPCH | ||
INCLUDE 'model1.bdf' | ||
ENDDATA |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
SOL 103 | ||
CEND | ||
TITLE=Rafa's flying beam model # | ||
ECHO=NONE | ||
DISPLACEMENT=ALL | ||
METHOD = 900 | ||
BEGIN BULK | ||
EIGRL,900,,,18 | ||
PARAM,POST,-1 | ||
INCLUDE 'model2.bdf' | ||
ENDDATA |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
SOL 103 | ||
CEND | ||
TITLE=Rafa's flying beam model # | ||
ECHO=NONE | ||
DISPLACEMENT=ALL | ||
METHOD = 900 | ||
BEGIN BULK | ||
EIGRL,900,,,18 | ||
PARAM,EXTOUT,DMIGPCH | ||
INCLUDE 'model2.bdf' | ||
ENDDATA |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
SOL 103 | ||
CEND | ||
TITLE=Rafa's flying beam model # | ||
ECHO=NONE | ||
DISPLACEMENT=ALL | ||
METHOD = 900 | ||
BEGIN BULK | ||
EIGRL,900,,,18 | ||
PARAM,POST,-1 | ||
INCLUDE 'model3.bdf' | ||
ENDDATA |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
SOL 103 | ||
CEND | ||
TITLE=Rafa's flying beam model # | ||
ECHO=NONE | ||
DISPLACEMENT=ALL | ||
METHOD = 900 | ||
BEGIN BULK | ||
EIGRL,900,,,18 | ||
PARAM,EXTOUT,DMIGPCH | ||
INCLUDE 'model3.bdf' | ||
ENDDATA |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
SOL 103 | ||
CEND | ||
TITLE=Rafa's flying beam model # | ||
ECHO=NONE | ||
DISPLACEMENT=ALL | ||
METHOD = 900 | ||
BEGIN BULK | ||
EIGRL,900,,,18 | ||
PARAM,POST,-1 | ||
INCLUDE 'model4.bdf' | ||
ENDDATA |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
SOL 103 | ||
CEND | ||
TITLE=Rafa's flying beam model # | ||
ECHO=NONE | ||
DISPLACEMENT=ALL | ||
METHOD = 900 | ||
BEGIN BULK | ||
EIGRL,900,,,18 | ||
PARAM,EXTOUT,DMIGPCH | ||
INCLUDE 'model4.bdf' | ||
ENDDATA |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
$pyNastran: version=msc | ||
$pyNastran: punch=True | ||
$pyNastran: encoding=utf-8 | ||
$pyNastran: nnodes=3 | ||
$pyNastran: nelements=2 | ||
$NODES | ||
GRID 1 0. 0. 0. | ||
GRID 2 1. 0. 0. | ||
GRID 3 -1. 0. 0. | ||
$ELEMENTS | ||
CBEAM 41 31 1 2 0. 1. 0. | ||
CBEAM 42 31 1 3 0. 1. 0. | ||
$PROPERTIES | ||
PBEAM 31 21 10. 1. 1. 10. | ||
$MATERIALS | ||
MAT1 21 100. 0. | ||
$MASSES | ||
CONM2 11 1 5. | ||
5. 5. 5. | ||
CONM2 12 2 2.5 | ||
.00001 .00001 .00001 | ||
CONM2 13 3 2.5 | ||
.00001 .00001 .00001 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
$pyNastran: version=msc | ||
$pyNastran: punch=True | ||
$pyNastran: encoding=utf-8 | ||
$pyNastran: nnodes=3 | ||
$pyNastran: nelements=2 | ||
$NODES | ||
GRID 1 0. 0. 0. | ||
GRID 2 1. 0. 0. | ||
GRID 3 -1. 0. 0. | ||
$ELEMENTS | ||
CBEAM 41 31 1 2 0. 1. 0. | ||
CBEAM 42 31 1 3 0. 1. 0. | ||
$PROPERTIES | ||
PBEAM 31 21 10. 1. 1. 10. | ||
$MATERIALS | ||
MAT1 21 100. 0. | ||
$MASSES | ||
CONM2 11 1 5. -.1 | ||
5. 5. 5. | ||
CONM2 12 2 2.5 | ||
.00001 .00001 .00001 | ||
CONM2 13 3 2.5 | ||
.00001 .00001 .00001 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
$pyNastran: version=msc | ||
$pyNastran: punch=True | ||
$pyNastran: encoding=utf-8 | ||
$pyNastran: nnodes=3 | ||
$pyNastran: nelements=2 | ||
$NODES | ||
GRID 1 0. 0. 0. | ||
GRID 2 .8660254 0. .5 | ||
GRID 3 -.866025 0. -.5 | ||
$ELEMENTS | ||
CBEAM 41 31 1 2 0. 1. 0. | ||
CBEAM 42 31 1 3 0. 1. 0. | ||
$PROPERTIES | ||
PBEAM 31 21 10. 1. 1. 10. | ||
$MATERIALS | ||
MAT1 21 100. 0. | ||
$MASSES | ||
CONM2 11 1 5. | ||
5. 5. 5. | ||
CONM2 12 2 2.5 | ||
.00001 .00001 .00001 | ||
CONM2 13 3 2.5 | ||
.00001 .00001 .00001 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
$pyNastran: version=msc | ||
$pyNastran: punch=True | ||
$pyNastran: encoding=utf-8 | ||
$pyNastran: nnodes=3 | ||
$pyNastran: nelements=2 | ||
$NODES | ||
GRID 1 0. 0. 0. | ||
GRID 2 .8660254 0. .5 | ||
GRID 3 -.866025 0. -.5 | ||
$ELEMENTS | ||
CBEAM 41 31 1 2 0. 1. 0. | ||
CBEAM 42 31 1 3 0. 1. 0. | ||
$PROPERTIES | ||
PBEAM 31 21 10. 1. 1. 10. | ||
$MATERIALS | ||
MAT1 21 100. 0. | ||
$MASSES | ||
CONM2 11 1 5. -.1 | ||
5. 5. 5. | ||
CONM2 12 2 2.5 | ||
.00001 .00001 .00001 | ||
CONM2 13 3 2.5 | ||
.00001 .00001 .00001 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
# [[file:modelgen.org::*Build Nastran models][Build Nastran models:1]] | ||
from pyNastran.bdf.bdf import BDF | ||
import numpy as np | ||
from dataclasses import dataclass | ||
import pathlib | ||
import feniax.unastran.matrixbuilder as matrixbuilder | ||
import feniax.unastran.op2reader as op2reader | ||
from feniax.unastran.asetbuilder import BuildAsetModel | ||
|
||
pathlib.Path('./FEM').mkdir(parents=True, exist_ok=True) | ||
pathlib.Path('./NASTRAN/data_out').mkdir(parents=True, exist_ok=True) | ||
pathlib.Path('./NASTRAN/simulations_out').mkdir(parents=True, exist_ok=True) | ||
# Build Nastran models:1 ends here | ||
|
||
# [[file:modelgen.org::*Build Nastran models][Build Nastran models:2]] | ||
@dataclass | ||
class Config: | ||
L: float = 1. | ||
THETA0: float = 0. | ||
M: float = 10. | ||
I: float = 1. | ||
Im: float = M * L **2 /2 | ||
OFFSET_x: float = 0. | ||
OFFSET_z: float = 0. | ||
E: float = 1e2 | ||
A: float = 5. | ||
J: float = 10 * I | ||
omega: float = None | ||
|
||
def __post_init__(self): | ||
|
||
self.omega = (24*self.E * self.I / (self.M * self.L ** 3) )**0.5 | ||
|
||
def build_bdf(config: Config): | ||
|
||
mesh=BDF(debug=True) | ||
############################ | ||
node1 = ['GRID', 1, None, 0., 0., 0., None, None, None] | ||
node2 = ['GRID', 2, None, config.L * np.cos(config.THETA0), 0., config.L * np.sin(config.THETA0), None, None, None] | ||
node3 = ['GRID', 3, None, -config.L * np.cos(config.THETA0), 0., -config.L * np.sin(config.THETA0), None, None, None] | ||
mesh.add_card(node1, 'GRID') | ||
mesh.add_card(node2, 'GRID') | ||
mesh.add_card(node3, 'GRID') | ||
############################ | ||
# CONM2=['CONM2',Eid,RefGid,0,self.inp.mass[i][k], | ||
# self.inp.X1[i][k],self.inp.X2[i][k],self.inp.X3[i][k],None, | ||
# self.inp.I11[i][k],self.inp.I21[i][k], self.inp.I22[i][k], | ||
# self.inp.I31[i][k],self.inp.I32[i][k],self.inp.I33[i][k]] | ||
conm21 = ['CONM2', 11, 1, 0, config.M / 2, | ||
config.OFFSET_x, 0., config.OFFSET_z, None, | ||
config.Im, 0., config.Im, 0., 0., config.Im | ||
] | ||
conm22 = ['CONM2', 12, 2, 0, config.M / 4, | ||
0., 0., 0. , None, | ||
1e-5, 0., 1e-5, 0., 0., 1e-5 | ||
] | ||
conm23 = ['CONM2', 13, 3, 0, config.M / 4, | ||
0., 0., 0. ,None, | ||
1e-5, 0., 1e-5, 0., 0., 1e-5 | ||
] | ||
|
||
mesh.add_card(conm21, 'CONM2') | ||
mesh.add_card(conm22, 'CONM2') | ||
mesh.add_card(conm23, 'CONM2') | ||
############################ | ||
# mat1 = ['MAT1',id_mat,Em,None,Nu,rho1] | ||
mat1 = ['MAT1',21, config.E, None,None,None] | ||
mesh.add_card(mat1, 'MAT1') | ||
############################ | ||
# pbeam = ['PBEAM',id_p,id_mat,Aa,I1a,I2a,I12a,Ja] | ||
pbeam = ['PBEAM', 31, 21, config.A, config.I, config.I, 0., config.J] | ||
mesh.add_card(pbeam, 'PBEAM') | ||
############################ | ||
# cbeam=['CBEAM',EID,PID,GA,GB,X1,X2,X3] | ||
cbeam1= ['CBEAM', 41, 31, 1, 2, 0., 1., 0.] | ||
cbeam2= ['CBEAM', 42, 31, 1, 3, 0., 1., 0.] | ||
mesh.add_card(cbeam1, 'CBEAM') | ||
mesh.add_card(cbeam2, 'CBEAM') | ||
############################ | ||
return mesh | ||
# Build Nastran models:2 ends here | ||
|
||
# [[file:modelgen.org::*Create nastran files for FE extraction][Create nastran files for FE extraction:1]] | ||
config1 = Config() | ||
mesh1 = build_bdf(config1) | ||
mesh1.write_bdf("./NASTRAN/model1.bdf", size=8, is_double=False, close=True) | ||
# Create nastran files for FE extraction:1 ends here | ||
|
||
# [[file:modelgen.org::*Create nastran files for FE extraction][Create nastran files for FE extraction:1]] | ||
config2 = Config(OFFSET_z = -0.1) | ||
mesh2 = build_bdf(config2) | ||
mesh2.write_bdf("./NASTRAN/model2.bdf", size=8, is_double=False, close=True) | ||
# Create nastran files for FE extraction:1 ends here | ||
|
||
# [[file:modelgen.org::*Create nastran files for FE extraction][Create nastran files for FE extraction:1]] | ||
config3 = Config(THETA0=30*np.pi/180) | ||
mesh3 = build_bdf(config3) | ||
mesh3.write_bdf("./NASTRAN/model3.bdf", size=8, is_double=False, close=True) | ||
# Create nastran files for FE extraction:1 ends here | ||
|
||
# [[file:modelgen.org::*Create nastran files for FE extraction][Create nastran files for FE extraction:1]] | ||
config4 = Config(OFFSET_z = -0.1, THETA0=30*np.pi/180,) | ||
mesh4 = build_bdf(config4) | ||
mesh4.write_bdf("./NASTRAN/model4.bdf", size=8, is_double=False, close=True) | ||
# Create nastran files for FE extraction:1 ends here | ||
|
||
# [[file:modelgen.org::*Read and save FEM and FENIAX grid][Read and save FEM and FENIAX grid:1]] | ||
num_models = 4 | ||
eigenvalues_list = [] | ||
eigenvectors_list = [] | ||
for i in range(1, num_models + 1): | ||
op2 = op2reader.NastranReader(op2name=f"./NASTRAN/simulations_out/Model{i}_103op2.op2") | ||
op2.readModel() | ||
eigenvalues = op2.eigenvalues() | ||
eigenvectors = op2.eigenvectors() | ||
eigenvalues_list.append(eigenvalues) | ||
eigenvectors_list.append(eigenvectors) | ||
v = eigenvectors.reshape((18,18)).T | ||
np.save(f"./FEM/eigenvals_m{i}.npy", eigenvalues) | ||
np.save(f"./FEM/eigenvecs_m{i}.npy", v) | ||
|
||
id_list,stiffnessMatrix,massMatrix = matrixbuilder.read_pch(f"./NASTRAN/simulations_out/Model{i}_103pch.pch") | ||
np.save(f"./FEM/Ka_m{i}.npy", stiffnessMatrix) | ||
np.save(f"./FEM/Ma_m{i}.npy", massMatrix) | ||
# Read and save FEM and FENIAX grid:1 ends here | ||
|
||
# [[file:modelgen.org::*Read and save FEM and FENIAX grid][Read and save FEM and FENIAX grid:2]] | ||
for i in range(1, num_models + 1): | ||
|
||
bdf = BDF() | ||
bdf.read_bdf(f"./NASTRAN/Model{i}_103op2.bdf", validate=False) | ||
components = dict(rbeam=[1,2], lbeam=[3]) | ||
model = BuildAsetModel(components, bdf) | ||
model.write_grid(f"./FEM/structuralGrid_m{i}") | ||
# Read and save FEM and FENIAX grid:2 ends here |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# [[file:modelgen.org::*Run nastran][Run nastran:1]] | ||
source ../../feniax/unastran/run_nastran.sh | ||
cd ./NASTRAN | ||
run_nastran Model1_103op2.bdf | ||
move_outputs Model1_103op2.bdf | ||
run_nastran Model1_103pch.bdf | ||
move_outputs Model1_103pch.bdf | ||
cd - | ||
# Run nastran:1 ends here | ||
|
||
# [[file:modelgen.org::*Run nastran][Run nastran:1]] | ||
source ../../feniax/unastran/run_nastran.sh | ||
cd ./NASTRAN | ||
run_nastran Model2_103op2.bdf | ||
move_outputs Model2_103op2.bdf | ||
run_nastran Model2_103pch.bdf | ||
move_outputs Model2_103pch.bdf | ||
cd - | ||
# Run nastran:1 ends here | ||
|
||
# [[file:modelgen.org::*Run nastran][Run nastran:1]] | ||
source ../../feniax/unastran/run_nastran.sh | ||
cd ./NASTRAN | ||
run_nastran Model3_103op2.bdf | ||
move_outputs Model3_103op2.bdf | ||
run_nastran Model3_103pch.bdf | ||
move_outputs Model3_103pch.bdf | ||
cd - | ||
# Run nastran:1 ends here | ||
|
||
# [[file:modelgen.org::*Run nastran][Run nastran:1]] | ||
source ../../feniax/unastran/run_nastran.sh | ||
cd ./NASTRAN | ||
run_nastran Model4_103op2.bdf | ||
move_outputs Model4_103op2.bdf | ||
run_nastran Model4_103pch.bdf | ||
move_outputs Model4_103pch.bdf | ||
cd - | ||
# Run nastran:1 ends here |
Oops, something went wrong.