HMCFD-T: 4000 DOE PhysicsAI Workflow

Baseline Model

Solution and Environment Selection

  1. When opening HMCFD, the Create Session dialog will appear. Select the Aerodynamics and Aeroacoustics solution and the Geometry Repair environment.
  2. From Directory field click on the folder icon. Navigate to the <working directory>/Study_Tutorial folder. Click on the Select Folder button.
  3. Click on the Create Session button.
    Figure 1.

File Open

Before you begin, copy the file(s) used in this tutorial to your working directory.
  1. From the horizontal toolbar, click File > Open > Solver Deck.
    The File Browser opens.
  2. From the File Browser, change the file type to STL (*.stl).
  3. Navigate to the provided tutorial directory where all the tutorial files are stored, select the AhmedBody.stl file and click Open. The Solver Open Options dialog opens.
    Figure 2.
  4. Keep the default options and click Open.
  5. From the Units Selection dialog, select MKS (m kg N s) and click Continue.
    Figure 3.
  6. From the horizontal toolbar, click File > Save As. The Save Session dialog opens. Navigate to the tutorial root folder and for File Name enter Model.hmcfd and click on Save button.
  7. From the Geometry ribbon, Home group, click on the Data Transfer tool.
    Figure 4.
  8. In the guide bar, select Parts (selected by default) and from the graphics area select the body part.
  9. Activate the Clear existing Setup data option located under the guide bar and click on Transfer.

Case Setup Environment Setup

  1. From the horizontal toolbar, click File > Preferences.
    Figure 5.
    The Preferences dialog opens.
  2. In the Preferences dialog, under Analysis, select ultraFluidX and disable the Compression preference.
  3. Click Apply and then click OK to close the Preference dialog.
    Note: This step is being executed so the uFX solver deck is written in .stl file format. In the later section of the DOE study, for each simulation an .stl file that corresponds to the shaped geometry will be created. The baseline model .xml file will be the same for all simulations done during the DOE.
  4. From the horizontal toolbar, click View > Model Browser to activate the Model Browser. Repeat the same step to activate the Property Editor. Both open on the left side of the modeling window.
    Note: The Model Browser and the Property Editor can also be activated by pressing the F2 and F3 keys.

Define Wind Tunnel

  1. From the Setup ribbon, click the Edit Tunnel tool.
    Figure 6.
    A tunnel is generated around the model.
  2. In the Property Editor, under Inflow velocity set an Inflow speed of 30 m/s.
  3. In the Property Editor, under Tunnel Properties, modify the dimensions of the wind tunnel:
    • For Length enter 16.7 m.
    • For Width enter 9.3 m.
    • For Height enter 6.7 m.
  4. In the Property Editor, under Tunnel Extents, enter -5.2 m for X Min.
  5. From the Model Browser, select the Wind Tunnel and hide it with the H shortcut key.

Define Mesh Controls

  1. From the Setup ribbon, click on the Mesh Controls tool.
    Figure 7.
  2. From the secondary tool set, click the Create Box Zone Around Body tool.
    Figure 8.
  3. Select any location on the model’s body.
    A new refinement box zone is created, and the Box Zone micro-dialog appears.
  4. From the Box Zone micro-dialog, click on the drop-down arrows and set a value of 4 for Level, 1.7 m for Length, 0.6 m for Width, 0.5 m for Height and then press Enter.
  5. In the Property Editor, under Zone Extents set a value of -0.25 m for X Min and rename the created box by setting General > Name to Box_RL4.
  6. From the Box Zone micro-dialog click on the Plus button.
    A second box refinement zone, which is one level coarser, is generated around the initial one.
  7. Repeat steps 4 to 6 using the following values:
    Table 1.
    Level Name Length Width Height X Min
    3 Box_RL3 2.4 m 0.8 m 0.5 m -0.4 m
    2 Box_RL2 3.1 m 0.95 m 0.7 m -0.6 m
    1 Box_RL1 5.2 m 1.1 m 0.85 m -1.1 m

