MV-7008: Co-simulation with AcuSolve

In this tutorial, you will learn how to setup a model in MotionView that will be coupled with AcuSolve.

With the addition of a co-simulation interface between MotionSolve and AcuSolve, you can now solve multi-physics problems that involve complex rigid body movement, coupled with fluid flow, that generates pressure forces on the rigid bodies. This capability lets you enhance the fidelity of your multi-body system, letting you generate more realistic results.

In this scenario, MotionSolve computes the displacements and rotations for the rigid bodies, while AcuSolve computes the forces and moments on those bodies. Both solvers exchange data with each other while stepping forward in time via the TCP socket protocol. This means that the two solvers can be located on different machines and on different platforms and still communicate with one another. For example, the CFD simulation can run on an HPC, while the MBS simulation can run locally on a laptop.

Tutorial Objectives

You will use the MotionSolve-AcuSolve co-simulation interface to couple the rigid body dynamics of a check valve within a pipe with the flow field. The AcuSolve model has already been setup for you and is located at <installation_directory>\tutorials\mv_hv_hg\mbd_modeling\motionsolve\cosimulation\Check_Valve_Coupled.acs. Steps for running this model in AcuSolve are included as part of this tutorial.

To learn more about how to setup the model in AcuSolve, please refer to <installation_directory>\acusolve\<platform>\help\acu\acusolve_tut\Tutorials\Check_Valve_Coupled\.

Software Requirements

To successfully complete this tutorial, the following must be installed:
Machine A Machine B
Software Platform Software Platform
MotionSolve/MotionView Windows 64-bit or Linux 64-bit AcuSolve Windows 64-bit or Linux 64-bit

From the table above, the co-simulation is supported for both Windows and Linux platforms (64-bit). Cross platform co-simulation is also possible.

Simulation Environment

The co-simulation interface between MotionSolve and AcuSolve consists of a “middleware” utility executable, acuMSI.exe. This executable is responsible for:
  • Establishing a connection to both MotionSolve and AcuSolve.
  • Communicating the displacements and rotations from MotionSolve to AcuSolve.
  • Communicating the forces and moments from AcuSolve to MotionSolve.
  • Managing runtime and licensing.
This is shown schematically below.


Figure 1. Co-Simulation setup

Pipe with a check valve

A check valve is a mechanical device that permits fluid to flow in only one direction. This is controlled by a shutter body. Fluid flowing in one direction pushes the shutter body in one direction, thereby opening the valve. Fluid flowing in the opposite direction pushes the shutter body in the other direction, which causes the valve to shut and prevents flow reversal in the pipe. Check valves are found in pumps, chemical and power plants, dump lines, irrigation sprinklers, hydraulic jacks, for example.

The geometry that is modeled in this tutorial is illustrated in the figure below. It consists of:
  • A pipe with an inlet and outlet for the fluid flow.
  • A check valve assembly that consists of a shutter plate attached to a stem.
  • A stop mounted on a perforated plate downstream of the shutter body.
  • The fluid flow in the pipe is assumed to be axisymmetric. This allows you to model only a part of the check valve. In this example, a 30 degree section of the geometry is modeled, as shown by the blue part in the figure below. The advantage of doing this is a reduced simulation time while still capturing an accurate solution.


Figure 2. Pipe with check valve model setup

The check valve assembly consists of a disc-like body mounted on a stem. When fluid flows in the direction specified by the red arrows in the figure above, the fluid forces the shutter body to translate in the same direction as the fluid. The motion of the shutter body is also affected by a spring damper attached between the shutter body and the perforated plate. Finally, 3D rigid body contact is modeled between the shutter body and the stop to arrest the motion of the shutter body in the direction of the flow.

For the MBS model, only 1/12 of the shutter body and the perforated plate are modeled.

At the start of the simulation, the flow field is stationary. A pressure specified at the inlet drives the flow, which varies over time as a piecewise linear function. This is illustrated in the figure below. As this pressure rises, the flow accelerates which in turn pushes the shutter body open and allows flow through the pipe.


Figure 3. Inlet pressure

This dynamics of this kind of model can be termed as being “tightly” coupled between the two solvers. This means that the motion of the rigid bodies affects the fluid flow field, which in turn affects the rigid body motion in a cyclical fashion.

The rest of this tutorial assumes that this model has been correctly setup in AcuSolve. Note that the model is designed to translate the shutter body until it collides with the perforated plate. The MotionView model has been designed with a contact between these two bodies that causes the shutter body to rebound appropriately. To allow the rigid bodies to come into contact without the AcuSolve finite element mesh fully collapsing, the perforated plate in the fluid model has been offset by 0.002m in the positive X direction. This allows the MotionView model to react as specified by the contact entity while keeping the AcuSolve mesh from fully collapsing.

