Basilisk CFD
Adaptive Cartesian mesh PDE framework
Loading...
Searching...
No Matches
predictor-corrector.h File Reference
#include "utils.h"
Include dependency graph for predictor-corrector.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

static trace void advance_generic (scalar *output, scalar *input, scalar *updates, double dt)
 
void event_defaults (void)
 Event: defaults (i = 0)
 
trace void run ()
 

Variables

scalarevolving
 The generic time-integration scheme in predictor-corrector.h needs to know which fields are updated i.e.
 
double(* update )(scalar *evolving, scalar *updates, double dtmax) = NULL
 
double(* gradient )(double, double, double) = minmod2
 
double dt = 0.
 These come from the multilayer solver.
 
static void(* advance )(scalar *output, scalar *input, scalar *updates, double dt) = advance_generic
 

Function Documentation

◆ advance_generic()

static trace void advance_generic ( scalar output,
scalar input,
scalar updates,
double  dt 
)
static

Definition at line 21 of file predictor-corrector.h.

References _i, dt, i, input(), o, trash(), u, and x.

Here is the call graph for this function:

◆ event_defaults()

void event_defaults ( void  )

Event: defaults (i = 0)

Boundary conditions for VOF-advected tracers usually depend on boundary conditions for the VOF field.

Event: defaults (i = 0)

Event: defaults (i = 0)

Initialisation

We set the default values.

Electrohydrodynamic stresses

The EHD force density, \(\mathbf{f}_e\), can be computed as the divergence of the Maxwell stress tensor \(\mathbf{M}\),

\[ M_{ij} = \varepsilon (E_i E_j - \frac{E^2}{2}\delta_{ij}) \]

where \(E_i\) is the \(i\)-component of the electric field, \(\mathbf{E}=-\nabla \phi\) and \(\delta_{ij}\) is the Kronecker delta.

We need to add the corresponding acceleration to the Navier–Stokes solver.

If the acceleration vector a (defined by the Navier–Stokes solver) is constant, we make it variable.

Event: defaults (i = 0)

Event: defaults (i = 0 )

Defaults

On trees we need to ensure conservation of the tracer when refining/coarsening.

Event: defaults (i = 0)

it is an acceleration. If necessary, we allocate a new vector field to store it.

Event: defaults (i = 0)

Event: defaults (i = 0)

\[ \begin{aligned} 0 & = - \sum_k \nabla \cdot [\theta_H (hu)_k^{n + 1} + (1 - \theta_H) (hu)^n_k] \\ \frac{(hu)^{n + 1}_k - (hu)_k^n}{\Delta t} & = - \Delta tgh^{n + 1 / 2}_k (\theta_H \nabla \eta_r^{n + 1} + (1 - \theta_H) \nabla \eta_r^n) \end{aligned} \]

where \(\eta_r\) is the equivalent free-surface height (i.e. pressure) applied on the rigid lid.

Event: defaults (i = 0)

Setup

The \(w_k\) and \(\phi_k\) scalar fields are allocated and the \(w_k\) are added to the list of advected tracers.

Event: defaults (i = 0)

Initial conditions

Event: defaults (i = 0)

Event: defaults (i = 0)

The default convention in Basilisk is no-flow through the boundaries of the domain, i.e. they are a streamline i.e. \(\psi=\)constant on the boundary. We set the default value for the CFL (the default in utils.h is 0.5). This is done once at the beginning of the simulation.

Event: defaults (i = 0)

Event: defaults (i = 0)

We will need to add the acceleration term \(w^2/y\) in the evolution equation for \(u_y\). If the acceleration field is not allocated yet, we do so.

Event: defaults (i = 0)

The default density field is set to unity (times the metric).

We reset the multigrid parameters to their default values.

If the viscosity is non-zero, we need to allocate the face-centered viscosity field.

We also initialize the list of tracers to be advected with the VOF function \(f\) (or its complementary function).

We set limiting.

On trees, we ensure that limiting is also applied to prolongation and refinement.

We add the interface and the density to the default display.

We switch to a pure minmod limiter by default for increased robustness.

With the MUSCL scheme we use the CFL depends on the dimension of the problem.

On trees we need to replace the default bilinear refinement/prolongation with linear so that reconstructed values also use slope limiting.

