Gerris
Functions

poisson.c File Reference

Poisson and diffusion solvers. More...

Functions

void gfs_multilevel_params_write (GfsMultilevelParams *par, FILE *fp)
void gfs_multilevel_params_stats_write (GfsMultilevelParams *par, FILE *fp)
GfsLinearProblem * gfs_linear_problem_new (GfsDomain *domain)
void gfs_linear_problem_add_stencil (GfsLinearProblem *lp, GfsStencil *stencil)
void gfs_linear_problem_destroy (GfsLinearProblem *lp)
GfsLinearProblem * gfs_get_poisson_problem (GfsDomain *domain, GfsVariable *rhs, GfsVariable *lhs, GfsVariable *dia, gint maxlevel, GfsVariable *v)
void gfs_relax (GfsDomain *domain, guint d, gint max_depth, gdouble omega, GfsVariable *u, GfsVariable *rhs, GfsVariable *dia)
void gfs_residual (GfsDomain *domain, guint d, FttTraverseFlags flags, gint max_depth, GfsVariable *u, GfsVariable *rhs, GfsVariable *dia, GfsVariable *res)
void gfs_poisson_coefficients (GfsDomain *domain, GfsFunction *alpha, gboolean positive, gboolean centered, gboolean reset)
void gfs_source_tension_coefficients (GfsSourceTension *s, GfsDomain *domain, GfsFunction *alpha)
void gfs_poisson_cycle (GfsDomain *domain, GfsMultilevelParams *p, GfsVariable *u, GfsVariable *rhs, GfsVariable *dia, GfsVariable *res)
gdouble gfs_poisson_compatibility (GfsDomain *domain, GfsVariable *lhs, GfsVariable *rhs, gdouble dt)
void gfs_poisson_solve (GfsDomain *domain, GfsMultilevelParams *par, GfsVariable *lhs, GfsVariable *rhs, GfsVariable *res, GfsVariable *dia, gdouble dt)
void gfs_diffusion_coefficients (GfsDomain *domain, GfsSourceDiffusion *d, gdouble dt, GfsVariable *rhoc, GfsVariable *metric, GfsFunction *alpha, gdouble beta)
void gfs_diffusion_rhs (GfsDomain *domain, GfsVariable *v, GfsVariable *rhs, GfsVariable *rhoc, GfsVariable *metric, gdouble beta)
void gfs_diffusion_residual (GfsDomain *domain, GfsVariable *u, GfsVariable *rhs, GfsVariable *rhoc, GfsVariable *metric, GfsVariable *res)
void gfs_diffusion_cycle (GfsDomain *domain, guint levelmin, guint depth, guint nrelax, GfsVariable *u, GfsVariable *rhs, GfsVariable *rhoc, GfsVariable *metric, GfsVariable *res)
GfsLinearProblem * gfs_get_diffusion_problem (GfsDomain *domain, GfsVariable *rhs, GfsVariable *lhs, GfsVariable *rhoc, GfsVariable *metric, gint maxlevel, GfsVariable *v)

Detailed Description

Poisson and diffusion solvers.


Function Documentation

void gfs_diffusion_coefficients ( GfsDomain *  domain,
GfsSourceDiffusion *  d,
gdouble  dt,
GfsVariable *  rhoc,
GfsVariable *  metric,
GfsFunction *  alpha,
gdouble  beta 
)
Parameters:
domaina #GfsDomain.
da #GfsSourceDiffusion.
dtthe time-step.
rhocwhere to store the mass.
metricwhere to store the implicit metric term (or NULL).
alphathe inverse of density or NULL.
betathe implicitness parameter (0.5 Crank-Nicholson, 1. backward Euler).

Initializes the face coefficients for the diffusion equation.

Here is the call graph for this function:

void gfs_diffusion_cycle ( GfsDomain *  domain,
guint  levelmin,
guint  depth,
guint  nrelax,
GfsVariable *  u,
GfsVariable *  rhs,
GfsVariable *  rhoc,
GfsVariable *  metric,
GfsVariable *  res 
)
Parameters:
domainthe domain on which to solve the diffusion equation.
levelminthe top level of the multigrid hierarchy.
depththe total depth of the domain.
nrelaxthe number of relaxations to apply at each level.
uthe variable to use as left-hand side.
rhsthe right-hand side.
rhocthe mass.
metricthe metric term.
resthe residual.

Apply one multigrid iteration to the diffusion equation for u.

