# ACU-T: 5201 Coupled Simulation of a Check Valve using AcuSolve and MotionSolve

## Prerequisites

This tutorial introduces you to the workflow for setting up an AcuSolve-MotionSolve co-simulation using HyperWorks CFD. Prior to starting this tutorial, you should have already run through the introductory HyperWorks tutorial, ACU-T: 1000 HyperWorks UI Introduction, and have a basic understanding of HyperWorks CFD, AcuSolve, and HyperView. To run this simulation, you will need access to a licensed version of HyperWorks CFD, MotionSolve, and AcuSolve.

Prior to running through this tutorial, copy HyperWorksCFD_tutorial_inputs.zip from <Altair_installation_directory>\hwcfdsolvers\acusolve\win64\model_files\tutorials\AcuSolve to a local directory. Extract ACU-T5201_pressureCheckValve.x_t and Valve_model.xml from HyperWorksCFD_tutorial_inputs.zip.

## Problem Description

The problem to be addressed in this tutorial is shown schematically in Figure 1. It consists of a cylindrical pipe containing water that flows past a check valve with a shutter attached to a virtual spring (not included in the geometry). The inlet pressure varies over time and the movement of the shutter will be determined as a function of the balance of the fluid forces against the reactive force of the spring. The problem is rotationally periodic at 30° increments about the longitudinal axis, and it is assumed that the resulting flow is also rotationally periodic, allowing for modeling with the use of a wedge-shaped section. For this tutorial, a 30° section of the geometry is modeled, as shown in the figure. Modeling a portion of an rotationally periodic geometry leads to reduced computation time while still providing an accurate solution.

The pipe has an inlet diameter of 0.08 m and is 0.3 m long. The check-valve assembly is 0.085 m downstream of the inlet. It consists of a plate 0.005 m thick with a centered orifice 0.044 m in diameter and a shutter with an initial position 0.005 m from the opening, simulating a nearly closed condition. The shutter plate is 0.05 m in diameter and 0.005 m thick. The shutter plate is attached to a stem 0.03 m long and 0.01 m in diameter. The mass of the shutter and stem is 0.2 kg and its motion is affected by a virtual spring with a stiffness of 2162 N/m. The motion of the valve shutter is limited by a stop mounted on a perforated plate downstream of the shutter.

Note that AcuSolve's internal rigid-body-dynamics solver is not able to simulate contact. Therefore, this problem is formulated to avoid contact between the valve and the stop.

Modeling the geometry as a 30° section requires that the fluid model is set up to be consistent with the rigid-body model. Since only 1/12 of the rigid body is modeled, the forces computed by AcuSolve that act on the valve shutter represent 1/12 of the actual force on the device. Therefore, it is also necessary to account for this in the simulation. There are two methods that can be used to accomplish this:
1. Scale up the fluid forces calculated by AcuSolve by a factor of 12 to represent the full load on the device when the displacement of the body is computed.

Using this approach, the full stiffness of the valve spring is used in the rigid-body solution, and the full mass of the valve is used.

2. Scale down the mass of the valve and the stiffness of the spring to by a factor of 12 to match the fraction of the valve geometry to be modeled.

Using this approach, the loading passed to the rigid-body solver is not scaled.

This second approach is used in this tutorial; the scaled mass of 0.0167 kg and the scaled stiffness of 180.1667 N/m will be used

The fluid in this problem is water, which has a density (ρ) of 1000 kg/m3 and a molecular viscosity (μ) of 1 X 10-3 kg/m-sec.

At the start of the simulation, the flow field is stationary. Flow is driven by the pressure at the inlet, which varies over time as a piecewise linear function shown in Figure 2. As the pressure at the inlet rises, the flow will accelerate as the valve opens. The turbulence viscosity ratio is assumed to be 10.

The initial inlet pressure is 0 Pa. At 0.002 s the pressure begins to ramp up and reaches 29,000 Pa at 0.05 s. The pressure is held at 29,000 Pa and begins to ramp back down starting at 0.2 s, reaching the initial pressure at 0.25 s where it remains for the rest of the simulation.

Prior simulations of this geometry indicate that the average velocity at the inlet reaches a maximum of 0.98 m/s. At this velocity, the Reynolds number for the flow is 78,400. When the Reynolds number is above 4,000 it is generally accepted that flow should be modeled as turbulent.

