Custom Inputs: Global Hook
In this tutorial, you will use custom input variables for training.
In HyperMesh 2024 and on, the following mechanisms exist for
inputting variables to physicsAI models.
- PhysicsAI can read the node coordinates and part IDs by default using the .h3d files provided. The coordinates are by default inputs to the physicsAI model. The part IDs can be enabled by selecting the box next to it.
- A global property associated with all nodes in a model such as material properties (Young’s Modulus, Poisson’s ratio) can be supplied by creating a .json file with the same name and in the same location as each of the .h3d files. A custom python script, global_hook.py, is needed.
The detailed instructions for each of these cases are provided in this tutorial. Before you begin, copy the file(s) used in this tutorial to your working directory.
Before you begin, copy the file(s) used in this tutorial to your
working directory.
Note: Unzip the project custom_inputs.zip and inspect the
contents. The global_inputs folder contains the
global_hook.py, .h3d, and
.json files for Use Global Hook.
Default Inputs Imported from h3d
If only .h3d files are provided, the nodal coordinates and part ID are imported by default. Only the nodal coordinates are enabled by default.
Use Global Hook
For properties which are applied at the same value to every node in a model, like global properties, the global hook should be used.
-
Open the global_inputs folder.
Inside the training_files folder, there are seven .h3d files named run__000X_m_1_fillet_cantilever_2.h3d and seven .json files named run__000X_m_1_fillet_cantilever_2.json files. Each .json file contains exactly two material properties, Young’s modulus and Poisson ratio with different values. It is necessary to have consistent labels and number of properties across all the samples.
-
Create a new project called global_inputs.
- Copy the global_inputs_hook.py file into the _hooks folder inside the project folder.
-
Create a new dataset using all seven samples and name it Beam.
-
Train the model.
-
Test the model.
New samples can be generated by copying and renaming one or more training files. Ensure that the associated .json files are also present with different values of E and nu while creating the test dataset.