Load the Model in MotionView

  1. From the Start menu, select All Programs > HyperWorks <version> (64-bit) > MotionView.
  2. Open the model Valve_model.mdl from <altair>\<version>\tutorials\mv_hv_hg\mbd_modeling\motionsolve\cosimulation.
    This model is prepared to run in MotionSolve but requires modifications to run in co-simulation with AcuSolve. These steps are outlined below.
    Once the model is loaded into MotionView, the graphical window displays the shutter valve, perforated plate, joint and spring entities, as well as a graphical representation of the spring damper as shown in the figure below.


    Figure 4. The MotionSolve model of the pressure check valve
    The MotionSolve model consists of the following components:
    Component Name Component Type Description
    Ground Body Rigid Body Ground Body
    Shutter Body Rigid Body 30 degree section of the shutter body.
    Perforated Body Rigid Body 30 degree section of the perforated plate.
    Contact 3D Rigid-Rigid Contact Force 3D rigid-rigid contact force between the Shutter body and the Perforated Body.
    Solver Units Data Set The units for this model (Newton, Meter, Kilogram and Second).
    Gravity Data Set Gravity specified for this model. The gravity is turned on and acts in the negative Y direction.
    Shutter Body Graphic Graphic The graphic that represents the shutter body. This graphic is used both for the co-simulation and for the contact force calculations.
    Perforated Plate Graphic Graphic The graphic that represents the perforated plate body. This graphic is used both for the co-simulation and for the contact force calculations.
    Spring Graphic The graphic that represents the spring modeled between the shutter body and the perforated plate body. This is only for visualization and does not affect the co-simulation results.
    Fixed Fixed Joint This fixed joint clamps the perforated plate body to the ground.
    Translation Translational Joint This translational joint allows motion of the shutter body along the X axis.
    Spring Spring Damper This is a simple spring damper mounted between the shutter body and the perforated plate body.
    ContactOutput Output An output signal that measures the contact force.
    Displacement Output An output signal that measures the displacement between the shutter body and the ground.
    Velocity Output An output signal that measures the velocity of the shutter body with respect to the ground.

Specify the “Wet” Body That Will Interact with AcuSolve

To couple with AcuSolve, you need to specify one or more "wet" bodies. A "wet" body is a body in the MotionSolve model which interacts with the fluid flow and thus has forces and moments acting on it. Such a body can translate or rotate due to the actuating fluid force/moment as computed by AcuSolve as well as due to any actuating forces/moments in the MotionSolve model. In this example, we will define a single "wet" body – the shutter body that translates along the X axis due to fluid impinging on it.

To specify a body as "wet" in MotionView, you have to make use of a system definition, which is described below.

  1. Add the system definition to your model by locating the Model system in your Project Browser and select it.
    This changes the panel selection at the bottom.
  2. From the Import/Export tab, select Import and click the File open icon, .
  3. The system definition that is used for this co-simulation is located at <installation_directory>\utility\mbd\fluid_force\sys_fluid_force.mdl. Click Import to import the file.
    The Import Definition dialog is displayed.
  4. Leave the labels as-is and click OK.


    Figure 5. Adding the system definition to the model

    A new system called System Wet Body is created in your model.

  5. Specify the "wet" body by clicking the newly created System Wet Body and clicking the Attachments tab as shown in the figure below.


    Figure 6. Defining the rigid body associated with the “wet” body
  6. Click the Body collector and resolve it to Shutter Body.
    If you examine the contents of this system under the project browser on the left, you will see the following new components have been created:
    Component Name Component Type Description
    Shutter Body - AcuSolveForce Action Only, TransRotational Force The force and moment calculated by AcuSolve is applied to the “wet” body through this force component.
    Plant Input Control Plant Input AcuSolve deposits the forces and torques into this modeling element.
    FromAS_FX

    FromAS_FY

    FromAS_FZ

    FromAS_TX

    FromAS_TY

    FromAS_TZ

    Solver Variables These variables hold the forces (X, Y and Z) and the moments (X, Y, Z) values from AcuSolve.
    Define wet_body attribute Template This template adds the attribute is_wet_body to the wet body that is chosen for this system.
    Define co-simulation with AcuSolve Data Set This template adds the attribute acusolve_cosim to the model to instruct MotionSolve to co-simulate with AcuSolve.

    At this point, you have setup the model in MotionView to interact with AcuSolve.

Run the Model without Co-simulating with AcuSolve

