Stokes Problem

Contents

rhea_stokes_problem.h
rhea_stokes_norm.h
rhea_strainrate.h
rhea_stress.h


rhea_stokes_problem.h [source]

Typedefs

typedef struct rhea_stokes_problem rhea_stokes_problem_t

Enums

enum rhea_stokes_problem_nonlinear_linearization_t

RHEA_STOKES_PROBLEM

Provides the Stokes solver.

Values:

enumerator RHEA_STOKES_PROBLEM_NONLINEAR_LINEARIZATION_PICARD
enumerator RHEA_STOKES_PROBLEM_NONLINEAR_LINEARIZATION_NEWTON_REGULAR
enumerator RHEA_STOKES_PROBLEM_NONLINEAR_LINEARIZATION_NEWTON_PRIMALDUAL
enumerator RHEA_STOKES_PROBLEM_NONLINEAR_LINEARIZATION_NEWTON_PRIMALDUAL_SYMM
enumerator RHEA_STOKES_PROBLEM_NONLINEAR_LINEARIZATION_NEWTON_DEV1
enumerator RHEA_STOKES_PROBLEM_NONLINEAR_LINEARIZATION_NEWTON_DEV2

Functions

void rhea_stokes_problem_add_options(ymir_options_t *opt_sup)

Defines options and adds them as sub-options.

void rhea_stokes_problem_process_options()

Processes options and stores them.

void rhea_stokes_problem_perfmon_init(const int activate, const int skip_if_active)

Initializes performance counters.

void rhea_stokes_problem_perfmon_print(sc_MPI_Comm mpicomm, const int print_wtime, const int print_n_calls, const int print_flops)

Prints statistics collected by performance monitors.

rhea_stokes_problem_t *rhea_stokes_problem_new(ymir_mesh_t *ymir_mesh, ymir_pressure_elem_t *press_elem, ymir_vec_t *temperature, ymir_vec_t *composition, rhea_domain_options_t *domain_options, rhea_temperature_options_t *temp_options, rhea_composition_options_t *comp_options, rhea_weakzone_options_t *weak_options, rhea_viscosity_options_t *visc_options)

Creates/destroys a Stokes problem.

void rhea_stokes_problem_destroy(rhea_stokes_problem_t *stokes_problem)
void rhea_stokes_problem_create_mesh_dependencies(rhea_stokes_problem_t *stokes_problem, ymir_mesh_t *ymir_mesh, ymir_pressure_elem_t *press_elem)

Sets up/clears objects that have dependencies on the mesh.

void rhea_stokes_problem_clear_mesh_dependencies(rhea_stokes_problem_t *stokes_problem)
void rhea_stokes_problem_setup_solver(rhea_stokes_problem_t *stokes_problem)

Sets up the solver of a Stokes problem.

int rhea_stokes_problem_solve(ymir_vec_t **sol_vel_press, const int nonzero_initial_guess, const int iter_max, const double rtol, rhea_stokes_problem_t *stokes_problem)

Solves a Stokes problem.

int rhea_stokes_problem_has_converged(const int stop_reason, rhea_stokes_problem_t *stokes_problem)
void rhea_stokes_problem_compute_coefficient(rhea_stokes_problem_t *stokes_problem, ymir_vec_t *velocity_pressure, const int nonlinear_init)

Computes the viscous stress coefficient of a Stokes problem.

void rhea_stokes_problem_compute_and_update_coefficient(rhea_stokes_problem_t *stokes_problem, ymir_vec_t *velocity_pressure, const int nonlinear_init)

Computes and updates the viscous stress coefficient of a Stokes problem.

void rhea_stokes_problem_setup_solver_ext(rhea_stokes_problem_t *stokes_problem, const int num_krylov_solvers)

Sets up the solver of a Stokes problem.

void rhea_stokes_problem_update_solver(rhea_stokes_problem_t *stokes_problem, const int update_coeff, ymir_vec_t *vel_press, const int override_rhs, ymir_vec_t *rhs_vel_press, ymir_vec_t *rhs_vel, ymir_vec_t *vel_nonzero_dirichlet, ymir_vec_t **rhs_vel_face_nonzero_neumann)

Updates the solver of a Stokes problem.

int rhea_stokes_problem_solve_ext(ymir_vec_t **sol_vel_press, const int nonzero_initial_guess, const int iter_max, const double rtol, rhea_stokes_problem_t *stokes_problem, const int resume, const int force_linear_solve, const int krylov_solver_idx, int *num_iterations, double *residual_reduction, int *mesh_modified_by_solver)