Note that the initial conditions of the flow are actually laminar; however, the increase in flow velocity and flow around the valve shutter is expected to cause a rapid transition to turbulent conditions. Therefore, the simulation will be set up to model transient, turbulent flow. When performing a transient analysis, convergence is achieved at every time step based on the defined stagger criteria. Mesh motion will be modeled using arbitrary mesh movement (arbitrary Lagrangian-Eulerian mesh motion).

For this case, the transient behavior of interest occurs in the time it takes for the pressure to ramp up and ramp back down, which is given by the transient pressure profile. To allow time for the spring to recover additional time will be simulated. For this tutorial 0.1 s is added after the pressure drops back to initial conditions for a total duration of 0.35 s.

Another critical decision in a transient simulation is choosing the time increment. The time increment is the change in time during a given time step of the simulation. It is important to choose a time increment that is short enough to capture the changes in flow properties of interest, but does not require unnecessary computation time. The change in inlet pressure from initial conditions to maximum occurs over 0.048 s. A time increment of 0.002 s would allow for excellent resolution of the transient changes without requiring excessive computational time.

## Start HyperWorks CFD and Create the HyperMesh Model Database

1. Start HyperWorks CFD from the Windows Start menu by clicking Start > Altair <version> > HyperWorks CFD.
When HyperWorks CFD is loaded, the Geometry ribbon is open by default.
2. Create a new .hm database in one of the following ways:
• From the menu bar, click File > Save.
• From the Home tools, Files tool group, click the Save As tool.
3. In the Save File As dialog, navigate to the directory where you would like to save the database.
4. Enter CheckValve_Coupled as the name for the database then click Save.
This will be your problem directory and all the files related to the simulation will be stored in this location.
5. Move the Valve_model.xml file to the problem directory.

## Import and Validate the Geometry

### Import the Geometry

1. From the menu bar, click File > Import > Geometry Model.
2. In the Import File dialog, browse to your working directory then select ACU-T5201_pressureCheckValve.x_t and click Open.
3. In the Geometry Import Options dialog, leave all the default options unchanged then click Import.

### Validate the Geometry

1. From the Geometry ribbon, click the Validate tool.
The Validate tool scans through the entire model, performs checks on the surfaces and solids, and flags any defects in the geometry, such as free edges, closed shells, intersections, duplicates, and slivers.

The current model doesn’t have any of the issues mentioned above. Alternatively, if any issues are found, they are indicated by the number in the brackets adjacent to the tool name.

Observe that a blue check mark appears on the top-left corner of the Validate icon. This indicates that the tool found no issues with the geometry model.
2. Press Esc or right-click in the modeling window and swipe the cursor over the green check mark from right to left.
3. Save the database.

## Set Up Flow

### Set Up the Simulation Parameters and Solver Settings

1. From the Flow ribbon, click the Physics tool.
The Setup dialog opens.
2. Under the Physics models setting:
1. Set Time marching to Transient.
2. Set the Time step size to 0.002 and the Final time to 0.35.
3. Select Spalart-Allmaras as the Turbulence model.
3. Click the Solver controls setting and set the Maximum stagger iterations to 3.
4. Close the dialog and save the model.

### Create a Multiplier Function for the Inlet Pressure

1. From the Flow ribbon, click the arrow next to the Setup tool set, then select Multipliers.
2. Click in the Multiplier Library dialog.
3. In the multiplier creation dialog, change the name of the multiplier function to Inlet Pressure by clicking on the top-left corner.
4. Set the Type to Piecewise Linear.
5. Verify that the Variable is set to Time and Evaluation is set to Time Step.
6. Click four times to add four rows to the bottom of the table.
7. Enter the table values according to the image below.

### Assign Material Properties

1. From the Flow ribbon, click the Material tool.
2. Click anywhere on the pipe geometry.
The entire geometry is highlighted.
3. In the microdialog, select Water from the Material drop-down menu.
4. On the guide bar, click to execute the command and exit the tool.
5. Save the model.

### Define Flow Boundary Conditions