The restriction/refine attributes of the charge density are those of a tracer otherwise the conservation is not guaranteed.

By default the permittivity is unity and other quantities are zero.

The (velocity) CFL is limited by the unsplit advection scheme, so is dependent on the dimension. The (gravity wave) CFL is set to 1/2 (if not already set by the user).

The gradient and prolongation/restriction functions are set for all tracer fields.

We setup the default display.

Boundary conditions

By default we set a zero Neumann boundary condition for all the components except if the bottom is an axis of symmetry.

We use (strict) minmod slope limiting for all components.

We reset the multigrid parameters to their default values.

The pressures are never dumped.

The default density field is set to unity (times the metric and the solid factors).

On trees, refinement of the face-centered velocity field needs to preserve the divergence-free condition.

When using embedded boundaries, the restriction and prolongation operators need to take the boundary into account.

We set the dimensions of the velocity field.

On trees, the refinement and restriction functions above rely on the volume fraction field f being refined/restricted before the components of velocity. To ensure this, we move f to the front of the field list (all).

We then set the refinement and restriction functions for the components of the velocity field. The boundary conditions on \(\mathbf{u}\) now depend on those on \(f\).

The default display.

Definition at line 37 of file predictor-corrector.h.

References display(), gradient, s, and x.

Here is the call graph for this function:

◆ run()

trace void run ( void  )

Definition at line 47 of file predictor-corrector.h.

References advance, dt, DT, dtnext(), events, evolving, free(), free_grid, gradient, inext, init_grid, iter, list_clone(), N, perf, t, timer_print(), timer_start(), tnext, update, update_perf(), x, and zero().

Here is the call graph for this function:

Variable Documentation

◆ advance

void(* advance) (scalar *output, scalar *input, scalar *updates, double dt) ( scalar output,
scalar input,
scalar updates,
double  dt 
) = advance_generic
static

Definition at line 33 of file predictor-corrector.h.

Referenced by event_defaults(), run(), and run().

◆ dt

double dt = 0.

These come from the multilayer solver.

Ohmic conduction

This function approximates implicitly the EHD equation set given by the electric Poisson equation and the ohmic conduction term of the charge density conservation (the advection term is computed elsewhere using a tracer advection scheme),

\[ \nabla \cdot( \epsilon \nabla \phi^{n+1}) = -\rho_e^{n+1} \quad \mathrm{and} \quad (\rho_e^{n+1}-\rho_e^n) = \Delta t\nabla \cdot (K\nabla \phi^{n+1}) \]

where \(\rho_e\) is the charge density, and \(\phi\) is the electric potential. \(K\) and \(\epsilon\) are the conductivity and permittivity respectively.

Substituting the Poisson equation into the conservation equation gives the following time-implicit scheme,

\[ \nabla \cdot [(K \, \Delta t + \epsilon) \nabla \phi^{n+1}] = -\rho_e^{n} \]

We need the Poisson solver and the timestep dt.

Definition at line 18 of file predictor-corrector.h.

Referenced by advance_generic(), and run().

◆ evolving

scalar* evolving
extern

The generic time-integration scheme in predictor-corrector.h needs to know which fields are updated i.e.

Time-integration

Setup

Time integration will be done with a generic predictor-corrector scheme. all the scalars + the components of all the vector fields. It also needs a function to compute the time-derivatives of the evolving variables.

The generic time-integration scheme in predictor-corrector.h needs to know which fields are updated i.e.

Time-integration

Setup

Time integration will be done with a generic predictor-corrector scheme. The list will be constructed in the defaults* event below.

Definition at line 55 of file conservation.h.

Referenced by event_cleanup(), event_defaults(), run(), update_saint_venant(), and vertical_fluxes().

◆ gradient

double(* gradient) (double, double, double) ( double  ,
double  ,
double   
) = minmod2

Definition at line 15 of file predictor-corrector.h.

Referenced by event_defaults(), and run().

◆ update

double(* update) (scalar *evolving, scalar *updates, double dtmax) ( scalar evolving,
scalar updates,
double  dtmax 
) = NULL

Definition at line 11 of file predictor-corrector.h.

Referenced by event_defaults(), run(), run(), and runge_kutta().