Solves a Stokes problem.

int rhea_stokes_problem_has_converged_ext(const int stop_reason, rhea_stokes_problem_t *stokes_problem, const int force_linear_solve)
void rhea_stokes_problem_set_solver_amr(rhea_stokes_problem_t *stokes_problem, p4est_t *p4est, rhea_discretization_options_t *discr_options)

Sets data to enable solver AMR/grid continuation.

void rhea_stokes_problem_set_solver_bin_output(rhea_stokes_problem_t *stokes_problem, char *bin_path)

Sets output path for binary output the iterations of a nonlinear solve.

void rhea_stokes_problem_set_solver_vtk_output(rhea_stokes_problem_t *stokes_problem, char *vtk_path)

Sets output path for vtk output the iterations of a nonlinear solve.

ymir_mesh_t *rhea_stokes_problem_get_ymir_mesh(rhea_stokes_problem_t *stokes_problem)

Accesses data of a Stokes problem.

ymir_pressure_elem_t *rhea_stokes_problem_get_press_elem(rhea_stokes_problem_t *stokes_problem)
void rhea_stokes_problem_set_temperature(rhea_stokes_problem_t *stokes_problem, ymir_vec_t *temperature)
ymir_vec_t *rhea_stokes_problem_get_temperature(rhea_stokes_problem_t *stokes_problem)
void rhea_stokes_problem_remove_temperature(rhea_stokes_problem_t *stokes_problem)
void rhea_stokes_problem_set_composition(rhea_stokes_problem_t *stokes_problem, ymir_vec_t *composition_density, ymir_vec_t *composition_viscosity)
ymir_vec_t *rhea_stokes_problem_get_composition_density(rhea_stokes_problem_t *stokes_problem)
void rhea_stokes_problem_remove_composition(rhea_stokes_problem_t *stokes_problem)
void rhea_stokes_problem_set_velocity_pressure(rhea_stokes_problem_t *stokes_problem, ymir_vec_t *velocity_pressure)
ymir_vec_t *rhea_stokes_problem_get_velocity_pressure(rhea_stokes_problem_t *stokes_problem)
void rhea_stokes_problem_remove_velocity_pressure(rhea_stokes_problem_t *stokes_problem)
int rhea_stokes_problem_is_nonlinear(rhea_stokes_problem_t *stokes_problem)
rhea_domain_options_t *rhea_stokes_problem_get_domain_options(rhea_stokes_problem_t *stokes_problem)
void rhea_stokes_problem_set_domain_options(rhea_stokes_problem_t *stokes_problem, rhea_domain_options_t *domain_options)
rhea_temperature_options_t *rhea_stokes_problem_get_temperature_options(rhea_stokes_problem_t *stokes_problem)
void rhea_stokes_problem_set_temperature_options(rhea_stokes_problem_t *stokes_problem, rhea_temperature_options_t *temp_options)
rhea_composition_options_t *rhea_stokes_problem_get_composition_options(rhea_stokes_problem_t *stokes_problem)
rhea_plate_options_t *rhea_stokes_problem_get_plate_options(rhea_stokes_problem_t *stokes_problem)
void rhea_stokes_problem_set_plate_options(rhea_stokes_problem_t *stokes_problem, rhea_plate_options_t *plate_options)
rhea_weakzone_options_t *rhea_stokes_problem_get_weakzone_options(rhea_stokes_problem_t *stokes_problem)
void rhea_stokes_problem_set_weakzone_options(rhea_stokes_problem_t *stokes_problem, rhea_weakzone_options_t *weak_options)
rhea_viscosity_options_t *rhea_stokes_problem_get_viscosity_options(rhea_stokes_problem_t *stokes_problem)
void rhea_stokes_problem_set_viscosity_options(rhea_stokes_problem_t *stokes_problem, rhea_viscosity_options_t *visc_options)
void rhea_stokes_problem_copy_viscosity(ymir_vec_t *viscosity, rhea_stokes_problem_t *stokes_problem)
void rhea_stokes_problem_copy_marker(ymir_vec_t *marker, rhea_stokes_problem_t *stokes_problem)
ymir_vec_t *rhea_stokes_problem_get_weakzone(rhea_stokes_problem_t *stokes_problem)
ymir_vec_t *rhea_stokes_problem_get_rhs_vel_press(rhea_stokes_problem_t *stokes_problem)
void rhea_stokes_problem_set_rhs_vel_press(rhea_stokes_problem_t *stokes_problem, ymir_vec_t *rhs_vel_press)
ymir_vec_t *rhea_stokes_problem_get_rhs_vel(rhea_stokes_problem_t *stokes_problem)
ymir_vec_t *rhea_stokes_problem_get_rhs_vel_nonzero_dirichlet(rhea_stokes_problem_t *stokes_problem)
ymir_vec_t **rhea_stokes_problem_get_rhs_vel_nonzero_neumann(rhea_stokes_problem_t *stokes_problem)
ymir_vec_t *rhea_stokes_problem_get_rhs_vel_nonzero_neumann_surface(rhea_stokes_problem_t *stokes_problem)
void rhea_stokes_problem_set_weakzone_compute_fn(rhea_stokes_problem_t *stokes_problem, rhea_weakzone_compute_fn_t fn, void *data)
void rhea_stokes_problem_set_viscosity_compute_fn(rhea_stokes_problem_t *stokes_problem, rhea_viscosity_compute_fn_t fn, void *data)
void rhea_stokes_problem_set_rhs_vel_compute_fn(rhea_stokes_problem_t *stokes_problem, rhea_velocity_rhs_compute_fn_t fn, void *data)
void rhea_stokes_problem_set_rhs_vel_nonzero_dir_compute_fn(rhea_stokes_problem_t *stokes_problem, rhea_velocity_rhs_nz_dir_compute_fn_t fn, void *data)
void rhea_stokes_problem_set_rhs_vel_nonzero_neu_compute_fn(rhea_stokes_problem_t *stokes_problem, rhea_velocity_rhs_nz_neu_compute_fn_t fn, void *data)
void rhea_stokes_problem_weakzone_compute(ymir_vec_t *weakzone, rhea_stokes_problem_t *stokes_problem)
void rhea_stokes_problem_viscosity_compute(ymir_vec_t *viscosity, ymir_vec_t *proj_scal, ymir_vec_t *marker, ymir_vec_t *temperature, ymir_vec_t *weakzone, ymir_vec_t *velocity, rhea_stokes_problem_t *stokes_problem)
ymir_stokes_op_t *rhea_stokes_problem_get_stokes_op(rhea_stokes_problem_t *stokes_problem)
int rhea_stokes_problem_get_num_krylov_solvers(rhea_stokes_problem_t *stokes_problem)
int rhea_stokes_problem_write(char *base_path_bin, rhea_stokes_problem_t *stokes_problem)