To make sure that the MotionView model is setup correctly, run the model in MotionSolve and make sure there are no warning/error messages from MotionSolve.

  1. To deactivate the template Define co-simulation with AcuSolve shown in the figure below, right-click on it in the browser and select Deactivate.


    Figure 7. Deactivate the co-simulation template

    By doing this, you are deactivating the flag which tells MotionSolve that this model is intended for co-simulation with AcuSolve. Thus, MotionSolve simulates this model as a stand-alone model without co-simulating with AcuSolve

    You may run this model using the Run panel in MotionView and ensure that there are no error or warning messages reported. This is recommended to ensure that the model works properly before attempting a co-simulation.

    If you load the animation H3D generated from running this model, you will see that there is no motion in any of the parts. This is because all of the actuation for this model comes from AcuSolve, which was disabled for this simulation.

  2. After you have verified the model, re-activate the template Define co-simulation with AcuSolve to perform a co-simulation, as shown in the figure below:


    Figure 8. Activate the co-simulation template
  3. To activate the template, right-click on it in the browser and select Activate.
  4. To export the model to your working directory, click the Export to Solver button and export the solver deck to your working directory.
    You may change the default name of the model.


    Figure 9. Exporting the model to .xml

Verify the Model between MotionSolve and AcuSolve

To successfully run the co-simulation, the model created in MotionView and the model created in AcuSolve must be consistent. The following criteria need to be met in order for the two models to be consistent.

  1. The name of the “wet” body/bodies need to match between MotionSolve and AcuSolve. The names of the “wet” body/bodies are specified in the *.inp file on the AcuSolve side.
    Note: The names are case-sensitive and must match exactly (see the text in red below).
    MotionSolve (.xml):
    <!-- MODEL.b_Part1 -->
    <Body_Rigid
    full_label = "Model-Shutter Body"
    AcuSolve (.inp):
    EXTERNAL_CODE_SURFACE( "Valve wall" ) {
    rigid_body_name = "Model-Shutter Body"
  2. The print_interval for the MotionSolve model needs to match the step size for the AcuSolve model. For this tutorial, it is set to 0.002s.
  3. You must set the MotionSolve step size, h_max, to match the print_interval (0.002s in this case).
  4. Also, verify that the end times for both models are set to the same values. For this tutorial, the end times for both the AcuSolve and MotionSolve models are set to 0.35s.
    See the Run Panel in MotionView to set the print_interval, step size (h_max), and end times.
    Note that the units in the MotionSolve and AcuSolve models do not need to match to run the co-simulation; however, the units must match to overlay the results animations in HyperView. The units in MotionView are set via the Units form shown below:


    Figure 10. Setting the units in MotionView

    All values in the MotionSolve model are set with respect to these units settings.

Run the MotionSolve and Middleware Executables for Co-simulation from the MotionSolve Run Manager

  1. From the Start menu, select All Programs >HyperWorks<version> 64-bit > MotionSolve to open the HyperWorks Solver Run Manager.
    Locate the model you just exported by clicking on the file open icon.


    Figure 11. Select the exported model from disk
  2. Click the ellipsis button next to the Options field to open the Available Options dialog.


    Figure 12. Selecting the co-simulation flag
  3. Activate the –as_cosim option. When this flag is enabled, it tells the Run Manager to do the following:
    1. Invoke the MotionSolve executable and run the model that is specified.
    2. Invoke the middleware “acuMSI”, which enables communication between MotionSolve and AcuSolve.

    When you activate this option, the following dialog is displayed and you are prompted for additional options:



    Figure 13. Specifying options for the co-simulation
    You may specify the following options here:
    acuMSI Options
    -aport <integer>

    Specifies the communication port number for communication between AcuSolve and acuMSI. The default is 48000.

    Note If you need to change the default port for communication between AcuSolve and acuMSI, in addition to changing this argument, you also have to specify the changed port number in the AcuSolve input file.

    -mport <integer>

    Specifies the communication port number for communication between MotionSolve and acuMSI. The default is 94043.

    Note: If you need to change the default port for communication between MotionSolve and acuMSI, in addition to changing this argument, you also have to specify the changed port number in an environment variable MS_AS_PORT. MotionSolve checks for this environment variable at the start of the simulation and changes its listening port accordingly.
    -mi <integer>
    Specifies the maximum number of iterations per time step between the two solvers. The default is 0.
    -v <integer>
    Specifies the verbosity level of the output file from acuMSI. The default is set to 0 (verbosity OFF).
  4. If you retain the default options, click None.
  5. Click Apply Options and click Close.


    Figure 14. Specifying the co-simulation flag
  6. You are now setup to start the co-simulation on the MotionSolve side. Click Run.


    Figure 15. Run the MotionSolve model

    This launches MotionSolve as well as the acuMSI executable. The MotionSolve run is paused at the first time step – it is now in waiting mode and the co-simulation will start as soon as AcuSolve is run.



    Figure 16. The MotionSolve simulation is waiting for a connection to AcuSolve

Run the AcuSolve Executable for Co-simulation

  1. To run the co-simulation model in AcuSolve, first copy the model file Check_Valve_Coupled.acs from <installation_directory>\tutorials\mv_hv_hg\mbd_modeling\motionsolve\cosimulation to your working directory.
  2. From the Start menu, select All Programs >HyperWorks <version> (64-bit) > AcuSolve > AcuSolve Job Launcher. In the window that is displayed, change the field Problem name as specified by the AcuSolve .inp file. Make sure your Problem directory is set to your current working directory.


    Figure 17. Launching AcuSolve for the co-simulation

    For this model, the default values are used. AcuSolve runs using a single processor, and AcuConsole generates the input files and launches AcuSolve.

  3. Press Launch to launch the solution process.
    As the solution starts, an AcuTail window opens. After executing AcuPrep, AcuSolve stops at the acuRun path step. It’s waiting for the execution of the process.MotionSolve
    Soon, AcuSolve and MotionSolve should begin to communicate with one another. You should be able to see relevant time stepping information in both solver windows. For example, you should see something like the following in the MotionSolve window at the beginning of the co-simulation:
    INFO: [AS-COSIM] Connected to AcuMsi on port 94043
    
    INFO: [AS-COSIM] License checked out.
    
    …
    
    Time=2.000E-06; Order=1; H=2.000E-06 [Max Phi=1.314E-16]
    Time=3.600E-02; Order=2; H=2.000E-03 [Max Phi=1.653E-08]
    …

    The co-simulation should take roughly 15 minutes to complete on a laptop (Intel i7. 2.8GHz).

    Note that there is no order dependency on launching the co-simulation – either MotionSolve or v can be launched first.

Post-process the Results from the Co-simulation

HyperView and HyperGraph can be used to post process the co-simulation results within the HyperWorks Desktop environment.

To launch HyperView (HyperGraph), from the Start menu, select All Programs >HyperWorks <version number> HyperView (HyperGraph).

The animation H3D generated by the MotionSolve part of the co-simulation contains only the results from MotionSolve. Similarly, the result files from AcuSolve only contain the results for the AcuSolve model. To animate the results from the co-simulation, follow these steps:

  1. Load the animation H3D generated by MotionSolve in HyperView.
    1. Go to the Load Model panel.
    2. Click the file open button, , next to Load model and navigate to the results directory (the same directory where the .xml file is located).
    3. Select the .h3d file and click Open.
    4. Click Apply.


      Figure 18. Loading MotionSolve H3D in HyperView
  2. HyperView loads the MotionSolve results file into the graphical window at the first time step. From this point, you can animate the transient results using Start/Stop on the Animation Slider.
  3. To load the AcuSolve results, they must first be converted to the .h3d format. This can be accomplished by using the AcuSolve utility, AcuTrans. AcuTrans is available from the Start menu. Select All Programs >HyperWorks <version> (64-bit) > AcuSolve > AcuSolve Cmd Prompt.
  4. Navigate to the results directory and execute the following command to convert the AcuSolve database into the .h3d format:
    acuTrans -out -to h3d -h3dopt single -ts A

    This creates a single .h3d file containing all of the time steps available for the simulation.

  5. Using AcuTrans, overlay the newly-created H3D over the MotionSolve result H3D in HyperView. This is accomplished by repeating Step 1 described above and activating Overlay when selecting the AcuSolve result H3D.


    Figure 19. Overlaying AcuSolve H3D over the MotionSolve H3D in HyperView

    Once loaded, the graphical window contains both results and can be animated as before. To visualize the information contained within the AcuSolve results, a Contour plot may be used. Click on the Contour button to display the panel.

  6. Set the options as shown in the figure below and click Apply.


    Figure 20. Overlaying AcuSolve H3D over the MotionSolve H3D in HyperView

    This creates a contour plot of the velocity magnitude overlaid with the results from MotionSolve in one window.



    Figure 21. Velocity magnitude plot overlaid with the MotionSolve results in HyperView

Plotting the MotionSolve Results in HyperGraph

You can also interpret the results with a two dimensional plot using HyperGraph. HyperWorks Desktop can be used in a multi-window layout, allowing both HyperView and HyperGraph to be open at the same time.

  1. First, open HyperView following the steps described in the previous section.
  2. From the toolbar, click the Page Window Layout button and split the page into two vertical pages.


    Figure 22. Splitting the page into two vertical pages

    This automatically adjusts the graphical window to accommodate two pages, defaulting to two instances of HyperView.

  3. Click anywhere in the page on the right and switch to HyperGraph by clicking the Page Selector button and selecting HyperGraph 2D from the drop-down list.
  4. Click the Build Plots button to load the .plt file from the same results directory.
    Once the .plt file is loaded into HyperGraph, the two outputs are available for plotting.
  5. Perform the following selections:
    1. Under Y Type, select Displacement.
    2. Under Y Request, select Displacement (on Shutter Body).
    3. Under Y Component, select X.
    4. Click Apply.
    HyperGraph can be used to create additional traces on the same plot to generate the following plots.


    Figure 23. Select the signals for plotting


    Figure 24.