Presets/cfd.xml

From AQUAgpusph
Jump to: navigation, search

Introduction

cfd.xml is the main preset to be loaded in order to perform Fluid Dynamics simulations.

Governing equations

The following governing equations are approximately solved with this preset (called conservation of mass equation, momentum equation, and equation of state):

where and are the density and the velocity respectively, is an external volumetric force field, is the pressure, and is the stress tensor for a Newtonian fluid:

with and the viscous coefficients and the rate of strain tensor:

As it has been stated in the 3rd governing equation (formerly Equation Of State, or EOS), we need to stablish a relation between the density and the pressure:

where is the sound speed (at least 10 times the maximum speed expected during the simulation), the density of reference of the fluid, and an incompressibility factor (1 is recommended, but it can be increased to get better incompressibility properties).

Numerical modelling

Conservation of mass equation

As usual in SPH the fluid domain is discretized in a set of particles, such that the aproximate solution of the conservation of mass equation can be written as:

where and are particle indexes, and their positions, the mass of the particle , and the outward normal and the surface of the boundary element , and a renormalization factor:

Optionally a diffusive term can be added to improve the stability (formulation known as -SPH).

Momentum equation

The momentum equation aproximation can be separated in 2 differential operators aproximation:

such that:

where the constant for 1D, 2D and 3D respectively.

Time integration

A pseudo second-order time integration scheme is used in AQUAgpusph, composed by a predictor and a corrector stage.

The predictor, executed at the start of the time step, can be written as follows:

Regarding the corrector stage, computed after the derivatives evaluation described before, can be written as:

Both, predictor and corrector are just applied to the fluid particles.

Usage

To use it just use the following include tag:

<Include file="/usr/share/aquagpusph/resources/Presets/cfd.xml" />

Where /usr/share/aquagpusph/ should be conveniently modified. For backward compatibility you can include /usr/share/aquagpusph/resources/OpenCLMain.xml instead, which is just redirecting to cfd.xml.

Remember that this preset should be the first included.

Variables defined

When this preset is loaded some variables are generated (on top of the default variables of AQUAgpusph):

NAME TYPE LENGTH DESCRIPTION
g vec 1 Gravity acceleration, . Null by default
cs float 1 Sound speed
rho_min float 1 A minimum value for the density. 0 by default
rho_max float 1 A maximum value for the density. by default
r_min vec 1 Minimum position of the particles. It is an automatically computed value, and therefore setting it is useless
r_max vec 1 Maximum position of the particles. It is an automatically computed value, and therefore setting it is useless
gamma float* n_sets Incompressibility factor of the EOS,
refd float* n_sets Density of reference,
visc_dyn float* n_sets Dynamic viscosity,
delta float* n_sets -SPH factor
imove unsigned int* N Moving flag: 1 for Fluid particles, 0 for Sensors, -1 for Fixed particles, -2 for Elastic bounce particles, -3 for Boundary integral elements
normal vec* N Normal of the particles, , only relevant for non fluid particles
u vec* N Velocity of the particles,
dudt vec* N Acceleration of the particles,
rho float* N Density of the particles,
drhodt float* N Density variation rate of the particles,
m float* N Mass of the particles (area for the boundary integral elements),
p float* N Pressure of the particles,
id_in unsigned int* N Backup of id for the predictor-corrector
iset_in unsigned int* N Backup of iset for the predictor-corrector
imove_in int* N Backup of imove for the predictor-corrector
r_in vec* N Backup of r for the predictor-corrector
normal_in vec* N Backup of normal for the predictor-corrector
u_in vec* N Backup of u for the predictor-corrector
dudt_in vec* N Backup of dudt for the predictor-corrector
rho_in float* N Backup of rho for the predictor-corrector
drhodt_in float* N Backup of drhodt for the predictor-corrector
m_in float* N Backup of m for the predictor-corrector
p_in float* N Backup of p for the predictor-corrector
grad_p vec* N Resulting
lap_u vec* N Resulting
div_u float* N Resulting
lap_p float* N Resulting

Definitions

The following definitions are made (see Definitions to learn more about this):

NAME VALUE DESCRIPTION
DIMS dims, i.e. 2 for the 2D version, 3 for the 3D version Number of dimensions
H h Kernel length
CONW 1/h^dims Constant multiplier for the kernel evaluation
CONW 1/h^(dims+2) Constant multiplier for the kernel gradient evaluation.
SUPPORT 2.f Kernel support, i.e. the number of times h needed to vanish it.

Tools

The following tools are set to be executed each time step (see Tools to learn more about this):

NAME TYPE DESCRIPTION
Predictor kernel Integration scheme predictor stage.
Link-List link-list Link list computation. It is giving information to sort the particles by the cell index.
Backup id copy Save id into id_in before sorting it.
Backup iset copy Save iset into iset_in before sorting it.
Backup imove copy Save imove into imove_in before sorting it.
Backup normal copy Save normal into normal_in before sorting it.
Backup m copy Save m into m_in before sorting it.
Sort kernel All the data fields are sorted using the data from the link list.
Backup dudt copy Save dudt into dudt_in for the Corrector stage, before computing the new interactions.
Backup drhodt copy Save drhodt into drhodt_in for the Corrector stage, before computing the new interactions.
Reinit grad_p set Set .
Reinit lap_p set Set .
Reinit div_u set Set .
Reinit lap_u set Set .
Reinit shepard set Set .
Interactions kernel Performs the interactions between fluid particles. It is also performing some interpolation tasks in the sensors and boundary elements.
NonFluidSet kernel Set the values of pressure and density in the boundary elements.
BoundaryIntegrals kernel Compute the effect of the boundary elements on the fluid particles.
Rates kernel Set the variation rates and from the computed , , , and .
ElasticBounce kernel Avoid the walls trespassing applying an elastic bounce.
Corrector kernel Integration scheme corrector stage.
FixedTimeStep set_scalar Set the time step as , with as the courant number.
t = t + dt set_scalar Increment by the time variable t.
iter += 1 set_scalar Increment by the iteration variable iter.

Reports

This preset is not adding new reports (see Reports).