In this step, you will assign the boundary conditions for the inlet, outlet and the symmetry faces.
1. From the Flow ribbon, Pressure tool group, click the Stagnation Pressure tool.
2. In the modeling window, click on the inlet surface, as shown in Figure 16.
3. In the microdialog, enter a value of 1 N/m2 for the Stagnation pressure.
4. Click the Multiplier function drop-down and select the function Inlet Pressure from the list.
5. Click the Turbulence icon the microdialog, set the Turbulence input type to Viscosity Ratio, and the enter a value of 10 for the Turbulence viscosity ratio.
6. On the guide bar, click to execute the command and remain in the tool.
7. In the Boundaries legend, right-click on Stagnation pressure and rename it to Inlet then press Enter.
8. Click the Outlet tool.
9. Click the outlet surface shown in the figure below.
10. On the guide bar, click to execute the command and exit the tool.
11. Click the Symmetry tool.
12. Select the two surfaces shown in the figure below.
13. On the guide bar, click to execute the command and remain in the tool.
14. In the Boundaries legend, rename Symmetry to Front_symmetry.
15. Rotate the model and select the other two symmetry faces.
16. On the guide bar, click to execute the command and remain in the tool.
17. In the Boundaries legend, rename Symmetry to Back_symmetry.
18. Save the model.

## Set Up Motion

In this step, you will activate the mesh motion and define the rigid body motion for the valve wall. Then, you will define the mesh displacement boundary conditions for the symmetry surfaces.

### Define the Mesh Motion Type

1. From the Motion ribbon, click the Settings tool.
2. In the Setup dialog, change the Mesh motion to Arbitrary.
3. Click the External code setting and activate the External code option.
4. Set the External Solver to MotionSolve and the Communication type to Socket.
5. Deactivate the External socket option and set the Socket host to localhost.
6. Set the Socket port to 48000.
7. Close the dialog.

### Define the Mesh Displacement Boundary Conditions

1. From the Motion ribbon, click the Planar Slip tool.
2. Select the two front symmetry surfaces shown Figure 27.
3. In the Mesh Motion legend, rename Planar Slip to Front_symmetry by double-clicking on the name.
4. On the guide bar, click to execute the command and remain in the tool.
5. Rotate the model and select the two back symmetry faces.
6. In the Mesh Motion legend, rename Planar Slip to Back_symmetry.
7. On the guide bar, click to execute the command and exit the tool.
8. Click the External Surface tool.
9. On the guide bar, make sure the Surfaces selector is active.
10. Right-click in the modeling window and go to Select > Advanced Select > By Boundaries > Default Wall.
11. Now that all the wall surfaces are highlighted, isolate the selected surfaces either by pressing the I key, or by right-clicking in the modeling window and selecting Isolate.
12. Zoom in on the valve region and select all the valve wall surfaces using the window selection method.
13. In the microdialog, set the Coupling direction to Both and enter Model-Shutter Body as the name of the Rigid body.
Note: The name of the rigid body specified here should match the name of the rigid body in the MotionSolve model.
14. In the External Code Surfaces legend, rename the External Surface to Valve wall.
15. On the guide bar, click to execute the command and exit the tool.
16. Turn on the display of all surfaces and save the model.

## Generate the Mesh

In this step, you will define the mesh controls and then generate the mesh.

### Define the Zone Mesh Controls

The zone mesh controls allow you to define a local volume mesh size for specific regions using standard shaped zones like cylindrical, spherical, and cuboidal zones.
1. From the Mesh ribbon, Zones tool group, click the Cylinder tool.
2. In the modeling window, hover the mouse around the point shown in the figure below. When the preview cylinder zone is parallel to the axis of the pipe, click on the model near the point shown below.
This point will be the center of the front face of the cylinder. In the next few steps you will edit the co-ordinates of this point manually.
3. Move the mouse cursor away from the center and then click again.
A preview of the zone should be displayed on the screen along with the manipulator. The manipulator allows you to modify the location and orientation of the zone.
4. Click the center of the manipulator and enter the following coordinates for the center (-0.06, 0.02, 0)
5. Double-click on the cylindrical surface of the zone and enter 0.022 m as the radius of the cylinder.
6. Double-click on the base of the cylinder and enter 0.1 m as the height of the cylinder.
7. Click anywhere in the empty space in the modeling window.
8. Enter a value of 0.0015 m for the mesh size in the microdialog.
9. In the Refinement zones legend, rename the zone to Valve region mesh refinement.
10. Save the model.