Writes a Stokes problem to disk.

int rhea_stokes_problem_velocity_set_boundary(ymir_vec_t *velocity, ymir_vec_t *velocity_on_boundary, rhea_stokes_problem_t *stokes_problem)

Sets velocity components on the boundary, which are constrained by Dirichlet boundary conditions.

int rhea_stokes_problem_velocity_set_boundary_zero(ymir_vec_t *velocity, rhea_stokes_problem_t *stokes_problem)
int rhea_stokes_problem_velocity_enforce_boundary_conditions(ymir_vec_t *velocity, rhea_stokes_problem_t *stokes_problem)
int rhea_stokes_problem_enforce_boundary_conditions(ymir_vec_t *velocity_pressure, rhea_stokes_problem_t *stokes_problem)
int rhea_stokes_problem_velocity_compute_mean_rotation(double mean_rot_axis[3], ymir_vec_t *velocity, rhea_stokes_problem_t *stokes_problem)

Computes mean rotation of the velocity.

int rhea_stokes_problem_velocity_project_out_mean_rotation(ymir_vec_t *velocity, const int residual_space, rhea_stokes_problem_t *stokes_problem)

Projects out mean rotation of the velocity.

int rhea_stokes_problem_project_out_nullspace(ymir_vec_t *vel_press, rhea_stokes_problem_t *stokes_problem)

Projects out null spaces.

int rhea_stokes_problem_stress_compute(ymir_vec_t *stress, ymir_vec_t *vel_press, rhea_stokes_problem_t *stokes_problem, ymir_stress_op_t *override_stress_op, int linearized_visc_coeff, const int skip_pressure)

Computes stress tensor.

int rhea_stokes_problem_stress_compute_normal_at_surface(ymir_vec_t *stress_norm_surf, ymir_vec_t *vel_press, rhea_stokes_problem_t *stokes_problem)

Computes normal stress at the surface of the domain.

int rhea_stokes_problem_stress_div_compute(ymir_vec_t *velocity, ymir_vec_t *stress_like_tensor, rhea_stokes_problem_t *stokes_problem, ymir_stress_op_t *override_stress_op, int linearized_visc_coeff)

Computes divergence of strain rate multiplied by viscous stress coefficient.