Define Output Controls

  1. From the Setup ribbon, Output group, click on the General Output tool. The ultraFluidX Output Controls dialog opens.
    Figure 9.
    Figure 10.
  2. From the ultraFluidX Output Controls dialog:
    1. Set the Output frequency value to 1.
    2. Click on the hamburger menu of Results > Output frequency.
    Figure 11.
    The General Output Field Variables dialog opens.
  3. From the General Output Field Variables dialog:
    1. Set the value of Start Iteration to 1616.
      Note: From the simulation parameters defined on the next section, iteration 1616 is the last iteration of the uFX run. By selecting the latter as a Start Iteration in combination with an Output frequency of 1, only the last timestep of the simulation will be exported for full & surface data.
    2. For the Full data select Pressure, Time average pressure, Velocity, Time average velocity and Surface normal.
    3. For the Surface data select Pressure, Time average pressure, Wall shear stress, Time average wall shear stress.
    4. From the Output file format enable H3D and disable Ensight.
    5. Under Aerodynamic coefficients, enable sectional coefficients in X, Y and Z and set a value of 100 sections for each of them. Leave Output start iteration as 1.
  4. Close the ultraFluidX Output Controls dialog.

Define Simulation Parameters

  1. From the Setup ribbon, Run group, click on the Run tool.
    Figure 12.
    The Write to UltraFluidX dialog opens.
    Figure 13.
  2. From the Write to UltraFluidX dialog:
    1. Set the Name of run as body, the Number of GPUs as 1 and for Run path set the path to the <working directory>/Study_Tutorial/baselineModel.
    2. For the Scaling factor set a value of 2.
    3. Uncheck the following options: Moving ground, Rotating wheels, Mesh preview.
    4. The setting should be as follows:
    Figure 14.
  3. Click Export to export the solver deck in the simulation directory.
  4. From File > Save, save the .hmcfd session.

Post Automation File

An .img file has been created to utilize the Report Generation utility of HyperMesh CFD. The file includes 2D plots of CL and CD over time and the time averaged sectional CD. In the later section, 2D plots will be generated for all the simulations completed in the DOE study, using this .img file.

Morphing

Control Volumes

  1. Switch to the Design Exploration environment.
  2. From the Morphing ribbon, Setup group, click the Volumes tool.
    Figure 15.
  3. From the secondary tool set, click the Enclosed tool.
    Figure 16.
  4. From the graphics area, select the elements at the front end of the body as shown in the following figure.
    Figure 17.
  5. In the micro-dialog click on the arrow to expand the drop-down menu. For Buffer %, set a value of 30.
  6. Click on Confirm to create the control volume.
  7. Repeat Steps 2 to 6 to create a second control volume as shown in the following figure.
    Figure 18.

Control Points

  1. From the Morphing ribbon, Setup group, click the Control Points tool.
    Figure 19.
  2. On the guidebar, select Seeds and create the following control points on the front area of the model.
    Figure 20.
  3. Click Play on the guidebar to create the control points set.
  4. From the Control Points menu, right click on the newly created control points and rename them to shape2_front_active.
    Figure 21.
    Note: From the Seed Location micro-dialog, use the Save icon to export control point sets to .csv files. By using the Folder icon, the user is able to import previously saved or already existing control point sets from .csv, .txt, .dat files.
  5. By clicking on the Seeds button on the guidebar, and clicking within the graphics window, the Seed Locations dialog opens.
  6. From the Seed Locations dialog, select the created seed and press the Delete button.
  7. Click on the Folder icon from Seed Location micro-dialog to import control points set from shape2_fixed.csv file located in the <working directory>/Study_Tutorial/Tutorial_StartFiles.
  8. Click the Play button.
  9. Rename the new set as shape2_front_fixed from the Control Points menu.

Morph

Shape 1

  1. From the Morphing ribbon, Setup group click on the Morph tool.
    Figure 22.
  2. On the guidebar, select Parts and select the model from the graphics area.
    Note: Generally, it is important to select all the parts we want to include in the geometry changes, to achieve better results in the final geometry after the morph.
  3. From the guidebar, click MorphVolumes and select the control volume on the rear side of the model.
  4. Click on Active on the guidebar and set the following control points on the model.
    Note: Attention is required while selecting the Active control points of the morph, to keep the whole area of interest in the range of the Impact Radius of these points (this will be clear later when we visualize the resulting shape).
    Figure 23.
  5. Click on Fixed from the guidebar and set the following control points on the model.
    Figure 24.
  6. For the Translation Vector, set a Z value of 0.05 m and let Impact Radius as default with a value of 0.1 m.
  7. Click on the Preview button and examine the displayed morphed geometry.
  8. If the shape describes the desired geometry sufficiently, click on the Play button to create the shape.
  9. From the Morph Shape menu, right click on the created shape and rename it to shape1_rear_z.

