/* * MigFlow - Copyright (C) <2010-2018> * * * List of the contributors to the development of MigFlow: see AUTHORS file. * Description and complete License: see LICENSE file. * * This program (MigFlow) is free software: * you can redistribute it and/or modify it under the terms of the GNU Lesser General * Public License as published by the Free Software Foundation, either version * 3 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program (see COPYING and COPYING.LESSER files). If not, * see . */ #ifndef FLUID_PROBLEM_H #define FLUID_PROBLEM_H #include "mesh.h" #include "mesh_find.h" #include "hxt_linear_system.h" #if DIMENSION==2 #define N_N 3 #else #define N_N 4 #endif typedef void BoundaryCallback(int n, const double *x, double *bnd); typedef struct { char *tag; int row; int field; BoundaryCallback *apply; } StrongBoundary; typedef struct FluidProblem FluidProblem; typedef enum {BND_WALL=0,BND_OPEN=1} BoundaryType; typedef struct { char *tag; BoundaryType type; BoundaryCallback *field_cb; int vid,pid,cid,aid; } WeakBoundary; struct FluidProblem { double *rho; double *mu; double g; double coeffStab; double sigma; double kinetic_energy; Mesh *mesh; MeshTree *mesh_tree; Tree_cell *Tree; Tree_cell **map; int *map2Tree; int size_initial_mesh; // number of initial elements in the mesh int size_initial_node; // number of initial nodes in the mesh MeshBoundary *boundaries; double *porosity; double *oldporosity; double *concentration; double *solution; double *solution_explicit; double *node_volume; double *element_size; double volume_drag; int n_strong_boundaries; StrongBoundary *strong_boundaries; int n_weak_boundaries; WeakBoundary *weak_boundaries; HXTLinearSystem *linear_system; int n_particles; double *particle_uvw; double *particle_position; double *particle_volume; double *particle_velocity; double *particle_contact; double *particle_mass; double *particle_force; int n_fluids; //stabilisation coefficients double *taup; double *tauc; int *particle_element_id; //parameters int reduced_gravity; double stab_param; int drag_in_stab; }; // complete force on the particle (including gravity) void fluid_problem_compute_node_particle_force(FluidProblem *problem, double dt, double *particle_force); int fluid_problem_implicit_euler(FluidProblem *problem, double dt, double newton_atol, double newton_rtol, int newton_max_it); void fluid_problem_set_particles(FluidProblem *problem, int n, double *mass, double *volume, double *position, double *velocity, double *contact, long int *elid, int init, int reload); void fluid_problem_set_concentration_cg(FluidProblem *problem, double *concentration); void fluid_problem_free(FluidProblem *problem); FluidProblem *fluid_problem_new(double g, int n_fluids, double *mu, double *rho, double sigma, double coeffStab, double volume_drag, const char *petsc_solver_type, int drag_in_stab); void fluid_problem_load_msh(FluidProblem *problem, const char *mesh_file_name); void fluid_problem_adapt_mesh(FluidProblem *problem, double e_target, double lcmax, double lcmin, int n_el, double cmax, double cmin, double U_0, double P_0); void fluid_problem_estimator_evaluation(FluidProblem *problem, double e_target, double lcmax, double lcmin, double n_el, double cmax, double cmin, int boolean_init, double U_0, double P_0); void fluid_problem_local_adapt_mesh(FluidProblem *problem, double lcmax, double lcmin, int bool_init_tree); int *fluid_problem_particle_element_id(FluidProblem *problem); int fluid_problem_n_particles(FluidProblem *problem); void fluid_problem_after_import(FluidProblem *problem); int fluid_problem_n_fields(const FluidProblem *p); double *fluid_problem_solution(const FluidProblem *p); void fluid_problem_set_weak_boundary(FluidProblem *p, const char *tag, BoundaryType type, BoundaryCallback *cb, int vid, int pid, int cid, int aid); void fluid_problem_set_strong_boundary(FluidProblem *p, const char *tag, int field, int row, BoundaryCallback *apply); double *fluid_problem_old_porosity(const FluidProblem *p); double *fluid_problem_porosity(const FluidProblem *p); double *fluid_problem_concentration_dg(const FluidProblem *p); double *fluid_problem_element_size(const FluidProblem *p); void fluid_problem_advance_concentration(FluidProblem *problem, double dt); // mesh data (for i/o) void printing(Mesh *mesh); int fluid_problem_n_nodes(const FluidProblem *p); double *fluid_problem_coordinates(const FluidProblem *p); int fluid_problem_n_elements(const FluidProblem *p); int *fluid_problem_elements(const FluidProblem *p); void fluid_problem_set_elements(FluidProblem *p, int n_nodes, double *x, int n_elements, int *elements, int n_boundaries, int *boundaries, int *boundary_tags,int n_physicals, char **physicals, int transfer_solution); //void fluid_problem_local_adapt_mesh(FluidProblem *problem, double lcmax, double lcmin); int fluid_problem_n_mesh_boundaries(const FluidProblem *p); void fluid_problem_mesh_boundary_info(const FluidProblem *p, int bid, char **bname, int *bsize); void fluid_problem_mesh_boundary_interfaces(const FluidProblem *p, int bid, int *binterfaces); void fluid_problem_set_stab_param(FluidProblem *p, double stab_param); void fluid_problem_set_reduced_gravity(FluidProblem *p, int reduced_gravity); int weak_boundary_n_values(const WeakBoundary *wbnd); double fluid_problem_a_integ_volume(FluidProblem *problem); double fluid_problem_a_integ_bnd(FluidProblem *problem, double dt); void weak_boundary_values(const Mesh *mesh, const MeshBoundary *bnd, const WeakBoundary *wbnd, double *data); #endif