Gerris
|
Timestepping. More...
Functions | |
void | gfs_reset_gradients (GfsDomain *domain, guint dimension, GfsVariable **g) |
void | gfs_scale_gradients (GfsDomain *domain, guint dimension, GfsVariable **g) |
void | gfs_correct_normal_velocities (GfsDomain *domain, guint dimension, GfsVariable *p, GfsVariable **g, gdouble dt) |
void | gfs_velocity_face_sources (GfsDomain *domain, GfsVariable **u, gdouble dt, GfsFunction *alpha, GfsVariable **g) |
void | gfs_update_gradients (GfsDomain *domain, GfsVariable *p, GfsFunction *alpha, GfsVariable **g) |
void | gfs_mac_projection (GfsDomain *domain, GfsMultilevelParams *par, gdouble dt, GfsVariable *p, GfsFunction *alpha, GfsVariable **g, void(*divergence_hook)(GfsDomain *domain, gdouble dt, GfsVariable *div)) |
void | gfs_correct_centered_velocities (GfsDomain *domain, guint dimension, GfsVariable **g, gdouble dt) |
void | gfs_approximate_projection (GfsDomain *domain, GfsMultilevelParams *par, gdouble dt, GfsVariable *p, GfsFunction *alpha, GfsVariable *res, GfsVariable **g, void(*divergence_hook)(GfsDomain *domain, gdouble dt, GfsVariable *div)) |
void | gfs_predicted_face_velocities (GfsDomain *domain, guint d, GfsAdvectionParams *par) |
void | gfs_diffusion (GfsDomain *domain, GfsMultilevelParams *par, GfsVariable *v, GfsVariable *rhs, GfsVariable *rhoc, GfsVariable *metric) |
void | gfs_add_sinking_velocity (GfsDomain *domain, GfsAdvectionParams *par) |
void | gfs_remove_sinking_velocity (GfsDomain *domain, GfsAdvectionParams *par) |
void | gfs_centered_velocity_advection_diffusion (GfsDomain *domain, guint dimension, GfsAdvectionParams *par, GfsVariable **gmac, GfsVariable **g, GfsFunction *alpha) |
void | gfs_tracer_advection_diffusion (GfsDomain *domain, GfsAdvectionParams *par, GfsFunction *alpha) |
Timestepping.
void gfs_add_sinking_velocity | ( | GfsDomain * | domain, |
GfsAdvectionParams * | par | ||
) |
domain | a #GfsDomain. |
par | the advection parameters. |
Adds the sinking velocity to the MAC velocity field of domain.
void gfs_approximate_projection | ( | GfsDomain * | domain, |
GfsMultilevelParams * | par, | ||
gdouble | dt, | ||
GfsVariable * | p, | ||
GfsFunction * | alpha, | ||
GfsVariable * | res, | ||
GfsVariable ** | g, | ||
void(*)(GfsDomain *domain, gdouble dt, GfsVariable *div) | divergence_hook | ||
) |
domain | a #GfsDomain. |
par | the projection control parameters. |
dt | the timestep. |
p | the pressure. |
alpha | the Poisson equation gradient weight. |
res | the residual or NULL. |
g | where to store the pressure gradient. |
divergence_hook | a hook function or NULL. |
Corrects the centered velocity field on the leaf level of domain using an approximate projection. The resulting centered velocity field is approximately divergence free. The (potential) pressure field is also obtained as a by-product.
The residual field of the par projection parameters is set to the norm of the residual (on the MAC grid) after the projection. The niter field of the par projection parameters is set to the number of iterations performed to solve the Poisson equation. The other projection parameters are not modified.
The Poisson equation for the pressure is first solved on a MAC grid where the MAC velocities are obtained from the centered velocities by simple averaging. The resulting pressure gradients (defined on the faces) are then averaged down on the center of the cells to correct the centered velocity.
void gfs_centered_velocity_advection_diffusion | ( | GfsDomain * | domain, |
guint | dimension, | ||
GfsAdvectionParams * | par, | ||
GfsVariable ** | gmac, | ||
GfsVariable ** | g, | ||
GfsFunction * | alpha | ||
) |
domain | a #GfsDomain. |
dimension | the number of dimensions (2 or 3). |
par | the advection parameters. |
gmac | the MAC pressure gradient. |
g | the pressure gradient. |
alpha | the inverse of density or NULL. |
Advects the (centered) velocity field using the current face-centered (MAC) velocity field and par->flux to compute the velocity flux through the faces of each cell.
For each component of the velocity, before calling the par->flux function the face values are first defined (at time t + dt/2) and can then be used within the par->flux function.
"Small" cut cells are treated using a cell-merging approach to avoid any restrictive CFL stability condition.
void gfs_correct_centered_velocities | ( | GfsDomain * | domain, |
guint | dimension, | ||
GfsVariable ** | g, | ||
gdouble | dt | ||
) |
domain | a #GfsDomain. |
dimension | the number of dimensions (2 or 3). |
g | the pressure gradient. |
dt | the timestep. |
Corrects the velocity field of domain using the pressure gradient stored in g[].
The g[] variables are freed by this function.
void gfs_correct_normal_velocities | ( | GfsDomain * | domain, |
guint | dimension, | ||
GfsVariable * | p, | ||
GfsVariable ** | g, | ||
gdouble | dt | ||
) |
domain | a #GfsDomain. |
dimension | the number of dimensions (2 or 3). |
p | the pressure field. |
g | where to store the pressure gradient or NULL. |
dt | the timestep. |
Corrects the normal velocity field of domain using p and and dt.
Assumes that the Poisson weighting coefficients have already been computed using gfs_poisson_coefficients().
Also fills the g variables (if not NULL) with the centered gradient of p.
void gfs_diffusion | ( | GfsDomain * | domain, |
GfsMultilevelParams * | par, | ||
GfsVariable * | v, | ||
GfsVariable * | rhs, | ||
GfsVariable * | rhoc, | ||
GfsVariable * | metric | ||
) |
domain | a #GfsDomain. |
par | the multilevel parameters. |
v | a #GfsVariable. |
rhs | the right-hand side. |
rhoc | the mass. |
metric | the metric term. |
Solves a diffusion equation for variable v using a Crank-Nicholson scheme with multilevel relaxations.
Diffusion coefficients must have been set using gfs_diffusion_coefficients() and a right-hand side defined using gfs_diffusion_rhs().
void gfs_mac_projection | ( | GfsDomain * | domain, |
GfsMultilevelParams * | par, | ||
gdouble | dt, | ||
GfsVariable * | p, | ||
GfsFunction * | alpha, | ||
GfsVariable ** | g, | ||
void(*)(GfsDomain *domain, gdouble dt, GfsVariable *div) | divergence_hook | ||
) |
domain | a #GfsDomain. |
par | the projection control parameters. |
dt | the timestep. |
p | the pressure. |
alpha | the Poisson equation gradient weight. |
g | where to store the pressure gradient. |
divergence_hook | a hook function or NULL. |
Corrects the face-centered velocity field (MAC field) on the leaf level of domain using an exact (MAC) projection. The resulting face-centered velocity field is (almost) exactly divergence free. The (potential) pressure field is also obtained as a by-product as well as its gradient at the center of the leaf cells of the domain. The gradient is stored in newly-allocated g[] variables and is obtained by simple averaging from the face values to the center. The newly-allocated g[] variables should be freed when not needed anymore.
The residual field of the par projection parameters is set to the norm of the residual after the projection. The niter field of the par projection parameters is set to the number of iterations performed to solve the Poisson equation. The other projection parameters are not modified.
void gfs_predicted_face_velocities | ( | GfsDomain * | domain, |
guint | d, | ||
GfsAdvectionParams * | par | ||
) |
domain | a #GfsDomain. |
d | the number of dimensions (2 or 3). |
par | the advection parameters. |
Fills the face (MAC) normal velocities of each leaf cell of domain with the predicted values at time t + dt/2 using a godunov type advection scheme.
void gfs_remove_sinking_velocity | ( | GfsDomain * | domain, |
GfsAdvectionParams * | par | ||
) |
domain | a #GfsDomain. |
par | the advection parameters. |
Removes the sinking velocity from the MAC velocity field of domain.
void gfs_reset_gradients | ( | GfsDomain * | domain, |
guint | dimension, | ||
GfsVariable ** | g | ||
) |
domain | a #GfsDomain. |
g | an array of dimension #GfsVariables. |
dimension | the number of dimension. |
Resets the gradient vector g.
void gfs_scale_gradients | ( | GfsDomain * | domain, |
guint | dimension, | ||
GfsVariable ** | g | ||
) |
domain | a #GfsDomain. |
dimension | the number of dimensions. |
g | the components of the gradient. |
Scales the gradient accumulated in g (typically using gfs_correct_normal_velocities()).
void gfs_tracer_advection_diffusion | ( | GfsDomain * | domain, |
GfsAdvectionParams * | par, | ||
GfsFunction * | alpha | ||
) |
domain | a #GfsDomain. |
par | the advection parameters. |
alpha | the specific volume or NULL. |
Advects the v field of par using the current face-centered (MAC) velocity field.
void gfs_update_gradients | ( | GfsDomain * | domain, |
GfsVariable * | p, | ||
GfsFunction * | alpha, | ||
GfsVariable ** | g | ||
) |
domain | a #GfsDomain. |
p | the pressure. |
alpha | the Poisson equation gradient weight. |
g | where to store the pressure gradient. |
Updates the gradients in g using p and alpha.
void gfs_velocity_face_sources | ( | GfsDomain * | domain, |
GfsVariable ** | u, | ||
gdouble | dt, | ||
GfsFunction * | alpha, | ||
GfsVariable ** | g | ||
) |
domain | a #GfsDomain. |
u | the velocity vector. |
dt | the timestep. |
alpha | the specific volume. |
g | the gradient vector. |
Add source terms on the velocity component of each cell faces.