Shape 2

  1. From the tool’s guidebar, click on Parts and select the model to create the next shape.
  2. Click MorphVolumes from the guidebar and select the control volume on the front side of the model.
  3. Click on Active and then click on the three dots button next to it on the guidebar.
    Figure 25.
    The Active Control Points dialog opens.
  4. From the list select shape2_front_active and close the dialog.
  5. For the Translation Vector, set a X value of -0.1 m and let Impact Radius as default with a value of 0.1 m.
  6. Click on Fixed and then click on the three dots button next to it on the guidebar.
    The Fixed Control Points dialog opens.
  7. From the list, select shape2_front_fixed and close the window.
  8. Click on the Preview button and examine the displayed geometry.
  9. Click on the Play button to create the shape and from the Morph Shape menu, rename the newly created shape as shape2_front_x.

Shape 3

  1. Click on Parts in the guidebar and select the model to create the next shape.
  2. Click MorphVolumes from the guidebar and select the control volume on the rear side of the model.
  3. Click on Active and create the following control points on the model.
    Figure 26.
  4. For the Translation Vector set a Y value of 0.05 m and a value of 0.15 m for Impact Radius.
  5. Enable the Consider Symmetry option and set Symmetry plane normal as (0, -1, 0).
  6. Click on the Preview button and examine the displayed geometry.
  7. Click on the Play button to create the shape and from the Morph Shape menu rename the newly created shape as shape3_rear_y.

Shapes – Design Variables

  1. From the Review group click on the Shapes tool.
    Figure 27.
    The Edit Shapes dialog opens.
  2. Here you can select all three shapes and click on the Animate Shapes button.
    Figure 28.
  3. Examine the created shapes by selecting them from the animation guidebar and enabling Contour plot from the hamburger menu. Click on the Display button on the guidebar to display the currently applied factor or the current frame number.
    Using the media arrow keys review different states of the morphed geometry for factors 0.3, 0.6 and 0.8. Users can apply the shape with any factor between 0 and 1 by clicking on Shapes tool, selecting a shape of interest, right click and select the option Apply by Factor. This action will open a pop-up dialog where the user is able to specify any desired factor for this shape preview.
  4. Click on the green check arrow to exit the animation.
  5. From the Edit Shapes dialog, under the Design Variable column specify all the shapes as Desvar. Make sure the following values are kept: Lower Bound = -1, Initial value = 0, Upper Bound = 1.
    Figure 29.
  6. Click on Close.

Design of Experiment (DOE)

Launch HyperStudy

  1. From the DOE group click on the DOE Study tool.
    The DOE Study tool dialog opens.
    Figure 30.
    Figure 31.
  2. From the DOE Study tool dialog:
    1. Set the Problem name as Model.
      Note: The Problem Name and the .hmcfd model name must be the same.
    2. To set the Study directory, click on the Folder icon and navigate to the <working directory>/Study_Tutorial folder and select the DOE_Study_Tutorial directory.
    3. Set the Solver to UFX.
    4. Set the Study type to Shape.
    5. Set the Export format to Part Based.
  3. To set the Setup template file, in this tutorial the baseline model .xml file will be used. Click on the Folder icon and navigate to the baseline model solver deck location and select body.xml file.
    Note: To run ultraFluidX simulations, the installation must include hwcfdsolvers.
  4. (For Linux users) Set the Solver run command “<HMDesktop Installation folder>/altair/hwcfdsolvers/scripts/ufx" -np 2 -inpFile body.xml..
  5. To set the Post automation file click on the Folder icon and navigate to <working directory>/Study_Tutorial. Select the doe_post.img file.
    Figure 32.
  6. Click Launch to launch the HyperStudy client.