The initial value of res on the leaves of root must be set to the residual of the diffusion equation using gfs_diffusion_residual().

The diffusion coefficients must be set using gfs_diffusion_coefficients().

The values of u on the leaf cells are updated as well as the values of res (i.e. the cell tree is ready for another iteration).

Here is the call graph for this function:

Here is the caller graph for this function:

void gfs_diffusion_residual ( GfsDomain *  domain,
GfsVariable *  u,
GfsVariable *  rhs,
GfsVariable *  rhoc,
GfsVariable *  metric,
GfsVariable *  res 
)
Parameters:
domaina #GfsDomain.
uthe variable to use as left-hand side.
rhsthe right-hand side.
rhocthe mass.
metricthe metric term.
resthe residual.

Sets the res variable of each leaf cell of domain to the residual of the diffusion equation for v.

The diffusion coefficients must have been set using gfs_diffusion_coefficients() and the right-hand side using gfs_diffusion_rhs().

Here is the call graph for this function:

Here is the caller graph for this function:

void gfs_diffusion_rhs ( GfsDomain *  domain,
GfsVariable *  v,
GfsVariable *  rhs,
GfsVariable *  rhoc,
GfsVariable *  metric,
gdouble  beta 
)
Parameters:
domaina #GfsDomain.
va #GfsVariable.
rhsa #GfsVariable.
rhocthe mass.
metricthe metric term.
betathe implicitness parameter (0.5 Crank-Nicholson, 1. backward Euler).

Adds to the rhs variable of cell the right-hand side of the diffusion equation for variable v.

The diffusion coefficients must have been already set using gfs_diffusion_coefficients().

Here is the call graph for this function:

GfsLinearProblem* gfs_get_diffusion_problem ( GfsDomain *  domain,
GfsVariable *  rhs,
GfsVariable *  lhs,
GfsVariable *  rhoc,
GfsVariable *  metric,
gint  maxlevel,
GfsVariable *  v 
)
Parameters:
domainthe domain over which the poisson problem is defined
rhsthe variable to use as right-hand side
lhsthe variable to use as left-hand side
rhocthe mass.
metricthe metric term (or NULL).
maxlevelthe maximum level to consider (or -1).
va #GfsVariable of which lhs is an homogeneous version.

Extracts the diffusion problem associated with lhs and rhs.

Returns:
a #GfsLinearProblem.

Here is the call graph for this function:

GfsLinearProblem* gfs_get_poisson_problem ( GfsDomain *  domain,
GfsVariable *  rhs,
GfsVariable *  lhs,
GfsVariable *  dia,
gint  maxlevel,
GfsVariable *  v 
)
Parameters:
domainthe domain over which the poisson problem is defined
rhsthe variable to use as right-hand side
lhsthe variable to use as left-hand side
diathe diagonal weight
maxlevelthe maximum level to consider (or -1).
va #GfsVariable of which lhs is an homogeneous version.

Extracts the poisson problem associated with lhs and rhs.

Returns:
a #GfsLinearProblem.

Here is the call graph for this function:

void gfs_linear_problem_add_stencil ( GfsLinearProblem *  lp,
GfsStencil *  stencil 
)
Parameters:
lpa #GfsLinearProblem.
stencila #GfsStencil.

Adds a stencil to the linear problem.

void gfs_linear_problem_destroy ( GfsLinearProblem *  lp)
Parameters:
lpa #GfsLinearProblem.

Destroys a #GfsLinearProblem.

Here is the call graph for this function:

GfsLinearProblem* gfs_linear_problem_new ( GfsDomain *  domain)
Parameters:
domaina #GfsDomain.
Returns:
a new #GfsLinearProblem.

Here is the caller graph for this function:

void gfs_multilevel_params_stats_write ( GfsMultilevelParams *  par,
FILE *  fp 
)
Parameters:
parthe multilevel parameters.
fpa file pointer.

Writes in fp the statistics contained in p.

void gfs_multilevel_params_write ( GfsMultilevelParams *  par,
FILE *  fp 
)
Parameters:
parthe multilevel parameters.
fpa file pointer.

Writes in fp a text representation of the multilevel parameters par.

void gfs_poisson_coefficients ( GfsDomain *  domain,
GfsFunction *  alpha,
gboolean  positive,
gboolean  centered,
gboolean  reset 
)
Parameters:
domaina #GfsDomain.
alphathe inverse of density or NULL.
positiveif TRUE, alpha must be strictly positive.
centeredTRUE if solving for a centered variable.
resetTRUE if resetting previous coefficients.

