Spaces:
Sleeping
Sleeping
Commit ·
f6ee655
1
Parent(s): df2b249
Update inverse design Space contents
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- .gitattributes +1 -0
- README.md +8 -23
- app.py +11 -447
- data_generation/hf_space_generation_ro/README.md +23 -0
- data_generation/hf_space_generation_ro/app.py +474 -0
- data_generation/hf_space_generation_ro/lam.py +707 -0
- data_generation/hf_space_generation_ro/models.py +17 -0
- data_generation/hf_space_generation_ro/requirements.txt +6 -0
- data_generation/hf_space_generation_ro/space_lib/__init__.py +2 -0
- data_generation/hf_space_generation_ro/space_lib/infer.py +262 -0
- data_generation/hf_space_generation_ro/space_lib/metadata.py +127 -0
- data_generation/hf_space_generation_ro/space_lib/models.py +238 -0
- data_generation/hf_space_generation_ro/space_lib/plots.py +205 -0
- data_generation/hf_space_generation_ro/space_lib/ro_curves.py +135 -0
- data_generation/hf_space_generation_ro/space_lib/simulate.py +242 -0
- data_generation/processed_dataset/config_1/metadata.json +3 -0
- data_generation/shahriar_modified_2025_12/RVE_Datasets/CHDPE_0.0924_1_11.txt +24 -0
- data_generation/shahriar_modified_2025_12/RVE_Datasets/CHDPE_0.0924_1_12.txt +24 -0
- data_generation/shahriar_modified_2025_12/RVE_Datasets/CHDPE_0.0924_1_22.txt +24 -0
- data_generation/shahriar_modified_2025_12/RVE_Datasets/CHDPE_0.0924_2_11.txt +24 -0
- data_generation/shahriar_modified_2025_12/RVE_Datasets/CHDPE_0.0924_2_12.txt +24 -0
- data_generation/shahriar_modified_2025_12/RVE_Datasets/CHDPE_0.0924_2_22.txt +24 -0
- data_generation/shahriar_modified_2025_12/RVE_Datasets/CHDPE_0.0924_3_11.txt +24 -0
- data_generation/shahriar_modified_2025_12/RVE_Datasets/CHDPE_0.0924_3_12.txt +24 -0
- data_generation/shahriar_modified_2025_12/RVE_Datasets/CHDPE_0.0924_3_22.txt +24 -0
- data_generation/shahriar_modified_2025_12/RVE_Datasets/CHDPE_0.0924_4_11.txt +24 -0
- data_generation/shahriar_modified_2025_12/RVE_Datasets/CHDPE_0.0924_4_12.txt +24 -0
- data_generation/shahriar_modified_2025_12/RVE_Datasets/CHDPE_0.0924_4_22.txt +24 -0
- data_generation/shahriar_modified_2025_12/RVE_Datasets/CHDPE_0.0924_5_11.txt +24 -0
- data_generation/shahriar_modified_2025_12/RVE_Datasets/CHDPE_0.0924_5_12.txt +24 -0
- data_generation/shahriar_modified_2025_12/RVE_Datasets/CHDPE_0.0924_5_22.txt +24 -0
- data_generation/shahriar_modified_2025_12/RVE_Datasets/CHDPE_0.2155_1_11.txt +24 -0
- data_generation/shahriar_modified_2025_12/RVE_Datasets/CHDPE_0.2155_1_12.txt +24 -0
- data_generation/shahriar_modified_2025_12/RVE_Datasets/CHDPE_0.2155_1_22.txt +24 -0
- data_generation/shahriar_modified_2025_12/RVE_Datasets/CHDPE_0.2155_2_11.txt +24 -0
- data_generation/shahriar_modified_2025_12/RVE_Datasets/CHDPE_0.2155_2_12.txt +24 -0
- data_generation/shahriar_modified_2025_12/RVE_Datasets/CHDPE_0.2155_2_22.txt +24 -0
- data_generation/shahriar_modified_2025_12/RVE_Datasets/CHDPE_0.2155_3_11.txt +24 -0
- data_generation/shahriar_modified_2025_12/RVE_Datasets/CHDPE_0.2155_3_12.txt +24 -0
- data_generation/shahriar_modified_2025_12/RVE_Datasets/CHDPE_0.2155_3_22.txt +24 -0
- data_generation/shahriar_modified_2025_12/RVE_Datasets/CHDPE_0.2155_4_11.txt +24 -0
- data_generation/shahriar_modified_2025_12/RVE_Datasets/CHDPE_0.2155_4_12.txt +24 -0
- data_generation/shahriar_modified_2025_12/RVE_Datasets/CHDPE_0.2155_4_22.txt +24 -0
- data_generation/shahriar_modified_2025_12/RVE_Datasets/CHDPE_0.2155_5_11.txt +24 -0
- data_generation/shahriar_modified_2025_12/RVE_Datasets/CHDPE_0.2155_5_12.txt +24 -0
- data_generation/shahriar_modified_2025_12/RVE_Datasets/CHDPE_0.2155_5_22.txt +24 -0
- data_generation/shahriar_modified_2025_12/RVE_Datasets/CHDPE_0.3079_1_11.txt +24 -0
- data_generation/shahriar_modified_2025_12/RVE_Datasets/CHDPE_0.3079_1_12.txt +24 -0
- data_generation/shahriar_modified_2025_12/RVE_Datasets/CHDPE_0.3079_1_22.txt +24 -0
- data_generation/shahriar_modified_2025_12/RVE_Datasets/CHDPE_0.3079_2_11.txt +24 -0
.gitattributes
CHANGED
|
@@ -36,6 +36,7 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 36 |
material_res3.png filter=lfs diff=lfs merge=lfs -text
|
| 37 |
figures/material_res3.png filter=lfs diff=lfs merge=lfs -text
|
| 38 |
figures/forming_angle.png filter=lfs diff=lfs merge=lfs -text
|
|
|
|
| 39 |
data_generation/processed_dataset/config_1/metadata.json filter=lfs diff=lfs merge=lfs -text
|
| 40 |
hybrid_diffusion_material_generation/checkpoints/config_1_continuous_100_epoch/exp_20260114_164540/best_model.pt filter=lfs diff=lfs merge=lfs -text
|
| 41 |
inverse_design_demo/model_checkpoint.pth filter=lfs diff=lfs merge=lfs -text
|
|
|
|
| 36 |
material_res3.png filter=lfs diff=lfs merge=lfs -text
|
| 37 |
figures/material_res3.png filter=lfs diff=lfs merge=lfs -text
|
| 38 |
figures/forming_angle.png filter=lfs diff=lfs merge=lfs -text
|
| 39 |
+
metadata.json filter=lfs diff=lfs merge=lfs -text
|
| 40 |
data_generation/processed_dataset/config_1/metadata.json filter=lfs diff=lfs merge=lfs -text
|
| 41 |
hybrid_diffusion_material_generation/checkpoints/config_1_continuous_100_epoch/exp_20260114_164540/best_model.pt filter=lfs diff=lfs merge=lfs -text
|
| 42 |
inverse_design_demo/model_checkpoint.pth filter=lfs diff=lfs merge=lfs -text
|
README.md
CHANGED
|
@@ -1,27 +1,12 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
|
|
|
|
|
|
|
|
|
| 3 |
sdk: streamlit
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
short_description: Thermoforming inverse design
|
| 8 |
---
|
| 9 |
-
# 🏂 US Population Dashboard
|
| 10 |
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
## Demo App
|
| 14 |
-
|
| 15 |
-
[](https://population-dashboard.streamlit.app/)
|
| 16 |
-
|
| 17 |
-
## Colab notebook
|
| 18 |
-
[](https://github.com/dataprofessor/population-dashboard/blob/master/US_Population.ipynb)
|
| 19 |
-
|
| 20 |
-
## Prerequisite libraries
|
| 21 |
-
Here are the Python libraries used in the creation of this dashboard app
|
| 22 |
-
|
| 23 |
-
## Data source
|
| 24 |
-
US Population data spanning the duration of 2010-2019 was obtained from the [U.S. Census Bureau](https://www.census.gov/data/datasets/time-series/demo/popest/2010s-state-total.html).
|
| 25 |
-
|
| 26 |
-
## Reference
|
| 27 |
-
A talk entitled [_Crafting a Dashboard App in Python using Streamlit_](https://budapestbi.hu/2023/hu/program/speakers/chanin-nantasenamat/) showing how to build this app is given at the [Budapest BI Forum (Data Visualization track)](https://budapestbi.hu/2023/hu/en/program-data-visualization-track/) on November 22, 2023.
|
|
|
|
| 1 |
---
|
| 2 |
+
title: Inverse Design Demo
|
| 3 |
+
emoji: 📚
|
| 4 |
+
colorFrom: green
|
| 5 |
+
colorTo: blue
|
| 6 |
sdk: streamlit
|
| 7 |
+
app_file: app.py
|
| 8 |
+
python_version: "3.10"
|
| 9 |
+
pinned: false
|
|
|
|
| 10 |
---
|
|
|
|
| 11 |
|
| 12 |
+
Thermoplastic composite inverse design demo.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app.py
CHANGED
|
@@ -1,450 +1,14 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
import
|
| 4 |
-
import pandas as pd
|
| 5 |
-
import altair as alt
|
| 6 |
-
# import plotly.express as px
|
| 7 |
-
from PIL import Image # Used to open and handle image files
|
| 8 |
-
import matplotlib
|
| 9 |
-
import matplotlib.pyplot as plt
|
| 10 |
-
import numpy as np
|
| 11 |
-
|
| 12 |
-
from model_inverse import inverse_design
|
| 13 |
-
|
| 14 |
-
#######################
|
| 15 |
-
# Page configuration
|
| 16 |
-
st.set_page_config(
|
| 17 |
-
page_title="Inverse Design of Thermoplastic Composites for Thermoforming",
|
| 18 |
-
# page_icon="🏂",
|
| 19 |
-
layout="wide",
|
| 20 |
-
initial_sidebar_state="collapsed")
|
| 21 |
-
|
| 22 |
-
alt.themes.enable('default')
|
| 23 |
-
|
| 24 |
-
#######################
|
| 25 |
-
# CSS styling
|
| 26 |
-
|
| 27 |
-
st.markdown("""
|
| 28 |
-
<style>
|
| 29 |
-
/* Target the input element within its container (adjust class name as needed via browser inspection) */
|
| 30 |
-
.stTextInput input {
|
| 31 |
-
border: 1px solid #333333; /* Set border width, style, and color */
|
| 32 |
-
border-radius: 6px; /* Optional: adds rounded corners */
|
| 33 |
-
padding: 10px; /* Optional: adds inner spacing */
|
| 34 |
-
}
|
| 35 |
-
</style>
|
| 36 |
-
""", unsafe_allow_html=True)
|
| 37 |
-
|
| 38 |
-
st.markdown("""
|
| 39 |
-
<style>
|
| 40 |
-
|
| 41 |
-
[data-testid="block-container"] {
|
| 42 |
-
padding-left: 2rem;
|
| 43 |
-
padding-right: 2rem;
|
| 44 |
-
padding-top: 1rem;
|
| 45 |
-
padding-bottom: 0rem;
|
| 46 |
-
margin-bottom: -7rem;
|
| 47 |
-
}
|
| 48 |
-
|
| 49 |
-
[data-testid="stVerticalBlock"] {
|
| 50 |
-
padding-left: 0rem;
|
| 51 |
-
padding-right: 0rem;
|
| 52 |
-
}
|
| 53 |
-
|
| 54 |
-
[data-testid="stMetric"] {
|
| 55 |
-
background-color: #393939;
|
| 56 |
-
text-align: center;
|
| 57 |
-
padding: 15px 0;
|
| 58 |
-
}
|
| 59 |
-
|
| 60 |
-
[data-testid="stMetricLabel"] {
|
| 61 |
-
display: flex;
|
| 62 |
-
justify-content: center;
|
| 63 |
-
align-items: center;
|
| 64 |
-
}
|
| 65 |
-
|
| 66 |
-
[data-testid="stMetricDeltaIcon-Up"] {
|
| 67 |
-
position: relative;
|
| 68 |
-
left: 38%;
|
| 69 |
-
-webkit-transform: translateX(-50%);
|
| 70 |
-
-ms-transform: translateX(-50%);
|
| 71 |
-
transform: translateX(-50%);
|
| 72 |
-
}
|
| 73 |
-
|
| 74 |
-
[data-testid="stMetricDeltaIcon-Down"] {
|
| 75 |
-
position: relative;
|
| 76 |
-
left: 38%;
|
| 77 |
-
-webkit-transform: translateX(-50%);
|
| 78 |
-
-ms-transform: translateX(-50%);
|
| 79 |
-
transform: translateX(-50%);
|
| 80 |
-
}
|
| 81 |
-
|
| 82 |
-
/* Main app + sidebar, target the label element itself */
|
| 83 |
-
[data-testid="stAppViewContainer"] label,
|
| 84 |
-
[data-testid="stWidgetLabel"] label {
|
| 85 |
-
font-size: 18px !important;
|
| 86 |
-
font-weight: 600 !important; /* optional */
|
| 87 |
-
color: #444 !important; /* optional */
|
| 88 |
-
}
|
| 89 |
-
|
| 90 |
-
/* Some versions wrap label text inside a <div><p> */
|
| 91 |
-
[data-testid="stAppViewContainer"] label > div > p,
|
| 92 |
-
[data-testid="stWidgetLabel"] label > div > p {
|
| 93 |
-
font-size: 18px !important;
|
| 94 |
-
font-weight: 600 !important;
|
| 95 |
-
}
|
| 96 |
-
</style>
|
| 97 |
-
""", unsafe_allow_html=True)
|
| 98 |
-
|
| 99 |
-
st.markdown("""
|
| 100 |
-
<style>
|
| 101 |
-
div.stButton > button:first-child {
|
| 102 |
-
background-color: #ee7700; /* background */
|
| 103 |
-
color: white; /* White text */
|
| 104 |
-
font-size: 20px;
|
| 105 |
-
border-radius: 10px;
|
| 106 |
-
# display: block; # this line and the next center the button horizontally
|
| 107 |
-
# margin: 0 auto;
|
| 108 |
-
}
|
| 109 |
-
</style>
|
| 110 |
-
""", unsafe_allow_html=True)
|
| 111 |
-
|
| 112 |
-
st.markdown("""
|
| 113 |
-
<style>
|
| 114 |
-
div[data-testid="stVirtualDropdown"] > div {
|
| 115 |
-
max-height: 10px !important; /* Adjust this value as needed */
|
| 116 |
-
overflow-y: auto;
|
| 117 |
-
}
|
| 118 |
-
</style>
|
| 119 |
-
""", unsafe_allow_html=True)
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
st.set_page_config(initial_sidebar_state="collapsed")
|
| 123 |
-
|
| 124 |
-
st.markdown(
|
| 125 |
-
"""
|
| 126 |
-
<style>
|
| 127 |
-
[data-testid="collapsedControl"] {
|
| 128 |
-
display: none
|
| 129 |
-
}
|
| 130 |
-
</style>
|
| 131 |
-
""",
|
| 132 |
-
unsafe_allow_html=True,
|
| 133 |
-
)
|
| 134 |
-
|
| 135 |
-
#######################
|
| 136 |
-
font = {'size' : 18}
|
| 137 |
-
|
| 138 |
-
matplotlib.rc('font', **font)
|
| 139 |
-
|
| 140 |
-
#######################
|
| 141 |
-
if 'input_changed' not in st.session_state:
|
| 142 |
-
st.session_state.input_changed= False
|
| 143 |
-
def input_typed_in():
|
| 144 |
-
st.session_state.input_changed= True
|
| 145 |
-
|
| 146 |
-
if 'forming_input_changed' not in st.session_state:
|
| 147 |
-
st.session_state.forming_input_changed= False
|
| 148 |
-
def forming_typed_in():
|
| 149 |
-
st.session_state.forming_input_changed= True
|
| 150 |
-
|
| 151 |
-
|
| 152 |
-
|
| 153 |
-
if 'input_curve_button_clicked' not in st.session_state:
|
| 154 |
-
st.session_state.input_curve_button_clicked= False
|
| 155 |
-
def input_curve_click():
|
| 156 |
-
st.session_state.input_curve_button_clicked = True
|
| 157 |
-
|
| 158 |
-
if 'material_design_button_clicked' not in st.session_state:
|
| 159 |
-
st.session_state.material_design_button_clicked= False
|
| 160 |
-
def material_design_click():
|
| 161 |
-
st.session_state.material_design_button_clicked = True
|
| 162 |
-
|
| 163 |
-
if 'forming_input_button_clicked' not in st.session_state:
|
| 164 |
-
st.session_state.forming_input_button_clicked= False
|
| 165 |
-
def forming_input_click():
|
| 166 |
-
st.session_state.forming_input_button_clicked = True
|
| 167 |
-
|
| 168 |
-
if 'forming_design_button_clicked' not in st.session_state:
|
| 169 |
-
st.session_state.forming_design_button_clicked= False
|
| 170 |
-
def forming_design_click():
|
| 171 |
-
st.session_state.forming_design_button_clicked = True
|
| 172 |
-
|
| 173 |
-
|
| 174 |
-
|
| 175 |
-
#######################
|
| 176 |
-
# Load data
|
| 177 |
-
#df_reshaped = pd.read_csv('data/us-population-2010-2019-reshaped.csv')
|
| 178 |
-
|
| 179 |
-
######## Initialize data #############
|
| 180 |
-
E1aV=0 # initial longitudinal stiffness
|
| 181 |
-
E1bV=0 # 10% strain longitudinal stiffness
|
| 182 |
-
G12aV=0 # initial longitudinal stiffness
|
| 183 |
-
G12bV=0 # 10% strain longitudinal stiffness
|
| 184 |
-
nlayers=4
|
| 185 |
-
vf=0.6
|
| 186 |
-
angle=30
|
| 187 |
-
|
| 188 |
-
#######################
|
| 189 |
-
# Main Panel
|
| 190 |
-
|
| 191 |
-
data_materials={
|
| 192 |
-
'Matrix':['ABS','Polyurethane','Nylon 6','Nylon 6','Nylon 66','PE','PP'],
|
| 193 |
-
'Filler':['Carbon Black','Glass Fiber','Glass Fiber','Carbon Fiber','Glass Fiber','Carbon Fiber','Glass Fiber'],
|
| 194 |
-
'VF':['15%','20%','20%','40%','30%','20%','30%'],
|
| 195 |
-
'Feature':['Blend','Extruded','Molded','Molded','Molded','Molded','Molded']
|
| 196 |
-
}
|
| 197 |
-
|
| 198 |
-
data_physical = {
|
| 199 |
-
'Forming T (C)': ['180', '185', '190'],
|
| 200 |
-
'Punch V (m/s)': ['1.05', '1.8','1.67'],
|
| 201 |
-
'Cooling time (s)': ['45','80','120'],
|
| 202 |
-
'Holding force (kN)': ['23','24','25']
|
| 203 |
-
}
|
| 204 |
-
|
| 205 |
-
st.title("Inverse Design of Thermoplastic Composites for Thermoforming")
|
| 206 |
-
st.write("")
|
| 207 |
-
st.write("")
|
| 208 |
-
st.write("")
|
| 209 |
-
st.write(r"$\textsf{\textbf{\Large Material Design Requirements}}$")
|
| 210 |
-
#st.text_input(r"$\textsf{\textbf{\Large Material Design Requirements}}$")
|
| 211 |
-
|
| 212 |
-
# First row with 5 columns
|
| 213 |
-
col1_row1, col2_row1, col3_row1, col4_row1, col5_row1= st.columns([0.25,0.25,0.25,0.25,0.25])
|
| 214 |
-
with col1_row1:
|
| 215 |
-
with st.container(border=False): # Container with a border
|
| 216 |
-
E1aV= st.number_input("Initial x-stiffness (MPa):", value=2000.00, format="%.2f", width=250, key="E1a", on_change=input_typed_in)
|
| 217 |
-
E1bV= st.number_input("10% strain x-stiffness (MPa):", value=1000.00, format="%.2f", width=250, key="E1b", on_change=input_typed_in)
|
| 218 |
-
S1bV= st.number_input("10% strain x-stress (MPa):", value=1000.00, format="%.2f", width=250, key="S1b", on_change=input_typed_in)
|
| 219 |
-
|
| 220 |
-
with col2_row1:
|
| 221 |
-
with st.container(border=False): # Container with a border
|
| 222 |
-
E2aV= st.number_input("Initial y-stiffness (MPa):", value=2000.00, format="%.2f", width=250, key="E2a", on_change=input_typed_in)
|
| 223 |
-
E2bV= st.number_input("10% strain y-stiffness (MPa):", value=1000.00, format="%.2f", width=250, key="E2b", on_change=input_typed_in)
|
| 224 |
-
S2bV= st.number_input("10% strain y-stress (MPa):", value=1000.00, format="%.2f", width=250, key="S2b", on_change=input_typed_in)
|
| 225 |
-
|
| 226 |
-
|
| 227 |
-
with col3_row1:
|
| 228 |
-
with st.container(border=False): # Container with a border
|
| 229 |
-
G12aV= st.number_input("Initial shear stiffness (MPa):", value=1800.00, format="%.2f", width=250, key="G12a", on_change=input_typed_in)
|
| 230 |
-
G12bV= st.number_input("0.1 shear strain stiffness (MPa):", value=1000.00, format="%.2f", width=250, key="G12b", on_change=input_typed_in)
|
| 231 |
-
S12bV= st.number_input("10% strain shear stress (MPa):", value=1000.00, format="%.2f", width=250, key="S12b", on_change=input_typed_in)
|
| 232 |
-
|
| 233 |
-
with col4_row1:
|
| 234 |
-
with st.container(border=False): # Container with a border
|
| 235 |
-
v12aV= st.number_input("Initial Poisson's ratio (vxy):", value=0.3, format="%.2f", width=250, key="v12a", on_change=input_typed_in)
|
| 236 |
-
v12bV= st.number_input("0.1 strain Poisson's ratio (vxy):", value=0.4, format="%.2f", width=250, key="v12b", on_change=input_typed_in)
|
| 237 |
-
|
| 238 |
-
|
| 239 |
-
with col5_row1:
|
| 240 |
-
with st.container(border=False): # Container with a border
|
| 241 |
-
v21aV= st.number_input("Initial Poisson's ratio (vyx):", value=0.3, format="%.2f", width=250, key="v21a", on_change=input_typed_in)
|
| 242 |
-
v21bV= st.number_input("0.1 strain Poisson's ratio (vyx):", value=0.4, format="%.2f", width=250, key="v21b", on_change=input_typed_in)
|
| 243 |
-
|
| 244 |
-
|
| 245 |
-
|
| 246 |
-
st.write("")
|
| 247 |
-
if st.session_state.input_changed == True:
|
| 248 |
-
st.session_state.input_curve_button_clicked = False
|
| 249 |
-
st.session_state.material_design_button_clicked = False
|
| 250 |
-
st.session_state.forming_input_button_clicked = False
|
| 251 |
-
st.session_state.forming_design_button_clicked = False
|
| 252 |
-
st.session_state.input_changed = False
|
| 253 |
-
|
| 254 |
-
st.button("Generate required stress-strain curves", use_container_width=True, on_click=input_curve_click)
|
| 255 |
-
|
| 256 |
-
if st.session_state.input_curve_button_clicked == True:
|
| 257 |
-
#st.write(E1aV)
|
| 258 |
-
#st.write(E1bV)
|
| 259 |
-
x = np.linspace(0, 0.1, 20)
|
| 260 |
-
A = np.array([[0.2, 0.03], [0.01, 0.001]])
|
| 261 |
-
b = np.array([E1bV-E1aV, S1bV-E1aV*0.1])
|
| 262 |
-
a = np.linalg.solve(A, b)
|
| 263 |
-
y1= E1aV*x + a[0]*x**2 + a[1]*x**3
|
| 264 |
-
b = np.array([E2bV-E2aV, S2bV-E2aV*0.1])
|
| 265 |
-
a = np.linalg.solve(A, b)
|
| 266 |
-
y2= E2aV*x + a[0]*x**2 + a[1]*x**3
|
| 267 |
-
b = np.array([G12bV-G12aV, S12bV-G12aV*0.1])
|
| 268 |
-
a = np.linalg.solve(A, b)
|
| 269 |
-
y3= G12aV*x + a[0]*x**2 + a[1]*x**3
|
| 270 |
-
|
| 271 |
-
y4 = v12aV*x + (v12bV - v12aV)/0.2*x*x
|
| 272 |
-
y5 = v21aV*x + (v21bV - v21aV)/0.2*x*x
|
| 273 |
-
|
| 274 |
-
|
| 275 |
-
#ylimit=np.max([np.max(y1),np.max(y2), np.max(y3)])
|
| 276 |
-
# 2nd row with 3 columns
|
| 277 |
-
col1_row2, col2_row2, col3_row2, col4_row2, col5_row2= st.columns([0.2,0.2,0.2,0.2,0.2])
|
| 278 |
-
with col1_row2:
|
| 279 |
-
with st.container(border=False): # Container with a border
|
| 280 |
-
fig, ax = plt.subplots()
|
| 281 |
-
ax.plot(x, y1)
|
| 282 |
-
#ax.set_ylim([0, ylimit])
|
| 283 |
-
ax.set_ylabel('Stress (MPa)')
|
| 284 |
-
ax.set_xlabel('Strain')
|
| 285 |
-
ax.set_title('Longitudinal stress-strain (xx)')
|
| 286 |
-
st.pyplot(fig)
|
| 287 |
-
with col2_row2:
|
| 288 |
-
with st.container(border=False): # Container with a border
|
| 289 |
-
fig, ax = plt.subplots()
|
| 290 |
-
ax.plot(x, y2)
|
| 291 |
-
#ax.set_ylim([0, ylimit])
|
| 292 |
-
ax.set_ylabel('Stress (MPa)')
|
| 293 |
-
ax.set_xlabel('Strain')
|
| 294 |
-
ax.set_title('Transverse stress-strain (yy)')
|
| 295 |
-
st.pyplot(fig)
|
| 296 |
-
with col3_row2:
|
| 297 |
-
with st.container(border=False): # Container with a border
|
| 298 |
-
fig, ax = plt.subplots()
|
| 299 |
-
ax.plot(x, y3)
|
| 300 |
-
#ax.set_ylim([0, ylimit])
|
| 301 |
-
ax.set_ylabel('Stress (MPa)')
|
| 302 |
-
ax.set_xlabel('Strain')
|
| 303 |
-
ax.set_title('Shear stress-strain (xy')
|
| 304 |
-
st.pyplot(fig)
|
| 305 |
-
with col4_row2:
|
| 306 |
-
with st.container(border=False): # Container with a border
|
| 307 |
-
fig, ax = plt.subplots()
|
| 308 |
-
ax.plot(x, -y4)
|
| 309 |
-
#ax.set_ylim([-0.05, 0])
|
| 310 |
-
ax.set_xlabel('Strain xx')
|
| 311 |
-
ax.set_ylabel('Strain yy')
|
| 312 |
-
ax.set_title('Strain ratio with stress xx')
|
| 313 |
-
st.pyplot(fig)
|
| 314 |
-
with col5_row2:
|
| 315 |
-
with st.container(border=False): # Container with a border
|
| 316 |
-
fig, ax = plt.subplots()
|
| 317 |
-
ax.plot(x, -y5)
|
| 318 |
-
#ax.set_ylim([-0.05, 0])
|
| 319 |
-
ax.set_xlabel('Strain yy')
|
| 320 |
-
ax.set_ylabel('Strain xx')
|
| 321 |
-
ax.set_title('Strain ratio with stress yy')
|
| 322 |
-
st.pyplot(fig)
|
| 323 |
-
|
| 324 |
-
st.write("")
|
| 325 |
-
st.button("Material Inverse Design", use_container_width=True, on_click=material_design_click)
|
| 326 |
-
if st.session_state.material_design_button_clicked == True:
|
| 327 |
-
#st.write("")
|
| 328 |
-
|
| 329 |
-
# 3rd row with 3 columns
|
| 330 |
-
col1_row3, col2_row3, col3_row3, col4_row3, col5_row3= st.columns([0.15,0.15,0.23,0.23,0.23])
|
| 331 |
-
with col1_row3:
|
| 332 |
-
with st.container(border=False): # Container with a border
|
| 333 |
-
st.write("Matrix material = ", "PEEK")
|
| 334 |
-
st.write("Fiber material = ", "Carbon")
|
| 335 |
-
|
| 336 |
-
with col2_row3:
|
| 337 |
-
with st.container(border=False): # Container with a border
|
| 338 |
-
st.write("Number of layers =", nlayers)
|
| 339 |
-
st.write("Volume fraction =", vf)
|
| 340 |
-
|
| 341 |
-
with col3_row3:
|
| 342 |
-
with st.container(border=False): # Container with a border
|
| 343 |
-
df = pd.DataFrame({'Ply': [], 'Orientation': []})
|
| 344 |
-
plies = np.array([[1,90], [2,45], [3,-45], [4,-90]])
|
| 345 |
-
plies_df=pd.DataFrame(plies, columns=df.columns)
|
| 346 |
-
df = pd.concat([df, plies_df], ignore_index=True)
|
| 347 |
-
st.dataframe(df, hide_index=True)
|
| 348 |
-
|
| 349 |
-
|
| 350 |
-
# 3.5rd row with 3 columns
|
| 351 |
-
col1_row35, col2_row35, col3_row35, col4_row35, col5_row35= st.columns([0.2,0.2,0.2,0.2,0.2])
|
| 352 |
-
with col1_row35:
|
| 353 |
-
with st.container(border=False): # Container with a border
|
| 354 |
-
image = Image.open('figures/material_res3.png')
|
| 355 |
-
new_image = image.resize((250, 200))
|
| 356 |
-
st.image(new_image, caption='')
|
| 357 |
-
|
| 358 |
-
with col2_row35:
|
| 359 |
-
with st.container(border=False): # Container with a border
|
| 360 |
-
image = Image.open('figures/material_res3.png')
|
| 361 |
-
new_image = image.resize((250, 200))
|
| 362 |
-
st.image(new_image, caption='')
|
| 363 |
-
|
| 364 |
-
with col3_row35:
|
| 365 |
-
with st.container(border=False): # Container with a border
|
| 366 |
-
image = Image.open('figures/material_res3.png')
|
| 367 |
-
new_image = image.resize((250, 200))
|
| 368 |
-
st.image(new_image, caption='')
|
| 369 |
-
|
| 370 |
-
with col4_row35:
|
| 371 |
-
with st.container(border=False): # Container with a border
|
| 372 |
-
image = Image.open('figures/material_res3.png')
|
| 373 |
-
new_image = image.resize((250, 200))
|
| 374 |
-
st.image(new_image, caption='')
|
| 375 |
-
|
| 376 |
-
|
| 377 |
-
with col5_row35:
|
| 378 |
-
with st.container(border=False): # Container with a border
|
| 379 |
-
image = Image.open('figures/material_res3.png')
|
| 380 |
-
new_image = image.resize((250, 200))
|
| 381 |
-
st.image(new_image, caption='')
|
| 382 |
-
|
| 383 |
-
|
| 384 |
-
st.write("")
|
| 385 |
-
st.button("Thermoforming Requirements", use_container_width=True, on_click=forming_input_click)
|
| 386 |
-
if st.session_state.forming_input_button_clicked == True:
|
| 387 |
-
#st.write("")
|
| 388 |
-
# 4th row with 3 columns
|
| 389 |
-
col1_row4, col2_row4, col3_row4, col4_row4, col5_row4 = st.columns([0.16,0.16,0.2,0.24,0.24])
|
| 390 |
-
with col1_row4:
|
| 391 |
-
with st.container(border=False): # Container with a border
|
| 392 |
-
st.write("Matrix material", "PEEK")
|
| 393 |
-
st.write("Fiber material=", "Carbon")
|
| 394 |
-
st.write("Number of layers=", nlayers)
|
| 395 |
-
st.write("Volume fraction=", vf)
|
| 396 |
-
with col2_row4:
|
| 397 |
-
with st.container(border=False): # Container with a border
|
| 398 |
-
df = pd.DataFrame({'Ply': [], 'Orientation': []})
|
| 399 |
-
plies = np.array([[1,90], [2,45], [3,-45], [4,-90]])
|
| 400 |
-
plies_df=pd.DataFrame(plies, columns=df.columns)
|
| 401 |
-
df = pd.concat([df, plies_df], ignore_index=True)
|
| 402 |
-
st.dataframe(df, hide_index=True)
|
| 403 |
-
|
| 404 |
-
with col3_row4:
|
| 405 |
-
with st.container(border=False): # Container with a border
|
| 406 |
-
image = Image.open('figures/forming_angle.png')
|
| 407 |
-
new_image = image.resize((250, 200))
|
| 408 |
-
st.image(new_image, caption='')
|
| 409 |
-
|
| 410 |
-
with col4_row4:
|
| 411 |
-
with st.container(border=False): # Container with a border
|
| 412 |
-
angleA= st.number_input("Maximum warpage angle A (degree):", format="%.2f", width=300, key="A", on_change=forming_typed_in)
|
| 413 |
-
angleB= st.number_input("Maximum warpage angle B (degree):", format="%.2f", width=300, key="B", on_change=forming_typed_in)
|
| 414 |
-
|
| 415 |
-
|
| 416 |
-
with col5_row4:
|
| 417 |
-
with st.container(border=False): # Container with a border
|
| 418 |
-
angleC= st.number_input("Maximum warpage angle C (degree):", format="%.2f", width=300, key="C", on_change=forming_typed_in)
|
| 419 |
-
max_stress= st.number_input("Maximum residual stress (MPa):", format="%.2f", width=300, key="max_stress", on_change=forming_typed_in)
|
| 420 |
-
|
| 421 |
-
|
| 422 |
-
st.write("")
|
| 423 |
-
if st.session_state.forming_input_changed == True:
|
| 424 |
-
st.session_state.forming_design_button_clicked = False
|
| 425 |
-
st.session_state.forming_input_changed = False
|
| 426 |
-
st.button("Thermoforming process design", use_container_width=True, on_click=forming_design_click)
|
| 427 |
-
if st.session_state.forming_design_button_clicked == True:
|
| 428 |
-
best = inverse_design(ply_number=nlayers,
|
| 429 |
-
fiber_vf=vf,
|
| 430 |
-
y_target=[angleA, angleB, angleC, max_stress],
|
| 431 |
-
n_restarts=5,
|
| 432 |
-
epochs=100)
|
| 433 |
-
# 5th row with 3 columns
|
| 434 |
-
col1_row5, col2_row5,col3_row5 = st.columns([0.25,0.25,0.25])
|
| 435 |
-
with col1_row5:
|
| 436 |
-
with st.container(border=False): # Container with a border
|
| 437 |
-
st.write("Forming temperature (C)=", best["input"][0])
|
| 438 |
-
with col2_row5:
|
| 439 |
-
with st.container(border=False): # Container with a border
|
| 440 |
-
st.write("Punching velocity (mm/s)=", best["input"][1])
|
| 441 |
-
with col3_row5:
|
| 442 |
-
with st.container(border=False): # Container with a border
|
| 443 |
-
st.write("Cooling time (s)=", best["input"][2])
|
| 444 |
-
|
| 445 |
-
|
| 446 |
-
|
| 447 |
-
|
| 448 |
|
| 449 |
|
|
|
|
|
|
|
|
|
|
| 450 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import runpy
|
| 3 |
+
import sys
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
|
| 5 |
|
| 6 |
+
APP_DIR = os.path.dirname(os.path.abspath(__file__))
|
| 7 |
+
DEMO_DIR = os.path.join(APP_DIR, "inverse_design_demo")
|
| 8 |
+
DEMO_APP = os.path.join(DEMO_DIR, "app.py")
|
| 9 |
|
| 10 |
+
# Execute the original Streamlit script in this process.
|
| 11 |
+
if DEMO_DIR not in sys.path:
|
| 12 |
+
sys.path.insert(0, DEMO_DIR)
|
| 13 |
+
os.chdir(DEMO_DIR)
|
| 14 |
+
runpy.run_path(DEMO_APP, run_name="__main__")
|
data_generation/hf_space_generation_ro/README.md
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Hybrid Diffusion Material Generation (RO) — Hugging Face Space
|
| 2 |
+
|
| 3 |
+
This folder is intended to be uploaded as a standalone Hugging Face Space.
|
| 4 |
+
|
| 5 |
+
## What it does
|
| 6 |
+
- Provides **5 groups of coefficient sliders** (RO params, 5×3) with min/max ranges loaded from `metadata_ro.json`.
|
| 7 |
+
- Shows **real-time curve previews** derived from the current coefficients.
|
| 8 |
+
- On **Generate**, runs diffusion sampling from a trained checkpoint and then runs **N simulations (1–5)** (instances `1..N`) and overlays the curves.
|
| 9 |
+
|
| 10 |
+
## Expected inputs (paths)
|
| 11 |
+
By default the app reads paths from environment variables (recommended for Spaces):
|
| 12 |
+
- `MG_CHECKPOINT_DIR`: directory containing `training_config.json` and a model checkpoint (`best_model.pt`).
|
| 13 |
+
- `MG_DATA_DIR`: processed data directory containing `metadata_ro.json` (for coefficient ranges and normalization stats).
|
| 14 |
+
- `MG_CURVE_DIR`: directory containing curve files like `CPP_0.0924_1_11.txt`, etc.
|
| 15 |
+
|
| 16 |
+
You can also edit these paths directly in the UI.
|
| 17 |
+
|
| 18 |
+
## Run locally
|
| 19 |
+
```bash
|
| 20 |
+
pip install -r requirements.txt
|
| 21 |
+
python app.py
|
| 22 |
+
```
|
| 23 |
+
|
data_generation/hf_space_generation_ro/app.py
ADDED
|
@@ -0,0 +1,474 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
|
| 3 |
+
import os
|
| 4 |
+
from functools import lru_cache
|
| 5 |
+
from typing import List
|
| 6 |
+
|
| 7 |
+
import gradio as gr
|
| 8 |
+
import numpy as np
|
| 9 |
+
import torch
|
| 10 |
+
|
| 11 |
+
from space_lib.infer import (
|
| 12 |
+
load_model_bundle,
|
| 13 |
+
postprocess_sample,
|
| 14 |
+
sample,
|
| 15 |
+
)
|
| 16 |
+
from space_lib.metadata import (
|
| 17 |
+
load_metadata_ro,
|
| 18 |
+
normalize_ro13,
|
| 19 |
+
ro13_from_ro15,
|
| 20 |
+
ro15_from_groups,
|
| 21 |
+
ro_groups_from_ro15,
|
| 22 |
+
)
|
| 23 |
+
from space_lib.plots import plot_condition_and_simulations
|
| 24 |
+
from space_lib.ro_curves import plot_ro_lateral_relation, plot_ro_stress_relation
|
| 25 |
+
from space_lib.simulate import default_lam_dir, simulate_instances
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
DEFAULT_CHECKPOINT_DIR = os.environ.get(
|
| 29 |
+
"MG_CHECKPOINT_DIR",
|
| 30 |
+
"/project/luofeng/feiyang/MaterialGeneration/hybrid_diffusion_material_generation_ro_fitting/checkpoints/config_1_continuous_100_epoch/exp_20260108_180412",
|
| 31 |
+
)
|
| 32 |
+
DEFAULT_DATA_DIR = os.environ.get(
|
| 33 |
+
"MG_DATA_DIR",
|
| 34 |
+
"/project/luofeng/feiyang/MaterialGeneration/data_generation/processed_dataset_ro",
|
| 35 |
+
)
|
| 36 |
+
DEFAULT_CURVE_DIR = os.environ.get(
|
| 37 |
+
"MG_CURVE_DIR",
|
| 38 |
+
"/project/luofeng/feiyang/MaterialGeneration/data_generation/shahriar_modified_2025_12/RVE_Datasets",
|
| 39 |
+
)
|
| 40 |
+
|
| 41 |
+
# UI simplification: hard-code these for the Space (no controls exposed)
|
| 42 |
+
CHECKPOINT_DIR = DEFAULT_CHECKPOINT_DIR
|
| 43 |
+
DATA_DIR = DEFAULT_DATA_DIR
|
| 44 |
+
CURVE_DIR = DEFAULT_CURVE_DIR
|
| 45 |
+
LAM_DIR = default_lam_dir()
|
| 46 |
+
|
| 47 |
+
NORMALIZATION_METHOD = "zscore"
|
| 48 |
+
DEVICE = "cuda" if torch.cuda.is_available() else "cpu"
|
| 49 |
+
REMASK_PROB = 0.1
|
| 50 |
+
ANGLE_RESOLUTION = 1.0
|
| 51 |
+
X_MAX = 0.1 # fixed
|
| 52 |
+
PLOT_HEIGHT = 260 # px: match ~3 stacked sliders visually
|
| 53 |
+
|
| 54 |
+
|
| 55 |
+
@lru_cache(maxsize=4)
|
| 56 |
+
def _get_meta(data_dir: str):
|
| 57 |
+
return load_metadata_ro(data_dir)
|
| 58 |
+
|
| 59 |
+
|
| 60 |
+
_MODEL_CACHE = {}
|
| 61 |
+
|
| 62 |
+
|
| 63 |
+
def _get_model(checkpoint_dir: str, device: str, angle_resolution: float):
|
| 64 |
+
key = (checkpoint_dir, device, float(angle_resolution))
|
| 65 |
+
if key not in _MODEL_CACHE:
|
| 66 |
+
_MODEL_CACHE[key] = load_model_bundle(checkpoint_dir, device=device, angle_resolution=angle_resolution)
|
| 67 |
+
return _MODEL_CACHE[key]
|
| 68 |
+
|
| 69 |
+
|
| 70 |
+
def _angle_categories_from_meta(meta, angle_resolution: float) -> np.ndarray:
|
| 71 |
+
angle_min_raw = float(meta.raw.get("angle_min", 0.0))
|
| 72 |
+
angle_max_raw = float(meta.raw.get("angle_max", 90.0))
|
| 73 |
+
res = float(angle_resolution)
|
| 74 |
+
ang_min = np.floor(angle_min_raw / res) * res
|
| 75 |
+
ang_max = np.ceil(angle_max_raw / res) * res
|
| 76 |
+
num = int((ang_max - ang_min) / res) + 1
|
| 77 |
+
return np.linspace(ang_min, ang_max, num, dtype=np.float32)
|
| 78 |
+
|
| 79 |
+
|
| 80 |
+
def _default_ro15_values(data_dir: str) -> np.ndarray:
|
| 81 |
+
meta = _get_meta(data_dir)
|
| 82 |
+
if meta.ro_mean_full is not None and meta.ro_mean_full.size == 15:
|
| 83 |
+
return meta.ro_mean_full.astype(np.float32)
|
| 84 |
+
return ((meta.ro_min_full + meta.ro_max_full) * 0.5).astype(np.float32)
|
| 85 |
+
|
| 86 |
+
|
| 87 |
+
_RO_FLAT_IDXS_SHOWN = (0, 1, 2, 3, 4, 6, 7, 8, 9, 10, 12, 13, 14) # hide c for groups 2 & 4
|
| 88 |
+
|
| 89 |
+
|
| 90 |
+
def _load_test_ro15(data_dir: str, idx: int) -> np.ndarray:
|
| 91 |
+
"""
|
| 92 |
+
Load RO coefficients from held-out test set (processed_dataset_ro/test_data_ro.npz).
|
| 93 |
+
Returns flattened (15,) corresponding to [5,3] row-major.
|
| 94 |
+
"""
|
| 95 |
+
npz_path = os.path.join(data_dir, "test_data_ro.npz")
|
| 96 |
+
if not os.path.exists(npz_path):
|
| 97 |
+
raise FileNotFoundError(f"Missing test file: {npz_path}")
|
| 98 |
+
data = np.load(npz_path)
|
| 99 |
+
if "ramberg_osgood_params" not in data:
|
| 100 |
+
raise KeyError(f"'ramberg_osgood_params' not found in {npz_path}. Keys: {list(data.keys())}")
|
| 101 |
+
arr = data["ramberg_osgood_params"] # (N,5,3)
|
| 102 |
+
n = int(arr.shape[0])
|
| 103 |
+
if n <= 0:
|
| 104 |
+
raise ValueError(f"No samples in {npz_path}")
|
| 105 |
+
idx = int(idx) % n
|
| 106 |
+
ro_5x3 = np.asarray(arr[idx], dtype=np.float32)
|
| 107 |
+
if ro_5x3.shape != (5, 3):
|
| 108 |
+
raise ValueError(f"Unexpected shape for ramberg_osgood_params[{idx}]: {ro_5x3.shape}")
|
| 109 |
+
return ro_5x3.reshape(-1) # (15,)
|
| 110 |
+
|
| 111 |
+
|
| 112 |
+
def _ro15_to_ui13(ro15: np.ndarray) -> list[float]:
|
| 113 |
+
ro15 = np.asarray(ro15, dtype=np.float32).reshape(-1)
|
| 114 |
+
if ro15.size != 15:
|
| 115 |
+
raise ValueError(f"Expected 15 values, got {ro15.size}")
|
| 116 |
+
return [round(float(ro15[i]), 3) for i in _RO_FLAT_IDXS_SHOWN]
|
| 117 |
+
|
| 118 |
+
|
| 119 |
+
def _build_groups_from_slider_values(vals: List[float]) -> np.ndarray:
|
| 120 |
+
"""
|
| 121 |
+
UI exposes only 13 coeffs:
|
| 122 |
+
- Group 1: a,b,c
|
| 123 |
+
- Group 2: a,b (c hidden/unused)
|
| 124 |
+
- Group 3: a,b,c
|
| 125 |
+
- Group 4: a,b (c hidden/unused)
|
| 126 |
+
- Group 5: a,b,c
|
| 127 |
+
|
| 128 |
+
Internally: return (5,3) with c for groups 2&4 forced to 0.
|
| 129 |
+
"""
|
| 130 |
+
if len(vals) != 13:
|
| 131 |
+
raise ValueError(f"Expected 13 slider values, got {len(vals)}")
|
| 132 |
+
ro15 = np.zeros(15, dtype=np.float32)
|
| 133 |
+
for i, flat_idx in enumerate(_RO_FLAT_IDXS_SHOWN):
|
| 134 |
+
ro15[int(flat_idx)] = float(vals[i])
|
| 135 |
+
ro15[5] = 0.0
|
| 136 |
+
ro15[11] = 0.0
|
| 137 |
+
return ro15.reshape(5, 3)
|
| 138 |
+
|
| 139 |
+
|
| 140 |
+
def ui_preview_11_stress(a: float, b: float, c: float):
|
| 141 |
+
meta = _get_meta(DATA_DIR)
|
| 142 |
+
fig = plot_ro_stress_relation(
|
| 143 |
+
a=a, b=b, c=c, x_scale=meta.eps_11_scale, x_max=X_MAX, title="Mode 11: σ11(ε11)"
|
| 144 |
+
)
|
| 145 |
+
return fig
|
| 146 |
+
|
| 147 |
+
|
| 148 |
+
def ui_preview_11_lat(a: float, b: float):
|
| 149 |
+
meta = _get_meta(DATA_DIR)
|
| 150 |
+
fig = plot_ro_lateral_relation(
|
| 151 |
+
a=a, b=b, x_scale=meta.eps_11_scale, y_scale=meta.eps_22_scale, x_max=X_MAX, title="Mode 11: ε22(ε11)"
|
| 152 |
+
)
|
| 153 |
+
return fig
|
| 154 |
+
|
| 155 |
+
|
| 156 |
+
def ui_preview_22_stress(a: float, b: float, c: float):
|
| 157 |
+
meta = _get_meta(DATA_DIR)
|
| 158 |
+
fig = plot_ro_stress_relation(
|
| 159 |
+
a=a, b=b, c=c, x_scale=meta.eps_22_scale, x_max=X_MAX, title="Mode 22: σ22(ε22)"
|
| 160 |
+
)
|
| 161 |
+
return fig
|
| 162 |
+
|
| 163 |
+
|
| 164 |
+
def ui_preview_22_lat(a: float, b: float):
|
| 165 |
+
meta = _get_meta(DATA_DIR)
|
| 166 |
+
fig = plot_ro_lateral_relation(
|
| 167 |
+
a=a, b=b, x_scale=meta.eps_22_scale, y_scale=meta.eps_11_scale, x_max=X_MAX, title="Mode 22: ε11(ε22)"
|
| 168 |
+
)
|
| 169 |
+
return fig
|
| 170 |
+
|
| 171 |
+
|
| 172 |
+
def ui_preview_12_stress(a: float, b: float, c: float):
|
| 173 |
+
meta = _get_meta(DATA_DIR)
|
| 174 |
+
fig = plot_ro_stress_relation(
|
| 175 |
+
a=a, b=b, c=c, x_scale=meta.eps_12_scale, x_max=X_MAX, title="Mode 12: σ12(ε12)"
|
| 176 |
+
)
|
| 177 |
+
return fig
|
| 178 |
+
|
| 179 |
+
|
| 180 |
+
def ui_generate(
|
| 181 |
+
n_simulations: int,
|
| 182 |
+
*slider_vals: float,
|
| 183 |
+
):
|
| 184 |
+
# Streaming generator: yields (plot, info, status_log) updates
|
| 185 |
+
meta = _get_meta(DATA_DIR)
|
| 186 |
+
log_lines: list[str] = []
|
| 187 |
+
def _push(msg: str):
|
| 188 |
+
log_lines.append(str(msg))
|
| 189 |
+
# keep log reasonably bounded
|
| 190 |
+
if len(log_lines) > 200:
|
| 191 |
+
log_lines[:] = log_lines[-200:]
|
| 192 |
+
return "\n".join(log_lines)
|
| 193 |
+
|
| 194 |
+
yield gr.update(), gr.update(), _push("Generating (diffusion sampling)...")
|
| 195 |
+
groups = _build_groups_from_slider_values(list(slider_vals))
|
| 196 |
+
ro15 = ro15_from_groups(groups)
|
| 197 |
+
ro13_raw = ro13_from_ro15(ro15)
|
| 198 |
+
cond_norm = normalize_ro13(ro13_raw, meta, NORMALIZATION_METHOD)
|
| 199 |
+
|
| 200 |
+
bundle = _get_model(CHECKPOINT_DIR, device=DEVICE, angle_resolution=ANGLE_RESOLUTION)
|
| 201 |
+
use_discrete_angles = bundle.use_discrete_angles
|
| 202 |
+
angle_categories = _angle_categories_from_meta(meta, ANGLE_RESOLUTION) if use_discrete_angles else None
|
| 203 |
+
|
| 204 |
+
cond_t = torch.tensor(cond_norm, dtype=torch.float32, device=DEVICE).view(1, -1)
|
| 205 |
+
out = sample(
|
| 206 |
+
model=bundle.model,
|
| 207 |
+
disc_diff_mat=bundle.disc_diff_mat,
|
| 208 |
+
disc_diff_vf_category=bundle.disc_diff_vf_category,
|
| 209 |
+
disc_diff_layer=bundle.disc_diff_layer,
|
| 210 |
+
disc_diff_angle=bundle.disc_diff_angle,
|
| 211 |
+
cont_diff=bundle.cont_diff,
|
| 212 |
+
cond=cond_t,
|
| 213 |
+
mask_ids=bundle.mask_ids,
|
| 214 |
+
device=DEVICE,
|
| 215 |
+
remask_prob=float(REMASK_PROB),
|
| 216 |
+
use_discrete_angles=use_discrete_angles,
|
| 217 |
+
)
|
| 218 |
+
|
| 219 |
+
mat_type, vf, upper_angles = postprocess_sample(out, use_discrete_angles=use_discrete_angles, angle_categories_deg=angle_categories)
|
| 220 |
+
# Continuous-angle model is constrained to (0, pi/2) in-model, but keep a defensive clip to metadata range.
|
| 221 |
+
ang_min = float(meta.raw.get("angle_min", 0.0))
|
| 222 |
+
ang_max = float(meta.raw.get("angle_max", 90.0))
|
| 223 |
+
upper_angles = [min(max(float(a), ang_min), ang_max) for a in upper_angles]
|
| 224 |
+
_push(f"Generation done.")
|
| 225 |
+
_push(f"Generated material: {mat_type}")
|
| 226 |
+
_push(f"Generated vf: {vf:.4f}")
|
| 227 |
+
_push(f"Generated upper angles (deg): {upper_angles}")
|
| 228 |
+
_push(f"Simulating {int(n_simulations)} instance(s)...")
|
| 229 |
+
|
| 230 |
+
# Show condition-only plot immediately
|
| 231 |
+
fig0 = plot_condition_and_simulations(
|
| 232 |
+
groups,
|
| 233 |
+
(meta.eps_11_scale, meta.eps_22_scale, meta.eps_12_scale),
|
| 234 |
+
{},
|
| 235 |
+
)
|
| 236 |
+
info0 = (
|
| 237 |
+
f"Generated material: {mat_type}\n"
|
| 238 |
+
f"Generated vf: {vf:.4f}\n"
|
| 239 |
+
f"Generated upper angles (deg): {upper_angles}\n"
|
| 240 |
+
f"Simulated instances: []"
|
| 241 |
+
)
|
| 242 |
+
yield fig0, info0, "\n".join(log_lines)
|
| 243 |
+
|
| 244 |
+
# Simulate sequentially so we can update status per instance.
|
| 245 |
+
sim_by_instance = {}
|
| 246 |
+
instances = list(range(1, int(n_simulations) + 1))
|
| 247 |
+
for inst in instances:
|
| 248 |
+
_push(f"Simulating instance {inst}/{len(instances)}...")
|
| 249 |
+
try:
|
| 250 |
+
sim_part = simulate_instances(
|
| 251 |
+
curve_dir=CURVE_DIR,
|
| 252 |
+
lam_dir=LAM_DIR,
|
| 253 |
+
mat_type=mat_type,
|
| 254 |
+
vf=vf,
|
| 255 |
+
upper_angles=upper_angles,
|
| 256 |
+
instances=[inst],
|
| 257 |
+
num_output_points=10,
|
| 258 |
+
)
|
| 259 |
+
sim_by_instance.update(sim_part)
|
| 260 |
+
_push(f"Instance {inst} done.")
|
| 261 |
+
except Exception as e:
|
| 262 |
+
_push(f"Instance {inst} failed: {type(e).__name__}: {e}")
|
| 263 |
+
|
| 264 |
+
# Update plot incrementally after each instance attempt
|
| 265 |
+
fig_i = plot_condition_and_simulations(
|
| 266 |
+
groups,
|
| 267 |
+
(meta.eps_11_scale, meta.eps_22_scale, meta.eps_12_scale),
|
| 268 |
+
sim_by_instance,
|
| 269 |
+
)
|
| 270 |
+
info_i = (
|
| 271 |
+
f"Generated material: {mat_type}\n"
|
| 272 |
+
f"Generated vf: {vf:.4f}\n"
|
| 273 |
+
f"Generated upper angles (deg): {upper_angles}\n"
|
| 274 |
+
f"Simulated instances: {sorted(sim_by_instance.keys())}"
|
| 275 |
+
)
|
| 276 |
+
yield fig_i, info_i, "\n".join(log_lines)
|
| 277 |
+
|
| 278 |
+
_push("Done.")
|
| 279 |
+
yield fig_i, info_i, "\n".join(log_lines)
|
| 280 |
+
|
| 281 |
+
|
| 282 |
+
def build_app():
|
| 283 |
+
meta = _get_meta(DATA_DIR)
|
| 284 |
+
# Default initialization uses dataset-wide mean (or min/max midpoint).
|
| 285 |
+
# You can optionally load a held-out test condition via the UI accordion.
|
| 286 |
+
ro15_init = _default_ro15_values(DATA_DIR)
|
| 287 |
+
ro_min = meta.ro_min_full
|
| 288 |
+
ro_max = meta.ro_max_full
|
| 289 |
+
|
| 290 |
+
with gr.Blocks(
|
| 291 |
+
css="""
|
| 292 |
+
/* Make slider numeric input boxes consistent width */
|
| 293 |
+
.gradio-container .gr-slider input[type="number"],
|
| 294 |
+
.gradio-container .gr-number input[type="number"],
|
| 295 |
+
.gradio-container input[type="number"] {
|
| 296 |
+
width: 78px !important;
|
| 297 |
+
min-width: 78px !important;
|
| 298 |
+
}
|
| 299 |
+
|
| 300 |
+
/* --- Layout: make plot columns match the 3-slider column height; keep 2-slider column top-aligned --- */
|
| 301 |
+
#mode11_row, #mode22_row, #mode12_row {
|
| 302 |
+
align-items: stretch !important; /* row height = tallest column (3 sliders) */
|
| 303 |
+
}
|
| 304 |
+
#mode11_col3, #mode22_col3, #mode12_col3 {
|
| 305 |
+
align-self: flex-start !important; /* 2-slider column should NOT stretch */
|
| 306 |
+
}
|
| 307 |
+
#mode11_col2, #mode11_col4, #mode22_col2, #mode22_col4, #mode12_col2, #mode12_col4 {
|
| 308 |
+
display: flex !important;
|
| 309 |
+
flex-direction: column !important;
|
| 310 |
+
}
|
| 311 |
+
#mode11_stress_plot, #mode11_lat_plot, #mode22_stress_plot, #mode22_lat_plot, #mode12_stress_plot {
|
| 312 |
+
flex: 1 1 auto !important;
|
| 313 |
+
height: 100% !important;
|
| 314 |
+
min-height: 0 !important;
|
| 315 |
+
}
|
| 316 |
+
#mode11_stress_plot img, #mode11_lat_plot img, #mode22_stress_plot img, #mode22_lat_plot img, #mode12_stress_plot img {
|
| 317 |
+
height: 100% !important;
|
| 318 |
+
width: 100% !important;
|
| 319 |
+
object-fit: contain;
|
| 320 |
+
}
|
| 321 |
+
"""
|
| 322 |
+
) as demo:
|
| 323 |
+
gr.Markdown("## Hybrid Diffusion Material Generation (RO)")
|
| 324 |
+
n_simulations = gr.Slider(1, 5, value=3, step=1, label="Number of simulations (instances 1..N)")
|
| 325 |
+
|
| 326 |
+
with gr.Accordion("Init from test set (optional)", open=False):
|
| 327 |
+
gr.Markdown(
|
| 328 |
+
"Loads coefficients from `processed_dataset_ro/test_data_ro.npz` → `ramberg_osgood_params[idx]`.\n"
|
| 329 |
+
"This is useful to sanity-check performance on held-out conditions."
|
| 330 |
+
)
|
| 331 |
+
test_idx = gr.Number(value=0, precision=0, label="test_data_ro.npz index (int)")
|
| 332 |
+
load_test_btn = gr.Button("Load this test index into sliders")
|
| 333 |
+
rand_test_btn = gr.Button("Load a random test index into sliders")
|
| 334 |
+
test_status = gr.Markdown("")
|
| 335 |
+
|
| 336 |
+
# --- Mode 11 ---
|
| 337 |
+
gr.Markdown(
|
| 338 |
+
"### Mode 11\n"
|
| 339 |
+
"**Stress relationship:**\n"
|
| 340 |
+
"$$\\sigma_{11} = a\\,(\\varepsilon_{11}/s_{11}) + b\\,(\\varepsilon_{11}/s_{11})^{c}$$\n"
|
| 341 |
+
"**Lateral relationship:**\n"
|
| 342 |
+
"$$\\varepsilon_{22} = a\\,|\\varepsilon_{11}/s_{11}|^{b}\\,s_{22}$$\n"
|
| 343 |
+
)
|
| 344 |
+
with gr.Row(elem_id="mode11_row"):
|
| 345 |
+
# Column 1: three sliders (subrows)
|
| 346 |
+
with gr.Column(scale=1, elem_id="mode11_col1"):
|
| 347 |
+
g11_a = gr.Slider(float(ro_min[0]), float(ro_max[0]), value=round(float(ro15_init[0]), 3), step=0.001, label="ε11→σ11:\u00A0a")
|
| 348 |
+
g11_b = gr.Slider(float(ro_min[1]), float(ro_max[1]), value=round(float(ro15_init[1]), 3), step=0.001, label="ε11→σ11:\u00A0b")
|
| 349 |
+
g11_c = gr.Slider(float(ro_min[2]), float(ro_max[2]), value=round(float(ro15_init[2]), 3), step=0.001, label="ε11→σ11:\u00A0c")
|
| 350 |
+
# Column 2: plot
|
| 351 |
+
with gr.Column(scale=1, elem_id="mode11_col2"):
|
| 352 |
+
_fig = ui_preview_11_stress(float(ro15_init[0]), float(ro15_init[1]), float(ro15_init[2]))
|
| 353 |
+
mode11_stress_plot = gr.Plot(value=_fig, elem_id="mode11_stress_plot")
|
| 354 |
+
# Column 3: two sliders (subrows)
|
| 355 |
+
with gr.Column(scale=1, elem_id="mode11_col3"):
|
| 356 |
+
g11_lat_a = gr.Slider(float(ro_min[3]), float(ro_max[3]), value=round(float(ro15_init[3]), 3), step=0.001, label="ε11→ε22:\u00A0a")
|
| 357 |
+
g11_lat_b = gr.Slider(float(ro_min[4]), float(ro_max[4]), value=round(float(ro15_init[4]), 3), step=0.001, label="ε11→ε22:\u00A0b")
|
| 358 |
+
# Column 4: plot
|
| 359 |
+
with gr.Column(scale=1, elem_id="mode11_col4"):
|
| 360 |
+
_fig = ui_preview_11_lat(float(ro15_init[3]), float(ro15_init[4]))
|
| 361 |
+
mode11_lat_plot = gr.Plot(value=_fig, elem_id="mode11_lat_plot")
|
| 362 |
+
|
| 363 |
+
# --- Mode 22 ---
|
| 364 |
+
gr.Markdown(
|
| 365 |
+
"### Mode 22\n"
|
| 366 |
+
"**Stress relationship:**\n"
|
| 367 |
+
"$$\\sigma_{22} = a\\,(\\varepsilon_{22}/s_{22}) + b\\,(\\varepsilon_{22}/s_{22})^{c}$$\n"
|
| 368 |
+
"**Lateral relationship:**\n"
|
| 369 |
+
"$$\\varepsilon_{11} = a\\,|\\varepsilon_{22}/s_{22}|^{b}\\,s_{11}$$\n"
|
| 370 |
+
)
|
| 371 |
+
with gr.Row(elem_id="mode22_row"):
|
| 372 |
+
# Column 1: three sliders (subrows)
|
| 373 |
+
with gr.Column(scale=1, elem_id="mode22_col1"):
|
| 374 |
+
g22_a = gr.Slider(float(ro_min[6]), float(ro_max[6]), value=round(float(ro15_init[6]), 3), step=0.001, label="ε22→σ22:\u00A0a")
|
| 375 |
+
g22_b = gr.Slider(float(ro_min[7]), float(ro_max[7]), value=round(float(ro15_init[7]), 3), step=0.001, label="ε22→σ22:\u00A0b")
|
| 376 |
+
g22_c = gr.Slider(float(ro_min[8]), float(ro_max[8]), value=round(float(ro15_init[8]), 3), step=0.001, label="ε22→σ22:\u00A0c")
|
| 377 |
+
# Column 2: plot
|
| 378 |
+
with gr.Column(scale=1, elem_id="mode22_col2"):
|
| 379 |
+
_fig = ui_preview_22_stress(float(ro15_init[6]), float(ro15_init[7]), float(ro15_init[8]))
|
| 380 |
+
mode22_stress_plot = gr.Plot(value=_fig, elem_id="mode22_stress_plot")
|
| 381 |
+
# Column 3: two sliders (subrows)
|
| 382 |
+
with gr.Column(scale=1, elem_id="mode22_col3"):
|
| 383 |
+
g22_lat_a = gr.Slider(float(ro_min[9]), float(ro_max[9]), value=round(float(ro15_init[9]), 3), step=0.001, label="ε22→ε11:\u00A0a")
|
| 384 |
+
g22_lat_b = gr.Slider(float(ro_min[10]), float(ro_max[10]), value=round(float(ro15_init[10]), 3), step=0.001, label="ε22→ε11:\u00A0b")
|
| 385 |
+
# Column 4: plot
|
| 386 |
+
with gr.Column(scale=1, elem_id="mode22_col4"):
|
| 387 |
+
_fig = ui_preview_22_lat(float(ro15_init[9]), float(ro15_init[10]))
|
| 388 |
+
mode22_lat_plot = gr.Plot(value=_fig, elem_id="mode22_lat_plot")
|
| 389 |
+
|
| 390 |
+
# --- Mode 12 ---
|
| 391 |
+
gr.Markdown(
|
| 392 |
+
"### Mode 12\n"
|
| 393 |
+
"**Stress relationship:**\n"
|
| 394 |
+
"$$\\sigma_{12} = a\\,(\\varepsilon_{12}/s_{12}) + b\\,(\\varepsilon_{12}/s_{12})^{c}$$\n"
|
| 395 |
+
)
|
| 396 |
+
with gr.Row(elem_id="mode12_row"):
|
| 397 |
+
# Column 1: three sliders (subrows)
|
| 398 |
+
with gr.Column(scale=1, elem_id="mode12_col1"):
|
| 399 |
+
g12_a = gr.Slider(float(ro_min[12]), float(ro_max[12]), value=round(float(ro15_init[12]), 3), step=0.001, label="ε12→σ12:\u00A0a")
|
| 400 |
+
g12_b = gr.Slider(float(ro_min[13]), float(ro_max[13]), value=round(float(ro15_init[13]), 3), step=0.001, label="ε12→σ12:\u00A0b")
|
| 401 |
+
g12_c = gr.Slider(float(ro_min[14]), float(ro_max[14]), value=round(float(ro15_init[14]), 3), step=0.001, label="ε12→σ12:\u00A0c")
|
| 402 |
+
# Column 2: plot
|
| 403 |
+
with gr.Column(scale=1, elem_id="mode12_col2"):
|
| 404 |
+
_fig = ui_preview_12_stress(float(ro15_init[12]), float(ro15_init[13]), float(ro15_init[14]))
|
| 405 |
+
mode12_stress_plot = gr.Plot(value=_fig, elem_id="mode12_stress_plot")
|
| 406 |
+
# Column 3+4: placeholders (keeps layout consistent)
|
| 407 |
+
with gr.Column(scale=1, elem_id="mode12_col3"):
|
| 408 |
+
gr.Markdown("")
|
| 409 |
+
with gr.Column(scale=1, elem_id="mode12_col4"):
|
| 410 |
+
gr.Markdown("")
|
| 411 |
+
|
| 412 |
+
# For generation we still need a flat list of the 13 UI coefficients, in this order:
|
| 413 |
+
sliders = [g11_a, g11_b, g11_c, g11_lat_a, g11_lat_b, g22_a, g22_b, g22_c, g22_lat_a, g22_lat_b, g12_a, g12_b, g12_c]
|
| 414 |
+
|
| 415 |
+
def _load_idx_into_sliders(idx: int):
|
| 416 |
+
ro15 = _load_test_ro15(DATA_DIR, int(idx))
|
| 417 |
+
return _ro15_to_ui13(ro15), f"Loaded test index **{int(idx)}** into sliders."
|
| 418 |
+
|
| 419 |
+
def _load_random_into_sliders():
|
| 420 |
+
# pick a random valid index (deterministic enough for interactive usage)
|
| 421 |
+
npz_path = os.path.join(DATA_DIR, "test_data_ro.npz")
|
| 422 |
+
data = np.load(npz_path)
|
| 423 |
+
n = int(data["ramberg_osgood_params"].shape[0])
|
| 424 |
+
idx = int(np.random.randint(0, max(n, 1)))
|
| 425 |
+
ro15 = np.asarray(data["ramberg_osgood_params"][idx], dtype=np.float32).reshape(-1)
|
| 426 |
+
return _ro15_to_ui13(ro15), f"Loaded random test index **{idx}** into sliders."
|
| 427 |
+
|
| 428 |
+
# Wire test-set loaders
|
| 429 |
+
load_test_btn.click(
|
| 430 |
+
fn=lambda idx: (*_load_idx_into_sliders(idx)[0], _load_idx_into_sliders(idx)[1]),
|
| 431 |
+
inputs=[test_idx],
|
| 432 |
+
outputs=sliders + [test_status],
|
| 433 |
+
show_progress=False,
|
| 434 |
+
)
|
| 435 |
+
rand_test_btn.click(
|
| 436 |
+
fn=lambda: (*_load_random_into_sliders()[0], _load_random_into_sliders()[1]),
|
| 437 |
+
inputs=[],
|
| 438 |
+
outputs=sliders + [test_status],
|
| 439 |
+
show_progress=False,
|
| 440 |
+
)
|
| 441 |
+
|
| 442 |
+
gr.Markdown("### Generate + simulate")
|
| 443 |
+
gen_btn = gr.Button("Generate")
|
| 444 |
+
gen_plot = gr.Plot(label="Condition + simulated curves (overlaid)")
|
| 445 |
+
gen_info = gr.Textbox(label="Generated parameters", lines=6)
|
| 446 |
+
gen_status = gr.Textbox(label="Run log", lines=8, value="Idle.", interactive=False)
|
| 447 |
+
|
| 448 |
+
# Wire live updates
|
| 449 |
+
for s in (g11_a, g11_b, g11_c):
|
| 450 |
+
s.change(ui_preview_11_stress, inputs=[g11_a, g11_b, g11_c], outputs=[mode11_stress_plot], show_progress=False)
|
| 451 |
+
for s in (g11_lat_a, g11_lat_b):
|
| 452 |
+
s.change(ui_preview_11_lat, inputs=[g11_lat_a, g11_lat_b], outputs=[mode11_lat_plot], show_progress=False)
|
| 453 |
+
|
| 454 |
+
for s in (g22_a, g22_b, g22_c):
|
| 455 |
+
s.change(ui_preview_22_stress, inputs=[g22_a, g22_b, g22_c], outputs=[mode22_stress_plot], show_progress=False)
|
| 456 |
+
for s in (g22_lat_a, g22_lat_b):
|
| 457 |
+
s.change(ui_preview_22_lat, inputs=[g22_lat_a, g22_lat_b], outputs=[mode22_lat_plot], show_progress=False)
|
| 458 |
+
|
| 459 |
+
for s in (g12_a, g12_b, g12_c):
|
| 460 |
+
s.change(ui_preview_12_stress, inputs=[g12_a, g12_b, g12_c], outputs=[mode12_stress_plot], show_progress=False)
|
| 461 |
+
|
| 462 |
+
# Generate
|
| 463 |
+
gen_btn.click(
|
| 464 |
+
ui_generate,
|
| 465 |
+
inputs=[n_simulations] + sliders,
|
| 466 |
+
outputs=[gen_plot, gen_info, gen_status],
|
| 467 |
+
)
|
| 468 |
+
|
| 469 |
+
return demo
|
| 470 |
+
|
| 471 |
+
|
| 472 |
+
if __name__ == "__main__":
|
| 473 |
+
build_app().launch(server_name="0.0.0.0", server_port=int(os.environ.get("PORT", "7860")))
|
| 474 |
+
|
data_generation/hf_space_generation_ro/lam.py
ADDED
|
@@ -0,0 +1,707 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
# --------------------- python packages ---------------------
|
| 6 |
+
|
| 7 |
+
# all these packages should be present in the system
|
| 8 |
+
import numpy as np
|
| 9 |
+
import matplotlib.pyplot as plt
|
| 10 |
+
from dataclasses import dataclass
|
| 11 |
+
from pathlib import Path
|
| 12 |
+
import warnings
|
| 13 |
+
from numpy.lib._iotools import ConversionWarning
|
| 14 |
+
from itertools import combinations_with_replacement
|
| 15 |
+
from math import comb
|
| 16 |
+
|
| 17 |
+
# --------------------- dataset parameter grids ---------------------
|
| 18 |
+
|
| 19 |
+
#MATERIAL_TYPES = ["CPP", "GPP", "CHDPE", "GHDPE"] # e.g. ["CPP", "GFPP", ...]
|
| 20 |
+
MATERIAL_TYPES = ["GHDPE", ]
|
| 21 |
+
VOL_FRACTIONS = ["0.0924", "0.2155", "0.3079", "0.4002", "0.4926"] # e.g. ["0.0924", "0.1500", ...]
|
| 22 |
+
INSTANCES = [1] # e.g. [1, 2, 3, 4]
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
# Number of plies in the *upper* half of the symmetric laminate
|
| 26 |
+
UPPER_LAYER_COUNTS = [5,6,7] # example: [1, 2, 3]
|
| 27 |
+
|
| 28 |
+
# Candidate angles (in degrees) each upper-half ply can take
|
| 29 |
+
CANDIDATE_ANGLES = [10,20,35,40,65,82]
|
| 30 |
+
|
| 31 |
+
# --------------------- input directory ---------------------
|
| 32 |
+
|
| 33 |
+
# Folder that contains RVE input files(3*100)(!!!update the path accordingly)
|
| 34 |
+
CURVE_DIR = Path(r"RVE_Datasets")
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
# --------------------- output directory ---------------------
|
| 39 |
+
|
| 40 |
+
# Folder that contains the laminate output files(!!!update the path accordingly)
|
| 41 |
+
OUT_DIR_ALL = Path(r"Output_directory")
|
| 42 |
+
|
| 43 |
+
|
| 44 |
+
# --------------------- user-set Poisson ratios ---------------------
|
| 45 |
+
NU12 = 0.36
|
| 46 |
+
NU13 = 0.36
|
| 47 |
+
NU23 = 0.86
|
| 48 |
+
|
| 49 |
+
COND_MAX = 1e12 #maximum allowable condition number of the stiffness matrix
|
| 50 |
+
|
| 51 |
+
# ===============================================================
|
| 52 |
+
@dataclass
|
| 53 |
+
class Curve1D:
|
| 54 |
+
eps: np.ndarray
|
| 55 |
+
sig: np.ndarray # Pa
|
| 56 |
+
|
| 57 |
+
def __post_init__(self):
|
| 58 |
+
idx = np.argsort(self.eps)
|
| 59 |
+
self.eps = np.asarray(self.eps, float)[idx]
|
| 60 |
+
self.sig = np.asarray(self.sig, float)[idx]
|
| 61 |
+
|
| 62 |
+
def stress(self, e):
|
| 63 |
+
ea = np.clip(abs(e), self.eps[0], self.eps[-1])
|
| 64 |
+
sa = np.interp(ea, self.eps, self.sig)
|
| 65 |
+
return np.sign(e) * sa
|
| 66 |
+
|
| 67 |
+
def tangent(self, e):
|
| 68 |
+
ea = np.clip(abs(e), self.eps[0], self.eps[-1])
|
| 69 |
+
i = np.searchsorted(self.eps, ea) - 1
|
| 70 |
+
i = np.clip(i, 0, len(self.eps)-2)
|
| 71 |
+
de = self.eps[i+1] - self.eps[i]
|
| 72 |
+
ds = self.sig[i+1] - self.sig[i]
|
| 73 |
+
return (ds/de)
|
| 74 |
+
|
| 75 |
+
def read_instance_metadata(prefix: str):
|
| 76 |
+
"""
|
| 77 |
+
Read volume fraction and fiber centers from the 11-file for this instance.
|
| 78 |
+
Example prefix: 'CHDPE_0.0924_1' -> CHDPE_0.0924_1_11.txt
|
| 79 |
+
"""
|
| 80 |
+
meta_file = CURVE_DIR / f"{prefix}_11.txt"
|
| 81 |
+
vol_frac = None
|
| 82 |
+
centers_str = None
|
| 83 |
+
|
| 84 |
+
with open(meta_file, "r") as f:
|
| 85 |
+
for line in f:
|
| 86 |
+
line = line.strip()
|
| 87 |
+
if line.startswith("volume fraction="):
|
| 88 |
+
# split at '=', take right-hand side, convert to float
|
| 89 |
+
vol_frac = float(line.split("=", 1)[1])
|
| 90 |
+
elif line.startswith("fiber_centers_YZ="):
|
| 91 |
+
# take everything after '=' as a raw string
|
| 92 |
+
centers_str = line.split("=", 1)[1].strip()
|
| 93 |
+
|
| 94 |
+
if vol_frac is None:
|
| 95 |
+
raise ValueError(f"volume fraction not found in {meta_file}")
|
| 96 |
+
if centers_str is None:
|
| 97 |
+
raise ValueError(f"fiber_centers_YZ not found in {meta_file}")
|
| 98 |
+
|
| 99 |
+
|
| 100 |
+
n_fibers = centers_str.count("(")
|
| 101 |
+
|
| 102 |
+
return vol_frac, centers_str, n_fibers
|
| 103 |
+
|
| 104 |
+
|
| 105 |
+
|
| 106 |
+
|
| 107 |
+
|
| 108 |
+
def load_curve_from_file(filename, strain_col=1, stress_col=2, skiprows=1, is_shear=False):
|
| 109 |
+
"""
|
| 110 |
+
Load a 2-col curve file.
|
| 111 |
+
If is_shear=True, strain column is assumed 'tensorial' and converted to engineering γ by *2.0*.
|
| 112 |
+
|
| 113 |
+
"""
|
| 114 |
+
p = Path(filename)
|
| 115 |
+
if not p.exists():
|
| 116 |
+
raise FileNotFoundError(f"Missing curve file: {p.resolve()}")
|
| 117 |
+
|
| 118 |
+
|
| 119 |
+
with warnings.catch_warnings():
|
| 120 |
+
warnings.simplefilter("ignore", ConversionWarning)
|
| 121 |
+
arr = np.genfromtxt(
|
| 122 |
+
p,
|
| 123 |
+
dtype=float,
|
| 124 |
+
delimiter=None,
|
| 125 |
+
skip_header=skiprows,
|
| 126 |
+
invalid_raise=False # bad lines (like "volume fraction= ...") are skipped
|
| 127 |
+
)
|
| 128 |
+
|
| 129 |
+
|
| 130 |
+
eps = arr[:, strain_col]
|
| 131 |
+
if is_shear:
|
| 132 |
+
eps = 2.0 * eps # tensorial -> engineering γ
|
| 133 |
+
sig = 1e6 * arr[:, stress_col] # MPa -> Pa
|
| 134 |
+
return Curve1D(eps, sig)
|
| 135 |
+
|
| 136 |
+
|
| 137 |
+
def load_ud_material_from_files(prefix: str) -> "PlyMaterial":
|
| 138 |
+
"""
|
| 139 |
+
Build a PlyMaterial from three curve files with a common prefix, e.g.
|
| 140 |
+
prefix='CPP_0.0924_1' → CPP_0.0924_1_11.txt, CPP_0.0924_1_22.txt, CPP_0.0924_1_12.txt
|
| 141 |
+
"""
|
| 142 |
+
# 11 curve: Strain_11, Stress_11, Strain_22, Strain_33
|
| 143 |
+
c11 = load_curve_from_file(
|
| 144 |
+
CURVE_DIR / f"{prefix}_11.txt",
|
| 145 |
+
strain_col=0, # Strain_11
|
| 146 |
+
stress_col=1, # Stress_11
|
| 147 |
+
skiprows=1
|
| 148 |
+
)
|
| 149 |
+
|
| 150 |
+
# 22 curve: Strain_22, Stress_22, Strain_11, Strain_33
|
| 151 |
+
c22 = load_curve_from_file(
|
| 152 |
+
CURVE_DIR / f"{prefix}_22.txt",
|
| 153 |
+
strain_col=0, # Strain_22
|
| 154 |
+
stress_col=1, # Stress_22
|
| 155 |
+
skiprows=1
|
| 156 |
+
)
|
| 157 |
+
|
| 158 |
+
# Reuse 22 curve for 33
|
| 159 |
+
c33 = c22
|
| 160 |
+
|
| 161 |
+
# 12 shear curve: Strain_12, Stress_12
|
| 162 |
+
c12 = load_curve_from_file(
|
| 163 |
+
CURVE_DIR / f"{prefix}_12.txt",
|
| 164 |
+
strain_col=0, # Strain_12
|
| 165 |
+
stress_col=1, # Stress_12
|
| 166 |
+
skiprows=1,
|
| 167 |
+
is_shear=True
|
| 168 |
+
)
|
| 169 |
+
|
| 170 |
+
# Reuse 12 curve for 13 and 23
|
| 171 |
+
c13 = c12
|
| 172 |
+
c23 = c12
|
| 173 |
+
|
| 174 |
+
return PlyMaterial(
|
| 175 |
+
E1_curve=c11, E2_curve=c22, E3_curve=c33,
|
| 176 |
+
G12_curve=c12, G13_curve=c13, G23_curve=c23,
|
| 177 |
+
nu12=NU12, nu13=NU13, nu23=NU23
|
| 178 |
+
)
|
| 179 |
+
|
| 180 |
+
|
| 181 |
+
# ===============================================================
|
| 182 |
+
# 3D orthotropic C' (Voigt 11,22,33,23,13,12)
|
| 183 |
+
# (engineering shear convention: C66=G12, etc.)
|
| 184 |
+
# ===============================================================
|
| 185 |
+
def orthotropic_C_prime(E1,E2,E3,G12,G13,G23, nu12,nu13,nu23):
|
| 186 |
+
V = (1.0
|
| 187 |
+
- (E3/E2)*(nu23**2)
|
| 188 |
+
- (E3/E1)*(nu13**2)
|
| 189 |
+
- (E2/E1)*(nu12**2)
|
| 190 |
+
- 2*(E3/E1)*(nu12*nu13*nu23))
|
| 191 |
+
|
| 192 |
+
C11 = ((1.0 - (E3/E2)*nu23**2) * E1) / V
|
| 193 |
+
C22 = ((1.0 - (E3/E1)*nu13**2) * E2) / V
|
| 194 |
+
C33 = ((1.0 - (E2/E1)*nu12**2) * E3) / V
|
| 195 |
+
C12 = ((nu12 + (E3/E2)*nu13*nu23) * E2) / V
|
| 196 |
+
C13 = ((nu13 + nu12*nu23) * E3) / V
|
| 197 |
+
C23 = ((nu23 + (E2/E1)*nu12*nu13) * E3) / V
|
| 198 |
+
|
| 199 |
+
C = np.zeros((6,6))
|
| 200 |
+
C[0,0] = C11; C[1,1] = C22; C[2,2] = C33
|
| 201 |
+
C[0,1] = C12; C[1,0] = C12
|
| 202 |
+
C[0,2] = C13; C[2,0] = C13
|
| 203 |
+
C[1,2] = C23; C[2,1] = C23
|
| 204 |
+
C[3,3] = G23; C[4,4] = G13; C[5,5] = G12
|
| 205 |
+
return C
|
| 206 |
+
|
| 207 |
+
# ===============================================================
|
| 208 |
+
# Transformations (engineering shear)
|
| 209 |
+
# ===============================================================
|
| 210 |
+
def T_sigma(theta_deg):
|
| 211 |
+
th = np.radians(theta_deg); m, n = np.cos(th), np.sin(th)
|
| 212 |
+
return np.array([
|
| 213 |
+
[ m*m, n*n, 0, 0, 0, 2*m*n],
|
| 214 |
+
[ n*n, m*m, 0, 0, 0, -2*m*n],
|
| 215 |
+
[ 0, 0, 1, 0, 0, 0],
|
| 216 |
+
[ 0, 0, 0, m,-n, 0],
|
| 217 |
+
[ 0, 0, 0, n, m, 0],
|
| 218 |
+
[-m*n, m*n, 0, 0, 0, m*m-n*n]
|
| 219 |
+
], float)
|
| 220 |
+
|
| 221 |
+
def T_eps(theta_deg):
|
| 222 |
+
th = np.radians(theta_deg); m, n = np.cos(th), np.sin(th)
|
| 223 |
+
return np.array([
|
| 224 |
+
[ m*m, n*n, 0, 0, 0, m*n],
|
| 225 |
+
[ n*n, m*m, 0, 0, 0, -m*n],
|
| 226 |
+
[ 0, 0, 1, 0, 0, 0],
|
| 227 |
+
[ 0, 0, 0, m,-n, 0],
|
| 228 |
+
[ 0, 0, 0, n, m, 0],
|
| 229 |
+
[-2*m*n,2*m*n,0, 0, 0, m*m-n*n]
|
| 230 |
+
], float)
|
| 231 |
+
|
| 232 |
+
|
| 233 |
+
def T(theta_deg):
|
| 234 |
+
th = np.radians(theta_deg); m, n = np.cos(th), np.sin(th)
|
| 235 |
+
return np.array([
|
| 236 |
+
[ m*m, n*n, 0, 0, 0, 2*m*n],
|
| 237 |
+
[ n*n, m*m, 0, 0, 0, -2*m*n],
|
| 238 |
+
[ 0, 0, 1, 0, 0, 0],
|
| 239 |
+
[ 0, 0, 0, m,-n, 0],
|
| 240 |
+
[ 0, 0, 0, n, m, 0],
|
| 241 |
+
[-1*m*n,1*m*n,0, 0, 0, m*m-n*n]
|
| 242 |
+
], float)
|
| 243 |
+
|
| 244 |
+
|
| 245 |
+
# ===============================================================
|
| 246 |
+
# Ply material & ply
|
| 247 |
+
# ===============================================================
|
| 248 |
+
@dataclass
|
| 249 |
+
class PlyMaterial:
|
| 250 |
+
E1_curve: Curve1D
|
| 251 |
+
E2_curve: Curve1D
|
| 252 |
+
E3_curve: Curve1D
|
| 253 |
+
G12_curve: Curve1D
|
| 254 |
+
G13_curve: Curve1D
|
| 255 |
+
G23_curve: Curve1D
|
| 256 |
+
nu12: float
|
| 257 |
+
nu13: float
|
| 258 |
+
nu23: float
|
| 259 |
+
|
| 260 |
+
def tangents_from_local_strain(self, e_local):
|
| 261 |
+
e11,e22,e33,g23,g13,g12 = e_local
|
| 262 |
+
floor = -1e12
|
| 263 |
+
E1 = max(self.E1_curve.tangent(e11), floor)
|
| 264 |
+
E2 = max(self.E2_curve.tangent(e22), floor)
|
| 265 |
+
E3 = max(self.E3_curve.tangent(e33), floor)
|
| 266 |
+
G12 = max(self.G12_curve.tangent(g12), floor)
|
| 267 |
+
G13 = max(self.G13_curve.tangent(g13), floor)
|
| 268 |
+
G23 = max(self.G23_curve.tangent(g23), floor)
|
| 269 |
+
return E1,E2,E3,G12,G13,G23
|
| 270 |
+
|
| 271 |
+
|
| 272 |
+
@dataclass
|
| 273 |
+
class Ply:
|
| 274 |
+
theta_deg: float # initial/reference fibre angle
|
| 275 |
+
thickness: float
|
| 276 |
+
mat: PlyMaterial
|
| 277 |
+
e_prev: np.ndarray = None
|
| 278 |
+
s_prev: np.ndarray = None
|
| 279 |
+
theta_curr_deg: float = None # running (current) fibre angle
|
| 280 |
+
|
| 281 |
+
def init_state(self):
|
| 282 |
+
self.e_prev = np.zeros(6)
|
| 283 |
+
self.s_prev = np.zeros(6)
|
| 284 |
+
self.theta_curr_deg = float(self.theta_deg)
|
| 285 |
+
|
| 286 |
+
|
| 287 |
+
class Laminate:
|
| 288 |
+
def __init__(self, plies, tol=1e-12):
|
| 289 |
+
self.plies = plies
|
| 290 |
+
for p in self.plies:
|
| 291 |
+
p.init_state()
|
| 292 |
+
t0 = self.plies[0].thickness
|
| 293 |
+
for i,p in enumerate(self.plies, 1):
|
| 294 |
+
if abs(p.thickness - t0) > tol:
|
| 295 |
+
raise ValueError(f"Equal-thickness assumption violated at ply {i}: {p.thickness} vs {t0}")
|
| 296 |
+
self.N = len(self.plies)
|
| 297 |
+
self.t = t0
|
| 298 |
+
self.total_t = self.N * self.t
|
| 299 |
+
|
| 300 |
+
# ---------- Incremental affine update using strain increments (engineering shear) ----------
|
| 301 |
+
def update_fiber_angles_incremental(self, d_ex, d_ey, d_gxy):
|
| 302 |
+
"""
|
| 303 |
+
a_{n+1} = ΔF a_n / ||ΔF a_n|| with ΔF = [[1+Δex, Δgxy/2],[Δgxy/2, 1+Δey]]
|
| 304 |
+
Updates each ply's theta_curr_deg in-place.
|
| 305 |
+
"""
|
| 306 |
+
Fd = np.array([[1.0 + d_ex, 0.5*d_gxy],
|
| 307 |
+
[0.5*d_gxy, 1.0 + d_ey]], dtype=float) #valid for small strain increments
|
| 308 |
+
|
| 309 |
+
for p in self.plies:
|
| 310 |
+
th = np.radians(p.theta_curr_deg)
|
| 311 |
+
a = np.array([np.cos(th), np.sin(th)])
|
| 312 |
+
a_new = Fd @ a
|
| 313 |
+
nrm = np.linalg.norm(a_new)
|
| 314 |
+
if nrm > 1e-14:
|
| 315 |
+
a_new /= nrm
|
| 316 |
+
p.theta_curr_deg = np.degrees(np.arctan2(a_new[1], a_new[0]))
|
| 317 |
+
|
| 318 |
+
# ---------- Build effective laminate C from PREVIOUS global strains ----------
|
| 319 |
+
def effective_C_from_previous_strains(self, ex_prev, ey_prev, ezz_prev, g23_prev, g13_prev, gxy_prev):
|
| 320 |
+
"""
|
| 321 |
+
Thickness-average of per-ply global tangential stiffness matrices,
|
| 322 |
+
each built from tangents evaluated at the previous-step local strains.
|
| 323 |
+
"""
|
| 324 |
+
e_prev_global = np.array([ex_prev, ey_prev, ezz_prev, g23_prev, g13_prev, gxy_prev], float)
|
| 325 |
+
Csum = np.zeros((6,6), float)
|
| 326 |
+
for p in self.plies:
|
| 327 |
+
theta = p.theta_curr_deg
|
| 328 |
+
T_e = T_eps(theta)
|
| 329 |
+
T_e_inv = np.linalg.inv(T_e)
|
| 330 |
+
T_s = T_sigma(theta)
|
| 331 |
+
|
| 332 |
+
e_local_prev = T_e @ e_prev_global
|
| 333 |
+
|
| 334 |
+
|
| 335 |
+
#print(f"theta={theta}")
|
| 336 |
+
|
| 337 |
+
E1,E2,E3,G12,G13,G23 = p.mat.tangents_from_local_strain(e_local_prev)
|
| 338 |
+
Cprime = orthotropic_C_prime(E1,E2,E3,G12,G13,G23, p.mat.nu12, p.mat.nu13, p.mat.nu23)
|
| 339 |
+
|
| 340 |
+
|
| 341 |
+
|
| 342 |
+
Tt=T(theta)
|
| 343 |
+
Cglob = np.linalg.inv(Tt) @ Cprime @ np.linalg.inv(Tt).T
|
| 344 |
+
|
| 345 |
+
Csum += Cglob
|
| 346 |
+
return Csum / self.N
|
| 347 |
+
|
| 348 |
+
|
| 349 |
+
# ===============================================================
|
| 350 |
+
# Helpers for symmetric stacking from upper-half definition
|
| 351 |
+
# ===============================================================
|
| 352 |
+
|
| 353 |
+
def build_full_symmetric_stack(upper_angles):
|
| 354 |
+
"""
|
| 355 |
+
Given a list of angles for the *upper* half of the laminate,
|
| 356 |
+
build the full symmetric stack with opposite angles in the lower half.
|
| 357 |
+
Example: [0, 45, -45] -> [0, 45, -45, +45, -45, 0]
|
| 358 |
+
"""
|
| 359 |
+
upper = list(upper_angles)
|
| 360 |
+
lower = [-a for a in reversed(upper)]
|
| 361 |
+
return upper + lower
|
| 362 |
+
|
| 363 |
+
def _format_angle_for_label(a):
|
| 364 |
+
"""
|
| 365 |
+
Format a ply angle for use in filenames:
|
| 366 |
+
- integer degrees
|
| 367 |
+
- explicit sign (+ or -)
|
| 368 |
+
Examples:
|
| 369 |
+
45.0 -> '+45'
|
| 370 |
+
-30.0 -> '-30'
|
| 371 |
+
0.0 -> '+0'
|
| 372 |
+
"""
|
| 373 |
+
a_int = int(round(float(a)))
|
| 374 |
+
sign = "+" if a_int >= 0 else "-"
|
| 375 |
+
return f"{sign}{abs(a_int)}"
|
| 376 |
+
|
| 377 |
+
|
| 378 |
+
|
| 379 |
+
|
| 380 |
+
|
| 381 |
+
def stack_label_from_upper(upper_angles):
|
| 382 |
+
"""
|
| 383 |
+
Return a human-readable description of the *upper-half* stacking sequence,
|
| 384 |
+
with comma separation, e.g. [0, 45, -45] -> '0, 45, -45'.
|
| 385 |
+
"""
|
| 386 |
+
parts = []
|
| 387 |
+
for a in upper_angles:
|
| 388 |
+
# show integer degrees without .0
|
| 389 |
+
if float(a).is_integer():
|
| 390 |
+
parts.append(f"{int(a)}")
|
| 391 |
+
else:
|
| 392 |
+
parts.append(f"{a}")
|
| 393 |
+
return ", ".join(parts)
|
| 394 |
+
|
| 395 |
+
# ===============================================================
|
| 396 |
+
# 5D uniaxial test driver (σy=τxy=σz=τyz=τxz=0), incremental: ds = Ceff_prev @ de
|
| 397 |
+
# ===============================================================
|
| 398 |
+
|
| 399 |
+
|
| 400 |
+
|
| 401 |
+
def run_uniaxial_test_from_files_5d(prefix: str, stack_angles, mode="11"):
|
| 402 |
+
|
| 403 |
+
# ---- Material from files ----
|
| 404 |
+
|
| 405 |
+
tply = 0.05 #dummy value, doesn't effect the result
|
| 406 |
+
|
| 407 |
+
|
| 408 |
+
|
| 409 |
+
|
| 410 |
+
# ---- Layup from full stacking sequence ----
|
| 411 |
+
plies = [Ply(angle_deg, tply, mat) for angle_deg in stack_angles]
|
| 412 |
+
lam = Laminate(plies)
|
| 413 |
+
|
| 414 |
+
|
| 415 |
+
|
| 416 |
+
|
| 417 |
+
# ---- Choose loading mode and strain path ----
|
| 418 |
+
if mode == "11":
|
| 419 |
+
main_index = 0 # ε11
|
| 420 |
+
eps_max = 0.10
|
| 421 |
+
elif mode == "22":
|
| 422 |
+
main_index = 1 # ε22
|
| 423 |
+
eps_max = 0.10
|
| 424 |
+
elif mode == "12":
|
| 425 |
+
main_index = 5 # γ12 (engineering shear internally)
|
| 426 |
+
eps_max = 0.20 # ⇒ tensorial E12 = γ12/2 goes to 0.10
|
| 427 |
+
else:
|
| 428 |
+
raise ValueError("mode must be '11', '22' or '12'")
|
| 429 |
+
|
| 430 |
+
main_steps = np.linspace(0.0, eps_max, 1500) #1500 strain increments are chosen for a converged result
|
| 431 |
+
|
| 432 |
+
|
| 433 |
+
|
| 434 |
+
|
| 435 |
+
# ---- Histories (totals) ----
|
| 436 |
+
ex_hist, sx_hist = [], [] # main component strain & stress
|
| 437 |
+
ey_hist, gxy_hist = [], []
|
| 438 |
+
ezz_hist, g23_hist, g13_hist = [], [], []
|
| 439 |
+
e11_hist = [] # always store total ε11
|
| 440 |
+
|
| 441 |
+
|
| 442 |
+
|
| 443 |
+
# ---- Previous-step totals ----
|
| 444 |
+
ex_prev = 0.0
|
| 445 |
+
ey_prev = 0.0
|
| 446 |
+
gxy_prev = 0.0
|
| 447 |
+
ezz_prev = 0.0
|
| 448 |
+
g23_prev = 0.0
|
| 449 |
+
g13_prev = 0.0
|
| 450 |
+
s1_prev = 0.0
|
| 451 |
+
|
| 452 |
+
for i in range(1, len(main_steps)):
|
| 453 |
+
main_target = main_steps[i]
|
| 454 |
+
|
| 455 |
+
# Previous value of the driven strain component
|
| 456 |
+
if main_index == 0:
|
| 457 |
+
main_prev = ex_prev
|
| 458 |
+
elif main_index == 1:
|
| 459 |
+
main_prev = ey_prev
|
| 460 |
+
else: # main_index == 5 (γ12)
|
| 461 |
+
main_prev = gxy_prev
|
| 462 |
+
|
| 463 |
+
# Increment in prescribed "main" strain (ε11 / ε22 / γ12)
|
| 464 |
+
dmain = main_target - main_prev
|
| 465 |
+
|
| 466 |
+
# Tangent Ceff at previous state from laminate
|
| 467 |
+
Ceff_prev = lam.effective_C_from_previous_strains(
|
| 468 |
+
ex_prev, ey_prev, ezz_prev, g23_prev, g13_prev, gxy_prev
|
| 469 |
+
)
|
| 470 |
+
|
| 471 |
+
# ---- Safeguard: check conditioning of Ceff_prev ----
|
| 472 |
+
cond = np.linalg.cond(Ceff_prev)
|
| 473 |
+
if not np.isfinite(cond) or cond > COND_MAX:
|
| 474 |
+
raise np.linalg.LinAlgError(
|
| 475 |
+
f"Effective C is ill-conditioned (cond={cond:.3e}) at step {i}"
|
| 476 |
+
)
|
| 477 |
+
|
| 478 |
+
# Compute ONLY the column of the compliance needed via solve,
|
| 479 |
+
# instead of inverting the full 6x6 matrix.
|
| 480 |
+
e_j = np.zeros(6)
|
| 481 |
+
e_j[main_index] = 1.0
|
| 482 |
+
|
| 483 |
+
try:
|
| 484 |
+
# S_col satisfies: Ceff_prev @ S_col = e_j
|
| 485 |
+
S_col = np.linalg.solve(Ceff_prev, e_j)
|
| 486 |
+
except np.linalg.LinAlgError as err:
|
| 487 |
+
raise np.linalg.LinAlgError(
|
| 488 |
+
f"Failed to solve for compliance column at step {i}: {err}"
|
| 489 |
+
)
|
| 490 |
+
|
| 491 |
+
Sjj = S_col[main_index]
|
| 492 |
+
if abs(Sjj) < 1e-20:
|
| 493 |
+
raise ZeroDivisionError(
|
| 494 |
+
f"Sjj is zero or too small at step {i} (Sjj={Sjj:.3e})."
|
| 495 |
+
)
|
| 496 |
+
|
| 497 |
+
|
| 498 |
+
ds1 = dmain / Sjj
|
| 499 |
+
de_vec = S_col * ds1
|
| 500 |
+
# enforce exactly the prescribed main increment
|
| 501 |
+
de_vec[main_index] = dmain
|
| 502 |
+
|
| 503 |
+
|
| 504 |
+
|
| 505 |
+
|
| 506 |
+
|
| 507 |
+
|
| 508 |
+
de1, de2, de3, de4, de5, de6 = de_vec
|
| 509 |
+
de4 = 0.0
|
| 510 |
+
de5 = 0.0
|
| 511 |
+
|
| 512 |
+
# (4) Update totals
|
| 513 |
+
s1 = s1_prev + ds1
|
| 514 |
+
ex = ex_prev + de1
|
| 515 |
+
ey = ey_prev + de2
|
| 516 |
+
ezz = ezz_prev + de3
|
| 517 |
+
g23 = g23_prev + de4
|
| 518 |
+
g13 = g13_prev + de5
|
| 519 |
+
gxy = gxy_prev + de6
|
| 520 |
+
|
| 521 |
+
# (5) Update fibre angles from INCREMENTS (Δex, Δey, Δγxy)
|
| 522 |
+
lam.update_fiber_angles_incremental(de1, de2, de6)
|
| 523 |
+
|
| 524 |
+
# (6) Commit for next step
|
| 525 |
+
ex_prev, ey_prev, ezz_prev = ex, ey, ezz
|
| 526 |
+
g23_prev, g13_prev, gxy_prev = g23, g13, gxy
|
| 527 |
+
s1_prev = s1
|
| 528 |
+
|
| 529 |
+
|
| 530 |
+
|
| 531 |
+
# (7) Save totals for output
|
| 532 |
+
# ex_hist stores the *driven* component: ε11, ε22, or *tensorial* E12 = γ12/2
|
| 533 |
+
if main_index == 0:
|
| 534 |
+
main_strain = ex
|
| 535 |
+
elif main_index == 1:
|
| 536 |
+
main_strain = ey
|
| 537 |
+
else: # shear
|
| 538 |
+
main_strain = 0.5 * gxy # convert engineering γ12 -> tensorial E12
|
| 539 |
+
|
| 540 |
+
|
| 541 |
+
ex_hist.append(main_strain)
|
| 542 |
+
sx_hist.append(s1)
|
| 543 |
+
ey_hist.append(ey); gxy_hist.append(gxy)
|
| 544 |
+
ezz_hist.append(ezz); g23_hist.append(g23); g13_hist.append(g13)
|
| 545 |
+
e11_hist.append(ex) # store true ε11 regardless of mode
|
| 546 |
+
|
| 547 |
+
|
| 548 |
+
|
| 549 |
+
|
| 550 |
+
angles_str = ", ".join(f"{p.theta_curr_deg:.2f}°" for p in lam.plies)
|
| 551 |
+
|
| 552 |
+
|
| 553 |
+
|
| 554 |
+
return (np.array(ex_hist), np.array(sx_hist),
|
| 555 |
+
np.array(ey_hist), np.array(gxy_hist),
|
| 556 |
+
np.array(ezz_hist), np.array(g23_hist), np.array(g13_hist),
|
| 557 |
+
np.array(e11_hist))
|
| 558 |
+
|
| 559 |
+
|
| 560 |
+
|
| 561 |
+
|
| 562 |
+
if __name__ == "__main__":
|
| 563 |
+
|
| 564 |
+
# ---- estimate total number of laminate output files ----
|
| 565 |
+
n_mat = len(MATERIAL_TYPES)
|
| 566 |
+
n_vf = len(VOL_FRACTIONS)
|
| 567 |
+
n_inst = len(INSTANCES)
|
| 568 |
+
n_ang = len(CANDIDATE_ANGLES)
|
| 569 |
+
|
| 570 |
+
# combinations-with-replacement count for each upper-half ply count
|
| 571 |
+
n_stacks_per_instance = sum(
|
| 572 |
+
comb(n_ang + n_layers - 1, n_layers) for n_layers in UPPER_LAYER_COUNTS
|
| 573 |
+
)
|
| 574 |
+
|
| 575 |
+
expected_files = n_mat * n_vf * n_inst * n_stacks_per_instance
|
| 576 |
+
print(f"Expected number of laminate output files: {expected_files}")
|
| 577 |
+
|
| 578 |
+
file_count = 0
|
| 579 |
+
for mat_type in MATERIAL_TYPES:
|
| 580 |
+
for vf in VOL_FRACTIONS:
|
| 581 |
+
vf_str = vf
|
| 582 |
+
|
| 583 |
+
for inst in INSTANCES:
|
| 584 |
+
prefix = f"{mat_type}_{vf_str}_{inst}"
|
| 585 |
+
vf_meta, centers_meta, n_fibers = read_instance_metadata(prefix)
|
| 586 |
+
mat = load_ud_material_from_files(prefix)
|
| 587 |
+
|
| 588 |
+
# ---- loop over upper-half stacking sequences ----
|
| 589 |
+
for n_layers in UPPER_LAYER_COUNTS:
|
| 590 |
+
for upper_angles in combinations_with_replacement(CANDIDATE_ANGLES, n_layers):
|
| 591 |
+
upper_angles = list(upper_angles)
|
| 592 |
+
full_angles = build_full_symmetric_stack(upper_angles)
|
| 593 |
+
|
| 594 |
+
# human-readable label for this stacking (upper half only)
|
| 595 |
+
stack_label_human = stack_label_from_upper(upper_angles) # e.g. "0, 30, -45"
|
| 596 |
+
stack_label_file = "_".join(s.strip().replace("+", "p").replace("-", "m")
|
| 597 |
+
for s in stack_label_human.split(","))
|
| 598 |
+
|
| 599 |
+
combined_blocks = {}
|
| 600 |
+
|
| 601 |
+
|
| 602 |
+
for mode in ("11", "22", "12"):
|
| 603 |
+
|
| 604 |
+
|
| 605 |
+
try:
|
| 606 |
+
# main strain, stress, ε22, γ12, ε33, γ23, γ13, ε11
|
| 607 |
+
ex, sx, ey, gxy, ezz, g23, g13, e11 = run_uniaxial_test_from_files_5d(
|
| 608 |
+
prefix,
|
| 609 |
+
full_angles,
|
| 610 |
+
mode=mode,
|
| 611 |
+
)
|
| 612 |
+
except Exception as e:
|
| 613 |
+
print(f"Skipping {prefix}, stack={stack_label_human} due to error: {e}")
|
| 614 |
+
continue
|
| 615 |
+
|
| 616 |
+
|
| 617 |
+
# 10 equally spaced output points in the driven (main) strain
|
| 618 |
+
N = 10
|
| 619 |
+
x_out = np.linspace(ex[0], ex[-1], N)
|
| 620 |
+
sx_out_MPa = np.interp(x_out, ex, sx/1e6)
|
| 621 |
+
|
| 622 |
+
# Pick Voigt-notation headers and lateral strain based on mode
|
| 623 |
+
if mode == "11":
|
| 624 |
+
strain_label = "eps_11"
|
| 625 |
+
stress_label = "sig_11"
|
| 626 |
+
lateral_label = "eps_22"
|
| 627 |
+
lateral_series = ey # ε22 is lateral in 11-test
|
| 628 |
+
elif mode == "22":
|
| 629 |
+
strain_label = "eps_22"
|
| 630 |
+
stress_label = "sig_22"
|
| 631 |
+
lateral_label = "eps_11"
|
| 632 |
+
lateral_series = e11 # ε11 is lateral in 22-test
|
| 633 |
+
elif mode == "12":
|
| 634 |
+
strain_label = "eps_12"
|
| 635 |
+
stress_label = "sig_12"
|
| 636 |
+
lateral_label = None
|
| 637 |
+
lateral_series = None
|
| 638 |
+
else:
|
| 639 |
+
raise ValueError(f"Unknown mode {mode}")
|
| 640 |
+
|
| 641 |
+
|
| 642 |
+
|
| 643 |
+
# Build lateral output (if any) on the same main-strain grid
|
| 644 |
+
if lateral_series is not None:
|
| 645 |
+
lateral_out = np.interp(x_out, ex, lateral_series)
|
| 646 |
+
else:
|
| 647 |
+
lateral_out = None
|
| 648 |
+
|
| 649 |
+
# Build header line and numeric rows (strings) for this mode
|
| 650 |
+
if lateral_label is None:
|
| 651 |
+
# shear case (12): two columns
|
| 652 |
+
header_line = f"{strain_label:<8} {stress_label:<8}"
|
| 653 |
+
else:
|
| 654 |
+
# tensile 11 or 22: three columns
|
| 655 |
+
header_line = f"{strain_label:<8} {stress_label:<8} {lateral_label:<8}"
|
| 656 |
+
|
| 657 |
+
rows = []
|
| 658 |
+
if lateral_label is None:
|
| 659 |
+
# two columns: eps, sig
|
| 660 |
+
for eps_val, sig_val in zip(x_out, sx_out_MPa):
|
| 661 |
+
line = f"{eps_val:8.6f} {sig_val:8.3f}"
|
| 662 |
+
rows.append(line)
|
| 663 |
+
else:
|
| 664 |
+
# three columns: eps, sig, lateral_eps
|
| 665 |
+
for eps_val, sig_val, lat_val in zip(x_out, sx_out_MPa, lateral_out):
|
| 666 |
+
line = f"{eps_val:8.6f} {sig_val:8.3f} {lat_val:8.6f}"
|
| 667 |
+
rows.append(line)
|
| 668 |
+
|
| 669 |
+
# store this block for the combined file
|
| 670 |
+
combined_blocks[mode] = (header_line, rows)
|
| 671 |
+
|
| 672 |
+
|
| 673 |
+
# ---- write combined file: 11, then 22, then 12, then common metadata ----
|
| 674 |
+
OUT_DIR_ALL.mkdir(parents=True, exist_ok=True)
|
| 675 |
+
combined_file = OUT_DIR_ALL / (
|
| 676 |
+
f"{mat_type}_{vf_str}_{inst}_{stack_label_file}.txt"
|
| 677 |
+
)
|
| 678 |
+
|
| 679 |
+
with open(combined_file, "w") as fc:
|
| 680 |
+
# write 11, then 22, then 12 in order
|
| 681 |
+
for m in ("11", "22", "12"):
|
| 682 |
+
header_line, rows = combined_blocks[m]
|
| 683 |
+
fc.write(header_line + "\n")
|
| 684 |
+
for line in rows:
|
| 685 |
+
fc.write(line + "\n")
|
| 686 |
+
fc.write("\n")
|
| 687 |
+
|
| 688 |
+
# one common metadata block at the end
|
| 689 |
+
fc.write(f"volume fraction= {vf_meta:.6f}\n")
|
| 690 |
+
fc.write(f"material type= {mat_type}\n")
|
| 691 |
+
fc.write("loading modes= 11, 22, 12\n")
|
| 692 |
+
fc.write(f"stacking sequence= {stack_label_human}\n")
|
| 693 |
+
fc.write(f"instance= {inst}\n")
|
| 694 |
+
fc.write(f"number of fibers= {n_fibers}\n")
|
| 695 |
+
fc.write(f"fiber_centers_YZ={centers_meta}\n")
|
| 696 |
+
|
| 697 |
+
|
| 698 |
+
file_count += 1
|
| 699 |
+
if file_count % 500 == 0 or file_count == expected_files:
|
| 700 |
+
print(f"Generated {file_count}/{expected_files} files")
|
| 701 |
+
|
| 702 |
+
|
| 703 |
+
|
| 704 |
+
|
| 705 |
+
|
| 706 |
+
|
| 707 |
+
|
data_generation/hf_space_generation_ro/models.py
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Compatibility shim for torch checkpoint loading.
|
| 3 |
+
|
| 4 |
+
Some training checkpoints were saved with objects pickled from a top-level module
|
| 5 |
+
named `models` (e.g. `models.ModelConfig`, `models.MaterialHybridDenoiser`).
|
| 6 |
+
|
| 7 |
+
In the Hugging Face Space we keep the implementation in `space_lib/models.py`,
|
| 8 |
+
but we also provide this top-level module so `torch.load()` can unpickle.
|
| 9 |
+
"""
|
| 10 |
+
|
| 11 |
+
from space_lib.models import ( # noqa: F401
|
| 12 |
+
ModelConfig,
|
| 13 |
+
MaterialHybridDenoiser,
|
| 14 |
+
SelfCrossAttnBlock,
|
| 15 |
+
timestep_embedding,
|
| 16 |
+
)
|
| 17 |
+
|
data_generation/hf_space_generation_ro/requirements.txt
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
gradio==4.44.1
|
| 2 |
+
numpy==1.26.4
|
| 3 |
+
matplotlib==3.8.4
|
| 4 |
+
torch==2.2.2
|
| 5 |
+
tqdm==4.66.4
|
| 6 |
+
pyyaml==6.0.2
|
data_generation/hf_space_generation_ro/space_lib/__init__.py
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Space-local library for RO-conditioned hybrid diffusion material generation."""
|
| 2 |
+
|
data_generation/hf_space_generation_ro/space_lib/infer.py
ADDED
|
@@ -0,0 +1,262 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
|
| 3 |
+
import json
|
| 4 |
+
import os
|
| 5 |
+
from dataclasses import dataclass
|
| 6 |
+
from typing import Dict, Optional, Tuple
|
| 7 |
+
|
| 8 |
+
import numpy as np
|
| 9 |
+
import pickle
|
| 10 |
+
import torch
|
| 11 |
+
import torch.nn.functional as F
|
| 12 |
+
|
| 13 |
+
from .models import MaterialHybridDenoiser, ModelConfig
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
VF_CATEGORIES = [0.0924, 0.2155, 0.3079, 0.4002, 0.4926]
|
| 17 |
+
MATERIAL_NAMES = ["CPP", "CHDPE", "GPP", "GHDPE"]
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
@dataclass(frozen=True)
|
| 21 |
+
class DiscreteMaskDiffusion:
|
| 22 |
+
T: int
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
class GaussianDiffusion:
|
| 26 |
+
def __init__(self, T: int, beta_start: float = 1e-4, beta_end: float = 2e-2, device: str = "cpu"):
|
| 27 |
+
self.T = int(T)
|
| 28 |
+
betas = torch.linspace(beta_start, beta_end, self.T, device=device)
|
| 29 |
+
alphas = 1.0 - betas
|
| 30 |
+
alpha_bar = torch.cumprod(alphas, dim=0)
|
| 31 |
+
self.betas = betas
|
| 32 |
+
self.alphas = alphas
|
| 33 |
+
self.sqrt_alpha_bar = torch.sqrt(alpha_bar)
|
| 34 |
+
self.sqrt_one_minus_alpha_bar = torch.sqrt(1.0 - alpha_bar)
|
| 35 |
+
self.sqrt_recip_alphas = torch.sqrt(1.0 / alphas)
|
| 36 |
+
|
| 37 |
+
@torch.no_grad()
|
| 38 |
+
def p_sample_step(self, x_t: torch.Tensor, t: torch.Tensor, eps_pred: torch.Tensor) -> torch.Tensor:
|
| 39 |
+
beta_t = self.betas[t].view(-1, 1, 1)
|
| 40 |
+
sqrt_recip_alpha_t = self.sqrt_recip_alphas[t].view(-1, 1, 1)
|
| 41 |
+
sqrt_one_minus_a_bar = self.sqrt_one_minus_alpha_bar[t].view(-1, 1, 1)
|
| 42 |
+
mu = sqrt_recip_alpha_t * (x_t - (beta_t / sqrt_one_minus_a_bar.clamp_min(1e-8)) * eps_pred)
|
| 43 |
+
noise = torch.randn_like(x_t)
|
| 44 |
+
nonzero_mask = (t != 0).float().view(-1, 1, 1)
|
| 45 |
+
return mu + nonzero_mask * torch.sqrt(beta_t) * noise
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
@torch.no_grad()
|
| 49 |
+
def sample(
|
| 50 |
+
model: MaterialHybridDenoiser,
|
| 51 |
+
disc_diff_mat: DiscreteMaskDiffusion,
|
| 52 |
+
disc_diff_vf_category: DiscreteMaskDiffusion,
|
| 53 |
+
disc_diff_layer: DiscreteMaskDiffusion,
|
| 54 |
+
disc_diff_angle: Optional[DiscreteMaskDiffusion] = None,
|
| 55 |
+
cont_diff: Optional[GaussianDiffusion] = None,
|
| 56 |
+
cond: torch.Tensor = None,
|
| 57 |
+
mask_ids: Dict[str, int] = None,
|
| 58 |
+
device: str = "cpu",
|
| 59 |
+
remask_prob: float = 0.1,
|
| 60 |
+
use_discrete_angles: bool = True,
|
| 61 |
+
) -> Dict[str, torch.Tensor]:
|
| 62 |
+
model.eval()
|
| 63 |
+
B = cond.shape[0]
|
| 64 |
+
L = model.cfg.n_max_layer
|
| 65 |
+
|
| 66 |
+
x_material_t = torch.full((B,), mask_ids["material"], dtype=torch.long, device=device)
|
| 67 |
+
x_vf_category_t = torch.full((B,), mask_ids["vf_category"], dtype=torch.long, device=device)
|
| 68 |
+
x_layer_t = torch.full((B, L), mask_ids["layer"], dtype=torch.long, device=device)
|
| 69 |
+
|
| 70 |
+
if use_discrete_angles:
|
| 71 |
+
if disc_diff_angle is None:
|
| 72 |
+
raise ValueError("disc_diff_angle is required when use_discrete_angles=True")
|
| 73 |
+
if "angle" not in mask_ids:
|
| 74 |
+
raise ValueError("mask_ids must include 'angle' when use_discrete_angles=True")
|
| 75 |
+
x_angle_t = torch.full((B, L), mask_ids["angle"], dtype=torch.long, device=device)
|
| 76 |
+
T = disc_diff_angle.T
|
| 77 |
+
else:
|
| 78 |
+
if cont_diff is None:
|
| 79 |
+
raise ValueError("cont_diff is required when use_discrete_angles=False")
|
| 80 |
+
x_angle_t = torch.randn(B, L, 1, device=device)
|
| 81 |
+
T = cont_diff.T
|
| 82 |
+
|
| 83 |
+
for t_int in reversed(range(T)):
|
| 84 |
+
t = torch.full((B,), t_int, dtype=torch.long, device=device)
|
| 85 |
+
outputs = model(x_material_t, x_vf_category_t, x_layer_t, x_angle_t, cond, t)
|
| 86 |
+
|
| 87 |
+
probs_mat = F.softmax(outputs["material_logits"], dim=-1)
|
| 88 |
+
remask_mat = (x_material_t == mask_ids["material"]) | (torch.rand(B, device=device) < remask_prob)
|
| 89 |
+
if remask_mat.any():
|
| 90 |
+
new_material = torch.multinomial(probs_mat[remask_mat], 1).squeeze(-1)
|
| 91 |
+
x_material_t = x_material_t.clone()
|
| 92 |
+
x_material_t[remask_mat] = new_material
|
| 93 |
+
|
| 94 |
+
probs_vf = F.softmax(outputs["vf_category_logits"], dim=-1)
|
| 95 |
+
remask_vf = (x_vf_category_t == mask_ids["vf_category"]) | (torch.rand(B, device=device) < remask_prob)
|
| 96 |
+
if remask_vf.any():
|
| 97 |
+
new_vf = torch.multinomial(probs_vf[remask_vf], 1).squeeze(-1)
|
| 98 |
+
x_vf_category_t = x_vf_category_t.clone()
|
| 99 |
+
x_vf_category_t[remask_vf] = new_vf
|
| 100 |
+
|
| 101 |
+
if use_discrete_angles:
|
| 102 |
+
probs_angle = F.softmax(outputs["angle_logits"], dim=-1) # (B,L,K+1)
|
| 103 |
+
remask_angle = (torch.rand(B, L, device=device) < remask_prob)
|
| 104 |
+
masked = (x_angle_t == mask_ids["angle"]) | remask_angle
|
| 105 |
+
if masked.any():
|
| 106 |
+
flat_probs = probs_angle.view(-1, probs_angle.size(-1))[masked.view(-1)]
|
| 107 |
+
new_angle = torch.multinomial(flat_probs, 1).squeeze(-1)
|
| 108 |
+
x_angle_t = x_angle_t.clone()
|
| 109 |
+
x_angle_t[masked] = new_angle
|
| 110 |
+
|
| 111 |
+
dead_category = probs_angle.size(-1) - 1
|
| 112 |
+
x_layer_t = (x_angle_t != dead_category).long()
|
| 113 |
+
else:
|
| 114 |
+
probs_layer = F.softmax(outputs["layer_logits"], dim=-1) # (B,L,2)
|
| 115 |
+
remask_layer = (torch.rand(B, L, device=device) < remask_prob)
|
| 116 |
+
masked = (x_layer_t == mask_ids["layer"]) | remask_layer
|
| 117 |
+
if masked.any():
|
| 118 |
+
flat_probs = probs_layer.view(-1, 2)[masked.view(-1)]
|
| 119 |
+
new_layer = torch.multinomial(flat_probs, 1).squeeze(-1)
|
| 120 |
+
x_layer_t = x_layer_t.clone()
|
| 121 |
+
x_layer_t[masked] = new_layer
|
| 122 |
+
|
| 123 |
+
angle_pred = outputs["angle"]
|
| 124 |
+
sqrt_alpha_bar_t = cont_diff.sqrt_alpha_bar[t].view(-1, 1, 1)
|
| 125 |
+
sqrt_one_minus_alpha_bar_t = cont_diff.sqrt_one_minus_alpha_bar[t].view(-1, 1, 1)
|
| 126 |
+
eps_pred = (x_angle_t - sqrt_alpha_bar_t * angle_pred) / sqrt_one_minus_alpha_bar_t.clamp_min(1e-8)
|
| 127 |
+
x_angle_t = cont_diff.p_sample_step(x_angle_t, t, eps_pred)
|
| 128 |
+
|
| 129 |
+
return {"material_t": x_material_t, "vf_category_t": x_vf_category_t, "layer_t": x_layer_t, "angle_t": x_angle_t}
|
| 130 |
+
|
| 131 |
+
|
| 132 |
+
@dataclass
|
| 133 |
+
class ModelBundle:
|
| 134 |
+
model: MaterialHybridDenoiser
|
| 135 |
+
disc_diff_mat: DiscreteMaskDiffusion
|
| 136 |
+
disc_diff_vf_category: DiscreteMaskDiffusion
|
| 137 |
+
disc_diff_layer: DiscreteMaskDiffusion
|
| 138 |
+
disc_diff_angle: Optional[DiscreteMaskDiffusion]
|
| 139 |
+
cont_diff: Optional[GaussianDiffusion]
|
| 140 |
+
mask_ids: Dict[str, int]
|
| 141 |
+
use_discrete_angles: bool
|
| 142 |
+
T: int
|
| 143 |
+
beta_start: float
|
| 144 |
+
beta_end: float
|
| 145 |
+
angle_resolution: float
|
| 146 |
+
|
| 147 |
+
|
| 148 |
+
def _load_state_dict_safely(obj) -> Dict[str, torch.Tensor]:
|
| 149 |
+
if isinstance(obj, dict):
|
| 150 |
+
for k in ("model_state_dict", "state_dict", "model"):
|
| 151 |
+
if k in obj and isinstance(obj[k], dict):
|
| 152 |
+
return obj[k]
|
| 153 |
+
# If it already looks like a state_dict
|
| 154 |
+
if all(isinstance(v, torch.Tensor) for v in obj.values()):
|
| 155 |
+
return obj # type: ignore[return-value]
|
| 156 |
+
raise ValueError("Unrecognized checkpoint format (expected dict with model state_dict)")
|
| 157 |
+
|
| 158 |
+
|
| 159 |
+
def load_model_bundle(checkpoint_dir: str, device: Optional[str] = None, angle_resolution: float = 1.0) -> ModelBundle:
|
| 160 |
+
cfg_path = os.path.join(checkpoint_dir, "training_config.json")
|
| 161 |
+
with open(cfg_path, "r") as f:
|
| 162 |
+
train_cfg = json.load(f)
|
| 163 |
+
|
| 164 |
+
use_discrete_angles = bool(train_cfg.get("use_discrete_angles", True))
|
| 165 |
+
model_cfg = ModelConfig(**train_cfg["model_config"])
|
| 166 |
+
|
| 167 |
+
if device is None:
|
| 168 |
+
device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 169 |
+
|
| 170 |
+
mask_ids = dict(train_cfg.get("mask_ids", {}))
|
| 171 |
+
# Angle category count only matters for discrete mode. We default to 7 if not present.
|
| 172 |
+
n_angle_categories = int(train_cfg.get("n_angle_categories", 7))
|
| 173 |
+
# IMPORTANT: match training model signature exactly (cfg, mask_ids, use_discrete_angles, n_angle_categories)
|
| 174 |
+
model = MaterialHybridDenoiser(
|
| 175 |
+
model_cfg,
|
| 176 |
+
mask_ids=mask_ids,
|
| 177 |
+
use_discrete_angles=use_discrete_angles,
|
| 178 |
+
n_angle_categories=n_angle_categories,
|
| 179 |
+
).to(device)
|
| 180 |
+
|
| 181 |
+
# Load checkpoint (prefer best_model.pt)
|
| 182 |
+
ckpt_path = os.path.join(checkpoint_dir, "best_model.pt")
|
| 183 |
+
if not os.path.exists(ckpt_path):
|
| 184 |
+
ckpt_path = os.path.join(checkpoint_dir, "checkpoint_epoch_1.pt")
|
| 185 |
+
# Some checkpoints may contain pickled objects referencing the original training module
|
| 186 |
+
# layout (e.g. top-level `models`). We ship a compatibility `models.py` in the Space.
|
| 187 |
+
# Also prefer weights-only loading when supported to avoid unpickling non-tensor objects.
|
| 188 |
+
try:
|
| 189 |
+
ckpt = torch.load(ckpt_path, map_location=device, weights_only=True) # type: ignore[call-arg]
|
| 190 |
+
except TypeError:
|
| 191 |
+
ckpt = torch.load(ckpt_path, map_location=device)
|
| 192 |
+
except pickle.UnpicklingError:
|
| 193 |
+
# PyTorch raised because weights-only loader encountered non-tensor objects
|
| 194 |
+
# (e.g. models.ModelConfig). We trust this checkpoint (bundled by us), so fall back.
|
| 195 |
+
ckpt = torch.load(ckpt_path, map_location=device, weights_only=False) # type: ignore[call-arg]
|
| 196 |
+
state_dict = _load_state_dict_safely(ckpt)
|
| 197 |
+
# Enforce exact match with checkpoint; otherwise generation can look arbitrarily bad.
|
| 198 |
+
model.load_state_dict(state_dict, strict=True)
|
| 199 |
+
|
| 200 |
+
T = int(train_cfg.get("T", 100))
|
| 201 |
+
beta_start = float(train_cfg.get("beta_start", 1e-4))
|
| 202 |
+
beta_end = float(train_cfg.get("beta_end", 2e-2))
|
| 203 |
+
|
| 204 |
+
disc = DiscreteMaskDiffusion(T=T)
|
| 205 |
+
disc_angle = DiscreteMaskDiffusion(T=T) if use_discrete_angles else None
|
| 206 |
+
cont = GaussianDiffusion(T=T, beta_start=beta_start, beta_end=beta_end, device=device) if not use_discrete_angles else None
|
| 207 |
+
|
| 208 |
+
# Some training configs omit angle mask when continuous; for discrete, define a reasonable default if missing.
|
| 209 |
+
if use_discrete_angles and "angle" not in mask_ids:
|
| 210 |
+
# categories: n_angle_categories + dead (1) -> +1 ; then mask id is last index
|
| 211 |
+
mask_ids["angle"] = n_angle_categories + 1
|
| 212 |
+
|
| 213 |
+
return ModelBundle(
|
| 214 |
+
model=model,
|
| 215 |
+
disc_diff_mat=disc,
|
| 216 |
+
disc_diff_vf_category=disc,
|
| 217 |
+
disc_diff_layer=disc,
|
| 218 |
+
disc_diff_angle=disc_angle,
|
| 219 |
+
cont_diff=cont,
|
| 220 |
+
mask_ids=mask_ids,
|
| 221 |
+
use_discrete_angles=use_discrete_angles,
|
| 222 |
+
T=T,
|
| 223 |
+
beta_start=beta_start,
|
| 224 |
+
beta_end=beta_end,
|
| 225 |
+
angle_resolution=float(angle_resolution),
|
| 226 |
+
)
|
| 227 |
+
|
| 228 |
+
|
| 229 |
+
def vf_category_to_volume_fraction(vf_category: int) -> float:
|
| 230 |
+
vf_category = int(vf_category)
|
| 231 |
+
if 0 <= vf_category < len(VF_CATEGORIES):
|
| 232 |
+
return float(VF_CATEGORIES[vf_category])
|
| 233 |
+
return float(VF_CATEGORIES[0])
|
| 234 |
+
|
| 235 |
+
|
| 236 |
+
def postprocess_sample(
|
| 237 |
+
out: Dict[str, torch.Tensor],
|
| 238 |
+
use_discrete_angles: bool,
|
| 239 |
+
angle_categories_deg: Optional[np.ndarray],
|
| 240 |
+
) -> Tuple[str, float, list[float]]:
|
| 241 |
+
mat_idx = int(out["material_t"].item())
|
| 242 |
+
vf_idx = int(out["vf_category_t"].item())
|
| 243 |
+
mat = MATERIAL_NAMES[mat_idx] if 0 <= mat_idx < len(MATERIAL_NAMES) else f"MAT{mat_idx}"
|
| 244 |
+
vf = vf_category_to_volume_fraction(vf_idx)
|
| 245 |
+
|
| 246 |
+
layer = out["layer_t"].detach().cpu().numpy()[0]
|
| 247 |
+
angle = out["angle_t"].detach().cpu().numpy()[0]
|
| 248 |
+
|
| 249 |
+
if use_discrete_angles:
|
| 250 |
+
if angle_categories_deg is None:
|
| 251 |
+
raise ValueError("angle_categories_deg is required for discrete angles")
|
| 252 |
+
dead_category = int(len(angle_categories_deg))
|
| 253 |
+
alive_mask = angle != dead_category
|
| 254 |
+
angle_cats = angle[alive_mask].astype(int)
|
| 255 |
+
angles_deg = [float(angle_categories_deg[c]) for c in angle_cats]
|
| 256 |
+
else:
|
| 257 |
+
alive_mask = layer == 1
|
| 258 |
+
vals = angle[alive_mask, 0] if angle.ndim > 1 else angle[alive_mask]
|
| 259 |
+
angles_deg = np.rad2deg(vals).astype(np.float32).tolist()
|
| 260 |
+
|
| 261 |
+
return mat, vf, sorted([float(a) for a in angles_deg])
|
| 262 |
+
|
data_generation/hf_space_generation_ro/space_lib/metadata.py
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
|
| 3 |
+
import json
|
| 4 |
+
import os
|
| 5 |
+
from dataclasses import dataclass
|
| 6 |
+
from typing import Any, Dict, Tuple
|
| 7 |
+
|
| 8 |
+
import numpy as np
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
RO_DROP_FLAT_IDXS = (5, 11) # padded zeros in flattened [5,3]
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
@dataclass(frozen=True)
|
| 15 |
+
class ROMetadata:
|
| 16 |
+
raw: Dict[str, Any]
|
| 17 |
+
ro_min_full: np.ndarray # (15,)
|
| 18 |
+
ro_max_full: np.ndarray # (15,)
|
| 19 |
+
ro_mean_full: np.ndarray | None # (15,) or None
|
| 20 |
+
ro_std_full: np.ndarray | None # (15,) or None
|
| 21 |
+
eps_11_scale: float
|
| 22 |
+
eps_22_scale: float
|
| 23 |
+
eps_12_scale: float
|
| 24 |
+
|
| 25 |
+
@property
|
| 26 |
+
def ro_min_13(self) -> np.ndarray:
|
| 27 |
+
keep = _keep_mask_15()
|
| 28 |
+
return self.ro_min_full[keep]
|
| 29 |
+
|
| 30 |
+
@property
|
| 31 |
+
def ro_max_13(self) -> np.ndarray:
|
| 32 |
+
keep = _keep_mask_15()
|
| 33 |
+
return self.ro_max_full[keep]
|
| 34 |
+
|
| 35 |
+
@property
|
| 36 |
+
def ro_mean_13(self) -> np.ndarray | None:
|
| 37 |
+
if self.ro_mean_full is None:
|
| 38 |
+
return None
|
| 39 |
+
keep = _keep_mask_15()
|
| 40 |
+
return self.ro_mean_full[keep]
|
| 41 |
+
|
| 42 |
+
@property
|
| 43 |
+
def ro_std_13(self) -> np.ndarray | None:
|
| 44 |
+
if self.ro_std_full is None:
|
| 45 |
+
return None
|
| 46 |
+
keep = _keep_mask_15()
|
| 47 |
+
return self.ro_std_full[keep]
|
| 48 |
+
|
| 49 |
+
|
| 50 |
+
def _keep_mask_15() -> np.ndarray:
|
| 51 |
+
keep = np.ones(15, dtype=bool)
|
| 52 |
+
keep[list(RO_DROP_FLAT_IDXS)] = False
|
| 53 |
+
return keep
|
| 54 |
+
|
| 55 |
+
|
| 56 |
+
def load_metadata_ro(data_dir: str) -> ROMetadata:
|
| 57 |
+
path = os.path.join(data_dir, "metadata_ro.json")
|
| 58 |
+
with open(path, "r") as f:
|
| 59 |
+
raw = json.load(f)
|
| 60 |
+
|
| 61 |
+
ro_min_full = np.asarray(raw["ramberg_osgood_param_min"], dtype=np.float32)
|
| 62 |
+
ro_max_full = np.asarray(raw["ramberg_osgood_param_max"], dtype=np.float32)
|
| 63 |
+
ro_mean_full = raw.get("ramberg_osgood_param_mean", None)
|
| 64 |
+
ro_std_full = raw.get("ramberg_osgood_param_std", None)
|
| 65 |
+
|
| 66 |
+
ro_mean_arr = np.asarray(ro_mean_full, dtype=np.float32) if ro_mean_full is not None else None
|
| 67 |
+
ro_std_arr = np.asarray(ro_std_full, dtype=np.float32) if ro_std_full is not None else None
|
| 68 |
+
|
| 69 |
+
return ROMetadata(
|
| 70 |
+
raw=raw,
|
| 71 |
+
ro_min_full=ro_min_full,
|
| 72 |
+
ro_max_full=ro_max_full,
|
| 73 |
+
ro_mean_full=ro_mean_arr,
|
| 74 |
+
ro_std_full=ro_std_arr,
|
| 75 |
+
eps_11_scale=float(raw.get("eps_11_scale", 0.1)),
|
| 76 |
+
eps_22_scale=float(raw.get("eps_22_scale", 0.1)),
|
| 77 |
+
eps_12_scale=float(raw.get("eps_12_scale", 0.1)),
|
| 78 |
+
)
|
| 79 |
+
|
| 80 |
+
|
| 81 |
+
def ro15_from_groups(groups_5x3: np.ndarray) -> np.ndarray:
|
| 82 |
+
arr = np.asarray(groups_5x3, dtype=np.float32)
|
| 83 |
+
if arr.shape != (5, 3):
|
| 84 |
+
raise ValueError(f"Expected shape (5,3), got {arr.shape}")
|
| 85 |
+
return arr.flatten() # (15,)
|
| 86 |
+
|
| 87 |
+
|
| 88 |
+
def ro13_from_ro15(ro15: np.ndarray) -> np.ndarray:
|
| 89 |
+
ro15 = np.asarray(ro15, dtype=np.float32).flatten()
|
| 90 |
+
if ro15.size != 15:
|
| 91 |
+
raise ValueError(f"Expected 15 values, got {ro15.size}")
|
| 92 |
+
keep = _keep_mask_15()
|
| 93 |
+
return ro15[keep] # (13,)
|
| 94 |
+
|
| 95 |
+
|
| 96 |
+
def normalize_ro13(ro13_raw: np.ndarray, meta: ROMetadata, method: str) -> np.ndarray:
|
| 97 |
+
x = np.asarray(ro13_raw, dtype=np.float32).flatten()
|
| 98 |
+
if x.size != 13:
|
| 99 |
+
raise ValueError(f"Expected 13 values, got {x.size}")
|
| 100 |
+
|
| 101 |
+
method = (method or "minmax").lower()
|
| 102 |
+
if method == "minmax":
|
| 103 |
+
mn = meta.ro_min_13
|
| 104 |
+
mx = meta.ro_max_13
|
| 105 |
+
rng = mx - mn
|
| 106 |
+
rng = np.where(rng == 0, 1.0, rng)
|
| 107 |
+
return ((x - mn) / rng).astype(np.float32)
|
| 108 |
+
if method == "zscore":
|
| 109 |
+
if meta.ro_mean_13 is None or meta.ro_std_13 is None:
|
| 110 |
+
raise ValueError("metadata_ro.json missing ramberg_osgood_param_mean/std for zscore")
|
| 111 |
+
mu = meta.ro_mean_13
|
| 112 |
+
sd = np.where(meta.ro_std_13 == 0, 1.0, meta.ro_std_13)
|
| 113 |
+
return ((x - mu) / sd).astype(np.float32)
|
| 114 |
+
|
| 115 |
+
raise ValueError(f"Unknown normalization method: {method}")
|
| 116 |
+
|
| 117 |
+
|
| 118 |
+
def ro_groups_from_ro15(ro15: np.ndarray) -> np.ndarray:
|
| 119 |
+
ro15 = np.asarray(ro15, dtype=np.float32).flatten()
|
| 120 |
+
if ro15.size != 15:
|
| 121 |
+
raise ValueError(f"Expected 15 values, got {ro15.size}")
|
| 122 |
+
return ro15.reshape(5, 3)
|
| 123 |
+
|
| 124 |
+
|
| 125 |
+
def ro15_minmax(meta: ROMetadata) -> Tuple[np.ndarray, np.ndarray]:
|
| 126 |
+
return meta.ro_min_full.copy(), meta.ro_max_full.copy()
|
| 127 |
+
|
data_generation/hf_space_generation_ro/space_lib/models.py
ADDED
|
@@ -0,0 +1,238 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import torch
|
| 2 |
+
import torch.nn as nn
|
| 3 |
+
from typing import Dict, Tuple
|
| 4 |
+
from dataclasses import dataclass
|
| 5 |
+
import math
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
# =========================
|
| 9 |
+
# Config
|
| 10 |
+
# =========================
|
| 11 |
+
|
| 12 |
+
@dataclass
|
| 13 |
+
class ModelConfig:
|
| 14 |
+
# problem sizes
|
| 15 |
+
n_conditions: int = 8
|
| 16 |
+
n_materials: int = 10
|
| 17 |
+
n_vf_categories: int = 5 # Volume fraction categories: 0.0924, 0.2155, 0.3079, 0.4002, 0.4926
|
| 18 |
+
n_max_layer: int = 24
|
| 19 |
+
|
| 20 |
+
# model architecture
|
| 21 |
+
d_model: int = 256
|
| 22 |
+
n_heads: int = 4
|
| 23 |
+
n_layers: int = 6
|
| 24 |
+
dropout: float = 0.0
|
| 25 |
+
|
| 26 |
+
# angle is in radians, limited to (-pi/2, pi/2)
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
# =========================
|
| 30 |
+
# Model
|
| 31 |
+
# =========================
|
| 32 |
+
|
| 33 |
+
def timestep_embedding(t: torch.Tensor, dim: int) -> torch.Tensor:
|
| 34 |
+
"""
|
| 35 |
+
Sinusoidal timestep embedding. t: (B,)
|
| 36 |
+
"""
|
| 37 |
+
half = dim // 2
|
| 38 |
+
freqs = torch.exp(-math.log(10000) * torch.arange(0, half, device=t.device) / half)
|
| 39 |
+
args = t.float().unsqueeze(1) * freqs.unsqueeze(0)
|
| 40 |
+
emb = torch.cat([torch.cos(args), torch.sin(args)], dim=1)
|
| 41 |
+
if dim % 2 == 1:
|
| 42 |
+
emb = torch.cat([emb, torch.zeros_like(emb[:, :1])], dim=1)
|
| 43 |
+
return emb # (B, dim)
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
class SelfCrossAttnBlock(nn.Module):
|
| 47 |
+
def __init__(self, d_model, n_heads, dropout=0.0):
|
| 48 |
+
super().__init__()
|
| 49 |
+
self.self_attn = nn.MultiheadAttention(
|
| 50 |
+
d_model, n_heads, dropout=dropout, batch_first=True
|
| 51 |
+
)
|
| 52 |
+
self.cross_attn = nn.MultiheadAttention(
|
| 53 |
+
d_model, n_heads, dropout=dropout, batch_first=True
|
| 54 |
+
)
|
| 55 |
+
self.ff = nn.Sequential(
|
| 56 |
+
nn.Linear(d_model, 4 * d_model),
|
| 57 |
+
nn.SiLU(),
|
| 58 |
+
nn.Linear(4 * d_model, d_model),
|
| 59 |
+
)
|
| 60 |
+
|
| 61 |
+
self.ln1 = nn.LayerNorm(d_model)
|
| 62 |
+
self.ln2 = nn.LayerNorm(d_model)
|
| 63 |
+
self.ln3 = nn.LayerNorm(d_model)
|
| 64 |
+
|
| 65 |
+
def forward(self, x, cond_tokens, key_padding_mask=None):
|
| 66 |
+
"""
|
| 67 |
+
x: (B, N, d) ← material + nfiber + angle tokens
|
| 68 |
+
cond_tokens:(B, M, d) ← condition tokens
|
| 69 |
+
key_padding_mask: (B, N) optional padding mask (True = mask out, False = keep)
|
| 70 |
+
"""
|
| 71 |
+
# self-attention (within tokens)
|
| 72 |
+
x = self.ln1(x + self.self_attn(x, x, x, key_padding_mask=key_padding_mask)[0])
|
| 73 |
+
|
| 74 |
+
# cross-attention (tokens attend to conditions)
|
| 75 |
+
x = self.ln2(x + self.cross_attn(x, cond_tokens, cond_tokens)[0])
|
| 76 |
+
|
| 77 |
+
# feed-forward
|
| 78 |
+
x = self.ln3(x + self.ff(x))
|
| 79 |
+
return x
|
| 80 |
+
|
| 81 |
+
|
| 82 |
+
class MaterialHybridDenoiser(nn.Module):
|
| 83 |
+
"""
|
| 84 |
+
Inputs:
|
| 85 |
+
material_t: (B,) in [0..n_materials-1] or MASK
|
| 86 |
+
vf_category_t: (B,) in [0..4] volume fraction category or MASK
|
| 87 |
+
layer_t: (B,L) in {0,1} or MASK
|
| 88 |
+
Note: When use_discrete_angles=True, layer_t is redundant (derived from angle_t,
|
| 89 |
+
where angle_t==n_angle_categories means dead layer). The model ignores layer_emb
|
| 90 |
+
in this case and only uses angle_emb.
|
| 91 |
+
angle_t: (B,L) discrete category indices [0..n_angle_categories-1] or MASK (if use_discrete_angles)
|
| 92 |
+
OR (B,L,1) continuous (if not use_discrete_angles)
|
| 93 |
+
When discrete: category n_angle_categories = dead layer, n_angle_categories+1 = MASK
|
| 94 |
+
cond: (B,C) continuous
|
| 95 |
+
t: (B,) timestep
|
| 96 |
+
|
| 97 |
+
Outputs:
|
| 98 |
+
material logits: (B, n_materials)
|
| 99 |
+
vf_category_logits: (B, 5) # 5 volume fraction categories
|
| 100 |
+
layer logits: (B,L,2) # alive/dead (only if not use_discrete_angles)
|
| 101 |
+
angle_logits: (B,L,n_angle_categories+1) # discrete angle categories + dead (if use_discrete_angles)
|
| 102 |
+
OR angle: (B,L,1) # angle in radians, range (0, pi/2) (if not use_discrete_angles)
|
| 103 |
+
"""
|
| 104 |
+
def __init__(self, cfg: ModelConfig, mask_ids: Dict[str, int], use_discrete_angles: bool = True, n_angle_categories: int = 7):
|
| 105 |
+
super().__init__()
|
| 106 |
+
self.cfg = cfg
|
| 107 |
+
self.L = cfg.n_max_layer
|
| 108 |
+
d = cfg.d_model
|
| 109 |
+
self.mask_ids = mask_ids
|
| 110 |
+
self.use_discrete_angles = use_discrete_angles
|
| 111 |
+
self.n_angle_categories = n_angle_categories # 7 categories: 0, 15, 30, 45, 60, 75, 90 degrees
|
| 112 |
+
|
| 113 |
+
# +1 to include mask token for material
|
| 114 |
+
self.material_emb = nn.Embedding(cfg.n_materials + 1, d)
|
| 115 |
+
# vf_category: 5 categories (0-4) plus mask; we allocate 6
|
| 116 |
+
self.vf_category_emb = nn.Embedding(cfg.n_vf_categories + 1, d)
|
| 117 |
+
|
| 118 |
+
if use_discrete_angles:
|
| 119 |
+
# Angle categories: 0..n_angle_categories-1
|
| 120 |
+
# Category n_angle_categories: dead layer
|
| 121 |
+
# Category n_angle_categories+1: mask token
|
| 122 |
+
self.angle_emb = nn.Embedding(n_angle_categories + 2, d)
|
| 123 |
+
self.layer_emb = None # Not needed when using discrete angles
|
| 124 |
+
else:
|
| 125 |
+
# layer token: {MASK, 0, 1} => 3 (only needed for continuous angles)
|
| 126 |
+
self.layer_emb = nn.Embedding(3, d)
|
| 127 |
+
self.angle_in = nn.Linear(1, d)
|
| 128 |
+
|
| 129 |
+
# Condition projection (TRAINED).
|
| 130 |
+
# Input cond can be either:
|
| 131 |
+
# - (B, C): raw condition vector (preferred; gets projected here)
|
| 132 |
+
# - (B, C, d): already-projected condition tokens (backward-compatible)
|
| 133 |
+
self.cond_proj = nn.ModuleList([
|
| 134 |
+
nn.Linear(1, d) for _ in range(cfg.n_conditions)
|
| 135 |
+
])
|
| 136 |
+
|
| 137 |
+
self.blocks = nn.ModuleList([
|
| 138 |
+
SelfCrossAttnBlock(d, cfg.n_heads, cfg.dropout)
|
| 139 |
+
for _ in range(cfg.n_layers)
|
| 140 |
+
])
|
| 141 |
+
|
| 142 |
+
# Positional embeddings for entire sequence: material (pos 0) + vf_category (pos 1) + layers (pos 2..)
|
| 143 |
+
self.pos_emb = nn.Embedding(2 + cfg.n_max_layer, d)
|
| 144 |
+
|
| 145 |
+
self.t_proj = nn.Linear(d, d)
|
| 146 |
+
|
| 147 |
+
enc_layer = nn.TransformerEncoderLayer(
|
| 148 |
+
d_model=d,
|
| 149 |
+
nhead=cfg.n_heads,
|
| 150 |
+
dropout=cfg.dropout,
|
| 151 |
+
batch_first=True,
|
| 152 |
+
)
|
| 153 |
+
self.encoder = nn.TransformerEncoder(enc_layer, num_layers=cfg.n_layers)
|
| 154 |
+
self.ln = nn.LayerNorm(d)
|
| 155 |
+
|
| 156 |
+
self.material_head = nn.Linear(d, cfg.n_materials)
|
| 157 |
+
self.vf_category_head = nn.Linear(d, cfg.n_vf_categories) # 5 volume fraction categories
|
| 158 |
+
if use_discrete_angles:
|
| 159 |
+
self.angle_head = nn.Linear(d, n_angle_categories + 1) # angles + dead
|
| 160 |
+
self.layer_head = None
|
| 161 |
+
else:
|
| 162 |
+
self.layer_head = nn.Linear(d, 2) # alive/dead for continuous mode
|
| 163 |
+
self.angle_head = nn.Linear(d, 1)
|
| 164 |
+
|
| 165 |
+
def forward(self, material_t, vf_category_t, layer_t, angle_t, cond, t):
|
| 166 |
+
B, L = layer_t.shape
|
| 167 |
+
assert L == self.L
|
| 168 |
+
|
| 169 |
+
# Project conditions if provided as raw scalars (B, C)
|
| 170 |
+
if cond.dim() == 2:
|
| 171 |
+
cond_list = []
|
| 172 |
+
for i in range(cond.shape[1]):
|
| 173 |
+
cond_list.append(self.cond_proj[i](cond[:, i:i+1].unsqueeze(-1))) # (B, 1, d)
|
| 174 |
+
cond = torch.cat(cond_list, dim=1) # (B, C, d)
|
| 175 |
+
|
| 176 |
+
# global tokens
|
| 177 |
+
g_mat = self.material_emb(material_t).unsqueeze(1) # (B,1,d)
|
| 178 |
+
g_vf = self.vf_category_emb(vf_category_t).unsqueeze(1) # (B,1,d)
|
| 179 |
+
|
| 180 |
+
# per-layer tokens
|
| 181 |
+
if self.use_discrete_angles:
|
| 182 |
+
layer_h = self.angle_emb(angle_t) # (B, L, d)
|
| 183 |
+
else:
|
| 184 |
+
layer_h = self.layer_emb(layer_t) + self.angle_in(angle_t) # (B,L,d)
|
| 185 |
+
|
| 186 |
+
h = torch.cat([g_mat, g_vf, layer_h], dim=1) # (B, 2+L, d)
|
| 187 |
+
|
| 188 |
+
# positional embeddings
|
| 189 |
+
pos_indices = torch.arange(2 + self.L, device=h.device) # (2+L,)
|
| 190 |
+
h = h + self.pos_emb(pos_indices).unsqueeze(0) # (B, 2+L, d)
|
| 191 |
+
|
| 192 |
+
# timestep
|
| 193 |
+
t_emb = timestep_embedding(t, h.size(-1)) # (B,d)
|
| 194 |
+
h = h + self.t_proj(t_emb).unsqueeze(1)
|
| 195 |
+
|
| 196 |
+
# key padding mask for discrete angle dead tokens
|
| 197 |
+
key_padding_mask = None
|
| 198 |
+
if self.use_discrete_angles:
|
| 199 |
+
dead_category = self.n_angle_categories
|
| 200 |
+
is_dead = (angle_t == dead_category) # (B, L)
|
| 201 |
+
first_dead_pos = torch.zeros(B, dtype=torch.long, device=angle_t.device)
|
| 202 |
+
for b in range(B):
|
| 203 |
+
dead_positions = torch.where(is_dead[b])[0]
|
| 204 |
+
if len(dead_positions) > 0:
|
| 205 |
+
first_dead_pos[b] = dead_positions[0].item() + 2
|
| 206 |
+
else:
|
| 207 |
+
first_dead_pos[b] = 2 + L
|
| 208 |
+
N = 2 + L
|
| 209 |
+
key_padding_mask = torch.zeros(B, N, dtype=torch.bool, device=h.device)
|
| 210 |
+
for b in range(B):
|
| 211 |
+
first_invalid = first_dead_pos[b].item()
|
| 212 |
+
if first_invalid < 2 + L:
|
| 213 |
+
key_padding_mask[b, first_invalid:] = True
|
| 214 |
+
key_padding_mask[b, :2] = False
|
| 215 |
+
|
| 216 |
+
for block in self.blocks:
|
| 217 |
+
h = block(h, cond, key_padding_mask=key_padding_mask)
|
| 218 |
+
|
| 219 |
+
h = self.ln(h)
|
| 220 |
+
|
| 221 |
+
if self.use_discrete_angles:
|
| 222 |
+
angle_logits = self.angle_head(h[:, 2:]) # (B, L, n_angle_categories + 1)
|
| 223 |
+
out = {
|
| 224 |
+
"material_logits": self.material_head(h[:, 0]),
|
| 225 |
+
"vf_category_logits": self.vf_category_head(h[:, 1]),
|
| 226 |
+
"angle_logits": angle_logits,
|
| 227 |
+
}
|
| 228 |
+
else:
|
| 229 |
+
angle_raw = self.angle_head(h[:, 2:]) # (B,L,1)
|
| 230 |
+
angle = torch.sigmoid(angle_raw) * (math.pi / 2) # (B,L,1)
|
| 231 |
+
out = {
|
| 232 |
+
"material_logits": self.material_head(h[:, 0]),
|
| 233 |
+
"vf_category_logits": self.vf_category_head(h[:, 1]),
|
| 234 |
+
"layer_logits": self.layer_head(h[:, 2:]),
|
| 235 |
+
"angle": angle,
|
| 236 |
+
}
|
| 237 |
+
return out
|
| 238 |
+
|
data_generation/hf_space_generation_ro/space_lib/plots.py
ADDED
|
@@ -0,0 +1,205 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
|
| 3 |
+
from typing import Dict, Tuple
|
| 4 |
+
|
| 5 |
+
import matplotlib
|
| 6 |
+
|
| 7 |
+
matplotlib.use("Agg")
|
| 8 |
+
import matplotlib.pyplot as plt
|
| 9 |
+
import numpy as np
|
| 10 |
+
|
| 11 |
+
from .ro_curves import ro_stress, ro_strain_strain
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
def _fit_ro_stress_curve(strain: np.ndarray, stress: np.ndarray, x_scale: float) -> tuple[float, float, float] | None:
|
| 15 |
+
"""
|
| 16 |
+
Fit y = a*xn + b*xn^c where xn = strain/x_scale.
|
| 17 |
+
Lightweight grid-search over c; solve a,b by least squares.
|
| 18 |
+
Returns (a,b,c) for ro_stress().
|
| 19 |
+
"""
|
| 20 |
+
x = np.asarray(strain, dtype=np.float32).reshape(-1)
|
| 21 |
+
y = np.asarray(stress, dtype=np.float32).reshape(-1)
|
| 22 |
+
if x.size < 4 or y.size != x.size:
|
| 23 |
+
return None
|
| 24 |
+
x_scale = float(x_scale) if x_scale and x_scale > 0 else 1.0
|
| 25 |
+
xn = np.clip(x / x_scale, 1e-6, None)
|
| 26 |
+
|
| 27 |
+
c_grid = np.concatenate(
|
| 28 |
+
[
|
| 29 |
+
np.linspace(0.5, 6.0, 56, dtype=np.float32),
|
| 30 |
+
np.linspace(6.5, 20.0, 28, dtype=np.float32),
|
| 31 |
+
]
|
| 32 |
+
)
|
| 33 |
+
best: tuple[float, float, float] | None = None
|
| 34 |
+
best_mse = float("inf")
|
| 35 |
+
for c in c_grid:
|
| 36 |
+
phi1 = xn
|
| 37 |
+
phi2 = np.power(xn, float(c))
|
| 38 |
+
A = np.stack([phi1, phi2], axis=1)
|
| 39 |
+
try:
|
| 40 |
+
coef, *_ = np.linalg.lstsq(A, y, rcond=None)
|
| 41 |
+
except Exception:
|
| 42 |
+
continue
|
| 43 |
+
a, b = float(coef[0]), float(coef[1])
|
| 44 |
+
yhat = a * phi1 + b * phi2
|
| 45 |
+
mse = float(np.mean((yhat - y) ** 2))
|
| 46 |
+
if np.isfinite(mse) and mse < best_mse:
|
| 47 |
+
best_mse = mse
|
| 48 |
+
best = (a, b, float(c))
|
| 49 |
+
return best
|
| 50 |
+
|
| 51 |
+
|
| 52 |
+
def _fit_ro_lateral_curve(strain: np.ndarray, lateral: np.ndarray, x_scale: float, y_scale: float) -> tuple[float, float] | None:
|
| 53 |
+
"""
|
| 54 |
+
Fit y_norm = a*|xn|^b where xn=strain/x_scale and y_norm=lateral/y_scale.
|
| 55 |
+
Grid-search over b; solve a by least squares (allows negative a).
|
| 56 |
+
Returns (a,b) for ro_strain_strain().
|
| 57 |
+
"""
|
| 58 |
+
x = np.asarray(strain, dtype=np.float32).reshape(-1)
|
| 59 |
+
y = np.asarray(lateral, dtype=np.float32).reshape(-1)
|
| 60 |
+
if x.size < 4 or y.size != x.size:
|
| 61 |
+
return None
|
| 62 |
+
x_scale = float(x_scale) if x_scale and x_scale > 0 else 1.0
|
| 63 |
+
y_scale = float(y_scale) if y_scale and y_scale > 0 else 1.0
|
| 64 |
+
xn = np.clip(np.abs(x / x_scale), 1e-6, None)
|
| 65 |
+
yn = y / y_scale
|
| 66 |
+
|
| 67 |
+
b_grid = np.concatenate(
|
| 68 |
+
[
|
| 69 |
+
np.linspace(0.2, 6.0, 60, dtype=np.float32),
|
| 70 |
+
np.linspace(6.5, 20.0, 28, dtype=np.float32),
|
| 71 |
+
]
|
| 72 |
+
)
|
| 73 |
+
best: tuple[float, float] | None = None
|
| 74 |
+
best_mse = float("inf")
|
| 75 |
+
for b in b_grid:
|
| 76 |
+
phi = np.power(xn, float(b))
|
| 77 |
+
denom = float(phi @ phi)
|
| 78 |
+
if denom <= 1e-12:
|
| 79 |
+
continue
|
| 80 |
+
a = float((phi @ yn) / denom)
|
| 81 |
+
yhat = a * phi
|
| 82 |
+
mse = float(np.mean((yhat - yn) ** 2))
|
| 83 |
+
if np.isfinite(mse) and mse < best_mse:
|
| 84 |
+
best_mse = mse
|
| 85 |
+
best = (a, float(b))
|
| 86 |
+
return best
|
| 87 |
+
|
| 88 |
+
|
| 89 |
+
def plot_condition_and_simulations(
|
| 90 |
+
ro_groups_5x3: np.ndarray,
|
| 91 |
+
eps_scales: Tuple[float, float, float],
|
| 92 |
+
simulations_by_instance: Dict[int, Dict[str, Dict[str, np.ndarray]]],
|
| 93 |
+
) -> plt.Figure:
|
| 94 |
+
ro = np.asarray(ro_groups_5x3, dtype=np.float32).reshape(5, 3)
|
| 95 |
+
eps_11_scale, eps_22_scale, eps_12_scale = map(float, eps_scales)
|
| 96 |
+
|
| 97 |
+
fig, axes = plt.subplots(2, 3, figsize=(12, 7))
|
| 98 |
+
modes = ["11", "22", "12"]
|
| 99 |
+
colors = ["b", "c", "m", "g", "r"]
|
| 100 |
+
|
| 101 |
+
for col, mode in enumerate(modes):
|
| 102 |
+
# Determine x-range from simulation if possible
|
| 103 |
+
x_min, x_max = None, None
|
| 104 |
+
for inst, sim in simulations_by_instance.items():
|
| 105 |
+
if mode in sim:
|
| 106 |
+
x = sim[mode]["strain"]
|
| 107 |
+
x_min = float(np.min(x))
|
| 108 |
+
x_max = float(np.max(x))
|
| 109 |
+
break
|
| 110 |
+
|
| 111 |
+
if x_min is None or x_max is None or x_max <= x_min:
|
| 112 |
+
# fallback stable range
|
| 113 |
+
if mode == "11":
|
| 114 |
+
x_min, x_max = 0.0, eps_11_scale
|
| 115 |
+
elif mode == "22":
|
| 116 |
+
x_min, x_max = 0.0, eps_22_scale
|
| 117 |
+
else:
|
| 118 |
+
x_min, x_max = 0.0, eps_12_scale
|
| 119 |
+
|
| 120 |
+
x_fit = np.linspace(float(x_min), float(x_max), 250, dtype=np.float32)
|
| 121 |
+
|
| 122 |
+
# Condition curve (black)
|
| 123 |
+
if mode == "11":
|
| 124 |
+
a0, b0, c0 = ro[0]
|
| 125 |
+
y = ro_stress(x_fit, float(a0), float(b0), float(c0), eps_11_scale)
|
| 126 |
+
axes[0, col].plot(x_fit, y, color="k", linewidth=2, label="Cond input")
|
| 127 |
+
|
| 128 |
+
a1, b1, _ = ro[1]
|
| 129 |
+
y_lat = ro_strain_strain(x_fit, float(a1), float(b1), eps_11_scale, eps_22_scale)
|
| 130 |
+
axes[1, col].plot(x_fit, y_lat, color="k", linewidth=2, label="Cond input")
|
| 131 |
+
axes[0, col].set_title("Mode 11")
|
| 132 |
+
axes[1, col].set_title("Mode 11 lateral")
|
| 133 |
+
|
| 134 |
+
elif mode == "22":
|
| 135 |
+
a0, b0, c0 = ro[2]
|
| 136 |
+
y = ro_stress(x_fit, float(a0), float(b0), float(c0), eps_22_scale)
|
| 137 |
+
axes[0, col].plot(x_fit, y, color="k", linewidth=2, label="Cond input")
|
| 138 |
+
|
| 139 |
+
a1, b1, _ = ro[3]
|
| 140 |
+
y_lat = ro_strain_strain(x_fit, float(a1), float(b1), eps_22_scale, eps_11_scale)
|
| 141 |
+
axes[1, col].plot(x_fit, y_lat, color="k", linewidth=2, label="Cond input")
|
| 142 |
+
axes[0, col].set_title("Mode 22")
|
| 143 |
+
axes[1, col].set_title("Mode 22 lateral")
|
| 144 |
+
|
| 145 |
+
else:
|
| 146 |
+
a0, b0, c0 = ro[4]
|
| 147 |
+
y = ro_stress(x_fit, float(a0), float(b0), float(c0), eps_12_scale)
|
| 148 |
+
axes[0, col].plot(x_fit, y, color="k", linewidth=2, label="Cond input")
|
| 149 |
+
axes[0, col].set_title("Mode 12")
|
| 150 |
+
axes[1, col].axis("off")
|
| 151 |
+
|
| 152 |
+
# Simulations overlay: dots + fitted RO curves (like train.py on_the_fly_validation)
|
| 153 |
+
for idx, (inst, sim) in enumerate(sorted(simulations_by_instance.items(), key=lambda kv: kv[0])):
|
| 154 |
+
if mode not in sim:
|
| 155 |
+
continue
|
| 156 |
+
d = sim[mode]
|
| 157 |
+
c = colors[idx % len(colors)]
|
| 158 |
+
axes[0, col].plot([], [], color=c, linewidth=2, label=f"Sim inst{inst}")
|
| 159 |
+
axes[0, col].scatter(d["strain"], d["stress"], color=c, s=22, alpha=0.85, label="_nolegend_")
|
| 160 |
+
|
| 161 |
+
if mode == "11":
|
| 162 |
+
x_scale = eps_11_scale
|
| 163 |
+
elif mode == "22":
|
| 164 |
+
x_scale = eps_22_scale
|
| 165 |
+
else:
|
| 166 |
+
x_scale = eps_12_scale
|
| 167 |
+
|
| 168 |
+
fit = _fit_ro_stress_curve(d["strain"], d["stress"], x_scale=x_scale)
|
| 169 |
+
if fit is not None and len(d["strain"]) >= 2:
|
| 170 |
+
fa, fb, fc = fit
|
| 171 |
+
x_line = np.linspace(float(np.min(d["strain"])), float(np.max(d["strain"])), 200, dtype=np.float32)
|
| 172 |
+
y_line = ro_stress(x_line, fa, fb, fc, x_scale)
|
| 173 |
+
axes[0, col].plot(x_line, y_line, color=c, linewidth=2, alpha=0.9, label="_nolegend_")
|
| 174 |
+
|
| 175 |
+
if mode in ("11", "22") and d.get("lateral") is not None:
|
| 176 |
+
axes[1, col].plot([], [], color=c, linewidth=2, label=f"Sim inst{inst}")
|
| 177 |
+
axes[1, col].scatter(d["strain"], d["lateral"], color=c, s=22, alpha=0.85, label="_nolegend_")
|
| 178 |
+
|
| 179 |
+
if mode == "11":
|
| 180 |
+
x_scale_lat, y_scale_lat = eps_11_scale, eps_22_scale
|
| 181 |
+
else:
|
| 182 |
+
x_scale_lat, y_scale_lat = eps_22_scale, eps_11_scale
|
| 183 |
+
fit_lat = _fit_ro_lateral_curve(d["strain"], d["lateral"], x_scale=x_scale_lat, y_scale=y_scale_lat)
|
| 184 |
+
if fit_lat is not None and len(d["strain"]) >= 2:
|
| 185 |
+
fa, fb = fit_lat
|
| 186 |
+
x_line = np.linspace(float(np.min(d["strain"])), float(np.max(d["strain"])), 200, dtype=np.float32)
|
| 187 |
+
y_line = ro_strain_strain(x_line, fa, fb, x_scale_lat, y_scale_lat)
|
| 188 |
+
axes[1, col].plot(x_line, y_line, color=c, linewidth=2, alpha=0.9, label="_nolegend_")
|
| 189 |
+
|
| 190 |
+
axes[0, col].set_xlabel("strain")
|
| 191 |
+
axes[0, col].set_ylabel("stress (MPa)")
|
| 192 |
+
axes[0, col].grid(True, alpha=0.25)
|
| 193 |
+
if mode in ("11", "22"):
|
| 194 |
+
axes[1, col].set_xlabel("strain")
|
| 195 |
+
axes[1, col].set_ylabel("lateral strain")
|
| 196 |
+
axes[1, col].grid(True, alpha=0.25)
|
| 197 |
+
|
| 198 |
+
# Legends
|
| 199 |
+
axes[0, col].legend(fontsize=8)
|
| 200 |
+
if mode in ("11", "22"):
|
| 201 |
+
axes[1, col].legend(fontsize=8)
|
| 202 |
+
|
| 203 |
+
fig.tight_layout()
|
| 204 |
+
return fig
|
| 205 |
+
|
data_generation/hf_space_generation_ro/space_lib/ro_curves.py
ADDED
|
@@ -0,0 +1,135 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
|
| 3 |
+
from typing import Tuple
|
| 4 |
+
|
| 5 |
+
import matplotlib
|
| 6 |
+
|
| 7 |
+
matplotlib.use("Agg")
|
| 8 |
+
import matplotlib.pyplot as plt
|
| 9 |
+
import numpy as np
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
def ro_stress(x: np.ndarray, a: float, b: float, c: float, x_scale: float) -> np.ndarray:
|
| 13 |
+
x = np.asarray(x, dtype=np.float32)
|
| 14 |
+
x_norm = x / x_scale if x_scale and x_scale > 0 else x
|
| 15 |
+
return a * x_norm + b * np.power(x_norm, c)
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
def ro_strain_strain(x: np.ndarray, a: float, b: float, x_scale: float, y_scale: float) -> np.ndarray:
|
| 19 |
+
x = np.asarray(x, dtype=np.float32)
|
| 20 |
+
x_norm = x / x_scale if x_scale and x_scale > 0 else x
|
| 21 |
+
y_norm = a * np.power(np.abs(x_norm), b)
|
| 22 |
+
return y_norm * y_scale if y_scale and y_scale > 0 else y_norm
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
def plot_ro_stress_relation(
|
| 26 |
+
*,
|
| 27 |
+
a: float,
|
| 28 |
+
b: float,
|
| 29 |
+
c: float,
|
| 30 |
+
x_scale: float,
|
| 31 |
+
x_max: float,
|
| 32 |
+
title: str,
|
| 33 |
+
) -> plt.Figure:
|
| 34 |
+
x = np.linspace(0.0, float(x_max), 250, dtype=np.float32)
|
| 35 |
+
y = ro_stress(x, float(a), float(b), float(c), float(x_scale))
|
| 36 |
+
fig, ax = plt.subplots(1, 1, figsize=(6, 3.5))
|
| 37 |
+
ax.plot(x, y, color="k", linewidth=2)
|
| 38 |
+
ax.set_title(title)
|
| 39 |
+
ax.set_xlabel("strain")
|
| 40 |
+
ax.set_ylabel("stress (MPa)")
|
| 41 |
+
ax.grid(True, alpha=0.25)
|
| 42 |
+
fig.tight_layout()
|
| 43 |
+
return fig
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
def plot_ro_lateral_relation(
|
| 47 |
+
*,
|
| 48 |
+
a: float,
|
| 49 |
+
b: float,
|
| 50 |
+
x_scale: float,
|
| 51 |
+
y_scale: float,
|
| 52 |
+
x_max: float,
|
| 53 |
+
title: str,
|
| 54 |
+
) -> plt.Figure:
|
| 55 |
+
x = np.linspace(0.0, float(x_max), 250, dtype=np.float32)
|
| 56 |
+
y = ro_strain_strain(x, float(a), float(b), float(x_scale), float(y_scale))
|
| 57 |
+
fig, ax = plt.subplots(1, 1, figsize=(6, 3.5))
|
| 58 |
+
ax.plot(x, y, color="k", linewidth=2)
|
| 59 |
+
ax.set_title(title)
|
| 60 |
+
ax.set_xlabel("strain")
|
| 61 |
+
ax.set_ylabel("lateral strain")
|
| 62 |
+
ax.grid(True, alpha=0.25)
|
| 63 |
+
fig.tight_layout()
|
| 64 |
+
return fig
|
| 65 |
+
|
| 66 |
+
|
| 67 |
+
def plot_condition_preview(
|
| 68 |
+
ro_groups_5x3: np.ndarray,
|
| 69 |
+
eps_scales: Tuple[float, float, float],
|
| 70 |
+
x_max: float | None = None,
|
| 71 |
+
) -> plt.Figure:
|
| 72 |
+
"""
|
| 73 |
+
Preview only the conditioned RO curves implied by the sliders.
|
| 74 |
+
Layout matches validation plots: 2 rows (stress, lateral) x 3 cols (11,22,12).
|
| 75 |
+
"""
|
| 76 |
+
ro = np.asarray(ro_groups_5x3, dtype=np.float32).reshape(5, 3)
|
| 77 |
+
eps_11_scale, eps_22_scale, eps_12_scale = (float(eps_scales[0]), float(eps_scales[1]), float(eps_scales[2]))
|
| 78 |
+
|
| 79 |
+
# Use a strain range that is stable for UI preview.
|
| 80 |
+
# Default to 0..scale for each mode unless user overrides x_max.
|
| 81 |
+
def _x_grid(scale: float) -> np.ndarray:
|
| 82 |
+
xm = float(x_max) if x_max is not None else float(scale)
|
| 83 |
+
xm = max(xm, 1e-6)
|
| 84 |
+
return np.linspace(0.0, xm, 250, dtype=np.float32)
|
| 85 |
+
|
| 86 |
+
fig, axes = plt.subplots(2, 3, figsize=(12, 7))
|
| 87 |
+
modes = ["11", "22", "12"]
|
| 88 |
+
for col, mode in enumerate(modes):
|
| 89 |
+
if mode == "11":
|
| 90 |
+
x = _x_grid(eps_11_scale)
|
| 91 |
+
a0, b0, c0 = ro[0]
|
| 92 |
+
y_stress = ro_stress(x, float(a0), float(b0), float(c0), eps_11_scale)
|
| 93 |
+
axes[0, col].plot(x, y_stress, color="k", linewidth=2)
|
| 94 |
+
|
| 95 |
+
a1, b1, _ = ro[1]
|
| 96 |
+
y_lat = ro_strain_strain(x, float(a1), float(b1), eps_11_scale, eps_22_scale)
|
| 97 |
+
axes[1, col].plot(x, y_lat, color="k", linewidth=2)
|
| 98 |
+
|
| 99 |
+
axes[0, col].set_title("Mode 11: σ11(ε11)")
|
| 100 |
+
axes[1, col].set_title("Mode 11: ε22(ε11)")
|
| 101 |
+
|
| 102 |
+
elif mode == "22":
|
| 103 |
+
x = _x_grid(eps_22_scale)
|
| 104 |
+
a0, b0, c0 = ro[2]
|
| 105 |
+
y_stress = ro_stress(x, float(a0), float(b0), float(c0), eps_22_scale)
|
| 106 |
+
axes[0, col].plot(x, y_stress, color="k", linewidth=2)
|
| 107 |
+
|
| 108 |
+
a1, b1, _ = ro[3]
|
| 109 |
+
y_lat = ro_strain_strain(x, float(a1), float(b1), eps_22_scale, eps_11_scale)
|
| 110 |
+
axes[1, col].plot(x, y_lat, color="k", linewidth=2)
|
| 111 |
+
|
| 112 |
+
axes[0, col].set_title("Mode 22: σ22(ε22)")
|
| 113 |
+
axes[1, col].set_title("Mode 22: ε11(ε22)")
|
| 114 |
+
|
| 115 |
+
else: # 12
|
| 116 |
+
x = _x_grid(eps_12_scale)
|
| 117 |
+
a0, b0, c0 = ro[4]
|
| 118 |
+
y_stress = ro_stress(x, float(a0), float(b0), float(c0), eps_12_scale)
|
| 119 |
+
axes[0, col].plot(x, y_stress, color="k", linewidth=2)
|
| 120 |
+
axes[0, col].set_title("Mode 12: σ12(ε12)")
|
| 121 |
+
axes[1, col].axis("off")
|
| 122 |
+
|
| 123 |
+
axes[0, col].set_xlabel("strain")
|
| 124 |
+
axes[0, col].set_ylabel("stress (MPa)")
|
| 125 |
+
if mode in ("11", "22"):
|
| 126 |
+
axes[1, col].set_xlabel("strain")
|
| 127 |
+
axes[1, col].set_ylabel("lateral strain")
|
| 128 |
+
|
| 129 |
+
axes[0, col].grid(True, alpha=0.25)
|
| 130 |
+
if mode in ("11", "22"):
|
| 131 |
+
axes[1, col].grid(True, alpha=0.25)
|
| 132 |
+
|
| 133 |
+
fig.tight_layout()
|
| 134 |
+
return fig
|
| 135 |
+
|
data_generation/hf_space_generation_ro/space_lib/simulate.py
ADDED
|
@@ -0,0 +1,242 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
|
| 3 |
+
import importlib.util
|
| 4 |
+
import os
|
| 5 |
+
from pathlib import Path
|
| 6 |
+
from typing import Dict, List, Tuple
|
| 7 |
+
|
| 8 |
+
import numpy as np
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
def format_vol_fraction(vf: float) -> str:
|
| 12 |
+
return f"{float(vf):.4f}"
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
def _import_lam(lam_dir: str):
|
| 16 |
+
lam_dir_p = Path(lam_dir).resolve()
|
| 17 |
+
lam_py = lam_dir_p / "lam.py"
|
| 18 |
+
if not lam_py.exists():
|
| 19 |
+
raise FileNotFoundError(f"lam.py not found in {lam_dir_p}")
|
| 20 |
+
spec = importlib.util.spec_from_file_location("lam", lam_py)
|
| 21 |
+
lam = importlib.util.module_from_spec(spec)
|
| 22 |
+
assert spec and spec.loader
|
| 23 |
+
spec.loader.exec_module(lam)
|
| 24 |
+
return lam
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
def run_simulation_with_mat(lam, prefix: str, full_angles: List[float], mode: str, mat):
|
| 28 |
+
"""
|
| 29 |
+
Copy of data_generation/generate_data_mp.py::run_simulation_with_mat.
|
| 30 |
+
Returns: ex, sx, ey, gxy, ezz, g23, g13, e11
|
| 31 |
+
"""
|
| 32 |
+
tply = 0.05
|
| 33 |
+
plies = [lam.Ply(float(angle_deg), tply, mat) for angle_deg in full_angles]
|
| 34 |
+
laminate = lam.Laminate(plies)
|
| 35 |
+
|
| 36 |
+
if mode == "11":
|
| 37 |
+
main_index = 0
|
| 38 |
+
eps_max = 0.10
|
| 39 |
+
elif mode == "22":
|
| 40 |
+
main_index = 1
|
| 41 |
+
eps_max = 0.10
|
| 42 |
+
elif mode == "12":
|
| 43 |
+
main_index = 5
|
| 44 |
+
eps_max = 0.20
|
| 45 |
+
else:
|
| 46 |
+
raise ValueError("mode must be '11', '22' or '12'")
|
| 47 |
+
|
| 48 |
+
main_steps = np.linspace(0.0, eps_max, 1500)
|
| 49 |
+
|
| 50 |
+
ex_hist, sx_hist = [], []
|
| 51 |
+
ey_hist, gxy_hist = [], []
|
| 52 |
+
ezz_hist, g23_hist, g13_hist = [], [], []
|
| 53 |
+
e11_hist = []
|
| 54 |
+
|
| 55 |
+
ex_prev = 0.0
|
| 56 |
+
ey_prev = 0.0
|
| 57 |
+
gxy_prev = 0.0
|
| 58 |
+
ezz_prev = 0.0
|
| 59 |
+
g23_prev = 0.0
|
| 60 |
+
g13_prev = 0.0
|
| 61 |
+
s1_prev = 0.0
|
| 62 |
+
|
| 63 |
+
for i in range(1, len(main_steps)):
|
| 64 |
+
main_target = main_steps[i]
|
| 65 |
+
|
| 66 |
+
if main_index == 0:
|
| 67 |
+
main_prev = ex_prev
|
| 68 |
+
elif main_index == 1:
|
| 69 |
+
main_prev = ey_prev
|
| 70 |
+
else:
|
| 71 |
+
main_prev = gxy_prev
|
| 72 |
+
|
| 73 |
+
dmain = main_target - main_prev
|
| 74 |
+
|
| 75 |
+
Ceff_prev = laminate.effective_C_from_previous_strains(
|
| 76 |
+
ex_prev, ey_prev, ezz_prev, g23_prev, g13_prev, gxy_prev
|
| 77 |
+
)
|
| 78 |
+
|
| 79 |
+
cond = np.linalg.cond(Ceff_prev)
|
| 80 |
+
if not np.isfinite(cond) or cond > lam.COND_MAX:
|
| 81 |
+
raise np.linalg.LinAlgError(
|
| 82 |
+
f"Effective C is ill-conditioned (cond={cond:.3e}) at step {i}"
|
| 83 |
+
)
|
| 84 |
+
|
| 85 |
+
e_j = np.zeros(6)
|
| 86 |
+
e_j[main_index] = 1.0
|
| 87 |
+
|
| 88 |
+
try:
|
| 89 |
+
S_col = np.linalg.solve(Ceff_prev, e_j)
|
| 90 |
+
except np.linalg.LinAlgError as err:
|
| 91 |
+
raise np.linalg.LinAlgError(
|
| 92 |
+
f"Failed to solve for compliance column at step {i}: {err}"
|
| 93 |
+
)
|
| 94 |
+
|
| 95 |
+
Sjj = S_col[main_index]
|
| 96 |
+
if abs(Sjj) < 1e-20:
|
| 97 |
+
raise ZeroDivisionError(
|
| 98 |
+
f"Sjj is zero or too small at step {i} (Sjj={Sjj:.3e})."
|
| 99 |
+
)
|
| 100 |
+
|
| 101 |
+
ds1 = dmain / Sjj
|
| 102 |
+
de_vec = S_col * ds1
|
| 103 |
+
de_vec[main_index] = dmain
|
| 104 |
+
|
| 105 |
+
de1, de2, de3, de4, de5, de6 = de_vec
|
| 106 |
+
de4 = 0.0
|
| 107 |
+
de5 = 0.0
|
| 108 |
+
|
| 109 |
+
s1 = s1_prev + ds1
|
| 110 |
+
ex = ex_prev + de1
|
| 111 |
+
ey = ey_prev + de2
|
| 112 |
+
ezz = ezz_prev + de3
|
| 113 |
+
g23 = g23_prev + de4
|
| 114 |
+
g13 = g13_prev + de5
|
| 115 |
+
gxy = gxy_prev + de6
|
| 116 |
+
|
| 117 |
+
laminate.update_fiber_angles_incremental(de1, de2, de6)
|
| 118 |
+
|
| 119 |
+
ex_prev, ey_prev, ezz_prev = ex, ey, ezz
|
| 120 |
+
g23_prev, g13_prev, gxy_prev = g23, g13, gxy
|
| 121 |
+
s1_prev = s1
|
| 122 |
+
|
| 123 |
+
if main_index == 0:
|
| 124 |
+
main_strain = ex
|
| 125 |
+
elif main_index == 1:
|
| 126 |
+
main_strain = ey
|
| 127 |
+
else:
|
| 128 |
+
main_strain = 0.5 * gxy
|
| 129 |
+
|
| 130 |
+
ex_hist.append(main_strain)
|
| 131 |
+
sx_hist.append(s1)
|
| 132 |
+
ey_hist.append(ey)
|
| 133 |
+
gxy_hist.append(gxy)
|
| 134 |
+
ezz_hist.append(ezz)
|
| 135 |
+
g23_hist.append(g23)
|
| 136 |
+
g13_hist.append(g13)
|
| 137 |
+
e11_hist.append(ex)
|
| 138 |
+
|
| 139 |
+
result = (
|
| 140 |
+
np.array(ex_hist),
|
| 141 |
+
np.array(sx_hist),
|
| 142 |
+
np.array(ey_hist),
|
| 143 |
+
np.array(gxy_hist),
|
| 144 |
+
np.array(ezz_hist),
|
| 145 |
+
np.array(g23_hist),
|
| 146 |
+
np.array(g13_hist),
|
| 147 |
+
np.array(e11_hist),
|
| 148 |
+
)
|
| 149 |
+
if len(result) != 8:
|
| 150 |
+
raise ValueError(f"Internal error: expected 8 return values, got {len(result)}")
|
| 151 |
+
return result
|
| 152 |
+
|
| 153 |
+
|
| 154 |
+
def simulate_instances(
|
| 155 |
+
*,
|
| 156 |
+
curve_dir: str,
|
| 157 |
+
lam_dir: str,
|
| 158 |
+
mat_type: str,
|
| 159 |
+
vf: float,
|
| 160 |
+
upper_angles: List[float],
|
| 161 |
+
instances: List[int],
|
| 162 |
+
num_output_points: int = 10,
|
| 163 |
+
) -> Dict[int, Dict[str, Dict[str, np.ndarray]]]:
|
| 164 |
+
"""
|
| 165 |
+
Returns:
|
| 166 |
+
{instance: {"11": {"strain","stress","lateral"}, "22": {...}, "12": {...}}}
|
| 167 |
+
"""
|
| 168 |
+
lam = _import_lam(lam_dir)
|
| 169 |
+
|
| 170 |
+
curve_dir_path = Path(curve_dir).resolve()
|
| 171 |
+
if not curve_dir_path.exists():
|
| 172 |
+
raise FileNotFoundError(f"curve_dir does not exist: {curve_dir_path}")
|
| 173 |
+
|
| 174 |
+
original_curve_dir = lam.CURVE_DIR
|
| 175 |
+
lam.CURVE_DIR = curve_dir_path
|
| 176 |
+
try:
|
| 177 |
+
vf_str = format_vol_fraction(vf)
|
| 178 |
+
out: Dict[int, Dict[str, Dict[str, np.ndarray]]] = {}
|
| 179 |
+
errors: Dict[int, List[str]] = {}
|
| 180 |
+
|
| 181 |
+
for inst in instances:
|
| 182 |
+
prefix = f"{mat_type}_{vf_str}_{int(inst)}"
|
| 183 |
+
# Fail fast if required curve files are missing.
|
| 184 |
+
for mode in ("11", "22", "12"):
|
| 185 |
+
p = curve_dir_path / f"{prefix}_{mode}.txt"
|
| 186 |
+
if not p.exists():
|
| 187 |
+
raise FileNotFoundError(f"Missing curve file: {p} (needed for simulation)")
|
| 188 |
+
vf_meta, centers_meta, n_fibers = lam.read_instance_metadata(prefix)
|
| 189 |
+
mat = lam.load_ud_material_from_files(prefix)
|
| 190 |
+
full_angles = lam.build_full_symmetric_stack(sorted([float(a) for a in upper_angles]))
|
| 191 |
+
|
| 192 |
+
sim_modes: Dict[str, Dict[str, np.ndarray]] = {}
|
| 193 |
+
for mode in ("11", "22", "12"):
|
| 194 |
+
try:
|
| 195 |
+
ex, sx, ey, gxy, ezz, g23, g13, e11 = run_simulation_with_mat(lam, prefix, full_angles, mode, mat)
|
| 196 |
+
if len(ex) < 2:
|
| 197 |
+
continue
|
| 198 |
+
x_out = np.linspace(float(ex[0]), float(ex[-1]), int(num_output_points))
|
| 199 |
+
sx_out_mpa = np.interp(x_out, ex, sx / 1e6)
|
| 200 |
+
if mode == "11":
|
| 201 |
+
lat_out = np.interp(x_out, ex, ey)
|
| 202 |
+
elif mode == "22":
|
| 203 |
+
lat_out = np.interp(x_out, ex, e11)
|
| 204 |
+
else:
|
| 205 |
+
lat_out = None
|
| 206 |
+
sim_modes[mode] = {
|
| 207 |
+
"strain": x_out.astype(np.float32),
|
| 208 |
+
"stress": sx_out_mpa.astype(np.float32),
|
| 209 |
+
"lateral": None if lat_out is None else lat_out.astype(np.float32),
|
| 210 |
+
}
|
| 211 |
+
except Exception as e:
|
| 212 |
+
errors.setdefault(int(inst), []).append(f"{mode} failed: {type(e).__name__}: {e}")
|
| 213 |
+
continue
|
| 214 |
+
|
| 215 |
+
if sim_modes:
|
| 216 |
+
out[int(inst)] = sim_modes
|
| 217 |
+
else:
|
| 218 |
+
errors.setdefault(int(inst), []).append("all modes failed")
|
| 219 |
+
|
| 220 |
+
if not out:
|
| 221 |
+
msg = f"No simulations succeeded for {mat_type} vf={vf_str} angles={upper_angles}."
|
| 222 |
+
if errors:
|
| 223 |
+
msg += " Errors: " + "; ".join(f"inst{inst}: {errs}" for inst, errs in errors.items())
|
| 224 |
+
raise RuntimeError(msg)
|
| 225 |
+
|
| 226 |
+
return out
|
| 227 |
+
finally:
|
| 228 |
+
lam.CURVE_DIR = original_curve_dir
|
| 229 |
+
|
| 230 |
+
|
| 231 |
+
def default_lam_dir() -> str:
|
| 232 |
+
"""
|
| 233 |
+
Default to the Space directory that contains a vendored `lam.py`.
|
| 234 |
+
Can be overridden via env MG_LAM_DIR.
|
| 235 |
+
"""
|
| 236 |
+
env = os.environ.get("MG_LAM_DIR")
|
| 237 |
+
if env:
|
| 238 |
+
return env
|
| 239 |
+
# Space layout: data_generation/hf_space_generation_ro/lam.py
|
| 240 |
+
here = Path(__file__).resolve()
|
| 241 |
+
return str(here.parent.parent)
|
| 242 |
+
|
data_generation/processed_dataset/config_1/metadata.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:1445e1ac3bf051c811c1c55520b1551d6298c467c276e2d65546d9bdb989d3d4
|
| 3 |
+
size 237926037
|
data_generation/shahriar_modified_2025_12/RVE_Datasets/CHDPE_0.0924_1_11.txt
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Strain_11 Stress_11 Strain_22 Strain_33
|
| 2 |
+
0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
|
| 3 |
+
5.000000e-03 9.534925e+01 -2.310667e-03 -2.307645e-03
|
| 4 |
+
1.000000e-02 1.905271e+02 -4.604358e-03 -4.598334e-03
|
| 5 |
+
1.500000e-02 2.853640e+02 -6.886136e-03 -6.877142e-03
|
| 6 |
+
2.000000e-02 3.792480e+02 -9.173770e-03 -9.161830e-03
|
| 7 |
+
2.500000e-02 4.720984e+02 -1.146994e-02 -1.145497e-02
|
| 8 |
+
3.000000e-02 5.644633e+02 -1.375957e-02 -1.374152e-02
|
| 9 |
+
3.500000e-02 6.565959e+02 -1.603539e-02 -1.601427e-02
|
| 10 |
+
4.000000e-02 7.485469e+02 -1.829625e-02 -1.827210e-02
|
| 11 |
+
4.500000e-02 8.403284e+02 -2.054202e-02 -2.051485e-02
|
| 12 |
+
5.000000e-02 9.319449e+02 -2.277277e-02 -2.274262e-02
|
| 13 |
+
5.500000e-02 1.023402e+03 -2.498851e-02 -2.495542e-02
|
| 14 |
+
6.000000e-02 1.114698e+03 -2.718959e-02 -2.715359e-02
|
| 15 |
+
6.500000e-02 1.205837e+03 -2.937602e-02 -2.933714e-02
|
| 16 |
+
7.000000e-02 1.296823e+03 -3.154793e-02 -3.150620e-02
|
| 17 |
+
7.500000e-02 1.387657e+03 -3.370544e-02 -3.366089e-02
|
| 18 |
+
8.000000e-02 1.478341e+03 -3.584868e-02 -3.580135e-02
|
| 19 |
+
8.500000e-02 1.568879e+03 -3.797777e-02 -3.792769e-02
|
| 20 |
+
9.000000e-02 1.659271e+03 -4.009285e-02 -4.004004e-02
|
| 21 |
+
9.500000e-02 1.749521e+03 -4.219405e-02 -4.213854e-02
|
| 22 |
+
1.000000e-01 1.839629e+03 -4.428148e-02 -4.422331e-02
|
| 23 |
+
volume fraction= 0.092363
|
| 24 |
+
fiber_centers_YZ= (0.017275,0.022793) (0.002167,0.005617) (0.009285,0.034121) (0.042275,0.022793) (0.027167,0.005617) (0.034285,0.034121) (0.052167,0.005617)
|
data_generation/shahriar_modified_2025_12/RVE_Datasets/CHDPE_0.0924_1_12.txt
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Strain_12 Stress_12
|
| 2 |
+
0.000000e+00 0.000000e+00
|
| 3 |
+
5.000000e-03 2.839216e+00
|
| 4 |
+
1.000000e-02 5.588398e+00
|
| 5 |
+
1.500000e-02 7.680908e+00
|
| 6 |
+
2.000000e-02 8.895033e+00
|
| 7 |
+
2.500000e-02 9.728212e+00
|
| 8 |
+
3.000000e-02 1.044392e+01
|
| 9 |
+
3.500000e-02 1.109897e+01
|
| 10 |
+
4.000000e-02 1.170674e+01
|
| 11 |
+
4.500000e-02 1.227277e+01
|
| 12 |
+
5.000000e-02 1.280090e+01
|
| 13 |
+
5.500000e-02 1.329438e+01
|
| 14 |
+
6.000000e-02 1.375612e+01
|
| 15 |
+
6.500000e-02 1.418882e+01
|
| 16 |
+
7.000000e-02 1.459495e+01
|
| 17 |
+
7.500000e-02 1.497678e+01
|
| 18 |
+
8.000000e-02 1.533224e+01
|
| 19 |
+
8.500000e-02 1.567142e+01
|
| 20 |
+
9.000000e-02 1.599245e+01
|
| 21 |
+
9.500000e-02 1.629687e+01
|
| 22 |
+
1.000000e-01 1.658625e+01
|
| 23 |
+
volume fraction= 0.092363
|
| 24 |
+
fiber_centers_YZ= (0.017275,0.022793) (0.002167,0.005617) (0.009285,0.034121) (0.042275,0.022793) (0.027167,0.005617) (0.034285,0.034121) (0.052167,0.005617)
|
data_generation/shahriar_modified_2025_12/RVE_Datasets/CHDPE_0.0924_1_22.txt
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Strain_22 Stress_22 Strain_11 Strain_33
|
| 2 |
+
0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
|
| 3 |
+
5.000000e-03 5.396585e+00 -1.306340e-04 -4.456201e-03
|
| 4 |
+
1.000000e-02 1.065990e+01 -2.572005e-04 -8.881963e-03
|
| 5 |
+
1.500000e-02 1.482475e+01 -3.587396e-04 -1.336267e-02
|
| 6 |
+
2.000000e-02 1.732569e+01 -4.229332e-04 -1.795116e-02
|
| 7 |
+
2.500000e-02 1.903323e+01 -4.683321e-04 -2.257021e-02
|
| 8 |
+
3.000000e-02 2.046323e+01 -5.063235e-04 -2.717229e-02
|
| 9 |
+
3.500000e-02 2.175922e+01 -5.402466e-04 -3.174410e-02
|
| 10 |
+
4.000000e-02 2.295725e+01 -5.710798e-04 -3.628243e-02
|
| 11 |
+
4.500000e-02 2.407041e+01 -5.992676e-04 -4.078629e-02
|
| 12 |
+
5.000000e-02 2.510145e+01 -6.248446e-04 -4.525610e-02
|
| 13 |
+
5.500000e-02 2.606607e+01 -6.485539e-04 -4.968996e-02
|
| 14 |
+
6.000000e-02 2.696554e+01 -6.703592e-04 -5.408849e-02
|
| 15 |
+
6.500000e-02 2.780489e+01 -6.904354e-04 -5.845164e-02
|
| 16 |
+
7.000000e-02 2.858871e+01 -7.089376e-04 -6.277939e-02
|
| 17 |
+
7.500000e-02 2.932103e+01 -7.259987e-04 -6.707179e-02
|
| 18 |
+
8.000000e-02 3.000571e+01 -7.417412e-04 -7.132894e-02
|
| 19 |
+
8.500000e-02 3.064632e+01 -7.562750e-04 -7.555094e-02
|
| 20 |
+
9.000000e-02 3.124631e+01 -7.697046e-04 -7.973792e-02
|
| 21 |
+
9.500000e-02 3.180916e+01 -7.821311e-04 -8.389001e-02
|
| 22 |
+
1.000000e-01 3.233775e+01 -7.936391e-04 -8.800741e-02
|
| 23 |
+
volume fraction= 0.092363
|
| 24 |
+
fiber_centers_YZ= (0.017275,0.022793) (0.002167,0.005617) (0.009285,0.034121) (0.042275,0.022793) (0.027167,0.005617) (0.034285,0.034121) (0.052167,0.005617)
|
data_generation/shahriar_modified_2025_12/RVE_Datasets/CHDPE_0.0924_2_11.txt
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Strain_11 Stress_11 Strain_22 Strain_33
|
| 2 |
+
0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
|
| 3 |
+
5.000000e-03 9.536606e+01 -2.301440e-03 -2.316797e-03
|
| 4 |
+
1.000000e-02 1.905607e+02 -4.585958e-03 -4.616585e-03
|
| 5 |
+
1.500000e-02 2.854143e+02 -6.858610e-03 -6.904451e-03
|
| 6 |
+
2.000000e-02 3.793148e+02 -9.136979e-03 -9.198358e-03
|
| 7 |
+
2.500000e-02 4.721818e+02 -1.142342e-02 -1.150120e-02
|
| 8 |
+
3.000000e-02 5.645633e+02 -1.370305e-02 -1.379772e-02
|
| 9 |
+
3.500000e-02 6.567123e+02 -1.596880e-02 -1.608052e-02
|
| 10 |
+
4.000000e-02 7.486799e+02 -1.821957e-02 -1.834841e-02
|
| 11 |
+
4.500000e-02 8.404779e+02 -2.045524e-02 -2.060124e-02
|
| 12 |
+
5.000000e-02 9.321136e+02 -2.267578e-02 -2.283897e-02
|
| 13 |
+
5.500000e-02 1.023585e+03 -2.488153e-02 -2.506197e-02
|
| 14 |
+
6.000000e-02 1.114897e+03 -2.707250e-02 -2.727023e-02
|
| 15 |
+
6.500000e-02 1.206052e+03 -2.924882e-02 -2.946387e-02
|
| 16 |
+
7.000000e-02 1.297054e+03 -3.141061e-02 -3.164303e-02
|
| 17 |
+
7.500000e-02 1.387905e+03 -3.355801e-02 -3.380782e-02
|
| 18 |
+
8.000000e-02 1.478606e+03 -3.569113e-02 -3.595838e-02
|
| 19 |
+
8.500000e-02 1.569159e+03 -3.781010e-02 -3.809483e-02
|
| 20 |
+
9.000000e-02 1.659568e+03 -3.991505e-02 -4.021730e-02
|
| 21 |
+
9.500000e-02 1.749834e+03 -4.200612e-02 -4.232591e-02
|
| 22 |
+
1.000000e-01 1.839958e+03 -4.408342e-02 -4.442080e-02
|
| 23 |
+
volume fraction= 0.092363
|
| 24 |
+
fiber_centers_YZ= (0.020136,0.014168) (0.010174,0.043883) (0.008863,0.020511) (0.045136,0.014168) (0.035174,0.043883) (0.033863,0.020511)
|
data_generation/shahriar_modified_2025_12/RVE_Datasets/CHDPE_0.0924_2_12.txt
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Strain_12 Stress_12
|
| 2 |
+
0.000000e+00 0.000000e+00
|
| 3 |
+
5.000000e-03 2.874010e+00
|
| 4 |
+
1.000000e-02 5.624720e+00
|
| 5 |
+
1.500000e-02 7.697166e+00
|
| 6 |
+
2.000000e-02 8.929249e+00
|
| 7 |
+
2.500000e-02 9.775334e+00
|
| 8 |
+
3.000000e-02 1.049814e+01
|
| 9 |
+
3.500000e-02 1.115800e+01
|
| 10 |
+
4.000000e-02 1.176904e+01
|
| 11 |
+
4.500000e-02 1.233750e+01
|
| 12 |
+
5.000000e-02 1.286757e+01
|
| 13 |
+
5.500000e-02 1.336269e+01
|
| 14 |
+
6.000000e-02 1.382596e+01
|
| 15 |
+
6.500000e-02 1.426022e+01
|
| 16 |
+
7.000000e-02 1.466802e+01
|
| 17 |
+
7.500000e-02 1.505176e+01
|
| 18 |
+
8.000000e-02 1.541368e+01
|
| 19 |
+
8.500000e-02 1.575582e+01
|
| 20 |
+
9.000000e-02 1.608007e+01
|
| 21 |
+
9.500000e-02 1.638818e+01
|
| 22 |
+
1.000000e-01 1.668206e+01
|
| 23 |
+
volume fraction= 0.092363
|
| 24 |
+
fiber_centers_YZ= (0.020136,0.014168) (0.010174,0.043883) (0.008863,0.020511) (0.045136,0.014168) (0.035174,0.043883) (0.033863,0.020511)
|
data_generation/shahriar_modified_2025_12/RVE_Datasets/CHDPE_0.0924_2_22.txt
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Strain_22 Stress_22 Strain_11 Strain_33
|
| 2 |
+
0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
|
| 3 |
+
5.000000e-03 5.497978e+00 -1.325568e-04 -4.451303e-03
|
| 4 |
+
1.000000e-02 1.083645e+01 -2.604151e-04 -8.874794e-03
|
| 5 |
+
1.500000e-02 1.501241e+01 -3.616524e-04 -1.335973e-02
|
| 6 |
+
2.000000e-02 1.757879e+01 -4.268926e-04 -1.794592e-02
|
| 7 |
+
2.500000e-02 1.936750e+01 -4.739540e-04 -2.256001e-02
|
| 8 |
+
3.000000e-02 2.087646e+01 -5.136756e-04 -2.715689e-02
|
| 9 |
+
3.500000e-02 2.224978e+01 -5.493598e-04 -3.172348e-02
|
| 10 |
+
4.000000e-02 2.352560e+01 -5.820102e-04 -3.625651e-02
|
| 11 |
+
4.500000e-02 2.471768e+01 -6.120789e-04 -4.075495e-02
|
| 12 |
+
5.000000e-02 2.583394e+01 -6.398600e-04 -4.521839e-02
|
| 13 |
+
5.500000e-02 2.688066e+01 -6.655902e-04 -4.964660e-02
|
| 14 |
+
6.000000e-02 2.786314e+01 -6.894631e-04 -5.403946e-02
|
| 15 |
+
6.500000e-02 2.878641e+01 -7.116537e-04 -5.839692e-02
|
| 16 |
+
7.000000e-02 2.965554e+01 -7.323258e-04 -6.271895e-02
|
| 17 |
+
7.500000e-02 3.047483e+01 -7.516175e-04 -6.700561e-02
|
| 18 |
+
8.000000e-02 3.124830e+01 -7.696568e-04 -7.125695e-02
|
| 19 |
+
8.500000e-02 3.197968e+01 -7.865551e-04 -7.547311e-02
|
| 20 |
+
9.000000e-02 3.267243e+01 -8.024180e-04 -7.965421e-02
|
| 21 |
+
9.500000e-02 3.333025e+01 -8.173495e-04 -8.380040e-02
|
| 22 |
+
1.000000e-01 3.395578e+01 -8.314306e-04 -8.791188e-02
|
| 23 |
+
volume fraction= 0.092363
|
| 24 |
+
fiber_centers_YZ= (0.020136,0.014168) (0.010174,0.043883) (0.008863,0.020511) (0.045136,0.014168) (0.035174,0.043883) (0.033863,0.020511)
|
data_generation/shahriar_modified_2025_12/RVE_Datasets/CHDPE_0.0924_3_11.txt
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Strain_11 Stress_11 Strain_22 Strain_33
|
| 2 |
+
0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
|
| 3 |
+
5.000000e-03 9.537730e+01 -2.300143e-03 -2.318003e-03
|
| 4 |
+
1.000000e-02 1.905831e+02 -4.583358e-03 -4.619005e-03
|
| 5 |
+
1.500000e-02 2.854478e+02 -6.854696e-03 -6.908107e-03
|
| 6 |
+
2.000000e-02 3.793593e+02 -9.131643e-03 -9.203398e-03
|
| 7 |
+
2.500000e-02 4.722372e+02 -1.141638e-02 -1.150793e-02
|
| 8 |
+
3.000000e-02 5.646297e+02 -1.369411e-02 -1.380634e-02
|
| 9 |
+
3.500000e-02 6.567897e+02 -1.595786e-02 -1.609114e-02
|
| 10 |
+
4.000000e-02 7.487682e+02 -1.820654e-02 -1.836111e-02
|
| 11 |
+
4.500000e-02 8.405800e+02 -2.043993e-02 -2.061598e-02
|
| 12 |
+
5.000000e-02 9.322239e+02 -2.265835e-02 -2.285606e-02
|
| 13 |
+
5.500000e-02 1.023706e+03 -2.486181e-02 -2.508135e-02
|
| 14 |
+
6.000000e-02 1.115029e+03 -2.705043e-02 -2.729196e-02
|
| 15 |
+
6.500000e-02 1.206195e+03 -2.922434e-02 -2.948801e-02
|
| 16 |
+
7.000000e-02 1.297208e+03 -3.138366e-02 -3.166964e-02
|
| 17 |
+
7.500000e-02 1.388069e+03 -3.352854e-02 -3.383696e-02
|
| 18 |
+
8.000000e-02 1.478781e+03 -3.565909e-02 -3.599009e-02
|
| 19 |
+
8.500000e-02 1.569345e+03 -3.777544e-02 -3.812917e-02
|
| 20 |
+
9.000000e-02 1.659765e+03 -3.987773e-02 -4.025431e-02
|
| 21 |
+
9.500000e-02 1.750041e+03 -4.196608e-02 -4.236565e-02
|
| 22 |
+
1.000000e-01 1.840176e+03 -4.404062e-02 -4.446332e-02
|
| 23 |
+
volume fraction= 0.092363
|
| 24 |
+
fiber_centers_YZ= (0.020112,0.032604) (0.013130,0.026381) (0.012601,0.040099) (0.045112,0.032604) (0.038130,0.026381) (0.037601,0.040099)
|
data_generation/shahriar_modified_2025_12/RVE_Datasets/CHDPE_0.0924_3_12.txt
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Strain_12 Stress_12
|
| 2 |
+
0.000000e+00 0.000000e+00
|
| 3 |
+
5.000000e-03 2.876095e+00
|
| 4 |
+
1.000000e-02 5.624020e+00
|
| 5 |
+
1.500000e-02 7.681499e+00
|
| 6 |
+
2.000000e-02 8.904930e+00
|
| 7 |
+
2.500000e-02 9.741776e+00
|
| 8 |
+
3.000000e-02 1.045608e+01
|
| 9 |
+
3.500000e-02 1.110762e+01
|
| 10 |
+
4.000000e-02 1.171044e+01
|
| 11 |
+
4.500000e-02 1.227050e+01
|
| 12 |
+
5.000000e-02 1.279198e+01
|
| 13 |
+
5.500000e-02 1.327837e+01
|
| 14 |
+
6.000000e-02 1.373279e+01
|
| 15 |
+
6.500000e-02 1.415809e+01
|
| 16 |
+
7.000000e-02 1.455685e+01
|
| 17 |
+
7.500000e-02 1.493145e+01
|
| 18 |
+
8.000000e-02 1.528410e+01
|
| 19 |
+
8.500000e-02 1.561683e+01
|
| 20 |
+
9.000000e-02 1.593158e+01
|
| 21 |
+
9.500000e-02 1.623006e+01
|
| 22 |
+
1.000000e-01 1.651393e+01
|
| 23 |
+
volume fraction= 0.092363
|
| 24 |
+
fiber_centers_YZ= (0.020112,0.032604) (0.013130,0.026381) (0.012601,0.040099) (0.045112,0.032604) (0.038130,0.026381) (0.037601,0.040099)
|
data_generation/shahriar_modified_2025_12/RVE_Datasets/CHDPE_0.0924_3_22.txt
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Strain_22 Stress_22 Strain_11 Strain_33
|
| 2 |
+
0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
|
| 3 |
+
5.000000e-03 5.470032e+00 -1.317899e-04 -4.454659e-03
|
| 4 |
+
1.000000e-02 1.075278e+01 -2.582043e-04 -8.884161e-03
|
| 5 |
+
1.500000e-02 1.490073e+01 -3.586903e-04 -1.337226e-02
|
| 6 |
+
2.000000e-02 1.748149e+01 -4.241835e-04 -1.795741e-02
|
| 7 |
+
2.500000e-02 1.923287e+01 -4.703627e-04 -2.257517e-02
|
| 8 |
+
3.000000e-02 2.069705e+01 -5.089641e-04 -2.717656e-02
|
| 9 |
+
3.500000e-02 2.202985e+01 -5.435675e-04 -3.174740e-02
|
| 10 |
+
4.000000e-02 2.326804e+01 -5.751737e-04 -3.628442e-02
|
| 11 |
+
4.500000e-02 2.442412e+01 -6.042203e-04 -4.078670e-02
|
| 12 |
+
5.000000e-02 2.550540e+01 -6.309950e-04 -4.525384e-02
|
| 13 |
+
5.500000e-02 2.651788e+01 -6.557309e-04 -4.968563e-02
|
| 14 |
+
6.000000e-02 2.746760e+01 -6.786415e-04 -5.408188e-02
|
| 15 |
+
6.500000e-02 2.835985e+01 -6.999099e-04 -5.844253e-02
|
| 16 |
+
7.000000e-02 2.919923e+01 -7.196903e-04 -6.276758e-02
|
| 17 |
+
7.500000e-02 2.998999e+01 -7.381215e-04 -6.705708e-02
|
| 18 |
+
8.000000e-02 3.073611e+01 -7.553293e-04 -7.131112e-02
|
| 19 |
+
8.500000e-02 3.143291e+01 -7.711048e-04 -7.553089e-02
|
| 20 |
+
9.000000e-02 3.210048e+01 -7.861920e-04 -7.971438e-02
|
| 21 |
+
9.500000e-02 3.273372e+01 -8.003683e-04 -8.386284e-02
|
| 22 |
+
1.000000e-01 3.333545e+01 -8.137147e-04 -8.797646e-02
|
| 23 |
+
volume fraction= 0.092363
|
| 24 |
+
fiber_centers_YZ= (0.020112,0.032604) (0.013130,0.026381) (0.012601,0.040099) (0.045112,0.032604) (0.038130,0.026381) (0.037601,0.040099)
|
data_generation/shahriar_modified_2025_12/RVE_Datasets/CHDPE_0.0924_4_11.txt
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Strain_11 Stress_11 Strain_22 Strain_33
|
| 2 |
+
0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
|
| 3 |
+
5.000000e-03 9.537443e+01 -2.284613e-03 -2.333356e-03
|
| 4 |
+
1.000000e-02 1.905773e+02 -4.552362e-03 -4.649648e-03
|
| 5 |
+
1.500000e-02 2.854390e+02 -6.808272e-03 -6.954022e-03
|
| 6 |
+
2.000000e-02 3.793473e+02 -9.069328e-03 -9.265099e-03
|
| 7 |
+
2.500000e-02 4.722219e+02 -1.133697e-02 -1.158666e-02
|
| 8 |
+
3.000000e-02 5.646111e+02 -1.359688e-02 -1.390283e-02
|
| 9 |
+
3.500000e-02 6.567679e+02 -1.584254e-02 -1.620566e-02
|
| 10 |
+
4.000000e-02 7.487461e+02 -1.807287e-02 -1.849369e-02
|
| 11 |
+
4.500000e-02 8.405518e+02 -2.028802e-02 -2.076699e-02
|
| 12 |
+
5.000000e-02 9.321925e+02 -2.248798e-02 -2.302549e-02
|
| 13 |
+
5.500000e-02 1.023671e+03 -2.467286e-02 -2.526929e-02
|
| 14 |
+
6.000000e-02 1.114991e+03 -2.684282e-02 -2.749852e-02
|
| 15 |
+
6.500000e-02 1.206155e+03 -2.899797e-02 -2.971329e-02
|
| 16 |
+
7.000000e-02 1.297164e+03 -3.113846e-02 -3.191370e-02
|
| 17 |
+
7.500000e-02 1.388022e+03 -3.326440e-02 -3.409990e-02
|
| 18 |
+
8.000000e-02 1.478731e+03 -3.537595e-02 -3.627199e-02
|
| 19 |
+
8.500000e-02 1.569292e+03 -3.747322e-02 -3.843010e-02
|
| 20 |
+
9.000000e-02 1.659708e+03 -3.955635e-02 -4.057435e-02
|
| 21 |
+
9.500000e-02 1.749981e+03 -4.162548e-02 -4.270487e-02
|
| 22 |
+
1.000000e-01 1.840113e+03 -4.368073e-02 -4.482177e-02
|
| 23 |
+
volume fraction= 0.092363
|
| 24 |
+
fiber_centers_YZ= (0.016667,0.031031) (0.013718,0.020586) (0.007343,0.032616) (0.041667,0.031031) (0.038718,0.020586) (0.032343,0.032616)
|
data_generation/shahriar_modified_2025_12/RVE_Datasets/CHDPE_0.0924_4_12.txt
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Strain_12 Stress_12
|
| 2 |
+
0.000000e+00 0.000000e+00
|
| 3 |
+
5.000000e-03 2.908917e+00
|
| 4 |
+
1.000000e-02 5.631345e+00
|
| 5 |
+
1.500000e-02 7.682056e+00
|
| 6 |
+
2.000000e-02 8.920737e+00
|
| 7 |
+
2.500000e-02 9.763417e+00
|
| 8 |
+
3.000000e-02 1.047962e+01
|
| 9 |
+
3.500000e-02 1.113198e+01
|
| 10 |
+
4.000000e-02 1.173521e+01
|
| 11 |
+
4.500000e-02 1.229560e+01
|
| 12 |
+
5.000000e-02 1.281753e+01
|
| 13 |
+
5.500000e-02 1.330257e+01
|
| 14 |
+
6.000000e-02 1.375779e+01
|
| 15 |
+
6.500000e-02 1.418445e+01
|
| 16 |
+
7.000000e-02 1.458511e+01
|
| 17 |
+
7.500000e-02 1.496218e+01
|
| 18 |
+
8.000000e-02 1.531793e+01
|
| 19 |
+
8.500000e-02 1.565763e+01
|
| 20 |
+
9.000000e-02 1.597712e+01
|
| 21 |
+
9.500000e-02 1.628089e+01
|
| 22 |
+
1.000000e-01 1.657066e+01
|
| 23 |
+
volume fraction= 0.092363
|
| 24 |
+
fiber_centers_YZ= (0.016667,0.031031) (0.013718,0.020586) (0.007343,0.032616) (0.041667,0.031031) (0.038718,0.020586) (0.032343,0.032616)
|
data_generation/shahriar_modified_2025_12/RVE_Datasets/CHDPE_0.0924_4_22.txt
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Strain_22 Stress_22 Strain_11 Strain_33
|
| 2 |
+
0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
|
| 3 |
+
5.000000e-03 5.941760e+00 -1.422726e-04 -4.418295e-03
|
| 4 |
+
1.000000e-02 1.152891e+01 -2.760146e-04 -8.820926e-03
|
| 5 |
+
1.500000e-02 1.581615e+01 -3.808509e-04 -1.329015e-02
|
| 6 |
+
2.000000e-02 1.859339e+01 -4.515324e-04 -1.785470e-02
|
| 7 |
+
2.500000e-02 2.054824e+01 -5.029107e-04 -2.245288e-02
|
| 8 |
+
3.000000e-02 2.218745e+01 -5.461238e-04 -2.703742e-02
|
| 9 |
+
3.500000e-02 2.367245e+01 -5.848588e-04 -3.159342e-02
|
| 10 |
+
4.000000e-02 2.504666e+01 -6.202492e-04 -3.611702e-02
|
| 11 |
+
4.500000e-02 2.632632e+01 -6.528080e-04 -4.060698e-02
|
| 12 |
+
5.000000e-02 2.752136e+01 -6.828773e-04 -4.506270e-02
|
| 13 |
+
5.500000e-02 2.863977e+01 -7.107327e-04 -4.948383e-02
|
| 14 |
+
6.000000e-02 2.968823e+01 -7.365987e-04 -5.387016e-02
|
| 15 |
+
6.500000e-02 3.067287e+01 -7.606744e-04 -5.822154e-02
|
| 16 |
+
7.000000e-02 3.159907e+01 -7.831302e-04 -6.253794e-02
|
| 17 |
+
7.500000e-02 3.247185e+01 -8.041205e-04 -6.681935e-02
|
| 18 |
+
8.000000e-02 3.329694e+01 -8.237328e-04 -7.106570e-02
|
| 19 |
+
8.500000e-02 3.407648e+01 -8.421972e-04 -7.527727e-02
|
| 20 |
+
9.000000e-02 3.481556e+01 -8.595775e-04 -7.945407e-02
|
| 21 |
+
9.500000e-02 3.551664e+01 -8.760271e-04 -8.359635e-02
|
| 22 |
+
1.000000e-01 3.618487e+01 -8.915277e-04 -8.770408e-02
|
| 23 |
+
volume fraction= 0.092363
|
| 24 |
+
fiber_centers_YZ= (0.016667,0.031031) (0.013718,0.020586) (0.007343,0.032616) (0.041667,0.031031) (0.038718,0.020586) (0.032343,0.032616)
|
data_generation/shahriar_modified_2025_12/RVE_Datasets/CHDPE_0.0924_5_11.txt
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Strain_11 Stress_11 Strain_22 Strain_33
|
| 2 |
+
0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
|
| 3 |
+
5.000000e-03 9.536402e+01 -2.301388e-03 -2.316881e-03
|
| 4 |
+
1.000000e-02 1.905566e+02 -4.585857e-03 -4.616750e-03
|
| 5 |
+
1.500000e-02 2.854082e+02 -6.858477e-03 -6.904677e-03
|
| 6 |
+
2.000000e-02 3.793068e+02 -9.136887e-03 -9.198566e-03
|
| 7 |
+
2.500000e-02 4.721717e+02 -1.142345e-02 -1.150130e-02
|
| 8 |
+
3.000000e-02 5.645513e+02 -1.370325e-02 -1.379767e-02
|
| 9 |
+
3.500000e-02 6.566984e+02 -1.596922e-02 -1.608028e-02
|
| 10 |
+
4.000000e-02 7.486640e+02 -1.822025e-02 -1.834792e-02
|
| 11 |
+
4.500000e-02 8.404628e+02 -2.045609e-02 -2.060036e-02
|
| 12 |
+
5.000000e-02 9.320938e+02 -2.267707e-02 -2.283791e-02
|
| 13 |
+
5.500000e-02 1.023563e+03 -2.488318e-02 -2.506055e-02
|
| 14 |
+
6.000000e-02 1.114873e+03 -2.707455e-02 -2.726843e-02
|
| 15 |
+
6.500000e-02 1.206027e+03 -2.925130e-02 -2.946165e-02
|
| 16 |
+
7.000000e-02 1.297027e+03 -3.141356e-02 -3.164035e-02
|
| 17 |
+
7.500000e-02 1.387875e+03 -3.356145e-02 -3.380466e-02
|
| 18 |
+
8.000000e-02 1.478574e+03 -3.569511e-02 -3.595469e-02
|
| 19 |
+
8.500000e-02 1.569126e+03 -3.781465e-02 -3.809058e-02
|
| 20 |
+
9.000000e-02 1.659533e+03 -3.992021e-02 -4.021245e-02
|
| 21 |
+
9.500000e-02 1.749797e+03 -4.201192e-02 -4.232044e-02
|
| 22 |
+
1.000000e-01 1.839920e+03 -4.408989e-02 -4.441466e-02
|
| 23 |
+
volume fraction= 0.092363
|
| 24 |
+
fiber_centers_YZ= (0.013619,0.034901) (0.001279,0.028660) (0.011215,0.007685) (0.038619,0.034901) (0.026279,0.028660) (0.036215,0.007685) (0.051279,0.028660)
|
data_generation/shahriar_modified_2025_12/RVE_Datasets/CHDPE_0.0924_5_12.txt
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Strain_12 Stress_12
|
| 2 |
+
0.000000e+00 0.000000e+00
|
| 3 |
+
5.000000e-03 2.873774e+00
|
| 4 |
+
1.000000e-02 5.624181e+00
|
| 5 |
+
1.500000e-02 7.695935e+00
|
| 6 |
+
2.000000e-02 8.927402e+00
|
| 7 |
+
2.500000e-02 9.772809e+00
|
| 8 |
+
3.000000e-02 1.049518e+01
|
| 9 |
+
3.500000e-02 1.115444e+01
|
| 10 |
+
4.000000e-02 1.176514e+01
|
| 11 |
+
4.500000e-02 1.233333e+01
|
| 12 |
+
5.000000e-02 1.286316e+01
|
| 13 |
+
5.500000e-02 1.335806e+01
|
| 14 |
+
6.000000e-02 1.382114e+01
|
| 15 |
+
6.500000e-02 1.425521e+01
|
| 16 |
+
7.000000e-02 1.466284e+01
|
| 17 |
+
7.500000e-02 1.504641e+01
|
| 18 |
+
8.000000e-02 1.540812e+01
|
| 19 |
+
8.500000e-02 1.574998e+01
|
| 20 |
+
9.000000e-02 1.607389e+01
|
| 21 |
+
9.500000e-02 1.638157e+01
|
| 22 |
+
1.000000e-01 1.667466e+01
|
| 23 |
+
volume fraction= 0.092363
|
| 24 |
+
fiber_centers_YZ= (0.013619,0.034901) (0.001279,0.028660) (0.011215,0.007685) (0.038619,0.034901) (0.026279,0.028660) (0.036215,0.007685) (0.051279,0.028660)
|
data_generation/shahriar_modified_2025_12/RVE_Datasets/CHDPE_0.0924_5_22.txt
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Strain_22 Stress_22 Strain_11 Strain_33
|
| 2 |
+
0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
|
| 3 |
+
5.000000e-03 5.502413e+00 -1.326491e-04 -4.450958e-03
|
| 4 |
+
1.000000e-02 1.084439e+01 -2.605947e-04 -8.874108e-03
|
| 5 |
+
1.500000e-02 1.502659e+01 -3.620199e-04 -1.335822e-02
|
| 6 |
+
2.000000e-02 1.760078e+01 -4.275539e-04 -1.794353e-02
|
| 7 |
+
2.500000e-02 1.938857e+01 -4.746586e-04 -2.255734e-02
|
| 8 |
+
3.000000e-02 2.089472e+01 -5.143568e-04 -2.715419e-02
|
| 9 |
+
3.500000e-02 2.226572e+01 -5.500112e-04 -3.172079e-02
|
| 10 |
+
4.000000e-02 2.353948e+01 -5.826307e-04 -3.625383e-02
|
| 11 |
+
4.500000e-02 2.472947e+01 -6.126641e-04 -4.075229e-02
|
| 12 |
+
5.000000e-02 2.584342e+01 -6.404036e-04 -4.521577e-02
|
| 13 |
+
5.500000e-02 2.688228e+01 -6.658380e-04 -4.964480e-02
|
| 14 |
+
6.000000e-02 2.786243e+01 -6.896614e-04 -5.403772e-02
|
| 15 |
+
6.500000e-02 2.878376e+01 -7.118114e-04 -5.839521e-02
|
| 16 |
+
7.000000e-02 2.965093e+01 -7.324434e-04 -6.271727e-02
|
| 17 |
+
7.500000e-02 3.046857e+01 -7.517040e-04 -6.700391e-02
|
| 18 |
+
8.000000e-02 3.124070e+01 -7.697190e-04 -7.125523e-02
|
| 19 |
+
8.500000e-02 3.197087e+01 -7.865988e-04 -7.547134e-02
|
| 20 |
+
9.000000e-02 3.266268e+01 -8.024503e-04 -7.965238e-02
|
| 21 |
+
9.500000e-02 3.331943e+01 -8.173695e-04 -8.379852e-02
|
| 22 |
+
1.000000e-01 3.394390e+01 -8.314383e-04 -8.790995e-02
|
| 23 |
+
volume fraction= 0.092363
|
| 24 |
+
fiber_centers_YZ= (0.013619,0.034901) (0.001279,0.028660) (0.011215,0.007685) (0.038619,0.034901) (0.026279,0.028660) (0.036215,0.007685) (0.051279,0.028660)
|
data_generation/shahriar_modified_2025_12/RVE_Datasets/CHDPE_0.2155_1_11.txt
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Strain_11 Stress_11 Strain_22 Strain_33
|
| 2 |
+
0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
|
| 3 |
+
5.000000e-03 2.178527e+02 -2.171294e-03 -2.218585e-03
|
| 4 |
+
1.000000e-02 4.352236e+02 -4.326776e-03 -4.421057e-03
|
| 5 |
+
1.500000e-02 6.519695e+02 -6.470945e-03 -6.612148e-03
|
| 6 |
+
2.000000e-02 8.675785e+02 -8.619132e-03 -8.808584e-03
|
| 7 |
+
2.500000e-02 1.082008e+03 -1.077291e-02 -1.101302e-02
|
| 8 |
+
3.000000e-02 1.295730e+03 -1.291951e-02 -1.321143e-02
|
| 9 |
+
3.500000e-02 1.508962e+03 -1.505283e-02 -1.539679e-02
|
| 10 |
+
4.000000e-02 1.721747e+03 -1.717201e-02 -1.756803e-02
|
| 11 |
+
4.500000e-02 1.934103e+03 -1.927675e-02 -1.972478e-02
|
| 12 |
+
5.000000e-02 2.146026e+03 -2.136756e-02 -2.186757e-02
|
| 13 |
+
5.500000e-02 2.357519e+03 -2.344468e-02 -2.399664e-02
|
| 14 |
+
6.000000e-02 2.568599e+03 -2.550738e-02 -2.611116e-02
|
| 15 |
+
6.500000e-02 2.779269e+03 -2.755631e-02 -2.821185e-02
|
| 16 |
+
7.000000e-02 2.989517e+03 -2.959185e-02 -3.029907e-02
|
| 17 |
+
7.500000e-02 3.199368e+03 -3.161360e-02 -3.237241e-02
|
| 18 |
+
8.000000e-02 3.408806e+03 -3.362235e-02 -3.443268e-02
|
| 19 |
+
8.500000e-02 3.617847e+03 -3.561735e-02 -3.647902e-02
|
| 20 |
+
9.000000e-02 3.826497e+03 -3.759920e-02 -3.851214e-02
|
| 21 |
+
9.500000e-02 4.034746e+03 -3.956821e-02 -4.053231e-02
|
| 22 |
+
1.000000e-01 4.242610e+03 -4.152411e-02 -4.253925e-02
|
| 23 |
+
volume fraction= 0.215513
|
| 24 |
+
fiber_centers_YZ= (0.017036,0.027518) (0.002511,0.037127) (0.013575,0.039619) (0.008139,0.010335) (0.018269,0.004963) (0.000336,0.014094) (0.009131,0.023287) (0.042036,0.027518) (0.027511,0.037127) (0.038575,0.039619) (0.033139,0.010335) (0.043269,0.004963) (0.025336,0.014094) (0.034131,0.023287) (0.052511,0.037127) (0.050336,0.014094)
|
data_generation/shahriar_modified_2025_12/RVE_Datasets/CHDPE_0.2155_1_12.txt
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Strain_12 Stress_12
|
| 2 |
+
0.000000e+00 0.000000e+00
|
| 3 |
+
5.000000e-03 3.826899e+00
|
| 4 |
+
1.000000e-02 7.119306e+00
|
| 5 |
+
1.500000e-02 9.188011e+00
|
| 6 |
+
2.000000e-02 1.049468e+01
|
| 7 |
+
2.500000e-02 1.150529e+01
|
| 8 |
+
3.000000e-02 1.238523e+01
|
| 9 |
+
3.500000e-02 1.317819e+01
|
| 10 |
+
4.000000e-02 1.390072e+01
|
| 11 |
+
4.500000e-02 1.456282e+01
|
| 12 |
+
5.000000e-02 1.517212e+01
|
| 13 |
+
5.500000e-02 1.573515e+01
|
| 14 |
+
6.000000e-02 1.625752e+01
|
| 15 |
+
6.500000e-02 1.674424e+01
|
| 16 |
+
7.000000e-02 1.719973e+01
|
| 17 |
+
7.500000e-02 1.762794e+01
|
| 18 |
+
8.000000e-02 1.803238e+01
|
| 19 |
+
8.500000e-02 1.841621e+01
|
| 20 |
+
9.000000e-02 1.878223e+01
|
| 21 |
+
9.500000e-02 1.913296e+01
|
| 22 |
+
1.000000e-01 1.947063e+01
|
| 23 |
+
volume fraction= 0.215513
|
| 24 |
+
fiber_centers_YZ= (0.017036,0.027518) (0.002511,0.037127) (0.013575,0.039619) (0.008139,0.010335) (0.018269,0.004963) (0.000336,0.014094) (0.009131,0.023287) (0.042036,0.027518) (0.027511,0.037127) (0.038575,0.039619) (0.033139,0.010335) (0.043269,0.004963) (0.025336,0.014094) (0.034131,0.023287) (0.052511,0.037127) (0.050336,0.014094)
|
data_generation/shahriar_modified_2025_12/RVE_Datasets/CHDPE_0.2155_1_22.txt
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Strain_22 Stress_22 Strain_11 Strain_33
|
| 2 |
+
0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
|
| 3 |
+
5.000000e-03 7.286320e+00 -7.257001e-05 -4.461557e-03
|
| 4 |
+
1.000000e-02 1.394007e+01 -1.387668e-04 -8.919231e-03
|
| 5 |
+
1.500000e-02 1.825638e+01 -1.829116e-04 -1.348743e-02
|
| 6 |
+
2.000000e-02 2.099228e+01 -2.116775e-04 -1.812176e-02
|
| 7 |
+
2.500000e-02 2.315578e+01 -2.345141e-04 -2.275336e-02
|
| 8 |
+
3.000000e-02 2.506238e+01 -2.544827e-04 -2.735927e-02
|
| 9 |
+
3.500000e-02 2.679631e+01 -2.724671e-04 -3.193352e-02
|
| 10 |
+
4.000000e-02 2.838915e+01 -2.888338e-04 -3.647414e-02
|
| 11 |
+
4.500000e-02 2.985959e+01 -3.038114e-04 -4.098022e-02
|
| 12 |
+
5.000000e-02 3.122135e+01 -3.175695e-04 -4.545123e-02
|
| 13 |
+
5.500000e-02 3.248601e+01 -3.302501e-04 -4.988685e-02
|
| 14 |
+
6.000000e-02 3.366358e+01 -3.419738e-04 -5.428686e-02
|
| 15 |
+
6.500000e-02 3.476325e+01 -3.528489e-04 -5.865110e-02
|
| 16 |
+
7.000000e-02 3.579333e+01 -3.629719e-04 -6.297950e-02
|
| 17 |
+
7.500000e-02 3.676124e+01 -3.724283e-04 -6.727204e-02
|
| 18 |
+
8.000000e-02 3.767394e+01 -3.812971e-04 -7.152873e-02
|
| 19 |
+
8.500000e-02 3.853763e+01 -3.896479e-04 -7.574963e-02
|
| 20 |
+
9.000000e-02 3.935765e+01 -3.975406e-04 -7.993487e-02
|
| 21 |
+
9.500000e-02 4.013906e+01 -4.050531e-04 -8.408472e-02
|
| 22 |
+
1.000000e-01 4.088604e+01 -4.121880e-04 -8.819911e-02
|
| 23 |
+
volume fraction= 0.215513
|
| 24 |
+
fiber_centers_YZ= (0.017036,0.027518) (0.002511,0.037127) (0.013575,0.039619) (0.008139,0.010335) (0.018269,0.004963) (0.000336,0.014094) (0.009131,0.023287) (0.042036,0.027518) (0.027511,0.037127) (0.038575,0.039619) (0.033139,0.010335) (0.043269,0.004963) (0.025336,0.014094) (0.034131,0.023287) (0.052511,0.037127) (0.050336,0.014094)
|
data_generation/shahriar_modified_2025_12/RVE_Datasets/CHDPE_0.2155_2_11.txt
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Strain_11 Stress_11 Strain_22 Strain_33
|
| 2 |
+
0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
|
| 3 |
+
5.000000e-03 2.178441e+02 -2.183689e-03 -2.206434e-03
|
| 4 |
+
1.000000e-02 4.352065e+02 -4.351463e-03 -4.396852e-03
|
| 5 |
+
1.500000e-02 6.519441e+02 -6.507875e-03 -6.575920e-03
|
| 6 |
+
2.000000e-02 8.675451e+02 -8.668506e-03 -8.760072e-03
|
| 7 |
+
2.500000e-02 1.081967e+03 -1.083503e-02 -1.095188e-02
|
| 8 |
+
3.000000e-02 1.295681e+03 -1.299444e-02 -1.313758e-02
|
| 9 |
+
3.500000e-02 1.508905e+03 -1.514050e-02 -1.531030e-02
|
| 10 |
+
4.000000e-02 1.721682e+03 -1.727232e-02 -1.746900e-02
|
| 11 |
+
4.500000e-02 1.934030e+03 -1.938957e-02 -1.961332e-02
|
| 12 |
+
5.000000e-02 2.145945e+03 -2.149280e-02 -2.174379e-02
|
| 13 |
+
5.500000e-02 2.357431e+03 -2.358209e-02 -2.386048e-02
|
| 14 |
+
6.000000e-02 2.568508e+03 -2.565694e-02 -2.596287e-02
|
| 15 |
+
6.500000e-02 2.779165e+03 -2.771810e-02 -2.805172e-02
|
| 16 |
+
7.000000e-02 2.989406e+03 -2.976565e-02 -3.012708e-02
|
| 17 |
+
7.500000e-02 3.199250e+03 -3.179922e-02 -3.218858e-02
|
| 18 |
+
8.000000e-02 3.408680e+03 -3.381952e-02 -3.423693e-02
|
| 19 |
+
8.500000e-02 3.617719e+03 -3.582620e-02 -3.627180e-02
|
| 20 |
+
9.000000e-02 3.826353e+03 -3.782012e-02 -3.829405e-02
|
| 21 |
+
9.500000e-02 4.034597e+03 -3.980007e-02 -4.030232e-02
|
| 22 |
+
1.000000e-01 4.242451e+03 -4.176743e-02 -4.229819e-02
|
| 23 |
+
volume fraction= 0.215513
|
| 24 |
+
fiber_centers_YZ= (0.013685,0.005883) (0.009428,0.029367) (0.017368,0.039730) (0.010789,0.016267) (0.002145,0.039296) (0.018889,0.022585) (0.001301,0.005213) (0.038685,0.005883) (0.034428,0.029367) (0.042368,0.039730) (0.035789,0.016267) (0.027145,0.039296) (0.043889,0.022585) (0.026301,0.005213) (0.052145,0.039296) (0.051301,0.005213)
|
data_generation/shahriar_modified_2025_12/RVE_Datasets/CHDPE_0.2155_2_12.txt
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Strain_12 Stress_12
|
| 2 |
+
0.000000e+00 0.000000e+00
|
| 3 |
+
5.000000e-03 3.749678e+00
|
| 4 |
+
1.000000e-02 7.035726e+00
|
| 5 |
+
1.500000e-02 9.090922e+00
|
| 6 |
+
2.000000e-02 1.037589e+01
|
| 7 |
+
2.500000e-02 1.137705e+01
|
| 8 |
+
3.000000e-02 1.225230e+01
|
| 9 |
+
3.500000e-02 1.304246e+01
|
| 10 |
+
4.000000e-02 1.376319e+01
|
| 11 |
+
4.500000e-02 1.442403e+01
|
| 12 |
+
5.000000e-02 1.503232e+01
|
| 13 |
+
5.500000e-02 1.559423e+01
|
| 14 |
+
6.000000e-02 1.611518e+01
|
| 15 |
+
6.500000e-02 1.660000e+01
|
| 16 |
+
7.000000e-02 1.705299e+01
|
| 17 |
+
7.500000e-02 1.747803e+01
|
| 18 |
+
8.000000e-02 1.787861e+01
|
| 19 |
+
8.500000e-02 1.825788e+01
|
| 20 |
+
9.000000e-02 1.861869e+01
|
| 21 |
+
9.500000e-02 1.896359e+01
|
| 22 |
+
1.000000e-01 1.929490e+01
|
| 23 |
+
volume fraction= 0.215513
|
| 24 |
+
fiber_centers_YZ= (0.013685,0.005883) (0.009428,0.029367) (0.017368,0.039730) (0.010789,0.016267) (0.002145,0.039296) (0.018889,0.022585) (0.001301,0.005213) (0.038685,0.005883) (0.034428,0.029367) (0.042368,0.039730) (0.035789,0.016267) (0.027145,0.039296) (0.043889,0.022585) (0.026301,0.005213) (0.052145,0.039296) (0.051301,0.005213)
|
data_generation/shahriar_modified_2025_12/RVE_Datasets/CHDPE_0.2155_2_22.txt
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Strain_22 Stress_22 Strain_11 Strain_33
|
| 2 |
+
0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
|
| 3 |
+
5.000000e-03 7.557735e+00 -7.573147e-05 -4.433629e-03
|
| 4 |
+
1.000000e-02 1.433275e+01 -1.437334e-04 -8.872497e-03
|
| 5 |
+
1.500000e-02 1.872942e+01 -1.890971e-04 -1.342871e-02
|
| 6 |
+
2.000000e-02 2.156185e+01 -2.191675e-04 -1.805170e-02
|
| 7 |
+
2.500000e-02 2.381467e+01 -2.432295e-04 -2.267246e-02
|
| 8 |
+
3.000000e-02 2.579465e+01 -2.642562e-04 -2.726905e-02
|
| 9 |
+
3.500000e-02 2.758764e+01 -2.831407e-04 -3.183544e-02
|
| 10 |
+
4.000000e-02 2.922823e+01 -3.002775e-04 -3.636941e-02
|
| 11 |
+
4.500000e-02 3.073676e+01 -3.159128e-04 -4.086986e-02
|
| 12 |
+
5.000000e-02 3.212860e+01 -3.302343e-04 -4.533611e-02
|
| 13 |
+
5.500000e-02 3.341684e+01 -3.434004e-04 -4.976765e-02
|
| 14 |
+
6.000000e-02 3.461252e+01 -3.555426e-04 -5.416419e-02
|
| 15 |
+
6.500000e-02 3.572509e+01 -3.667735e-04 -5.852551e-02
|
| 16 |
+
7.000000e-02 3.676336e+01 -3.771946e-04 -6.285150e-02
|
| 17 |
+
7.500000e-02 3.773499e+01 -3.868946e-04 -6.714210e-02
|
| 18 |
+
8.000000e-02 3.864689e+01 -3.959521e-04 -7.139730e-02
|
| 19 |
+
8.500000e-02 3.950539e+01 -4.044380e-04 -7.561716e-02
|
| 20 |
+
9.000000e-02 4.031629e+01 -4.124167e-04 -7.980176e-02
|
| 21 |
+
9.500000e-02 4.108455e+01 -4.199436e-04 -8.395123e-02
|
| 22 |
+
1.000000e-01 4.181481e+01 -4.270691e-04 -8.806575e-02
|
| 23 |
+
volume fraction= 0.215513
|
| 24 |
+
fiber_centers_YZ= (0.013685,0.005883) (0.009428,0.029367) (0.017368,0.039730) (0.010789,0.016267) (0.002145,0.039296) (0.018889,0.022585) (0.001301,0.005213) (0.038685,0.005883) (0.034428,0.029367) (0.042368,0.039730) (0.035789,0.016267) (0.027145,0.039296) (0.043889,0.022585) (0.026301,0.005213) (0.052145,0.039296) (0.051301,0.005213)
|
data_generation/shahriar_modified_2025_12/RVE_Datasets/CHDPE_0.2155_3_11.txt
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Strain_11 Stress_11 Strain_22 Strain_33
|
| 2 |
+
0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
|
| 3 |
+
5.000000e-03 2.178475e+02 -2.186513e-03 -2.203805e-03
|
| 4 |
+
1.000000e-02 4.352135e+02 -4.357112e-03 -4.391589e-03
|
| 5 |
+
1.500000e-02 6.519549e+02 -6.516370e-03 -6.567986e-03
|
| 6 |
+
2.000000e-02 8.675598e+02 -8.680058e-03 -8.749209e-03
|
| 7 |
+
2.500000e-02 1.081985e+03 -1.085007e-02 -1.093762e-02
|
| 8 |
+
3.000000e-02 1.295703e+03 -1.301326e-02 -1.311964e-02
|
| 9 |
+
3.500000e-02 1.508931e+03 -1.516323e-02 -1.528853e-02
|
| 10 |
+
4.000000e-02 1.721712e+03 -1.729907e-02 -1.744330e-02
|
| 11 |
+
4.500000e-02 1.934065e+03 -1.942044e-02 -1.958358e-02
|
| 12 |
+
5.000000e-02 2.145983e+03 -2.152787e-02 -2.170992e-02
|
| 13 |
+
5.500000e-02 2.357473e+03 -2.362165e-02 -2.382261e-02
|
| 14 |
+
6.000000e-02 2.568550e+03 -2.570085e-02 -2.592066e-02
|
| 15 |
+
6.500000e-02 2.779216e+03 -2.776630e-02 -2.800495e-02
|
| 16 |
+
7.000000e-02 2.989461e+03 -2.981838e-02 -3.007584e-02
|
| 17 |
+
7.500000e-02 3.199308e+03 -3.185657e-02 -3.213280e-02
|
| 18 |
+
8.000000e-02 3.408742e+03 -3.388163e-02 -3.417662e-02
|
| 19 |
+
8.500000e-02 3.617785e+03 -3.589301e-02 -3.620670e-02
|
| 20 |
+
9.000000e-02 3.826423e+03 -3.789195e-02 -3.822435e-02
|
| 21 |
+
9.500000e-02 4.034672e+03 -3.987700e-02 -4.022803e-02
|
| 22 |
+
1.000000e-01 4.242529e+03 -4.184972e-02 -4.221937e-02
|
| 23 |
+
volume fraction= 0.215513
|
| 24 |
+
fiber_centers_YZ= (0.011831,0.005758) (0.007619,0.028165) (0.004083,0.039896) (0.000104,0.015820) (0.010460,0.017838) (0.020118,0.024590) (0.015527,0.040871) (0.036831,0.005758) (0.032619,0.028165) (0.029083,0.039896) (0.025104,0.015820) (0.035460,0.017838) (0.045118,0.024590) (0.040527,0.040871) (0.050104,0.015820)
|
data_generation/shahriar_modified_2025_12/RVE_Datasets/CHDPE_0.2155_3_12.txt
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Strain_12 Stress_12
|
| 2 |
+
0.000000e+00 0.000000e+00
|
| 3 |
+
5.000000e-03 3.745580e+00
|
| 4 |
+
1.000000e-02 7.015756e+00
|
| 5 |
+
1.500000e-02 9.054713e+00
|
| 6 |
+
2.000000e-02 1.033547e+01
|
| 7 |
+
2.500000e-02 1.133145e+01
|
| 8 |
+
3.000000e-02 1.220107e+01
|
| 9 |
+
3.500000e-02 1.298556e+01
|
| 10 |
+
4.000000e-02 1.370066e+01
|
| 11 |
+
4.500000e-02 1.435586e+01
|
| 12 |
+
5.000000e-02 1.495846e+01
|
| 13 |
+
5.500000e-02 1.551460e+01
|
| 14 |
+
6.000000e-02 1.602968e+01
|
| 15 |
+
6.500000e-02 1.650846e+01
|
| 16 |
+
7.000000e-02 1.695524e+01
|
| 17 |
+
7.500000e-02 1.737388e+01
|
| 18 |
+
8.000000e-02 1.776786e+01
|
| 19 |
+
8.500000e-02 1.814030e+01
|
| 20 |
+
9.000000e-02 1.849403e+01
|
| 21 |
+
9.500000e-02 1.883164e+01
|
| 22 |
+
1.000000e-01 1.915547e+01
|
| 23 |
+
volume fraction= 0.215513
|
| 24 |
+
fiber_centers_YZ= (0.011831,0.005758) (0.007619,0.028165) (0.004083,0.039896) (0.000104,0.015820) (0.010460,0.017838) (0.020118,0.024590) (0.015527,0.040871) (0.036831,0.005758) (0.032619,0.028165) (0.029083,0.039896) (0.025104,0.015820) (0.035460,0.017838) (0.045118,0.024590) (0.040527,0.040871) (0.050104,0.015820)
|
data_generation/shahriar_modified_2025_12/RVE_Datasets/CHDPE_0.2155_3_22.txt
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Strain_22 Stress_22 Strain_11 Strain_33
|
| 2 |
+
0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
|
| 3 |
+
5.000000e-03 7.822113e+00 -7.849323e-05 -4.412473e-03
|
| 4 |
+
1.000000e-02 1.474260e+01 -1.481190e-04 -8.838691e-03
|
| 5 |
+
1.500000e-02 1.923159e+01 -1.945933e-04 -1.338459e-02
|
| 6 |
+
2.000000e-02 2.218162e+01 -2.259374e-04 -1.799746e-02
|
| 7 |
+
2.500000e-02 2.452489e+01 -2.510093e-04 -2.261038e-02
|
| 8 |
+
3.000000e-02 2.657515e+01 -2.728653e-04 -2.720020e-02
|
| 9 |
+
3.500000e-02 2.842807e+01 -2.925177e-04 -3.176025e-02
|
| 10 |
+
4.000000e-02 3.012327e+01 -3.103345e-04 -3.628789e-02
|
| 11 |
+
4.500000e-02 3.168256e+01 -3.266087e-04 -4.078202e-02
|
| 12 |
+
5.000000e-02 3.312247e+01 -3.415402e-04 -4.524191e-02
|
| 13 |
+
5.500000e-02 3.445698e+01 -3.552968e-04 -4.966698e-02
|
| 14 |
+
6.000000e-02 3.569803e+01 -3.680199e-04 -5.405685e-02
|
| 15 |
+
6.500000e-02 3.685622e+01 -3.798336e-04 -5.841122e-02
|
| 16 |
+
7.000000e-02 3.794041e+01 -3.908418e-04 -6.272993e-02
|
| 17 |
+
7.500000e-02 3.895857e+01 -4.011358e-04 -6.701286e-02
|
| 18 |
+
8.000000e-02 3.991805e+01 -4.107987e-04 -7.125998e-02
|
| 19 |
+
8.500000e-02 4.082557e+01 -4.199055e-04 -7.547126e-02
|
| 20 |
+
9.000000e-02 4.168715e+01 -4.285231e-04 -7.964675e-02
|
| 21 |
+
9.500000e-02 4.250801e+01 -4.367092e-04 -8.378652e-02
|
| 22 |
+
1.000000e-01 4.329286e+01 -4.445155e-04 -8.789071e-02
|
| 23 |
+
volume fraction= 0.215513
|
| 24 |
+
fiber_centers_YZ= (0.011831,0.005758) (0.007619,0.028165) (0.004083,0.039896) (0.000104,0.015820) (0.010460,0.017838) (0.020118,0.024590) (0.015527,0.040871) (0.036831,0.005758) (0.032619,0.028165) (0.029083,0.039896) (0.025104,0.015820) (0.035460,0.017838) (0.045118,0.024590) (0.040527,0.040871) (0.050104,0.015820)
|
data_generation/shahriar_modified_2025_12/RVE_Datasets/CHDPE_0.2155_4_11.txt
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Strain_11 Stress_11 Strain_22 Strain_33
|
| 2 |
+
0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
|
| 3 |
+
5.000000e-03 2.178472e+02 -2.199787e-03 -2.190225e-03
|
| 4 |
+
1.000000e-02 4.352127e+02 -4.383578e-03 -4.364516e-03
|
| 5 |
+
1.500000e-02 6.519534e+02 -6.555993e-03 -6.527475e-03
|
| 6 |
+
2.000000e-02 8.675573e+02 -8.733155e-03 -8.695005e-03
|
| 7 |
+
2.500000e-02 1.081982e+03 -1.091732e-02 -1.086909e-02
|
| 8 |
+
3.000000e-02 1.295699e+03 -1.309500e-02 -1.303645e-02
|
| 9 |
+
3.500000e-02 1.508925e+03 -1.525954e-02 -1.519063e-02
|
| 10 |
+
4.000000e-02 1.721706e+03 -1.740995e-02 -1.733067e-02
|
| 11 |
+
4.500000e-02 1.934056e+03 -1.954589e-02 -1.945625e-02
|
| 12 |
+
5.000000e-02 2.145974e+03 -2.166788e-02 -2.156788e-02
|
| 13 |
+
5.500000e-02 2.357468e+03 -2.377581e-02 -2.366546e-02
|
| 14 |
+
6.000000e-02 2.568538e+03 -2.586999e-02 -2.574930e-02
|
| 15 |
+
6.500000e-02 2.779202e+03 -2.794992e-02 -2.781891e-02
|
| 16 |
+
7.000000e-02 2.989450e+03 -3.001634e-02 -2.987501e-02
|
| 17 |
+
7.500000e-02 3.199292e+03 -3.206918e-02 -3.191754e-02
|
| 18 |
+
8.000000e-02 3.408725e+03 -3.410877e-02 -3.394682e-02
|
| 19 |
+
8.500000e-02 3.617766e+03 -3.613453e-02 -3.596230e-02
|
| 20 |
+
9.000000e-02 3.826404e+03 -3.814741e-02 -3.796489e-02
|
| 21 |
+
9.500000e-02 4.034654e+03 -4.014693e-02 -3.995414e-02
|
| 22 |
+
1.000000e-01 4.242508e+03 -4.213368e-02 -4.193063e-02
|
| 23 |
+
volume fraction= 0.215513
|
| 24 |
+
fiber_centers_YZ= (0.015753,0.009729) (0.007691,0.016919) (0.007308,0.006878) (0.010610,0.037217) (0.012315,0.026873) (0.000615,0.030461) (0.020472,0.045532) (0.040753,0.009729) (0.032691,0.016919) (0.032308,0.006878) (0.035610,0.037217) (0.037315,0.026873) (0.025615,0.030461) (0.045472,0.045532) (0.050615,0.030461)
|
data_generation/shahriar_modified_2025_12/RVE_Datasets/CHDPE_0.2155_4_12.txt
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Strain_12 Stress_12
|
| 2 |
+
0.000000e+00 0.000000e+00
|
| 3 |
+
5.000000e-03 3.687761e+00
|
| 4 |
+
1.000000e-02 6.972763e+00
|
| 5 |
+
1.500000e-02 9.018226e+00
|
| 6 |
+
2.000000e-02 1.027248e+01
|
| 7 |
+
2.500000e-02 1.125342e+01
|
| 8 |
+
3.000000e-02 1.211403e+01
|
| 9 |
+
3.500000e-02 1.289229e+01
|
| 10 |
+
4.000000e-02 1.360263e+01
|
| 11 |
+
4.500000e-02 1.425393e+01
|
| 12 |
+
5.000000e-02 1.485306e+01
|
| 13 |
+
5.500000e-02 1.540594e+01
|
| 14 |
+
6.000000e-02 1.591778e+01
|
| 15 |
+
6.500000e-02 1.639328e+01
|
| 16 |
+
7.000000e-02 1.683663e+01
|
| 17 |
+
7.500000e-02 1.725164e+01
|
| 18 |
+
8.000000e-02 1.764175e+01
|
| 19 |
+
8.500000e-02 1.801003e+01
|
| 20 |
+
9.000000e-02 1.835932e+01
|
| 21 |
+
9.500000e-02 1.869217e+01
|
| 22 |
+
1.000000e-01 1.901090e+01
|
| 23 |
+
volume fraction= 0.215513
|
| 24 |
+
fiber_centers_YZ= (0.015753,0.009729) (0.007691,0.016919) (0.007308,0.006878) (0.010610,0.037217) (0.012315,0.026873) (0.000615,0.030461) (0.020472,0.045532) (0.040753,0.009729) (0.032691,0.016919) (0.032308,0.006878) (0.035610,0.037217) (0.037315,0.026873) (0.025615,0.030461) (0.045472,0.045532) (0.050615,0.030461)
|
data_generation/shahriar_modified_2025_12/RVE_Datasets/CHDPE_0.2155_4_22.txt
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Strain_22 Stress_22 Strain_11 Strain_33
|
| 2 |
+
0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
|
| 3 |
+
5.000000e-03 7.619207e+00 -7.690803e-05 -4.418106e-03
|
| 4 |
+
1.000000e-02 1.448578e+01 -1.460216e-04 -8.846401e-03
|
| 5 |
+
1.500000e-02 1.899922e+01 -1.923186e-04 -1.339731e-02
|
| 6 |
+
2.000000e-02 2.191834e+01 -2.231789e-04 -1.801569e-02
|
| 7 |
+
2.500000e-02 2.423135e+01 -2.479159e-04 -2.263157e-02
|
| 8 |
+
3.000000e-02 2.627091e+01 -2.696455e-04 -2.722245e-02
|
| 9 |
+
3.500000e-02 2.812746e+01 -2.892669e-04 -3.178260e-02
|
| 10 |
+
4.000000e-02 2.983443e+01 -3.071560e-04 -3.631005e-02
|
| 11 |
+
4.500000e-02 3.141160e+01 -3.235546e-04 -4.080374e-02
|
| 12 |
+
5.000000e-02 3.287449e+01 -3.386553e-04 -4.526294e-02
|
| 13 |
+
5.500000e-02 3.423590e+01 -3.526168e-04 -4.968711e-02
|
| 14 |
+
6.000000e-02 3.550632e+01 -3.655684e-04 -5.407593e-02
|
| 15 |
+
6.500000e-02 3.669574e+01 -3.776293e-04 -5.842909e-02
|
| 16 |
+
7.000000e-02 3.781239e+01 -3.889346e-04 -6.274661e-02
|
| 17 |
+
7.500000e-02 3.886612e+01 -3.995207e-04 -6.702794e-02
|
| 18 |
+
8.000000e-02 3.986303e+01 -4.094985e-04 -7.127324e-02
|
| 19 |
+
8.500000e-02 4.080926e+01 -4.189385e-04 -7.548253e-02
|
| 20 |
+
9.000000e-02 4.171038e+01 -4.279038e-04 -7.965585e-02
|
| 21 |
+
9.500000e-02 4.257171e+01 -4.364540e-04 -8.379331e-02
|
| 22 |
+
1.000000e-01 4.339807e+01 -4.446428e-04 -8.789499e-02
|
| 23 |
+
volume fraction= 0.215513
|
| 24 |
+
fiber_centers_YZ= (0.015753,0.009729) (0.007691,0.016919) (0.007308,0.006878) (0.010610,0.037217) (0.012315,0.026873) (0.000615,0.030461) (0.020472,0.045532) (0.040753,0.009729) (0.032691,0.016919) (0.032308,0.006878) (0.035610,0.037217) (0.037315,0.026873) (0.025615,0.030461) (0.045472,0.045532) (0.050615,0.030461)
|
data_generation/shahriar_modified_2025_12/RVE_Datasets/CHDPE_0.2155_5_11.txt
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Strain_11 Stress_11 Strain_22 Strain_33
|
| 2 |
+
0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
|
| 3 |
+
5.000000e-03 2.178574e+02 -2.211241e-03 -2.178585e-03
|
| 4 |
+
1.000000e-02 4.352330e+02 -4.406443e-03 -4.341282e-03
|
| 5 |
+
1.500000e-02 6.519835e+02 -6.590354e-03 -6.492585e-03
|
| 6 |
+
2.000000e-02 8.675970e+02 -8.779785e-03 -8.647751e-03
|
| 7 |
+
2.500000e-02 1.082031e+03 -1.097743e-02 -1.080830e-02
|
| 8 |
+
3.000000e-02 1.295758e+03 -1.316922e-02 -1.296149e-02
|
| 9 |
+
3.500000e-02 1.508994e+03 -1.534816e-02 -1.510122e-02
|
| 10 |
+
4.000000e-02 1.721784e+03 -1.751314e-02 -1.722665e-02
|
| 11 |
+
4.500000e-02 1.934144e+03 -1.966381e-02 -1.933746e-02
|
| 12 |
+
5.000000e-02 2.146071e+03 -2.180066e-02 -2.143419e-02
|
| 13 |
+
5.500000e-02 2.357574e+03 -2.392358e-02 -2.351675e-02
|
| 14 |
+
6.000000e-02 2.568658e+03 -2.603266e-02 -2.558526e-02
|
| 15 |
+
6.500000e-02 2.779322e+03 -2.812816e-02 -2.764000e-02
|
| 16 |
+
7.000000e-02 2.989585e+03 -3.020973e-02 -2.968062e-02
|
| 17 |
+
7.500000e-02 3.199436e+03 -3.227798e-02 -3.170775e-02
|
| 18 |
+
8.000000e-02 3.408879e+03 -3.433290e-02 -3.372140e-02
|
| 19 |
+
8.500000e-02 3.617928e+03 -3.637435e-02 -3.572143e-02
|
| 20 |
+
9.000000e-02 3.826575e+03 -3.840281e-02 -3.770835e-02
|
| 21 |
+
9.500000e-02 4.034834e+03 -4.041810e-02 -3.968195e-02
|
| 22 |
+
1.000000e-01 4.242692e+03 -4.242045e-02 -4.164258e-02
|
| 23 |
+
volume fraction= 0.215513
|
| 24 |
+
fiber_centers_YZ= (0.018802,0.037413) (0.006169,0.028326) (0.015373,0.007545) (0.017987,0.026778) (0.002253,0.006858) (0.008082,0.042031) (0.016899,0.017719) (0.043802,0.037413) (0.031169,0.028326) (0.040373,0.007545) (0.042987,0.026778) (0.027253,0.006858) (0.033082,0.042031) (0.041899,0.017719) (0.052253,0.006858)
|
data_generation/shahriar_modified_2025_12/RVE_Datasets/CHDPE_0.2155_5_12.txt
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Strain_12 Stress_12
|
| 2 |
+
0.000000e+00 0.000000e+00
|
| 3 |
+
5.000000e-03 3.672059e+00
|
| 4 |
+
1.000000e-02 6.918214e+00
|
| 5 |
+
1.500000e-02 8.933409e+00
|
| 6 |
+
2.000000e-02 1.018200e+01
|
| 7 |
+
2.500000e-02 1.115501e+01
|
| 8 |
+
3.000000e-02 1.200765e+01
|
| 9 |
+
3.500000e-02 1.277828e+01
|
| 10 |
+
4.000000e-02 1.348117e+01
|
| 11 |
+
4.500000e-02 1.412511e+01
|
| 12 |
+
5.000000e-02 1.471699e+01
|
| 13 |
+
5.500000e-02 1.526271e+01
|
| 14 |
+
6.000000e-02 1.576748e+01
|
| 15 |
+
6.500000e-02 1.623595e+01
|
| 16 |
+
7.000000e-02 1.667231e+01
|
| 17 |
+
7.500000e-02 1.708032e+01
|
| 18 |
+
8.000000e-02 1.746339e+01
|
| 19 |
+
8.500000e-02 1.782464e+01
|
| 20 |
+
9.000000e-02 1.816686e+01
|
| 21 |
+
9.500000e-02 1.849263e+01
|
| 22 |
+
1.000000e-01 1.880430e+01
|
| 23 |
+
volume fraction= 0.215513
|
| 24 |
+
fiber_centers_YZ= (0.018802,0.037413) (0.006169,0.028326) (0.015373,0.007545) (0.017987,0.026778) (0.002253,0.006858) (0.008082,0.042031) (0.016899,0.017719) (0.043802,0.037413) (0.031169,0.028326) (0.040373,0.007545) (0.042987,0.026778) (0.027253,0.006858) (0.033082,0.042031) (0.041899,0.017719) (0.052253,0.006858)
|
data_generation/shahriar_modified_2025_12/RVE_Datasets/CHDPE_0.2155_5_22.txt
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Strain_22 Stress_22 Strain_11 Strain_33
|
| 2 |
+
0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
|
| 3 |
+
5.000000e-03 8.201448e+00 -8.324874e-05 -4.366647e-03
|
| 4 |
+
1.000000e-02 1.544217e+01 -1.567699e-04 -8.757356e-03
|
| 5 |
+
1.500000e-02 2.015233e+01 -2.058516e-04 -1.328206e-02
|
| 6 |
+
2.000000e-02 2.333676e+01 -2.400654e-04 -1.787153e-02
|
| 7 |
+
2.500000e-02 2.592434e+01 -2.681086e-04 -2.246025e-02
|
| 8 |
+
3.000000e-02 2.821232e+01 -2.928608e-04 -2.702702e-02
|
| 9 |
+
3.500000e-02 3.029487e+01 -3.152837e-04 -3.156517e-02
|
| 10 |
+
4.000000e-02 3.221307e+01 -3.358311e-04 -3.607197e-02
|
| 11 |
+
4.500000e-02 3.399103e+01 -3.547867e-04 -4.054596e-02
|
| 12 |
+
5.000000e-02 3.564650e+01 -3.723642e-04 -4.498619e-02
|
| 13 |
+
5.500000e-02 3.719428e+01 -3.887418e-04 -4.939196e-02
|
| 14 |
+
6.000000e-02 3.864661e+01 -4.040669e-04 -5.376274e-02
|
| 15 |
+
6.500000e-02 4.001442e+01 -4.184684e-04 -5.809813e-02
|
| 16 |
+
7.000000e-02 4.130806e+01 -4.320308e-04 -6.239769e-02
|
| 17 |
+
7.500000e-02 4.253527e+01 -4.449171e-04 -6.666138e-02
|
| 18 |
+
8.000000e-02 4.370432e+01 -4.571853e-04 -7.088894e-02
|
| 19 |
+
8.500000e-02 4.482198e+01 -4.689122e-04 -7.508025e-02
|
| 20 |
+
9.000000e-02 4.589408e+01 -4.801639e-04 -7.923526e-02
|
| 21 |
+
9.500000e-02 4.692590e+01 -4.909996e-04 -8.335396e-02
|
| 22 |
+
1.000000e-01 4.792247e+01 -5.014752e-04 -8.743633e-02
|
| 23 |
+
volume fraction= 0.215513
|
| 24 |
+
fiber_centers_YZ= (0.018802,0.037413) (0.006169,0.028326) (0.015373,0.007545) (0.017987,0.026778) (0.002253,0.006858) (0.008082,0.042031) (0.016899,0.017719) (0.043802,0.037413) (0.031169,0.028326) (0.040373,0.007545) (0.042987,0.026778) (0.027253,0.006858) (0.033082,0.042031) (0.041899,0.017719) (0.052253,0.006858)
|
data_generation/shahriar_modified_2025_12/RVE_Datasets/CHDPE_0.3079_1_11.txt
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Strain_11 Stress_11 Strain_22 Strain_33
|
| 2 |
+
0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
|
| 3 |
+
5.000000e-03 3.096895e+02 -2.111192e-03 -2.102994e-03
|
| 4 |
+
1.000000e-02 6.185883e+02 -4.207203e-03 -4.190828e-03
|
| 5 |
+
1.500000e-02 9.265735e+02 -6.292739e-03 -6.267513e-03
|
| 6 |
+
2.000000e-02 1.233208e+03 -8.383067e-03 -8.347447e-03
|
| 7 |
+
2.500000e-02 1.538476e+03 -1.047935e-02 -1.043282e-02
|
| 8 |
+
3.000000e-02 1.842791e+03 -1.256924e-02 -1.251152e-02
|
| 9 |
+
3.500000e-02 2.146346e+03 -1.464669e-02 -1.457757e-02
|
| 10 |
+
4.000000e-02 2.449180e+03 -1.671080e-02 -1.663009e-02
|
| 11 |
+
4.500000e-02 2.751306e+03 -1.876149e-02 -1.866904e-02
|
| 12 |
+
5.000000e-02 3.052733e+03 -2.079867e-02 -2.069437e-02
|
| 13 |
+
5.500000e-02 3.353467e+03 -2.282260e-02 -2.270632e-02
|
| 14 |
+
6.000000e-02 3.653514e+03 -2.483330e-02 -2.470492e-02
|
| 15 |
+
6.500000e-02 3.952885e+03 -2.683064e-02 -2.669010e-02
|
| 16 |
+
7.000000e-02 4.251571e+03 -2.881547e-02 -2.866259e-02
|
| 17 |
+
7.500000e-02 4.549597e+03 -3.078691e-02 -3.062169e-02
|
| 18 |
+
8.000000e-02 4.846948e+03 -3.274599e-02 -3.256826e-02
|
| 19 |
+
8.500000e-02 5.143651e+03 -3.469202e-02 -3.450179e-02
|
| 20 |
+
9.000000e-02 5.439692e+03 -3.662596e-02 -3.642305e-02
|
| 21 |
+
9.500000e-02 5.735084e+03 -3.854707e-02 -3.833146e-02
|
| 22 |
+
1.000000e-01 6.029839e+03 -4.045569e-02 -4.022736e-02
|
| 23 |
+
volume fraction= 0.307876
|
| 24 |
+
fiber_centers_YZ= (0.016091,0.007156) (0.007983,0.030747) (0.015540,0.032727) (0.005918,0.043270) (0.004559,0.015036) (0.016730,0.015471) (0.019107,0.043869) (0.002578,0.007493) (0.012864,0.022411) (0.000522,0.034035) (0.041091,0.007156) (0.032983,0.030747) (0.040540,0.032727) (0.030918,0.043270) (0.029559,0.015036) (0.041730,0.015471) (0.044107,0.043869) (0.027578,0.007493) (0.037864,0.022411) (0.025522,0.034035) (0.052578,0.007493) (0.050522,0.034035)
|
data_generation/shahriar_modified_2025_12/RVE_Datasets/CHDPE_0.3079_1_12.txt
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Strain_12 Stress_12
|
| 2 |
+
0.000000e+00 0.000000e+00
|
| 3 |
+
5.000000e-03 4.684055e+00
|
| 4 |
+
1.000000e-02 8.181754e+00
|
| 5 |
+
1.500000e-02 1.024328e+01
|
| 6 |
+
2.000000e-02 1.160673e+01
|
| 7 |
+
2.500000e-02 1.270877e+01
|
| 8 |
+
3.000000e-02 1.366986e+01
|
| 9 |
+
3.500000e-02 1.452786e+01
|
| 10 |
+
4.000000e-02 1.530195e+01
|
| 11 |
+
4.500000e-02 1.600544e+01
|
| 12 |
+
5.000000e-02 1.664882e+01
|
| 13 |
+
5.500000e-02 1.724077e+01
|
| 14 |
+
6.000000e-02 1.778676e+01
|
| 15 |
+
6.500000e-02 1.829660e+01
|
| 16 |
+
7.000000e-02 1.877417e+01
|
| 17 |
+
7.500000e-02 1.922438e+01
|
| 18 |
+
8.000000e-02 1.965152e+01
|
| 19 |
+
8.500000e-02 2.005949e+01
|
| 20 |
+
9.000000e-02 2.045176e+01
|
| 21 |
+
9.500000e-02 2.083150e+01
|
| 22 |
+
1.000000e-01 2.120154e+01
|
| 23 |
+
volume fraction= 0.307876
|
| 24 |
+
fiber_centers_YZ= (0.016091,0.007156) (0.007983,0.030747) (0.015540,0.032727) (0.005918,0.043270) (0.004559,0.015036) (0.016730,0.015471) (0.019107,0.043869) (0.002578,0.007493) (0.012864,0.022411) (0.000522,0.034035) (0.041091,0.007156) (0.032983,0.030747) (0.040540,0.032727) (0.030918,0.043270) (0.029559,0.015036) (0.041730,0.015471) (0.044107,0.043869) (0.027578,0.007493) (0.037864,0.022411) (0.025522,0.034035) (0.052578,0.007493) (0.050522,0.034035)
|
data_generation/shahriar_modified_2025_12/RVE_Datasets/CHDPE_0.3079_1_22.txt
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Strain_22 Stress_22 Strain_11 Strain_33
|
| 2 |
+
0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
|
| 3 |
+
5.000000e-03 1.155199e+01 -7.889273e-05 -4.253139e-03
|
| 4 |
+
1.000000e-02 2.035728e+01 -1.401625e-04 -8.609537e-03
|
| 5 |
+
1.500000e-02 2.598578e+01 -1.805075e-04 -1.311493e-02
|
| 6 |
+
2.000000e-02 3.020892e+01 -2.112602e-04 -1.766669e-02
|
| 7 |
+
2.500000e-02 3.377746e+01 -2.373696e-04 -2.221715e-02
|
| 8 |
+
3.000000e-02 3.692992e+01 -2.604455e-04 -2.675096e-02
|
| 9 |
+
3.500000e-02 3.976773e+01 -2.812005e-04 -3.126182e-02
|
| 10 |
+
4.000000e-02 4.234890e+01 -3.000576e-04 -3.574635e-02
|
| 11 |
+
4.500000e-02 4.471428e+01 -3.173206e-04 -4.020234e-02
|
| 12 |
+
5.000000e-02 4.689505e+01 -3.332223e-04 -4.462822e-02
|
| 13 |
+
5.500000e-02 4.891731e+01 -3.479565e-04 -4.902278e-02
|
| 14 |
+
6.000000e-02 5.080212e+01 -3.616799e-04 -5.338515e-02
|
| 15 |
+
6.500000e-02 5.256817e+01 -3.745301e-04 -5.771461e-02
|
| 16 |
+
7.000000e-02 5.423133e+01 -3.866242e-04 -6.201059e-02
|
| 17 |
+
7.500000e-02 5.580521e+01 -3.980618e-04 -6.627272e-02
|
| 18 |
+
8.000000e-02 5.730090e+01 -4.089247e-04 -7.050072e-02
|
| 19 |
+
8.500000e-02 5.872809e+01 -4.192840e-04 -7.469444e-02
|
| 20 |
+
9.000000e-02 6.009515e+01 -4.292008e-04 -7.885379e-02
|
| 21 |
+
9.500000e-02 6.140867e+01 -4.387449e-04 -8.297920e-02
|
| 22 |
+
1.000000e-01 6.267566e+01 -4.479225e-04 -8.706988e-02
|
| 23 |
+
volume fraction= 0.307876
|
| 24 |
+
fiber_centers_YZ= (0.016091,0.007156) (0.007983,0.030747) (0.015540,0.032727) (0.005918,0.043270) (0.004559,0.015036) (0.016730,0.015471) (0.019107,0.043869) (0.002578,0.007493) (0.012864,0.022411) (0.000522,0.034035) (0.041091,0.007156) (0.032983,0.030747) (0.040540,0.032727) (0.030918,0.043270) (0.029559,0.015036) (0.041730,0.015471) (0.044107,0.043869) (0.027578,0.007493) (0.037864,0.022411) (0.025522,0.034035) (0.052578,0.007493) (0.050522,0.034035)
|
data_generation/shahriar_modified_2025_12/RVE_Datasets/CHDPE_0.3079_2_11.txt
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Strain_11 Stress_11 Strain_22 Strain_33
|
| 2 |
+
0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
|
| 3 |
+
5.000000e-03 3.096753e+02 -2.107945e-03 -2.110143e-03
|
| 4 |
+
1.000000e-02 6.185627e+02 -4.200729e-03 -4.205056e-03
|
| 5 |
+
1.500000e-02 9.265392e+02 -6.282791e-03 -6.288871e-03
|
| 6 |
+
2.000000e-02 1.233167e+03 -8.369273e-03 -8.375856e-03
|
| 7 |
+
2.500000e-02 1.538428e+03 -1.046183e-02 -1.046781e-02
|
| 8 |
+
3.000000e-02 1.842740e+03 -1.254801e-02 -1.255285e-02
|
| 9 |
+
3.500000e-02 2.146292e+03 -1.462174e-02 -1.462507e-02
|
| 10 |
+
4.000000e-02 2.449127e+03 -1.668215e-02 -1.668364e-02
|
| 11 |
+
4.500000e-02 2.751255e+03 -1.872916e-02 -1.872850e-02
|
| 12 |
+
5.000000e-02 3.052684e+03 -2.076269e-02 -2.075960e-02
|
| 13 |
+
5.500000e-02 3.353429e+03 -2.278276e-02 -2.277696e-02
|
| 14 |
+
6.000000e-02 3.653474e+03 -2.479063e-02 -2.478178e-02
|
| 15 |
+
6.500000e-02 3.952851e+03 -2.678415e-02 -2.677212e-02
|
| 16 |
+
7.000000e-02 4.251547e+03 -2.876523e-02 -2.874975e-02
|
| 17 |
+
7.500000e-02 4.549584e+03 -3.073328e-02 -3.071409e-02
|
| 18 |
+
8.000000e-02 4.846948e+03 -3.268883e-02 -3.266574e-02
|
| 19 |
+
8.500000e-02 5.143656e+03 -3.463208e-02 -3.460481e-02
|
| 20 |
+
9.000000e-02 5.439713e+03 -3.656241e-02 -3.653079e-02
|
| 21 |
+
9.500000e-02 5.735121e+03 -3.848027e-02 -3.844412e-02
|
| 22 |
+
1.000000e-01 6.029886e+03 -4.038580e-02 -4.034495e-02
|
| 23 |
+
volume fraction= 0.307876
|
| 24 |
+
fiber_centers_YZ= (0.011407,0.012536) (0.012042,0.025734) (0.001826,0.010511) (0.000075,0.030859) (0.000460,0.020979) (0.014482,0.041024) (0.003143,0.039885) (0.019847,0.005768) (0.016297,0.018670) (0.011150,0.004606) (0.036407,0.012536) (0.037042,0.025734) (0.026826,0.010511) (0.025075,0.030859) (0.025460,0.020979) (0.039482,0.041024) (0.028143,0.039885) (0.044847,0.005768) (0.041297,0.018670) (0.036150,0.004606) (0.051826,0.010511) (0.050075,0.030859) (0.050460,0.020979) (0.053143,0.039885)
|