Setup – Nominal Model

  1. From the Study Explorer on the left-hand side under Setup > Definition, click on Define Models. Here you can find general details about the model.
    Figure 33.
  2. Click on Import Variables to import the shape Design Variables created in the Design Exploration environment of HyperMesh CFD. Click on the Next button.
    Figure 34.
  3. Review the Input Variables and click on the Next button.
  4. From Study Directory, right click on Ufx_Hst file. Select Show In > Explorer.
  5. (For Linux users) Open Ufx_Hst file in the text editor.
    1. Update the hmbatch script’s path to “$HW_ROOT/scripts/hmbatch”.
    2. Before the execution command of hwcfdReport script, add the following line of code: cp “<working directory>/Study_Tutorial/doe_post.img”.
    3. Update the hwcfdReport script’s path to "$HW_ROOT\hwx\plugins\hwd\profiles\HyperworksCfd\hwcfdReport".
      1. Make sure the input to hwcfdReport script is specified as: --img doe_post.img
    4. Before the hwcfdReport call command, make sure to add the following lines of code:
      while [ ! -e "uFX_summary.txt" ] 
      do
      # Check if termination text is present in uFX log
      if grep -1 "terminating" "uFX_log_*" then OR if grep -q -e "terminating" -e "Error:" "uFX_log_*"; then
      break
      fi
      sleep 10
      done
      
  6. (For Linux Users) Click on Run Definition button. The model files and settings files are written, then the baseline simulation should begin. When all tasks are completed, click on the Next button to continue.
  7. Windows users, where ultraFluidX cannot work, will continue with the Test Models step (Step 8) and then will copy paste the simulation files in the corresponding folder under the study directory. Once this is done the user will be able to continue the setup.
  8. (For Windows users) Extract and copy ultraFluidX simulation data in the DOE subdirectory.
    1. In the Test Models tab, click on the Write button. The model files and settings files are written.
    2. From the Study Directory, click on the approaches folder, select Show In > Explorer.
    3. Extract and then Copy the baseline simulation files located at <working directory>/Study_Tutorial /hst_files_for_windows_users/setup_1-def/m_1.
    4. Navigate to approaches/setup_1-def/run__0001/m_1/ folder and Paste the copied files.
    5. Return to HyperStudy environment. In the Test Models tab, click on the Extract button. Then click on the Next button to continue.
  9. Click on the Data Sources tab. Then, click on the Add Data Source button.
    Figure 35.
    A new variable line appears.
  10. From the File column click on the three dots.
    The Data Source Builder dialog opens.
  11. From the File option, click on the Folder icon and navigate to the uFX_coefficients_Avg.txt file under approaches\setup_1-def\run__00001\m_1\uFX_coefficientsData folder. Select and click Open.
    Figure 36.
  12. From the Component drop down menu, select Column 2, which describes the CX coefficient.
  13. Click OK.
  14. Click on the Define Output Responses tab and then click on Add Output Response button.
    A new variable line appears.
    Figure 37.
  15. Under the Expression column click on the three dots button.
    The Expression builder dialog opens.
    Figure 38.
  16. Click on the Data Sources tab.
  17. From the Data Sources tab, click on the Insert Varname arrow to expand the drop-down menu. From the list, select the Last Element option and then click on the Insert Varname button.
    The resulting value is displayed in the Preview area.
  18. Click OK.

Design of Experiment Study

  1. Click on the Next button. Two options appear, select Add.
  2. In the window that pops up, under Select Type select DOE. In the Definition From drop down menu select Setup. Click OK to continue.
    Figure 39.
  3. In the Study Explorer under DOE 1, repeat the model definition as previously done for Setup on Steps 2 to 3.
    The Test Models step can be skipped. The DOE is Setup based, and the nominal uFX simulation is already completed during the Setup Definition of the study. Input Variables and Output Response definitions are the same as specified earlier, during the Setup Definition.
  4. Click on the Next button twice.
  5. Under the Specifications tab, click on Show more and select the Full Factorial DOE Method.
  6. On the right-hand side of the HyperStudy window, select the Levels tab to specify levels for Input Variables. Specify a Level value of 4.
    Figure 40.
  7. Click on Apply and then click on the Next button.
  8. At the Evaluate step, on the Run Tasks selection, enable only the Write Input Files option and click the Evaluate Tasks button. This will create directories for all the runs of the DOE under the <working directory>/Study_Tutorial/DOE_Study_Tutorial/approaches/doe_1 subfolder. Also, the setting files for each run will be created.
    Figure 41.
  9. If every run’s Write column is tagged as Success, on the Run Tasks selection enable Execute Analysis and Extract Output Responses options.
    Note: For this tutorial, the desired result files from the DOE study are provided. Running the complete analysis is a time-heavy task that might take several hours for the user to complete (depending on the available resources). It is suggested that the user completes only a small amount of simulations (1 to 4) to be able to explore the Post-Processing capabilities.
  10. (For Linux Users) In the Evaluation Tasks tab, activate cases 1 to 4. Click on the Evaluate Tasks button to run the DOE study.
    Note: (For Windows users) Copy and paste the simulation files into the corresponding folder under the study directory.
  11. (For Windows users) Extract and copy ultraFluidX simulation data in the DOE subdirectory.
    1. From the Study Directory, right click on the approaches folder, select Show In > Explorer.
    2. Extract and then Copy the DOE simulation file folders from <working directory>/Study_Tutorial /hst_files_for_windows_users/doe_1/.
    3. Navigate to the <working directory>/Study_Tutorial/DOE_Study_Tutorial/approaches/doe_1/ folder and Paste the copied files.
    4. Return to HyperStudy environment. In the Run Tasks tab, enable only the Extract Output Responses task and click the Evaluate Tasks button.
  12. When all tasks have been completed and every step in the Study Explorer is highlighted as green, continue to the Post-Processing step by clicking on the Next button.
  13. Under the Summary tab, a table with the Response Output values per Input Variables pair is displayed. This can be used to further organize your study on the model if needed. The enumeration matches the Evaluation Tasks order.
    Figure 42.
    Note: More options for visualization on the DOE results, based on the response outputs and input variables, can be found in this step. Linear Effects, Interactions and Pareto Plot are some useful plots to use to see how each shape’s input variable value interacts with the response output, CX, behavior.
  14. Save the current study. Close the HyperStudy window and return to the HyperMesh CFD session that is already open.

