Basilisk CFD
Adaptive Cartesian mesh PDE framework
Loading...
Searching...
No Matches
embed-tree.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

static void embed_fraction_refine (Point point, scalar cs)
 
 for (int _d=0;_d< 2;_d++) static void embed_face_fraction_refine_x(Point point
 
 if (cs[]<=0.||cs[] >=1.)
 If the cell is empty or full, simple injection from the coarse cell value is used.
 
 if (2.*fabs(alpha)< fabs(n.y))
 We need to reconstruct the face fractions fs for the fine cells.
 
else fine (fs.x, 1, 0)
 
 for (int i=0;i<=1;i++) if(neighbor(2 *i-1).neighbors &&(is_local(cell)||is_local(neighbor(2 *i-1))))
 For the fine face fractions coincident with the faces of the coarse cell, we obtain the intersection position from the coarse cell face fraction.
 
static void restriction_embed_linear (Point point, scalar s)
 
static void refine_embed_linear (Point point, scalar s)
 
 if (is_local(cell))
 

Variables

scalar s
 
 else
 
double alpha = plane_alpha (cs[], n)
 
 attribute
 

Function Documentation

◆ embed_fraction_refine()

static void embed_fraction_refine ( Point  point,
scalar  cs 
)
static

Embedded boundaries on adaptive trees

This file defines the restriction/prolongation functions which are necessary to implement embedded boundaries on adaptive meshes.

Volume fraction field <em>cs</em>

For the embedded fraction field cs, the function below is modelled closely on the volume fraction refinement function fraction_refine().

If the cell is empty or full, simple injection from the coarse cell value is used.

If the cell contains the embedded boundary, we reconstruct the boundary using VOF linear reconstruction and a normal estimated from the surface fractions.

Definition at line 16 of file embed-tree.h.

References a, alpha, b, cc, cs, dimension, facet_normal(), fs, n, nc, plane_alpha, point, rectangle_fraction(), x, and coord::x.

Referenced by event_metric().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fine()

else fine ( fs.  x,
,
 
)

References a, alpha, b, fine(), fs, j, k, n, nc, rectangle_fraction(), vector::x, and coord::x.

Referenced by face_average(), fine(), for(), halo_face(), if(), if(), if(), if(), if(), multigrid_debug(), prolongation_vertex(), refine_cm_axi(), refine_cm_lonlat(), refine_cm_spherisym(), refine_face_solenoidal(), refine_face_x_axi(), refine_face_x_lonlat(), refine_face_x_spherisym(), refine_face_y_axi(), refine_face_y_lonlat(), restriction_embed_linear(), restriction_vertex(), tag(), and tree_boundary_level().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ for() [1/2]

for ( )

Surface fractions field <em>fs</em>

The embedded surface fractions fs are reconstructed using this function.

Refinement/prolongation of face-centered velocity

This function is modelled on refine_face_x() and is typically used to refine the values of the face-centered velocity field uf. It uses linear interpolation, taking into account the weighting by the embedded fractions fs.

◆ for() [2/2]

for ( int  i = 0; i <= 1; i++) &&

For the fine face fractions coincident with the faces of the coarse cell, we obtain the intersection position from the coarse cell face fraction.

In 2D the orientation is obtained by looking at the values of face fractions in the transverse direction.

The face fractions of empty children cells must be zero.

Definition at line 134 of file embed-tree.h.

References a, alpha, b, cs, dimension, fine(), fs, i, is_refined, j, k, n, nc, neighbor(), rectangle_fraction(), vector::x, x, coord::x, and vector::y.

Here is the call graph for this function:

◆ if() [1/3]

if ( )

We need to reconstruct the face fractions fs for the fine cells.

For the fine face fractions contained within the coarse cell, we compute the intersections directly using the VOF reconstruction. In 2D, we obtain the face fractions by taking into account the orientation of the normal.

Definition at line 102 of file embed-tree.h.

References alpha, fine(), fs, i, n, vector::x, and x.

Here is the call graph for this function:

◆ if() [2/3]

if ( cs<=0.||[]cs >=  1.[])

If the cell is empty or full, simple injection from the coarse cell value is used.

We need to make sure that the fine cells face fractions match those of their neighbours.

Definition at line 63 of file embed-tree.h.

References cell(), cs, fine(), fs, i, is_refined, j, k, neighbor(), vector::x, and x.

Here is the call graph for this function:

◆ if() [3/3]

if ( is_local(cell )

Definition at line 388 of file embed-tree.h.

References fine(), fs, j, k, v, vector::x, and x.

Here is the call graph for this function:

◆ refine_embed_linear()

static void refine_embed_linear ( Point  point,
scalar  s 
)
inlinestatic

Refinement/prolongation of cell-centered fields

For refinement, we use either bilinear interpolation, if the required four coarse cell values are defined or trilinear interpolation if only three coarse cell values are defined. If less that three coarse cell values are defined ("pathological cases" below), we try to estimate gradients in each direction and add the corresponding correction.

Definition at line 270 of file embed-tree.h.

References assert, coarse(), cs, dimension, fs, i, j, k, s, vector::x, x, and vector::y.

Referenced by event_defaults().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ restriction_embed_linear()

static void restriction_embed_linear ( Point  point,
scalar  s 
)
inlinestatic

We first try to interpolate "diagonally". If enough child cells are defined (i.e. have non-zero embedded fractions), we return the corresponding value.

Otherwise, we use the average of the child cells which are defined (there is at least one).

If the gradient is defined and if the variable is not using homogeneous boundary conditions, we improve the interpolation using this information.

Definition at line 212 of file embed-tree.h.

References assert, cs, dimension, fine(), g, i, j, o, p, point, s, val(), vector::x, x, coord::x, y, and z.

Referenced by event_defaults().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ alpha

double alpha = plane_alpha (cs[], n)

Definition at line 87 of file embed-tree.h.

Referenced by embed_fraction_refine(), fine(), for(), and if().

◆ attribute

attribute
Initial value:
{
int x
Definition common.h:76
static coord embed_gradient(Point point, vector u, coord p, coord n)
Definition embed.h:473
Definition linear.h:21
Definition common.h:78

Restriction of cell-centered fields

We now define restriction and prolongation functions for cell-centered fields. The goal is to define second-order operators which do not use any values from cells entirely contained within the embedded boundary (for which cs = 0).

When restricting it is unfortunately not always possible to obtain a second-order interpolation. This happens when the parent cell does not contain enough child cells not entirely contained within the embedded boundary. In these cases, some external information (i.e. a boundary gradient condition) is required to be able to maintain second-order accuracy. This information can be passed by defining the embed_gradient()* function of the field being restricted.

Definition at line 208 of file embed-tree.h.

◆ else

else
Initial value:
{
Point point
Definition conserving.h:86
else return n
Definition curvature.h:101
scalar cs[]
The volume and area fractions are stored in these fields.
Definition embed.h:21
vector fs[]
Definition embed.h:22
coord facet_normal(Point point, scalar c, vector s)
Definition fractions.h:426

Definition at line 79 of file embed-tree.h.

◆ s

scalar s
Initial value:
{
vector fs = s.v
scalar s
Definition embed-tree.h:56

Definition at line 55 of file embed-tree.h.

Referenced by __ac_X31_hash_string(), _box_json(), _cells_json(), _draw_string_json(), _draw_vof_json(), _isoline_json(), _isosurface_json(), _labels_json(), _lines_json(), _squares_json(), _travelling_json(), _vectors_json(), _view_json(), add_cexpr(), advect(), antisymmetry(), apply_bc(), args(), assemble_node(), atobool(), atoi_check(), barycenter(), bilinear(), biquadratic(), biquadratic_vertex(), boundary_internal(), boundary_stencil(), box_boundary_level(), box_boundary_level(), box_boundary_level(), box_boundary_level_normal(), box_boundary_level_normal(), box_boundary_level_tangent(), box_matrix(), cartesian_boundary_face(), cartesian_debug(), cartesian_init_scalar(), cartesian_init_vertex_scalar(), change(), check_stencil(), compile_expression(), correct_qz(), curvature_prolongation(), curvature_restriction(), default_stencil(), delete(), diagonalization_2D(), display_control_update(), display_init(), echo(), eigenvalues(), eqstate_eos_alpha(), eqstate_eos_beta(), eqstate_eqstate1(), eqstate_rho_feistel(), eqstate_unesco(), equilibrium_tide_constituents(), eta_prolongation(), eta_restriction(), evaluate_expression(), event_cleanup(), event_defaults(), event_error(), event_init(), event_pressure(), event_tracer_advection(), event_viscous_term(), event_vof(), face_fraction(), facet_normal(), facets(), fclone(), fields_stats(), find_comma(), flux(), for(), for(), for(), foreach_stencil(), foreach_stencil_generic(), free_cexpr(), GetRoot(), getvalue(), givens(), gpu_boundary_level(), gpu_errorslex(), gpu_reduction(), gradients(), half_column(), heights(), horizontal_diffusion(), if(), if(), implicit_horizontal_diffusion(), inclex(), include(), includes(), init_const_scalar(), input_gfs(), input_pgm(), interpolate_array(), inverse_wavelet(), is_code(), is_vertex_scalar(), kdt_sum_core_init(), kdt_sum_init(), lambda2(), list_add(), list_add_depends(), list_append(), list_clone(), list_concat(), list_copy(), list_lenb(), list_lookup(), list_prepend(), list_print(), load(), lookup_field(), lookup_tag(), lookup_vector(), main(), main(), matrix1(), maxruntime(), merge(), mg_cycle(), mg_solve(), mpi_boundary_refine(), mpi_boundary_update(), msolve(), multigrid_init_scalar(), multigrid_init_vertex_scalar(), multigrid_restriction(), mystrtok(), new_bid(), new_const_scalar(), next_string(), no_coalescence(), no_data(), observations_const_nns(), ohmic_flux(), OMP_PARALLEL(), output_vtk(), parse_params(), periodic_bc(), periodic_boundary(), periodic_boundary_level_x(), pmuntrace(), PointTriangleDistance(), poisson_thermal(), postlex(), prediction(), process_line(), pstrdup(), push(), push_once(), quad_neighbor_finest(), quadtree(), query_sum(), rcv_pid_receive(), rcv_pid_send(), rcv_pid_sync(), refine_bilinear(), refine_biquadratic(), refine_distance(), refine_embed_linear(), refine_linear(), refine_linear_single(), relax_diffusion(), remap_robin(), remove_blanks(), repeat(), reset(), residual_diffusion(), residual_nh(), residual_nh2(), residual_nh3(), restore_mpi(), restriction_average(), restriction_embed_linear(), restriction_face(), restriction_vertex(), restriction_volume_average(), save(), scalar_depends_from(), scalar_is_dirty(), set_dirty_stencil(), set_prolongation(), set_restriction(), singleslash(), slave_interpolate(), snd_rcv_init(), solve_hessenberg(), split(), statsf(), stencil_val(), stencil_val_a(), strip_path(), stripname(), stripslash(), strlencheck(), symmetry(), tag(), terrain(), timer_print(), timer_timing(), tracer_fluxes(), update_conservation(), update_distance(), update_saint_venant(), update_sum(), util_convert_fluxes(), vectors_from_scalars(), vertical_diffusion(), vertical_remapping(), vof_concentration_refine(), volumez(), wavelet(), which(), writepath(), yyerror(), zareaval(), and zvolume().