rhea_stokes_norm.h [source]

Enums

enum rhea_stokes_norm_type_t

Values:

enumerator RHEA_STOKES_NORM_NONE = -1
enumerator RHEA_STOKES_NORM_L2_VEC_SP
enumerator RHEA_STOKES_NORM_L2_PRIMAL
enumerator RHEA_STOKES_NORM_L2_DUAL
enumerator RHEA_STOKES_NORM_HMINUS1_L2

Functions

double rhea_stokes_norm_compute(double *norm_vel, double *norm_press, ymir_vec_t *vec, rhea_stokes_norm_type_t norm_type, ymir_Hminus1_norm_op_t *norm_op, ymir_pressure_elem_t *press_elem)

Computes the norm of a Stokes (i.e., velocity-pressure) vector.

void rhea_stokes_norm_innerprod(double *innerprod_vel, double *innerprod_press, ymir_vec_t *arg_left, ymir_vec_t *arg_right, rhea_stokes_norm_type_t norm_type, ymir_Hminus1_norm_op_t *norm_op, ymir_pressure_elem_t *press_elem)

Computes the inner product of the individual velocity and pressure components of a Stokes vector.


rhea_strainrate.h [source]

Defines

RHEA_STRAINRATE_2INV_NEUTRAL_VALUE (1.0)

Functions

double rhea_strainrate_get_dim_1_s(rhea_domain_options_t *domain_options, rhea_temperature_options_t *temp_options)

Gets the scaling factor to convert nondimensional values to corresponding dimensional quantities. Unit: [1/s]

ymir_vec_t *rhea_strainrate_new(ymir_mesh_t *ymir_mesh)

Creates a new (second invariant of) strain rate tensor.

ymir_vec_t *rhea_strainrate_2inv_new(ymir_mesh_t *ymir_mesh)
void rhea_strainrate_destroy(ymir_vec_t *strainrate)

Destroys a (second invariant of) strain rate tensor.

void rhea_strainrate_2inv_destroy(ymir_vec_t *strainrate_2inv)
void rhea_strainrate_convert_to_dimensional_1_s(ymir_vec_t *strainrate, rhea_domain_options_t *domain_options, rhea_temperature_options_t *temp_options)

Converts entries of a nondimensional strain rate vector into dimensional values: Unit: [1/s]

int rhea_strainrate_check_vec_type(ymir_vec_t *vec)

Checks whether a vector is of the right type.

int rhea_strainrate_2inv_check_vec_type(ymir_vec_t *vec)
int rhea_strainrate_is_valid(ymir_vec_t *vec)

Checks entries of a vector.

int rhea_strainrate_2inv_is_valid(ymir_vec_t *vec)
void rhea_strainrate_compute(ymir_vec_t *strainrate, ymir_vec_t *velocity)

Computes the strain rate tensor.

void rhea_strainrate_compute_sqrt_of_2inv(ymir_vec_t *strainrate_sqrt_2inv, ymir_vec_t *velocity)

Computes the squre root of the second invariant of the strain rate.

void rhea_strainrate_compute_sqrt_of_2inv_elem(sc_dmatrix_t *strainrate_2inv_el_mat, sc_dmatrix_t *vel_el_mat, ymir_vec_t *vel_vec, const ymir_locidx_t elid, sc_dmatrix_t *tmp_grad_vel, sc_dmatrix_t *tmp_dvel, sc_dmatrix_t *tmp_vel)

Computes the square root of the second invariant of the strain rate at Gauss nodes, given the velocity at GLL nodes.

void rhea_strainrate_stats_get_global(double *min_1_s, double *max_1_s, double *mean_1_s, ymir_vec_t *velocity, rhea_domain_options_t *domain_options, rhea_temperature_options_t *temp_options)

Computes global strain rate statistics.


rhea_stress.h [source]

Functions

double rhea_stress_get_dim_Pa(rhea_domain_options_t *domain_options, rhea_temperature_options_t *temp_options, rhea_viscosity_options_t *visc_options)

Gets the scaling factor to convert nondimensional stress to the corresponding dimensional quantity. Unit: [Pa]

ymir_vec_t *rhea_stress_new(ymir_mesh_t *ymir_mesh)

Creates a new stress tensor, stress components, and the second invariant.

ymir_vec_t *rhea_stress_nonsymmetric_new(ymir_mesh_t *ymir_mesh)
ymir_vec_t *rhea_stress_normal_new(ymir_mesh_t *ymir_mesh)
ymir_vec_t *rhea_stress_tangential_new(ymir_mesh_t *ymir_mesh)
ymir_vec_t *rhea_stress_2inv_new(ymir_mesh_t *ymir_mesh)
void rhea_stress_destroy(ymir_vec_t *stress)