PhysicsAI

Create a PhysicsAI Project

  1. From the ribbon selection toolbar (horizontal toolbar), select PhysicsAI.
  2. From the PhysicsAI ribbon, click on the Create Project tool.
    Figure 43.
    The Create Project dialog opens.
  3. From the Create Project dialog
    1. For Project Name, enter Ahmed_Body_PAI.
    2. For Location, click on Pick Location and select a save location for the project.
  4. Click OK.

Decimate Utility (Optional)

In case the DOE was not conducted or fully completed, the decimated .h3d files are already provided within the working directory (<working directory>/Study_Tutorial/decimated_surfaceData_h3ds.zip). If the provided .h3d files are used, this section can be skipped. If so, proceed directly to the Create Datasets section of the tutorial.
  1. From the PhysicsAI ribbon, click on the Decimate tool.
    Figure 44.
    Figure 45.
    The PhysicsAI Data Creation dialog opens.
  2. For Simulation Directory, click on the Browse button.
    The Simulation Directory dialog opens.
  3. Navigate to the Study_Tutorial/DOE_Study_Tutorial/approaches/doe_1 folder and click Select Folder. This folder contains all the runs that were executed during the DOE.
  4. Enable the Consider Subdirectories for File checkbox.
  5. For Folder Keyword to Skip, enter uFX_fullData and uFX_meshData. These keywords will be used to skip folders during search.
  6. For Simulation Files Keyword, leave it blank.
  7. For Result File Extension, click on the arrow to expand the drop-down menu, and select .h3d.
  8. For Parts to Skip, ensure it is blank.
    Note: The parts defined in the Parts to Skip tab are completely removed during decimation and they are not included in the resulting decimated result file.
  9. For Maximum Threads, leave it as default.
  10. For Decimation Feature Angle, enter 1.
  11. For Decimate Reduction, enter 0.2.
  12. Enable the Extract KPIs checkbox.
  13. For KPI Extraction Method, click on the arrow to expand the drop-down menu, and select Extract from UFX result.
  14. Click on Run.
  15. After the decimate tool has finished, navigate to the <working directory>/Study_Tutorial/DOE_Study_Tutorial/Approaches/doe_1 folder and notice that a new folder under the name h3ds has been created. This folder contains both the decimated result files and the .json files needed for KPI predictions.

Create Datasets

Training and Testing Datasets

  1. From the PhysicsAI ribbon, click on the Create Dataset tool.
    Figure 46.
    Figure 47.
    The Create Dataset dialog opens.
  2. For Dataset Name, enter Ahmed_Body.
  3. For File System, click on the three dots button.
    The Select Folder dialog opens.
  4. From the Select Folder dialog, navigate to the folder where the decimated .h3d files are stored and click Select Folder.
  5. The table under File System should now be populated with all the decimated .h3d files.
    Note: Under the File System table, the desired file type can be specified for file selection. By default, it is set as *.h3d.
    Note: In this case, the result files contained field information, such as pressure and wall shear stress fields. However, in case vector data are the only output (such as Key Performance Index studies), the geometry information can be supplied using mesh files, such as .fem files.
  6. Select all .h3d files and click on the transfer button to transfer them to the Requested Files table.
  7. Enable the Enable Train Test Split option and make sure the Train % is set to 80.
    The Enable Train Test Split option will automatically split the selected files into two datasets, one used for training and one used for testing. By default, the train percentage is set to 80%, which means that 80% of the specified h3d files will be put in the training dataset, while the rest will be put in the testing dataset.
  8. Enable the Extract Solid Faces option.
  9. Disable the Extract Simulation Properties option.
  10. Click OK.
  11. After the extraction of the training dataset is done, the Datasets dialog opens.
    Figure 48.
    Note: Notice that due to the use of the Enable Train Test Split option, two datasets are created, one for training and one for testing.
  12. Click Close.