### Define the Boundary Layer Controls

1. From the Mesh ribbon, click the Boundary Layer tool.
2. Right-click in the modeling window and go to Select > Advanced Select > By Boundaries > Default Wall.
All the wall surfaces should be highlighted and a dialog for BL specification appears.
3. Enter the following values in the dialog:
1. First layer thickness: 0.00035
2. Total number of layers: 3
3. Growth method: Constant
4. Initial growth rate: 1.2
5. Termination policy: Truncate
6. Activate Enable surface mesh modification.
4. In the BL Controls legend, rename the BL control to Pipe walls BL.
5. On the guide bar, click to execute the command and remain in the tool.
6. In the next few steps, you will define the boundary layer mesh control for the valve walls. For convenience, hide the front and back symmetry faces.
7. Select the valve wall surfaces using the box selection method.
8. In the dialog that appears, enter the following values for the BL specification:
1. First layer thickness: 0.00015
2. Total number of layers: 3
3. Growth method: Constant
4. Initial growth rate: 1.2
5. Termination policy: Truncate
6. Activate Enable surface mesh modification.
9. In the BL Controls legend, rename the BL control to Valve walls BL.
10. On the guide bar, click to execute the command and exit the tool.
11. Click the drop-down next to the Mesh Controls tool set and select Advanced.
12. In the Advanced mesh settings dialog, change the Boundary layer element type to Tetra then close the dialog.
13. Turn on the display of all the surfaces and save the model.

### Generate the Mesh

1. From the Mesh ribbon, click the Batch tool.
2. In the Meshing Operations dialog, set the Mesh size option to Maximum size and set the Maximum element size to 0.005.
3. Deactivate Curvature based surface refinement.
4. Click Mesh to generate the mesh.

Once the meshing process has started, the Run Status dialog appears and the application moves to the Solution ribbon.

5. Once the meshing is completed, close the Run Status dialog.

## Compute the Solution

### Define Nodal Outputs

1. From the Solution ribbon, click the Field tool.
2. In the Field Outputs dialog, set the Time step interval to 1 for the Solution variables.

### Run AcuSolve

1. From the Solution ribbon, click the Run tool.
2. In the Launch AcuSolve dialog, enter the following text in the Additional arguments box: -tlog -lprobe.
This will launch the AcuProbe and AcuTail utilities automatically once the run is launched.
3. Set the Parallel processing option to Intel MPI.
4. Optional: Set the number of processors to 4 or 8 based on availability.
5. Deactivate the Automatically define pressure reference option.
6. Leave the remaining options as default and click Run to launch AcuSolve.
The Run Status dialog opens. Once the run is complete, the status is updated and you can close the dialog.

### Run MotionSolve

In the next steps you will start MotionSolve and provide settings for communication with AcuSolve.
1. Run Start > All Programs > Altair HyperWorks <version> > MotionSolve to open the HyperWorks Solver Run Manager.
2. Click beside the Input file(s) field, browse to the location where you saved Valve_model.xml, and open it.
3. Click to open the Available Options dialog.
4. Enable the -as_cosim option to indicate coupling between MotionSolve and AcuSolve.
5. In the -as_cosim dialog that appears, click None.
6. In the Available Options options dialog, click Apply Options and close the dialog.
7. Click Run to start MotionSolve.
As the solution progresses, a HyperWorks Solver View window will open. Solution progress is reported in this window. The AcuSolve AcuTail window will also update as the solution progresses.
As the solution progresses, you can monitor the progress with AcuProbe, as detailed in the next steps.

### Monitor the Solution with AcuProbe

While AcuSolve is running, you can monitor flow characteristics such as inlet pressure, displacement of the valve, and velocity of the valve, using AcuProbe.

Once the MotionSolve run launched, the AcuProbe window will be launched automatically after the first time step.

1. In the AcuProbe Data Tree, expand Surface Output > Inlet - Output > Pressure.
2. Right-click on pressure and select Plot.
3. Similarly, expand Valve_wall - Output > Geometry under Surface Output.
4. Right-click on mesh_x_displacement and select Plot.
Note: You might need to click on the toolbar in order to properly display the plot.

In the next steps you will create a plot of the x-velocity of the valve walls.