Destroys a stress tensor, stress components, and the second invariant.

void rhea_stress_nonsymmetric_destroy(ymir_vec_t *stress)
void rhea_stress_normal_destroy(ymir_vec_t *stress_norm)
void rhea_stress_tangential_destroy(ymir_vec_t *stress_tang)
void rhea_stress_2inv_destroy(ymir_vec_t *stress_2inv)
void rhea_stress_convert_to_dimensional_Pa(ymir_vec_t *stress, rhea_domain_options_t *domain_options, rhea_temperature_options_t *temp_options, rhea_viscosity_options_t *visc_options)

Converts entries of a nondimensional stress vector into dimensional values. Unit: [Pa]

int rhea_stress_check_vec_type(ymir_vec_t *vec)

Checks whether a vector is of the right type.

int rhea_stress_nonsymmetric_check_vec_type(ymir_vec_t *vec)
int rhea_stress_normal_check_vec_type(ymir_vec_t *vec)
int rhea_stress_tangential_check_vec_type(ymir_vec_t *vec)
int rhea_stress_2inv_check_vec_type(ymir_vec_t *vec)
int rhea_stress_is_valid(ymir_vec_t *vec)

Checks entries of a vector.

int rhea_stress_2inv_is_valid(ymir_vec_t *vec)
void rhea_stress_nonsymmetric_to_symmetric(ymir_vec_t *stress_symm, ymir_vec_t *stress_nonsymm)

Converts nonsymmetric stress tensor to a symmetric stress tensor.

void rhea_stress_compute_viscstress(ymir_vec_t *viscstress, ymir_vec_t *strainrate, ymir_vec_t *viscosity)

Computes the viscous stress tensor.

void rhea_stress_combine_stresses(ymir_vec_t *stress, ymir_vec_t *pressure, ymir_pressure_elem_t *press_elem)

Combines viscous stress and (negative) pressure into a stress tensor. Note that stress contains the viscous stress and its diagonal is modified to reflect the stress coming from the pressure.

void rhea_stress_compute_viscstress_sqrt_of_2inv(ymir_vec_t *viscstress_sqrt_2inv, ymir_vec_t *strainrate_sqrt_2inv, ymir_vec_t *viscosity)

Computes the square root of the second invariant of the viscous stress tensor.

double rhea_stress_compute_norm(ymir_vec_t *stress)

Computes the norm of a stress tensor.

void rhea_stress_separate_diag_offdiag(ymir_vec_t *stress_diag, ymir_vec_t *stress_offdiag, ymir_vec_t *stress)

Separates the 6 components of a (symmetric) stress tensor into diagonal and off-diagonal components.

void rhea_stress_normal_compute_normal(ymir_vec_t *stress_normal_normal, ymir_vec_t *stress, ymir_vec_t *normal)

Computes the normal component of the normal stress.

void rhea_stress_normal_compute_tangential(ymir_vec_t *stress_normal_tangential, ymir_vec_t *stress, ymir_vec_t *normal)

Computes the tangential component of the normal stress.

ymir_vec_t *rhea_stress_surface_new(ymir_mesh_t *ymir_mesh)

Creates a new stress vector at surface.

void rhea_stress_surface_destroy(ymir_vec_t *vel_surf)

Destroys a stress vector at surface.

int rhea_stress_surface_check_vec_type(ymir_vec_t *vec)

Checks whether a vector is of the right type.

int rhea_stress_surface_is_valid(ymir_vec_t *vec)

Checks entries of a vector.

void rhea_stress_surface_extract_from_residual(ymir_vec_t *stress_norm_surf, ymir_vec_t *residual_mom)

Extracts the normal component of the stress at the surface from the residual of the Stokes momentum equation.

void rhea_stress_stats_get_global(double *min_Pa, double *max_Pa, double *mean_Pa, ymir_vec_t *velocity, ymir_vec_t *viscosity, rhea_domain_options_t *domain_options, rhea_temperature_options_t *temp_options, rhea_viscosity_options_t *visc_options)

Computes global strain rate statistics.

void rhea_stress_surface_stats_get_global(double *min_Pa, double *max_Pa, double *mean_Pa, ymir_vec_t *stress_norm_surf, rhea_domain_options_t *domain_options, rhea_temperature_options_t *temp_options, rhea_viscosity_options_t *visc_options)