PhysicsAI for KPI Predictions

In this section a PhysicsAI model will be trained with the SER method to predict drag coefficient values.

Train the Machine Learning Model

  1. From the PhysicsAI ribbon click on the Train ML Model tool.
    Figure 49.
    Figure 50.
    The Train Model dialog opens.
  2. From the Train Model dialog:
    1. For Model Name, enter Ahmed_Body_SER.
    2. For Training Data, select Ahmed_Body_train.
    3. Under Methods, select SER. On the right-hand side of the Train Model dialog, the SER method hyperparameters are shown.
    Note: PhysicsAI offers three methods for training, the Graphic Neural Simulator (GCNS), the Transformer Neural Simulator (TNS) and the Shape Encoding Regressor (SER). The GCNS and TNS methods can be used for field variable predictions, while SER is solely used for KPI predictions. For more information on these methods refer to the PhysicsAI help page.
    Note: Once the SER method has been selected, the Inputs and Outputs > Contours tabs become unavailable for modification.
  3. Under Outputs > Vector, select Cx.
  4. Specify the hyperparameters as shown in the table below:
    Table 2. SER Hyperparameters
    Hyperparameters Values
    K-fold Builds 10
    K-fold Test Fraction 0.1
    PCA Input Enabled
    PCA output Disabled
    Note: You can click on the hyperparameter names to read their description.
  5. Click Train.
    Note: Training may take some time, depending on the available resources. An already trained SER model is also provided in the <working directory>/Study_Tutorial/PhysicsAI_Trained_Models folder. This model can be used to continue the tutorial by importing it through the Import Model button in the Model Training dialog.
    Figure 51.
    The Model Training dialog opens.
  6. After training is completed, the Status will change to Done.
  7. Click on Set Active Model and then click on Close to exit the Model Training dialog.

Test the Machine Learning Model

Using the Model Testing tool, predictions on models, whose CFD results are available, can be generated. The Model Testing tool automatically calculates metrics to assess the Machine Learning model’s performance.
  1. From the PhysicsAI ribbon click on the Test ML Model tool.
    The Test Model dialog opens.
    Figure 52.
    Figure 53.
  2. From the Test Model dialog, under Models, select Ahmed_Body_SER. Under Datasets select Ahmed_Body_test.
  3. Click OK.
    Note: In this case, due to the small size of the models, testing takes very little time to complete. Notice that for larger models it may take longer, depending on the models’ sizes.
  4. After testing is completed, the Model Testing dialog opens.
    Figure 54.
  5. In the Model Testing dialog, the Mean Absolute Errors (MAE) for the specified Vector Outputs over all test models are displayed.
  6. Click on the Ahmed_Body_SER model. The Run IDs along with their corresponding MAEs are displayed.
  7. Click on Detailed Report to open the View Score Report dialog.
    Figure 55.
  8. Click Close to exit the View Score Report dialog.
    Note: From the Model Testing dialog, select an individual Run ID and click Display File. The PhysicsAI Plot windows opens, displaying the true and predicted Cx values for the selected model in a plot.
  9. Click Close to exit the Model Testing dialog.

Predict Using the Machine Learning Model

