# Tutorial: Six degree-of-freedom multiphase simulation

Multiphase flow simulation, as the name suggests, models two fluids of dissimilar densities and their interaction with each other in the flow domain. This is done through a phase-fraction variable φ that takes a value of 0 for one fluid and 1 for the other. In many application, one is interested in the effect of the flow patterns on the cartesian and polar displament of the body. The 6DOF solid body motion on the SimScale platform provides this functionality to the user, allowing for simulation of many important cases in the industry and in science.

Here, we present a step-by-step description of setting up a multiphase, 6-DOF simulation on the SimScale platform. The case in question is the simulation of a boat freely floating on an air-water interface.

Import the tutorial project into workspace

## Step-by-Step

### Create a multiphase simulation

1. To create a new simulation, switch to the Simulation Designer tab and click on New simulation. Enter a name for the simulation e.g Multi-phase-6-DOF-Sym and click OK.
2. From the analysis type choose: Fluid Dynamics section of the analysis types, then Multiphase and setup the properties as shown in the figure below and click on Save. After saving a new tree will be automatically generated in the left panel with all the parameters and settings that are necessary to completely specify such an analysis.

### Select a domain

1. Now, click on the Domain entry in the tree and select the mesh Boat-STEP-Mesh to assign it to this simulation from the options panel. Clicking on Save will automatically load the selected mesh in the viewer.
1. Information about what part of the domain needs to be initialized with water needs to be supplied through geometry primitives. In this case, we use cartesian boxes. Two boxes are created: the first specifies the flat water body, and the second is the source of the wave. In order to create the boxes, click on Create new geometry primitive and select Cartesian Box. Enter the minimum and maximum limits of x, y and z, and click Save.

### Define the Model

1. For the simulation model, we first need to specify the surface tension between the fluids, and the magnitude and direction of gravity. Click on the Model section, enter the appropriate values, and click Save.

#### Materials

6. The next step is to define the materials being used in the simulation. Select the Materials subsection, click on Add material. A new material will become available. Scroll down and click on Import from material library. This opens a dialog box where one can choose from a set of predefined materials. In our case we select Air. This corresponds to phase 0 (since it was selected first). Then click Save. We then add Water (corresponding to pahse 1). One also has the option for defining a custom material. Note that the phase to which a material corresponds (i.e., 0 or 1) can be changed using the option Associated phase. After selecting the material, click on the appropriate volume to assign the material to. Then click on Save.

#### Initial Conditions

1. Specify the initial conditions for pressure, velocity and phase-fraction. Specification of the phase fraction is done as follows:
• Click on the phase fraction option under the Initial Conditions subsection.
• Change Type to Subdomain-based. Click Save. An Add subdomain button appears at the bottom. In the Default phase fraction value, specify that phase (0 or 1), which will not occupy the subdomain regions. In our case, it is air. So we specify 0.
• Click on the Add subdomain button. Select the from geometry primitives defined previously, those which you would like to initialize with the phase value specified within Phase fraction value inside the subdomain. Since we want the subdomains to contain water, we specify 1 for the phase fraction.
• Click Save.

#### Boundary Conditions

1. Specify the boundary conditions for all faces of the geometry. For details on specifying boundary conditions for multiphase simulation, refer to  tutorial.

#### Solid Body Motion: 6 Degrees Of Freedom

1. We now take a look at how the motion of the boat in 6 degrees of freedom can be specified.
1. Click on Advanced Concepts subsection. Click on Solid Body Motions, and click the Add solid body motion button.
2. Change Type to Six degree-of-freedom motion.
3. For the details of what the parameters in this section mean, please refer to this page.
4. Under Topological Mapping, select those faces which undergo motion. In this case, we select the faces of the boat.
5. Click on Save.

### Define Numerics and Simulation Parameters

1. Specify the solution schemes, convergence tolerance and other numerical settings of the simulation in the Numerics section. These changes will help in better stability and convergence on the simulation.
1. Next, in simulation control we define some main control settings such as start and end times, time step size, auto time-stepping and number of processors for this simulation run.

### Start a New Run

Once the simulation definition is complete, we can proceed to begin a run. Click on the Simulation Runs section and click Create new run. In the dialog box, give the run a name and click Create.

The run is now ready to be started. Click on Start to begin the simulation.

### Post-processing

Once the run is complete, the progress bar turns green. For post-processing, one can either download the results to the local system, or process them online in the post-processer.