Main functions dedicated to the modelling of two-phase flows in a porous media. This media is always considered as unsaturated. Two sub-models are considered: miscible (MTPF) or immiscible (ITPF). More...
#include "cs_defs.h"
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include <float.h>
#include <bft_mem.h>
#include "cs_array.h"
#include "cs_cdovb_priv.h"
#include "cs_field.h"
#include "cs_gwf_priv.h"
#include "cs_gwf_soil.h"
#include "cs_log.h"
#include "cs_mesh_location.h"
#include "cs_parall.h"
#include "cs_param_types.h"
#include "cs_physical_constants.h"
#include "cs_post.h"
#include "cs_property.h"
#include "cs_reco.h"
#include "cs_time_plot.h"
#include "cs_gwf_tpf.h"
Macros | |
#define | CS_GWF_TPF_DBG 0 |
#define | CS_GWF_TPF_N_OUTPUT_VARS 5 |
Functions | |
cs_gwf_tpf_t * | cs_gwf_tpf_create (cs_gwf_model_type_t model) |
Allocate and initialize the model context structure for two-phase flows in a porous media. More... | |
void | cs_gwf_tpf_free (cs_gwf_tpf_t **p_tpf) |
Free the context structure associated to the modelling of two-phase flows in a porous media. More... | |
void | cs_gwf_tpf_define_relax_pty_by_value (cs_gwf_tpf_t *tpf, double val) |
Define the relaxation property by value and set this value. More... | |
cs_xdef_t * | cs_gwf_tpf_define_relax_pty_by_time_func (cs_gwf_tpf_t *tpf, cs_time_func_t *func, void *func_context) |
Define the relaxation property by value and set this value. More... | |
void | cs_gwf_tpf_log_setup (cs_gwf_tpf_t *tpf) |
Log the setup related to the model context of two-phase flows. Common to the different sub-models relying on two-phase flows. More... | |
void | cs_gwf_tpf_init (cs_gwf_tpf_t *tpf, cs_property_type_t perm_type) |
Initialize the model context according to the settings done inside the function cs_user_model() Case of a two-phase flows model in porous media. More... | |
void | cs_gwf_tpf_init_setup (cs_flag_t post_flag, cs_gwf_tpf_t *tpf) |
Initial setup stage for two-phase flows in porous media. At this stage, all soils have been defined and equation parameters are set. Case of a miscible or immiscible model. More... | |
void | cs_gwf_tpf_finalize_setup (const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *cdoq, cs_flag_t flag, cs_gwf_tpf_t *tpf) |
Last setup stage in the case of two-phase flows in a porous media (miscible or immiscible case) More... | |
void | cs_gwf_tpf_init_values (const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *cdoq, cs_gwf_tpf_t *tpf) |
Last setup stage in the case of two-phase flows in a porous media (miscible or immiscible case) More... | |
void | cs_gwf_tpf_compute (const cs_mesh_t *mesh, const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *cdoq, const cs_time_step_t *time_step, cs_flag_t option_flag, cs_gwf_tpf_t *tpf) |
Compute the new state for the groundwater flows module. Case of two-phase flows in porous media. More... | |
void | cs_gwf_tpf_current_to_previous (const cs_cdo_connect_t *connect, cs_gwf_tpf_t *tpf) |
Operate a "current to previous" step on fields or arrays which have at least a storage of the previous step (time t^n when computing t^{n+1}) More... | |
void | cs_gwf_tpf_update (const cs_mesh_t *mesh, const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *cdoq, double time_eval, cs_flag_t option_flag, cs_gwf_tpf_t *tpf) |
Perform the update step in the case of a two-phase flow model in porous media (miscible or immiscible). To operate a "current to
previous" step, one has to call the dedicated function cs_gwf_tpf_current_to_previous() More... | |
void | cs_gwf_tpf_extra_op (const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *cdoq, const cs_time_step_t *ts, cs_flag_t post_flag, cs_gwf_tpf_t *tpf) |
Predefined extra-operations for the groundwater flow module in case of miscible or immiscible two-phase flows in porous media. More... | |
void | cs_gwf_tpf_extra_post (int mesh_id, cs_lnum_t n_cells, const cs_lnum_t cell_ids[], cs_flag_t post_flag, const cs_property_t *abs_perm, const cs_gwf_tpf_t *tpf, const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *cdoq, const cs_time_step_t *time_step) |
Predefined post-processing output for the groundwater flow module in case of saturated two-phase flows (tpf) in porous media. More... | |
Main functions dedicated to the modelling of two-phase flows in a porous media. This media is always considered as unsaturated. Two sub-models are considered: miscible (MTPF) or immiscible (ITPF).
#define CS_GWF_TPF_DBG 0 |
#define CS_GWF_TPF_N_OUTPUT_VARS 5 |
void cs_gwf_tpf_compute | ( | const cs_mesh_t * | mesh, |
const cs_cdo_connect_t * | connect, | ||
const cs_cdo_quantities_t * | cdoq, | ||
const cs_time_step_t * | time_step, | ||
cs_flag_t | option_flag, | ||
cs_gwf_tpf_t * | tpf | ||
) |
Compute the new state for the groundwater flows module. Case of two-phase flows in porous media.
[in] | mesh | pointer to a cs_mesh_t structure |
[in] | connect | pointer to a cs_cdo_connect_t structure |
[in] | cdoq | pointer to a cs_cdo_quantities_t structure |
[in] | time_step | pointer to a cs_time_step_t structure |
[in] | option_flag | calculation option related to the GWF module |
[in,out] | tpf | pointer to the model context structure |
cs_gwf_tpf_t * cs_gwf_tpf_create | ( | cs_gwf_model_type_t | model | ) |
Allocate and initialize the model context structure for two-phase flows in a porous media.
[in] | model | type of physical modelling |
void cs_gwf_tpf_current_to_previous | ( | const cs_cdo_connect_t * | connect, |
cs_gwf_tpf_t * | tpf | ||
) |
Operate a "current to previous" step on fields or arrays which have at least a storage of the previous step (time t^n when computing t^{n+1})
[in] | connect | pointer to a cs_cdo_connect_t structure |
[in,out] | tpf | pointer to the casted model context |
cs_xdef_t * cs_gwf_tpf_define_relax_pty_by_time_func | ( | cs_gwf_tpf_t * | tpf, |
cs_time_func_t * | func, | ||
void * | func_context | ||
) |
Define the relaxation property by value and set this value.
[in] | tpf | pointer to the model context structure |
[in] | func | function pointer to a time function |
[in] | func_context | context related to this function |
void cs_gwf_tpf_define_relax_pty_by_value | ( | cs_gwf_tpf_t * | tpf, |
double | val | ||
) |
Define the relaxation property by value and set this value.
[in] | tpf | pointer to the model context structure |
[in] | val | reference value used to set the relaxation property |
void cs_gwf_tpf_extra_op | ( | const cs_cdo_connect_t * | connect, |
const cs_cdo_quantities_t * | cdoq, | ||
const cs_time_step_t * | ts, | ||
cs_flag_t | post_flag, | ||
cs_gwf_tpf_t * | tpf | ||
) |
Predefined extra-operations for the groundwater flow module in case of miscible or immiscible two-phase flows in porous media.
[in] | connect | pointer to a cs_cdo_connect_t structure |
[in] | cdoq | pointer to a cs_cdo_quantities_t structure |
[in] | ts | pointer to a cs_time_step_t struct. |
[in] | post_flag | requested quantities to be postprocessed |
[in,out] | tpf | pointer to the casted model context |
void cs_gwf_tpf_extra_post | ( | int | mesh_id, |
cs_lnum_t | n_cells, | ||
const cs_lnum_t | cell_ids[], | ||
cs_flag_t | post_flag, | ||
const cs_property_t * | abs_perm, | ||
const cs_gwf_tpf_t * | tpf, | ||
const cs_cdo_connect_t * | connect, | ||
const cs_cdo_quantities_t * | cdoq, | ||
const cs_time_step_t * | time_step | ||
) |
Predefined post-processing output for the groundwater flow module in case of saturated two-phase flows (tpf) in porous media.
[in] | mesh_id | id of the output mesh for the current call |
[in] | n_cells | local number of cells of post_mesh |
[in] | cell_ids | list of cells (0 to n-1) |
[in] | post_flag | flag gathering quantities to postprocess |
[in] | abs_perm | property for the absolute permeability |
[in] | tpf | pointer to the model context structure |
[in] | connect | pointer to additional connectivities for CDO |
[in] | cdoq | pointer to additional mesh quantities for CDO |
[in] | time_step | pointer to a cs_time_step_t struct. |
void cs_gwf_tpf_finalize_setup | ( | const cs_cdo_connect_t * | connect, |
const cs_cdo_quantities_t * | cdoq, | ||
cs_flag_t | flag, | ||
cs_gwf_tpf_t * | tpf | ||
) |
Last setup stage in the case of two-phase flows in a porous media (miscible or immiscible case)
[in] | connect | pointer to a cs_cdo_connect_t structure |
[in] | cdoq | pointer to a cs_cdo_quantities_t structure |
[in] | flag | optional settings for the module |
[in,out] | tpf | pointer to the casted model context |
void cs_gwf_tpf_free | ( | cs_gwf_tpf_t ** | p_tpf | ) |
Free the context structure associated to the modelling of two-phase flows in a porous media.
[in,out] | p_tpf | pointer of pointer to the model context structure |
void cs_gwf_tpf_init | ( | cs_gwf_tpf_t * | tpf, |
cs_property_type_t | perm_type | ||
) |
Initialize the model context according to the settings done inside the function cs_user_model() Case of a two-phase flows model in porous media.
[in,out] | tpf | pointer to the model context structure |
[in,out] | perm_type | type of permeability to handle |
void cs_gwf_tpf_init_setup | ( | cs_flag_t | post_flag, |
cs_gwf_tpf_t * | tpf | ||
) |
Initial setup stage for two-phase flows in porous media. At this stage, all soils have been defined and equation parameters are set. Case of a miscible or immiscible model.
[in] | post_flag | optional postprocessing request(s) |
[in,out] | tpf | pointer to the casted model context |
void cs_gwf_tpf_init_values | ( | const cs_cdo_connect_t * | connect, |
const cs_cdo_quantities_t * | cdoq, | ||
cs_gwf_tpf_t * | tpf | ||
) |
Last setup stage in the case of two-phase flows in a porous media (miscible or immiscible case)
[in] | connect | pointer to a cs_cdo_connect_t structure |
[in] | cdoq | pointer to a cs_cdo_quantities_t structure |
[in,out] | tpf | pointer to the casted model context |
void cs_gwf_tpf_log_setup | ( | cs_gwf_tpf_t * | tpf | ) |
Log the setup related to the model context of two-phase flows. Common to the different sub-models relying on two-phase flows.
[in] | tpf | pointer to the model context structure |
void cs_gwf_tpf_update | ( | const cs_mesh_t * | mesh, |
const cs_cdo_connect_t * | connect, | ||
const cs_cdo_quantities_t * | cdoq, | ||
double | time_eval, | ||
cs_flag_t | option_flag, | ||
cs_gwf_tpf_t * | tpf | ||
) |
Perform the update step in the case of a two-phase flow model in porous media (miscible or immiscible). To operate a "current to previous" step, one has to call the dedicated function cs_gwf_tpf_current_to_previous()
[in] | mesh | pointer to a cs_mesh_t structure |
[in] | connect | pointer to a cs_cdo_connect_t structure |
[in] | cdoq | pointer to a cs_cdo_quantities_t structure |
[in] | time_eval | time at which properties are evaluated if needed |
[in] | option_flag | calculation option related to the GWF module |
[in,out] | tpf | pointer to a TPF model context |