Using the Predict tool, you can generate predictions for new designs.
Morphing
  1. From the ribbon selection toolbar (horizontal toolbar), select Morphing.
  2. From the Setup group, click on the Volumes tool.
  3. From the secondary tool set, click on the Enclosed tool.
  4. From the graphics area, select the elements at the front end of the body as shown in the following figure,
  5. In the micro-dialog click on the arrow to expand the drop-down menu. For Buffer % set a value of 30.
    Figure 56.
  6. Click Confirm to create the control volume.
  7. From the Morphing ribbon, Setup group, click on the Control Points tool.
  8. On the guidebar set the selector to Elements.
  9. From the graphics window, select the following elements.
    Figure 57.
  10. In the micro-dialog, select Uniform option for Method, and a target Number of seeds of 40.
  11. Click on the Calculate button to create the control points set.
  12. Close the Seed Location dialog.
  13. From the Control Points menu, right-click on the newly created control points and rename them to Predict_Active.
  14. Repeat Steps 7-12 for the elements shown in the following image.
    Figure 58.
  15. From the Control Points menu, right click on the newly created control points and rename them to Predict_Fixed.
  16. Click on the green check arrow to exit the tool.
  17. From the Morphing ribbon, Setup group click on the Morph tool.
  18. On the guidebar, select Parts and select the model from the graphics area.
  19. On the guidebar, click MorphVolumes and select the control volume created in Step 6.
  20. Click on Active on the guidebar. Then click on the 3-dot button next to it in the guidebar. From the Active Control Points dialog, select Predict_Active set. Close the Active Control Points dialog.
  21. Click on Fixed on the guidebar. Then click on the 3-dot button next to it in the guidebar. From the Fixed Control Points dialog, select Predict_Fixed set. Close the Fixed Control Points dialog.
  22. For the Translation Vector set a Z value of -0.05 m in the and let Impact Radius as default with a value of 0.1 m.
  23. Click on the Preview button and examine the displayed morphed geometry.
  24. Click on the Play button to create the shape.
  25. From the Morph Shape menu right click on the created shape and Rename it to PredictDesign.
  26. Click on the green check arrow to exit the tool.
  27. From the Review group click on the Shapes tool.
  28. Select PredictDesign shape and right click on it, then click on Apply by Factor button. A micro-dialog opens. Set a value of 1 and click on Apply.
  29. Close the Edit Shapes dialog.
Prediction
Once the new morphed design has been created and applied, from the PhysicsAI ribbon click on the Predict tool.
Figure 59.
Note: If a “No Active PhysicsAI Model” error gets displayed, go to Model Training, select the Ahmed_Body_SER model, then click Set Active Model.
After a prediction is generated, the PhysicsAI Plot windows opens, displaying the predicted Cx value for the morphed model.

PhysicsAI for Field Variable Predictions

In this section a PhysicsAI model with the TNS method will be trained to predict time average pressure and time average wall shear stress fields.
Note: For GCNS and TNS, it is advised to train PhysicsAI models using a GPU, because it is significantly faster than training on a CPU. To use a GPU for training, please refer to PhysicsAI help.

Train the Machine Learning Model

  1. From the PhysicsAI ribbon, click on the Train ML Model tool.
    Figure 60.
    Figure 61.
    The Train Model dialog opens.
  2. From the Train Model dialog
    1. For Model Name, enter Ahmed_Body_TNS.
    2. For Training Data, select Ahmed_Body_train.
    3. Under Methods, select TNS. On the right-hand side of the Train Model dialog, the TNS method hyperparameters are shown.
    4. Under Inputs, select cae.mesh and make sure that the cae.part_label is not selected.
    Note: Using the cae.mesh option as input means that the spatial coordinates are used as a predictor of behavior. This option is selected by default, and it is recommended to always keep it on.
    Note: The cae.part_label allows for part labels to be used as predictors of behavior. It is useful in the case of large assemblies, where part names remain unchanged. However, it is suggested to turn it off if there are changes in part naming. By default, cae.part_label is not selected.
  3. Under Outputs > Contours, select time_avg_pressure and time_avg_wall_shear_stress.
  4. Specify the hyperparameters as shown in the table below.
    Table 3. TNS Hyperparameters
    Hyperparameters Values
    Width 64
    Depth 4
    Sections 32
    Attention Heads 4
    Node Subsampling Fraction 0.5
    Batch Size 1
    Epochs 600
    Learning Rate Cosine Decay
    Initial Value 1e-3
    Decay Fraction 1e-3
    Early Stopping Enabled
    Patience 100
    Mesh Alignment None
    Validation Fraction 0.15
    Note: You can click on the hyperparameter names to read their description.
  5. Click Train. The Model Training dialog opens.
    Note: Training may take some time, depending on the available resources. An already trained TNS model is also provided in the <working directory>/Study_Tutorial/PhysicsAI_Trained_Models folder. This model can be used to continue the tutorial by importing it through the Import Model button in the Model Training dialog.
    Figure 62.
    Note: Once the Status changes to Running, click on Show Log to inspect the training log file or click on Loss Curve to monitor the progression of the training and validation losses.
  6. After training is completed, the Status will change to Done.
  7. Click on Set Active Model and then click on Close to exit the Model Training dialog.

Test the Machine Learning Model

