Examples/2D/souto etal 2012 standingwave

From AQUAgpusph
Jump to: navigation, search

Introduction

In this examples we are reproducing the simulation of the standing wave carried out by Souto et all (2012) [1].

The standing wave is defined on top of an infinite periodic fluid domain composed by rectangular subdomains of dimensions , with . In such domain a wave with length (i.e. the wave number is ) and amplitude is imposed. Denoting the ratio by the following velocity potential can be considered:

valid for small values of . In previous equations is the angular frequency given by the dispersion relation of gravity waves: , and corresponds to the flat free surface (In Fig. 13 of Souto et all (2012)[1] it is wrong described)

Therefore the velocity field can be computed as . It should be noticed that for a flat free surface is obtained.

With such velocity potential, for a viscous fluid, it is possible to get an analytical solution for the kinetic energy decay[2]:

where the kinematic viscosity can be computed from the Reynolds number:

In our simulation , , , and , where is the initial distance between the particles.

Setting up the simulation

In AQUAgpusph the examples are generated on top of template archives, which are read and modified by the Python Script Create.py, such that they can be ran from an arbitrary folder, and modified just touching such Create.py script.

You can run the prebuilt version of the example right after compiling AQUAgpusph:

cd examples/2D/souto_etal_2012_standingwave
./run.sh --run

Also you can plot the result in real time opening a new terminal (in the same place) and typing:

./run.sh --plot e

Souto etal 2012 standingwave-Ekin.png

Resulting kinetic energy compared with the analytically computed.

However we are interested into setup the case from scratch, assuming that we are running it in the same folder we are creating the input files.

Presets

We are using a number of AQUAgpusph presets:

  • cfd.xml: Should preset should be the first included for fluid dynamics problems.
  • domain.xml: Even though in this problem it is not expected to get particles running away from the domain, it is strongly recommended to ever set a computational domain.
  • energy.xml and energy.report.xml: In this problem the main result is the kinetic energy evolution along the time, so we ask to compute and print it to a file.
  • timing.report.xml and performance.report.xml: Useful to profile the execution.
  • symmetry.xml: To can impose symmetric boundary conditions.

To load all these presets (except symmetry.xml one, which we are managing later) we can create a file called Presets.xml, with the following content:

<?xml version="1.0" ?>
<sphInput>
    <Include file="/usr/share/aquagpusph/resources/Presets/cfd.xml" />
    <Include file="/usr/share/aquagpusph/resources/Presets/domain.xml" />
    <Include file="/usr/share/aquagpusph/resources/Presets/energy.xml" />
    <Include file="/usr/share/aquagpusph/resources/Presets/timing.report.xml" />
    <Include file="/usr/share/aquagpusph/resources/Presets/performance.report.xml" />
    <Include file="/usr/share/aquagpusph/resources/Presets/energy.report.xml" />
</sphInput>

Replacing /usr/share/aquagpusph by the AQUAgpusph folder.

Settings

System settings

In order to specify the general settings, we can create another XML file named Settings.xml:

<?xml version="1.0" ?>
<sphInput>
    <Settings>
        <Verbose level="2" />
        <Device platform="0" device="0" type="GPU" />
    </Settings>
</sphInput>

Where the Device tag should be conveniently modified depending on the hardware available on the system.

Simulation output/stop criteria

In order to set the simulation stop criteria, as well as the output rates, we can generate a XML file named Time.xml, with the following content:

<?xml version="1.0" ?>
<sphInput>
    <Timing>
        <Option name="End" type="Time" value="8" />
        <Option name="LogFile" type="FPS" value="120" />
        <Option name="Output" type="FPS" value="30" />
    </Timing>
</sphInput>

Where a 8 seconds of simulation has been asked, updating the log data 120 times per second of simulation, and writing 30 full frames per second. You can learn more about the simulation timing control here.

Physical properties and numerical settings

In AQUAgpusph the physical properties are divided in two different blocks: The global properties, and the properties per particles set (Such that 2 different fluid species should be added as different particles set).

The global properties are Scalar variables, while the properties per particles set are Array variables of length n_sets.

Fluid physical properties

We should provide the following variables per particles set (see the variables defined in cfd.xml):

  1. gamma
  2. refd
  3. visc_dyn
  4. delta

It should be mentioned that, in AQUAgpusph, the artificial viscosity factor cannot be directly provided, resulting from the visc_dyn and refd values set.

In this case we have a single particles set, corresponding to the unique fluid we are considering, and therefore we can create the following Fluids.xml file:

<?xml version="1.0" ?>
<sphInput>
    <ParticlesSet n="20200">
        <Scalar name="gamma" value="1.0" />
        <Scalar name="refd" value="1.0" />
        <Scalar name="visc_dyn" value="0.004" />
        <Scalar name="delta" value="0.0" />
 
        <Load format="ASCII" file="Fluid.dat" fields="r, normal, u, dudt, rho, drhodt, m, imove" />
        <Save format="VTK" file="output" fields="r, normal, u, dudt, rho, drhodt, m, p, imove" />
    </ParticlesSet>
</sphInput>

In such file we are setting the required physical properties, as well as the file where the initial condition will be stored (Fluid.dat). It should be noticed that the number of particles should be provided within the tag ParticlesSet.

Global physical properties and numerical settings

In order to set the global physical properties, and the SPH numerical settings, we can create a new file, SPH.xml:

<?xml version="1.0" ?>
<sphInput>
    <Variables>
        <Variable name="g" type="vec" value="0.0, -1" />
        <Variable name="cs" type="float" value="50.0" />
        <Variable name="courant" type="float" value="0.2" />
        <Variable name="dr" type="float" value="0.01" />
        <Variable name="hfac" type="float" value="4.0" />
        <Variable name="h" type="float" value="hfac * dr" />
        <!-- Computational domain (domain.xml preset) -->
        <Variable name="domain_min" type="vec" value="-0.4, -0.21" />
        <Variable name="domain_max" type="vec" value="2.4, 1.26" />
        <!-- Initial values of the kinetic and potential energy (energy.xml preset) -->
        <Variable name="energy_Ekin" type="float" value="0.00125" />
        <Variable name="energy_Epot" type="float" value="1.0" />
    </Variables>
</sphInput>

Note that we are also setting some variables related with the domain.xml and energy.xml presets.

Boundary conditions and Initial condition

Main simulation XML file

Finally we should join all the already generated XML files in a global XML file called Main.xml, with the following content:

<?xml version="1.0" ?>
<sphInput>
    <Include file="Presets.xml" />
    <Include file="Settings.xml" />
    <Include file="Time.xml" />
    <Include file="Symmetries.xml" />
    <Include file="SPH.xml" />
    <Include file="Fluids.xml" />
</sphInput>

Running the simulation

Post-processing

References

  1. 1.0 1.1 Antonio Souto-Iglesias, Fabricio Macià, Leo M. González, Jose L. Cercos-Pita. On the consistency of MPS. Computer Physics Communications, 2012
  2. J. Lighthill. Waves in Fluids. Cambridge University Press, 2001