diff --git a/python/FIERRO-GUI/fierro_gui/Bulk_Forming.py b/python/FIERRO-GUI/fierro_gui/Bulk_Forming.py
index 12ccf14d8..caa82168f 100644
--- a/python/FIERRO-GUI/fierro_gui/Bulk_Forming.py
+++ b/python/FIERRO-GUI/fierro_gui/Bulk_Forming.py
@@ -47,6 +47,14 @@ def material_class_2():
self.MaterialTypeTool_2.setCurrentIndex(4)
self.INMaterialType_2.currentIndexChanged.connect(material_class_2)
+ # Control addition of plasticity
+ def plasticity():
+ if self.BEnablePlasticity.isChecked():
+ self.EnablePlasticity.setCurrentIndex(1)
+ else:
+ self.EnablePlasticity.setCurrentIndex(0)
+ self.BEnablePlasticity.stateChanged.connect(plasticity)
+
# Define material properties using predefined values
def predefined_materials():
# Clear elastic parameters
@@ -85,7 +93,68 @@ def predefined_materials():
self.INthet1.clear()
self.INhselfx.clear()
self.INhlatex.clear()
- if "Single Crystal Copper" in self.INMaterialDefinition.currentText():
+ if "Import Elastic Parameters File" in self.INMaterialDefinition.currentText():
+ elastic_filename, _ = QFileDialog.getOpenFileName(filter="Elastic Parameters File (*.txt)",)
+ matrix = []
+ with open(elastic_filename, 'r') as file:
+ # Read the first line
+ first_line = file.readline().strip()
+
+ # Check if the first character of the first line is '0' - anisotropic
+ if first_line[0] == '0':
+ # Read next six lines for the matrix
+ for _ in range(6):
+ line = file.readline().strip()
+ if line: # Ensure line is not empty
+ row = line.split()[:6] # Convert to float
+ row = [float(val) for val in row if val.replace('.', '').isdigit()]
+ matrix.append(row)
+ # Add to anisotropic table
+ for i in range(6):
+ for j in range(6):
+ item = QTableWidgetItem(str(matrix[i][j]))
+ self.TAnisotropic_2.setItem(i, j, item)
+ # Turn page to anisotropic
+ self.MaterialTypeTool_2.setCurrentIndex(2)
+ # Check if the first character of the first line is '1' - isotropic
+ elif first_line[0] == '1':
+ line = file.readline().strip()
+ row = line.split()[:2]
+ row = [float(val) for val in row if val.replace('.', '').isdigit()]
+ matrix.append(row)
+ # Add to isotropic line edit definitions
+ self.INYoungsModulus_2.setText(str(matrix[0][0]))
+ self.INPoissonsRatio_2.setText(str(matrix[0][1]))
+ # Turn page to isotropic
+ self.MaterialTypeTool_2.setCurrentIndex(0)
+ else:
+ warning_message("ERROR: The first character of the first line is not a '0' (anisotropic) or '1' (isotropic)")
+ return None
+ elif "Import Plastic Parameters File" in self.INMaterialDefinition.currentText():
+ plastic_filename, _ = QFileDialog.getOpenFileName(filter="Plastic Parameters File (*.txt)",)
+ with open(plastic_filename, 'r') as file:
+ iline = 1;
+ for line in file:
+ # Find crystal axes
+ if iline == 3:
+ crystal_axes_line = line.strip().split()[:3]
+ crystal_axes_line = [float(val) for val in crystal_axes_line if val.replace('.', '').isdigit()]
+ if len(crystal_axes_line) < 3:
+ warning_message("ERROR: crystal axes was not found on line 3")
+ return
+ else:
+ self.INa.setText(str(crystal_axes_line[0]))
+ self.INb.setText(str(crystal_axes_line[1]))
+ self.INc.setText(str(crystal_axes_line[2]))
+ # Find slip systems
+
+ # Update line number
+ iline += 1
+
+ # Turn page to plastic
+ self.BEnablePlasticity.setChecked(True)
+ self.MaterialMenu_2.setCurrentIndex(1)
+ elif "Single Crystal Copper" in self.INMaterialDefinition.currentText():
if 'MPa' in self.INUnits.currentText():
m = 1
elif 'Pa' in self.INUnits.currentText():
@@ -106,6 +175,7 @@ def predefined_materials():
self.TAnisotropic_2.setItem(4,4,QTableWidgetItem('75400.'))
self.TAnisotropic_2.setItem(5,5,QTableWidgetItem('75400.'))
# Define plastic properties
+ self.BEnablePlasticity.setChecked(True)
self.INa.setText('1.')
self.INb.setText('1.')
self.INc.setText('1.')
@@ -140,6 +210,7 @@ def predefined_materials():
self.TAnisotropic_2.setItem(4,4,QTableWidgetItem('82500.'))
self.TAnisotropic_2.setItem(5,5,QTableWidgetItem('82500.'))
# Define plastic properties
+ self.BEnablePlasticity.setChecked(True)
self.INa.setText('1.')
self.INb.setText('1.')
self.INc.setText('1.')
@@ -186,18 +257,19 @@ def add_material_2():
warning_message('ERROR: Elastic material definition incomplete')
return
# Plastic parameters checks
- if not self.INa.text().strip() or not self.INb.text().strip() or not self.INc.text().strip():
- warning_message('ERROR: crystal axis definition incomplete')
- return
- if self.TSlipSystemParameters.rowCount() == 0:
- warning_message('ERROR: Voce parameters are incomplete')
- return
- for rowc in range(self.TSlipSystemParameters.rowCount()):
- for colc in range(self.TSlipSystemParameters.columnCount()):
- item = self.TSlipSystemParameters.item(rowc, colc)
- if item is None or not item.text().strip():
- warning_message('ERROR: Voce parameters are incomplete')
- return
+ if self.BEnablePlasticity.isChecked():
+ if not self.INa.text().strip() or not self.INb.text().strip() or not self.INc.text().strip():
+ warning_message('ERROR: crystal axis definition incomplete')
+ return
+ if self.TSlipSystemParameters.rowCount() == 0:
+ warning_message('ERROR: Voce parameters are incomplete')
+ return
+ for rowc in range(self.TSlipSystemParameters.rowCount()):
+ for colc in range(self.TSlipSystemParameters.columnCount()):
+ item = self.TSlipSystemParameters.item(rowc, colc)
+ if item is None or not item.text().strip():
+ warning_message('ERROR: Voce parameters are incomplete')
+ return
# Assign elastic parameters if all checks pass
if 'Gas' in self.INSolidGas_2.currentText():
@@ -439,17 +511,18 @@ def add_material_2():
self.TMaterials_2.setItem(row, i, QTableWidgetItem('0'))
# Add plastic parameters
- self.TMaterials_2.setItem(row,23,QTableWidgetItem(self.INa.text()))
- self.TMaterials_2.setItem(row,24,QTableWidgetItem(self.INb.text()))
- self.TMaterials_2.setItem(row,25,QTableWidgetItem(self.INc.text()))
- for colc in range(self.TSlipSystemParameters.columnCount()):
- for rowc in range(self.TSlipSystemParameters.rowCount()):
- item = self.TSlipSystemParameters.item(rowc, colc)
- if rowc == 0:
- new_text = item.text()
- else:
- new_text = new_text + ', ' + item.text()
- self.TMaterials_2.setItem(row,colc+26,QTableWidgetItem(new_text))
+ if self.BEnablePlasticity.isChecked():
+ self.TMaterials_2.setItem(row,23,QTableWidgetItem(self.INa.text()))
+ self.TMaterials_2.setItem(row,24,QTableWidgetItem(self.INb.text()))
+ self.TMaterials_2.setItem(row,25,QTableWidgetItem(self.INc.text()))
+ for colc in range(self.TSlipSystemParameters.columnCount()):
+ for rowc in range(self.TSlipSystemParameters.rowCount()):
+ item = self.TSlipSystemParameters.item(rowc, colc)
+ if rowc == 0:
+ new_text = item.text()
+ else:
+ new_text = new_text + ', ' + item.text()
+ self.TMaterials_2.setItem(row,colc+26,QTableWidgetItem(new_text))
# Clear plastic parameters
self.INa.clear()
@@ -769,7 +842,6 @@ def add_custom_system():
# Expand custom definition
self.TSlipSystems.expandItem(custom_label[0])
self.BSubmit.clicked.connect(add_custom_system)
-
# Setup New Page
new_page.setLayout(page_layout)
self.SlipSystemInfo.addWidget(new_page)
@@ -954,6 +1026,22 @@ def boundary_conditions():
self.TVgrad.setItem(2,0,QTableWidgetItem("0."))
self.TVgrad.setItem(2,1,QTableWidgetItem("0."))
self.TVgrad.setItem(2,2,QTableWidgetItem("0."))
+ elif "Compression Z" in self.INbulkBC.currentText():
+ # Clear tables
+ self.TVgrad.clearContents()
+ self.TVgradi.clearContents()
+ self.TCstress.clearContents()
+
+ # Assign values
+ self.TVgrad.setItem(0,1,QTableWidgetItem("0."))
+ self.TVgrad.setItem(0,2,QTableWidgetItem("0."))
+ self.TVgrad.setItem(1,0,QTableWidgetItem("0."))
+ self.TVgrad.setItem(1,2,QTableWidgetItem("0."))
+ self.TVgrad.setItem(2,0,QTableWidgetItem("0."))
+ self.TVgrad.setItem(2,1,QTableWidgetItem("0."))
+ self.TVgrad.setItem(2,2,QTableWidgetItem("-1.0"))
+ self.TCstress.setItem(0,0,QTableWidgetItem("0."))
+ self.TCstress.setItem(1,1,QTableWidgetItem("0."))
self.INbulkBC.currentIndexChanged.connect(boundary_conditions)
# Run Bulk Formation
@@ -981,7 +1069,12 @@ def run_bulk_forming():
executable_path = DeveloperInputs.fierro_evpfft_exe
elif self.UserConfig == "User":
executable_path = "evpfft"
- arguments = ["-f", self.BULK_FORMING_INPUT]
+ if ".txt" in file_type:
+ arguments = ["-f", self.BULK_FORMING_INPUT]
+ elif ".vtk" in file_type:
+ arguments = ["-f", self.BULK_FORMING_INPUT, "-m", "2"]
+ else:
+ warning_message("ERROR: Trying to run an incorrect file type.")
self.p = QProcess()
self.p.setWorkingDirectory(self.working_directory)
diff --git a/python/FIERRO-GUI/fierro_gui/Bulk_Forming_WInput.py b/python/FIERRO-GUI/fierro_gui/Bulk_Forming_WInput.py
index 2e16ad7a7..8c8280b4a 100644
--- a/python/FIERRO-GUI/fierro_gui/Bulk_Forming_WInput.py
+++ b/python/FIERRO-GUI/fierro_gui/Bulk_Forming_WInput.py
@@ -2,55 +2,64 @@
import tempfile
def Bulk_Forming_WInput(self):
-
# Plastic Input File
plastic_parameters = open(self.BULK_FORMING_PLASTIC_PARAMETERS,"w")
- header = 'SLIP SYSTEMS FOR CUBIC CRYSTAL\n' \
- 'CUBIC icryst\n'
- plastic_parameters.write(header)
- crystal_axis = f' {self.TMaterials_2.item(0,23).text()} {self.TMaterials_2.item(0,24).text()} {self.TMaterials_2.item(0,25).text()} crystal axis (cdim(i))\n'
- plastic_parameters.write(crystal_axis)
- system_names = self.TMaterials_2.item(0,26).text()
- num_systems = system_names.count(',') + 1
- nmodes = f' {num_systems} nmodesx (total # of modes listed in the file)\n' \
- f' {num_systems} nmodes (# of modes to be used in the calculation)\n'
- plastic_parameters.write(nmodes)
- modei = ' 1'
- for i in range(num_systems-1):
- modei = modei + f' {i+2}'
- modei = modei + ' mode(i) (label of the modes to be used)\n'
- plastic_parameters.write(modei)
- slip_system_names = system_names.split(',')
- nsmx_max = 0
- for i in range(num_systems):
- slip_system_name = slip_system_names[i].split('.', 1)[1].strip()
- dict = slip_system_names[i].split('.', 1)[0].strip()
- dvar = f'T{dict}'
- slip_table = getattr(self, dvar)
- nsmx = slip_table.rowCount()
- if nsmx > nsmx_max:
- nsmx_max = nsmx
- slip_parameters = f' {slip_system_name} SLIP\n' \
- f' {i+1} {nsmx} {self.TMaterials_2.item(0,27).text().split(",")[i]} {self.TMaterials_2.item(0,28).text().split(",")[i]} 0.0 0 modex,nsmx,nrsx,gamd0x,twshx,isectwx\n' \
- f' {self.TMaterials_2.item(0,29).text().split(",")[i]} {self.TMaterials_2.item(0,30).text().split(",")[i]} {self.TMaterials_2.item(0,31).text().split(",")[i]} {self.TMaterials_2.item(0,32).text().split(",")[i]} {self.TMaterials_2.item(0,33).text().split(",")[i]} tau0xf,tau0xb,tau1x,thet0,thet1\n' \
- f' {self.TMaterials_2.item(0,34).text().split(",")[i]}'
- for ii in range(num_systems):
- slip_parameters = slip_parameters + f' {self.TMaterials_2.item(0,35).text().split(",")[i]}'
- slip_parameters = slip_parameters + ' hselfx,hlatex\n'
- plastic_parameters.write(slip_parameters)
- for j in range(nsmx):
- slip_plane = slip_table.item(j,0).text().split(',')
- slip_system = ' '
- for k in range(len(slip_plane)):
- slip_system = slip_system + f'{slip_plane[k]} '
- slip_direction = slip_table.item(j,1).text().split(',')
- for k in range(len(slip_direction)):
- slip_system = slip_system + f' {slip_direction[k]}'
- if j == 0:
- slip_system = slip_system + ' SLIP (n-b)\n'
- else:
- slip_system = slip_system + '\n'
- plastic_parameters.write(slip_system)
+ if self.TMaterials_2.item(0,23) is None or not self.TMaterials_2.item(0,23).text().strip():
+ no_plasticity_input = 'SLIP SYSTEMS FOR CUBIC CRYSTAL\n' \
+ 'CUBIC icryst\n' \
+ ' 1. 1. 1. crystal axis (cdim(i))\n' \
+ ' 0 nmodesx (total # of modes listed in the file)\n' \
+ ' 0 nmodes (# of modes to be used in the calculation)'
+ plastic_parameters.write(no_plasticity_input)
+ modes = '2 0 0 0 NPHMX, NMODMX, NTWMMX, NSYSMX\n'
+ else:
+ header = 'SLIP SYSTEMS FOR CUBIC CRYSTAL\n' \
+ 'CUBIC icryst\n'
+ plastic_parameters.write(header)
+ crystal_axis = f' {self.TMaterials_2.item(0,23).text()} {self.TMaterials_2.item(0,24).text()} {self.TMaterials_2.item(0,25).text()} crystal axis (cdim(i))\n'
+ plastic_parameters.write(crystal_axis)
+ system_names = self.TMaterials_2.item(0,26).text()
+ num_systems = system_names.count(',') + 1
+ nmodes = f' {num_systems} nmodesx (total # of modes listed in the file)\n' \
+ f' {num_systems} nmodes (# of modes to be used in the calculation)\n'
+ plastic_parameters.write(nmodes)
+ modei = ' 1'
+ for i in range(num_systems-1):
+ modei = modei + f' {i+2}'
+ modei = modei + ' mode(i) (label of the modes to be used)\n'
+ plastic_parameters.write(modei)
+ slip_system_names = system_names.split(',')
+ nsmx_max = 0
+ for i in range(num_systems):
+ slip_system_name = slip_system_names[i].split('.', 1)[1].strip()
+ dict = slip_system_names[i].split('.', 1)[0].strip()
+ dvar = f'T{dict}'
+ slip_table = getattr(self, dvar)
+ nsmx = slip_table.rowCount()
+ if nsmx > nsmx_max:
+ nsmx_max = nsmx
+ slip_parameters = f' {slip_system_name} SLIP\n' \
+ f' {i+1} {nsmx} {self.TMaterials_2.item(0,27).text().split(",")[i]} {self.TMaterials_2.item(0,28).text().split(",")[i]} 0.0 0 modex,nsmx,nrsx,gamd0x,twshx,isectwx\n' \
+ f' {self.TMaterials_2.item(0,29).text().split(",")[i]} {self.TMaterials_2.item(0,30).text().split(",")[i]} {self.TMaterials_2.item(0,31).text().split(",")[i]} {self.TMaterials_2.item(0,32).text().split(",")[i]} {self.TMaterials_2.item(0,33).text().split(",")[i]} tau0xf,tau0xb,tau1x,thet0,thet1\n' \
+ f' {self.TMaterials_2.item(0,34).text().split(",")[i]}'
+ for ii in range(num_systems):
+ slip_parameters = slip_parameters + f' {self.TMaterials_2.item(0,35).text().split(",")[i]}'
+ slip_parameters = slip_parameters + ' hselfx,hlatex\n'
+ plastic_parameters.write(slip_parameters)
+ for j in range(nsmx):
+ slip_plane = slip_table.item(j,0).text().split(',')
+ slip_system = ' '
+ for k in range(len(slip_plane)):
+ slip_system = slip_system + f'{slip_plane[k]} '
+ slip_direction = slip_table.item(j,1).text().split(',')
+ for k in range(len(slip_direction)):
+ slip_system = slip_system + f' {slip_direction[k]}'
+ if j == 0:
+ slip_system = slip_system + ' SLIP (n-b)\n'
+ else:
+ slip_system = slip_system + '\n'
+ plastic_parameters.write(slip_system)
+ modes = f'1 1 1 {nsmx_max} NPHMX, NMODMX, NTWMMX, NSYSMX\n'
plastic_parameters.close()
# Elastic Input File
@@ -81,7 +90,6 @@ def Bulk_Forming_WInput(self):
# Bulk Forming input parameters file
bulk_forming_input = open(self.BULK_FORMING_INPUT,"w")
- modes = f'1 1 1 {nsmx_max} NPHMX, NMODMX, NTWMMX, NSYSMX\n'
bulk_forming_input.write(modes)
Nx = int(self.TParts.item(0,7).text())
Ny = int(self.TParts.item(0,8).text())
diff --git a/python/FIERRO-GUI/fierro_gui/FIERRO_GUI.py b/python/FIERRO-GUI/fierro_gui/FIERRO_GUI.py
index b7501c0f6..52b0b9b32 100644
--- a/python/FIERRO-GUI/fierro_gui/FIERRO_GUI.py
+++ b/python/FIERRO-GUI/fierro_gui/FIERRO_GUI.py
@@ -163,6 +163,7 @@ def SetupPipeline(selection):
# Define geometry imports
self.INSelectGeometryImport.clear()
self.INSelectGeometryImport.addItem("Import Polycrystalline Data Set (.txt)")
+ self.INSelectGeometryImport.addItem("Import Geometry (.stl, .vtk)")
# Turn off tabs
self.NavigationMenu.setTabEnabled(3, False)
self.MaterialMenu.setTabEnabled(1, True)
diff --git a/python/FIERRO-GUI/fierro_gui/FIERRO_GUI.ui b/python/FIERRO-GUI/fierro_gui/FIERRO_GUI.ui
index 612ee7744..cf83cfa1f 100644
--- a/python/FIERRO-GUI/fierro_gui/FIERRO_GUI.ui
+++ b/python/FIERRO-GUI/fierro_gui/FIERRO_GUI.ui
@@ -352,7 +352,7 @@
nuxy:
", None)) self.LEz_2.setText(QCoreApplication.translate("MainWindow", u"Ez:
", None)) self.MaterialMenu_2.setTabText(self.MaterialMenu_2.indexOf(self.Elastic_2), QCoreApplication.translate("MainWindow", u"Elastic", None)) + self.BEnablePlasticity.setText(QCoreApplication.translate("MainWindow", u"Enable Plasticity", None)) self.Lc.setText(QCoreApplication.translate("MainWindow", u"c", None)) self.La.setText(QCoreApplication.translate("MainWindow", u"a", None)) self.Lb.setText(QCoreApplication.translate("MainWindow", u"b", None)) @@ -7160,6 +7194,7 @@ def retranslateUi(self, MainWindow): self.INbulkBC.setItemText(0, QCoreApplication.translate("MainWindow", u"Custom", None)) self.INbulkBC.setItemText(1, QCoreApplication.translate("MainWindow", u"Example", None)) self.INbulkBC.setItemText(2, QCoreApplication.translate("MainWindow", u"ECAP", None)) + self.INbulkBC.setItemText(3, QCoreApplication.translate("MainWindow", u"Compression Z", None)) self.LVgrad.setText(QCoreApplication.translate("MainWindow", u"VELOCITY GRADIENT", None)) self.label_12.setText(QCoreApplication.translate("MainWindow", u"--enforced condition--", None))