Using the Model Testing tool, you can generate predictions on models, whose CFD results are available, and automatically calculate metrics to assess the Machine Learning model’s performance.
  1. From the PhysicsAI ribbon click on the Test ML Model tool.
    Figure 63.
    The Test Model dialog opens.
    Figure 64.
  2. From the Test Model dialog, under Models select Ahmed_Body_TNS. Under Datasets select Ahmed_Body_test.
  3. Click OK.
    Note: In this case, due to the small size of the models, testing takes about a minute to complete. Notice that for larger models it may take longer, depending on the models’ sizes.
  4. After testing is completed, the Model Testing dialog opens.
    Figure 65.
  5. In the Model Testing dialog, the Mean Absolute Errors (MAE) for the specified Outputs over all test models are displayed.
  6. Click on the Ahmed_Body_TNS model. The Run IDs along with their corresponding MAEs are displayed.
  7. Click on Detailed Report to open the View Score Report dialog.
    Figure 66.
  8. Click Close to exit the View Score Report dialog.
    Note: From the Model Testing dialog, select an individual Run ID and click Display File. HyperMesh CFD automatically switches to the Post-Processing environment and loads the prediction and true results for the selected Run ID.
  9. Click Close to exit the Model Testing dialog.

Predict Using the Machine Learning Model

Using the Predict tool, you can generate predictions for new model designs.
Morphing
  1. From the ribbon selection toolbar (horizontal toolbar), select Morphing.
  2. From the Setup group, click on the Volumes tool.
  3. From the secondary tool set, click on the Enclosed tool.
  4. From the graphics area, select the elements at the front end of the body as shown in the following figure.
  5. In the micro-dialog click on the arrow to expand the drop-down menu. For Buffer % set a value of 30.
    Figure 67.
  6. Click Confirm to create the control volume.
  7. From the Morphing ribbon, Setup group, click the Control Points tool.
  8. On the guidebar set the selector to Elements.
  9. From the graphics window select the following elements.
    Figure 68.
  10. In the micro-dialog select Uniform option for Method, and a target Number of seeds of 40.
  11. Click on the Calculate button to create the control points set.
  12. Close the Seed Location dialog.
  13. From the Control Points menu, right click on the newly created control points and rename them to Predict_Active.
  14. Repeat Steps 7 to 12 for the elements shown in the following image.
    Figure 69.
  15. From the Control Points menu, right click on the newly created control points and rename them to Predict_Fixed.
  16. From the Morphing ribbon, Setup group click on the Morph tool.
  17. On the guidebar select Parts and select the model from the graphics area.
  18. On the guidebar click MorphVolumes and select the control volume created on Step 6.
  19. Click on Active on the guidebar. Then click on the 3-dot button next to it in the guidebar. From the Active Control Points dialog, select Predict_Active set. Close the Active Control Points dialog.
  20. Click on Fixed on the guidebar. Then click on the 3-dot button next to it in the guidebar. From the Fixed Control Points dialog select Predict_Fixed set. Close the Fixed Control Points dialog.
  21. For the Translation Vector set a Z value of -0.05 m in the and let Impact Radius as default with a value of 0.1 m.
  22. Click on the Preview button and examine the displayed morphed geometry.
  23. Click on the Play button to create the shape.
  24. From the Morph Shape menu right click on the created shape and rename it to PredictDesign.
  25. From the Review group click on the Shapes tool.
  26. Select PredictDesign shape and right click on it, then click on Apply by Factor button. A micro-dialog opens up. Set a value of 1 and click on Apply.
  27. Close the Edit Shapes window.
Prediction
  1. Once the new morphed design has been created and applied, from the PhysicsAI ribbon click on the Predict tool.
    Figure 70.
    Note: If a “No Active PhysicsAI Model” error gets displayed, go to Model Training, select the Ahmed_Body_TNS model and click Set Active Model.
    Note: The predicted .h3d file will be saved in the directory specified in the Create Session dialog.
    After a prediction is generated for the morphed model, the environment will automatically switch to Post-Processing, where the predicted results will be available for visualization.
    In the Post-Processing environment of HyperMesh CFD the drag coefficient of the design can also be calculated.
  2. From the Post-Processing environment, Measures group, click on the Engineering Quantities tool.
    Figure 71.
  3. From the guidebar, select Force and set the selector to Boundary Groups. Then, from the graphics window, select the body boundary group.
    A micro-dialog with optional calculation parameters comes up.
  4. From the micro-dialog, enable the checkboxes for Normalize force, Flip surface normals, and set the Freestream velocity as 30 m/s, the Freestream density as 1.2041 kg/m3, and the Area as 0.1 m2.
    Figure 72.
  5. Click Calculate.