Initializes the face coefficients for the Poisson equation $\nabla\cdot\alpha\nabla p=\dots$.

If alpha is NULL, it is taken to be unity.

Here is the call graph for this function:

Here is the caller graph for this function:

gdouble gfs_poisson_compatibility ( GfsDomain *  domain,
GfsVariable *  lhs,
GfsVariable *  rhs,
gdouble  dt 
)
Parameters:
domainthe domain over which the poisson problem is solved.
lhsthe variable to use as left-hand side.
rhsthe variable to use as right-hand side.
dtthe timestep.
Returns:
the absolute value of the compatibility condition for a Poisson equation using lhs as left-hand-side and rhs as right-hand-side.

Here is the call graph for this function:

void gfs_poisson_cycle ( GfsDomain *  domain,
GfsMultilevelParams *  p,
GfsVariable *  u,
GfsVariable *  rhs,
GfsVariable *  dia,
GfsVariable *  res 
)
Parameters:
domainthe domain on which to solve the Poisson equation.
pthe #GfsMultilevelParams.
uthe variable to use as left-hand side.
rhsthe variable to use as right-hand side.
diathe diagonal weight.
resthe residual.

Apply one multigrid iteration to the Poisson equation defined by u and rhs.

The initial value of res on the leaves of root must be set to the residual of the Poisson equation (using gfs_residual()).

The face coefficients must be set using gfs_poisson_coefficients().

The values of u on the leaf cells are updated as well as the values of res (i.e. the cell tree is ready for another iteration).

Here is the call graph for this function:

Here is the caller graph for this function:

void gfs_poisson_solve ( GfsDomain *  domain,
GfsMultilevelParams *  par,
GfsVariable *  lhs,
GfsVariable *  rhs,
GfsVariable *  res,
GfsVariable *  dia,
gdouble  dt 
)
Parameters:
domainthe domain over which the poisson problem is solved.
parthe parameters of the poisson problem.
lhsthe variable to use as left-hand side.
rhsthe variable to use as right-hand side.
resthe variable in which to store the residual
diathe diagonal weight.
dtthe length of the time-step.

Solves the poisson problem over domain using Gerris' native multigrid poisson solver.

Here is the call graph for this function:

void gfs_relax ( GfsDomain *  domain,
guint  d,
gint  max_depth,
gdouble  omega,
GfsVariable *  u,
GfsVariable *  rhs,
GfsVariable *  dia 
)
Parameters:
domainthe domain to relax.
dnumber of dimensions (2 or 3).
max_depththe maximum depth of the domain to relax.
omegathe over-relaxation parameter.
uthe variable to use as left-hand side.
rhsthe variable to use as right-hand side.
diathe diagonal weight.

Apply one pass of a Jacobi relaxation to all the leaf cells of domain with a level inferior or equal to max_depth and to all the cells at level max_depth. The relaxation should converge (if the right-hand-side rhs verifies the solvability conditions) toward the solution of a Poisson equation for u at the maximum depth.

Here is the call graph for this function:

void gfs_residual ( GfsDomain *  domain,
guint  d,
FttTraverseFlags  flags,
gint  max_depth,
GfsVariable *  u,
GfsVariable *  rhs,
GfsVariable *  dia,
GfsVariable *  res 
)
Parameters:
domaina domain.
dnumber of dimensions (2 or 3).
flagswhich types of cells are to be visited.
max_depthmaximum depth of the traversal.
uthe variable to use as left-hand side.
rhsthe variable to use as right-hand side.
diathe diagonal weight.
resthe variable to use to store the residual.

For each cell of domain, computes the sum of the residual over the volume of the cell for a Poisson equation with u as left-hand-side and rhs as right-hand-side. Stores the result in res.

Here is the call graph for this function:

Here is the caller graph for this function:

void gfs_source_tension_coefficients ( GfsSourceTension *  s,
GfsDomain *  domain,
GfsFunction *  alpha 
)
Parameters:
sa #GfsSourceTension.
domaina #GfsDomain.
alphathe inverse of density or NULL.

Initializes the face coefficients with the surface tension term (interface curvature times surface tension coefficient).

If alpha is NULL, it is taken to be unity.

Here is the call graph for this function:

Here is the caller graph for this function:

 All Data Structures Files Functions Variables