5. Turn off the plot of pressure at the inlet by right-clicking on Inlet - Output and selecting Plot None.
6. Expand Valve_wall - Output > Momentum, right-click on x_velocity, and select Plot.
7. Close the AcuTail and AcuProbe windows.

## Post-Process the Results with HyperView

In this step, you will create an animation of the valve motion as the water flows across the valve using HyperView.

### Open HyperView and Load the Model and Results

1. Start HyperView from the Windows Start menu by clicking Start > All Programs > Altair <version> > HyperView.
Once the HyperView window is loaded, the Load model and results panel should be open by default. If you do not see the panel, click File > Open > Model.
2. In the Load model and results panel, click next to Load model.
3. In the Load Model File dialog, navigate to your working directory and select the AcuSolve .Log file for the solution run that you want to post-process. In this example, the file to be selected is CheckValve_Coupled.1.Log.
4. Click Open.
5. Click Apply in the panel area to load the model and results.
The model is colored by geometry after loading.

### Create an Animation of Velocity Magnitude

In the next step, you will create an animation of the velocity magnitude on the symmetry plane and then save it.
1. In the Results Browser, expand the list of Components then click the Isolate Shown icon .
2. Click the Front_symmetry - Output component to turn off the visibility of all the components except the front symmetry surface.
3. Orient the display to the xy-plane by clicking on the Standard Views toolbar.
4. Click on the Results toolbar to open the Contour panel.
5. In the panel area, change the Result type to Velocity (v) and verify that the drop-down below it is set to Mag (magnitude).
6. Click the Components entity selector. In the Extended Entity Selection dialog, select Displayed.
7. Click Apply.
8. In the panel area, under the Display tab, turn off the Discrete color option.
9. Go to the Legend tab and then click Edit Legend.
10. In the Edit Legend dialog, change the Type to Dynamic scale and the Numeric format to Fixed then click OK.
11. Click on the Animation toolbar to play the velocity magnitude animation on the front symmetry plane.
12. On the ImageCapture toolbar, click on the Capture Graphics Area Video icon .
13. In the Save Graphics Area Video As dialog, browse to the directory where you want to save the animation, give a name to the video (ex: velocity mag), then click Save.

### Display Pressure and Velocity Contours on a Section Cut

In the next step, you will create a section cut on the mid-z plane and then display the pressure contours and velocity vectors on that cross section.
1. In the Results Browser, turn off the display of all the Components except the Fluid_Main SolidBody_2_1 component.
2. Click on the Results toolbar to open the Contour panel.
3. In the panel area, change the Result type to Pressure (s).
4. Click the Components entity selector. In the Extended Entity Selection dialog, select Displayed.
5. Click Apply to create the contour plot of pressure.
6. In the panel area, under the Result tab, activate the Overlay result display check box (if not already selected).
7. Click the Section cut icon on the HV-Display toolbar.
8. In the panel area, click Add to create a new section cut named Section 1.
9. In the Define plane section, set the axis to Z Axis then click Apply.
10. Set the Z Base coordinate to 0 and press Enter.
11. Change the Display options from Clipping plane to Cross section.
12. Click Gridline. In the Gridline Options dialog, deactivate the Show check box under Grid line then click OK.
13. Click on the Results toolbar to open the Vector panel.
14. In the panel area, set the Result type to Velocity (v).
15. Click the Selection drop-down and select Sections from the list of options.
16. Click the Sections entity selector then select All.
17. In the panel area, activate the Overlay result display check box (if not set already).
18. Click Apply.
19. Under the Plot tab, verify that only the X+Y+Z Resultant option is selected.
20. Go to the Display tab, set the Size scaling option to Uniform, and enter a value of 0.002 in the size field.
21. Set the Color by option to Direction and set the X+Y+Z color to White.
22. Go to the Section tab, activate the Projected check box, then click Apply.
The vector plot should look like the one shown in the figure below.

The result at 0.156 sec is shown.

## Summary

In this tutorial, you learned the basic workflow to set up a co-simulation using AcuSolve and MotionSolve. The tutorial introduced you to the steps involved in setting up external code communication between AcuSolve and MotionSolve using HyperWorks CFD, and then running the simulation and post-process the results using HyperView. You also learned how to create a vector plot on an existing contour plot on a cut plane.