8.3
general documentation
cs_gwf_tpf.cpp File Reference

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"
+ Include dependency graph for cs_gwf_tpf.cpp:

Macros

#define CS_GWF_TPF_DBG   0
 
#define CS_GWF_TPF_N_OUTPUT_VARS   5
 

Functions

cs_gwf_tpf_tcs_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_tcs_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...
 

Detailed Description

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).

Macro Definition Documentation

◆ CS_GWF_TPF_DBG

#define CS_GWF_TPF_DBG   0

◆ CS_GWF_TPF_N_OUTPUT_VARS

#define CS_GWF_TPF_N_OUTPUT_VARS   5

Function Documentation

◆ cs_gwf_tpf_compute()

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.

Parameters
[in]meshpointer to a cs_mesh_t structure
[in]connectpointer to a cs_cdo_connect_t structure
[in]cdoqpointer to a cs_cdo_quantities_t structure
[in]time_steppointer to a cs_time_step_t structure
[in]option_flagcalculation option related to the GWF module
[in,out]tpfpointer to the model context structure

◆ cs_gwf_tpf_create()

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.

Parameters
[in]modeltype of physical modelling
Returns
a pointer to a new allocated structure

◆ cs_gwf_tpf_current_to_previous()

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})

Parameters
[in]connectpointer to a cs_cdo_connect_t structure
[in,out]tpfpointer to the casted model context

◆ cs_gwf_tpf_define_relax_pty_by_time_func()

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.

Parameters
[in]tpfpointer to the model context structure
[in]funcfunction pointer to a time function
[in]func_contextcontext related to this function
Returns
a pointer to the created definition (cs_xdef_t structure)

◆ cs_gwf_tpf_define_relax_pty_by_value()

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.

Parameters
[in]tpfpointer to the model context structure
[in]valreference value used to set the relaxation property

◆ cs_gwf_tpf_extra_op()

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.

Parameters
[in]connectpointer to a cs_cdo_connect_t structure
[in]cdoqpointer to a cs_cdo_quantities_t structure
[in]tspointer to a cs_time_step_t struct.
[in]post_flagrequested quantities to be postprocessed
[in,out]tpfpointer to the casted model context

◆ cs_gwf_tpf_extra_post()

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.

Parameters
[in]mesh_idid of the output mesh for the current call
[in]n_cellslocal number of cells of post_mesh
[in]cell_idslist of cells (0 to n-1)
[in]post_flagflag gathering quantities to postprocess
[in]abs_permproperty for the absolute permeability
[in]tpfpointer to the model context structure
[in]connectpointer to additional connectivities for CDO
[in]cdoqpointer to additional mesh quantities for CDO
[in]time_steppointer to a cs_time_step_t struct.

◆ cs_gwf_tpf_finalize_setup()

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)

Parameters
[in]connectpointer to a cs_cdo_connect_t structure
[in]cdoqpointer to a cs_cdo_quantities_t structure
[in]flagoptional settings for the module
[in,out]tpfpointer to the casted model context

◆ cs_gwf_tpf_free()

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.

Parameters
[in,out]p_tpfpointer of pointer to the model context structure

◆ cs_gwf_tpf_init()

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.

Parameters
[in,out]tpfpointer to the model context structure
[in,out]perm_typetype of permeability to handle

◆ cs_gwf_tpf_init_setup()

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.

Parameters
[in]post_flagoptional postprocessing request(s)
[in,out]tpfpointer to the casted model context

◆ cs_gwf_tpf_init_values()

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)

Parameters
[in]connectpointer to a cs_cdo_connect_t structure
[in]cdoqpointer to a cs_cdo_quantities_t structure
[in,out]tpfpointer to the casted model context

◆ cs_gwf_tpf_log_setup()

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.

Parameters
[in]tpfpointer to the model context structure

◆ cs_gwf_tpf_update()

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()

Parameters
[in]meshpointer to a cs_mesh_t structure
[in]connectpointer to a cs_cdo_connect_t structure
[in]cdoqpointer to a cs_cdo_quantities_t structure
[in]time_evaltime at which properties are evaluated if needed
[in]option_flagcalculation option related to the GWF module
[in,out]tpfpointer to a TPF model context