6.3
general documentation
cs_navsto_system.h
Go to the documentation of this file.
1 #ifndef __CS_NAVSTO_SYSTEM_H__
2 #define __CS_NAVSTO_SYSTEM_H__
3 
4 /*============================================================================
5  * Routines to handle cs_navsto_system_t structure
6  *============================================================================*/
7 
8 /*
9  This file is part of Code_Saturne, a general-purpose CFD tool.
10 
11  Copyright (C) 1998-2020 EDF S.A.
12 
13  This program is free software; you can redistribute it and/or modify it under
14  the terms of the GNU General Public License as published by the Free Software
15  Foundation; either version 2 of the License, or (at your option) any later
16  version.
17 
18  This program is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
20  FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
21  details.
22 
23  You should have received a copy of the GNU General Public License along with
24  this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
25  Street, Fifth Floor, Boston, MA 02110-1301, USA.
26 */
27 
28 /*----------------------------------------------------------------------------
29  * Local headers
30  *----------------------------------------------------------------------------*/
31 
32 #include "cs_advection_field.h"
33 #include "cs_cdo_turbulence.h"
34 #include "cs_equation.h"
35 #include "cs_field.h"
36 #include "cs_param_types.h"
37 #include "cs_property.h"
38 #include "cs_maxwell.h"
39 #include "cs_mesh.h"
40 #include "cs_navsto_param.h"
41 #include "cs_time_step.h"
42 #include "cs_thermal_system.h"
43 #include "cs_xdef.h"
44 
45 /*----------------------------------------------------------------------------*/
46 
48 
55 /*============================================================================
56  * Macro definitions
57  *============================================================================*/
58 
59 /*============================================================================
60  * Function pointer definitions
61  *============================================================================*/
62 
63 /*----------------------------------------------------------------------------*/
79 /*----------------------------------------------------------------------------*/
80 
81 typedef void *
83  cs_adv_field_t *adv_field,
84  cs_real_t *mflux,
85  cs_real_t *mflux_pre,
86  cs_boundary_type_t *fb_type,
87  void *nscc);
88 
89 /*----------------------------------------------------------------------------*/
99 /*----------------------------------------------------------------------------*/
100 
101 typedef void *
102 (cs_navsto_free_scheme_context_t)(void *scheme_context);
103 
104 /*----------------------------------------------------------------------------*/
115 /*----------------------------------------------------------------------------*/
116 
117 typedef void
119  const cs_cdo_quantities_t *quant,
120  const cs_time_step_t *ts,
121  cs_field_t *field);
122 
123 /*----------------------------------------------------------------------------*/
133 /*----------------------------------------------------------------------------*/
134 
135 typedef void
137  const cs_navsto_param_t *nsp,
138  void *scheme_context);
139 
140 /*=============================================================================
141  * Structure definitions
142  *============================================================================*/
143 
149 typedef struct {
150 
155 
161 
168 
175 
180 
193 
199 
216 
223 
229  cs_maxwell_t *mxl;
230 
245 
252 
258 
264 
270 
275 
283 
296 
303 
316 
323 
329 
335 
341 
347 
349 
350 /*============================================================================
351  * Public function prototypes
352  *============================================================================*/
353 
354 /*----------------------------------------------------------------------------*/
361 /*----------------------------------------------------------------------------*/
362 
363 bool
365 
366 /*----------------------------------------------------------------------------*/
372 /*----------------------------------------------------------------------------*/
373 
374 void
375 cs_navsto_system_update_model(bool with_thermal);
376 
377 /*----------------------------------------------------------------------------*/
389 /*----------------------------------------------------------------------------*/
390 
392 cs_navsto_system_activate(const cs_boundary_t *boundaries,
394  cs_navsto_param_model_flag_t model_flag,
395  cs_navsto_param_coupling_t algo_coupling,
396  cs_navsto_param_post_flag_t post_flag);
397 
398 /*----------------------------------------------------------------------------*/
402 /*----------------------------------------------------------------------------*/
403 
404 void
406 
407 /*----------------------------------------------------------------------------*/
414 /*----------------------------------------------------------------------------*/
415 
418 
419 /*----------------------------------------------------------------------------*/
425 /*----------------------------------------------------------------------------*/
426 
429 
430 /*----------------------------------------------------------------------------*/
437 /*----------------------------------------------------------------------------*/
438 
441 
442 /*----------------------------------------------------------------------------*/
451 /*----------------------------------------------------------------------------*/
452 
453 cs_real_t *
454 cs_navsto_get_mass_flux(bool previous);
455 
456 /*----------------------------------------------------------------------------*/
462 /*----------------------------------------------------------------------------*/
463 
464 void
466 
467 /*----------------------------------------------------------------------------*/
476 /*----------------------------------------------------------------------------*/
477 
478 void
480  const cs_cdo_connect_t *connect,
481  const cs_cdo_quantities_t *quant,
482  const cs_time_step_t *time_step);
483 
484 /*----------------------------------------------------------------------------*/
488 /*----------------------------------------------------------------------------*/
489 
490 void
492 
493 /*----------------------------------------------------------------------------*/
504 /*----------------------------------------------------------------------------*/
505 
506 void
508  const cs_cdo_connect_t *connect,
509  const cs_cdo_quantities_t *quant,
510  const cs_time_step_t *ts);
511 
512 /*----------------------------------------------------------------------------*/
519 /*----------------------------------------------------------------------------*/
520 
521 void
523  cs_lnum_t solid_cell_ids[]);
524 
525 /*----------------------------------------------------------------------------*/
535 /*----------------------------------------------------------------------------*/
536 
537 void
539  const cs_time_step_t *time_step,
540  const cs_cdo_connect_t *connect,
541  const cs_cdo_quantities_t *cdoq);
542 
543 /*----------------------------------------------------------------------------*/
553 /*----------------------------------------------------------------------------*/
554 
555 void
557  const cs_time_step_t *time_step,
558  const cs_cdo_connect_t *connect,
559  const cs_cdo_quantities_t *cdoq);
560 
561 /*----------------------------------------------------------------------------*/
570 /*----------------------------------------------------------------------------*/
571 
572 void
574  const cs_time_step_t *time_step,
575  const cs_cdo_connect_t *connect,
576  const cs_cdo_quantities_t *cdoq);
577 
578 /*----------------------------------------------------------------------------*/
587 /*----------------------------------------------------------------------------*/
588 
589 void
591  const cs_cdo_connect_t *connect,
592  const cs_cdo_quantities_t *cdoq,
593  const cs_time_step_t *ts);
594 
595 /*----------------------------------------------------------------------------*/
617 /*----------------------------------------------------------------------------*/
618 
619 void
620 cs_navsto_system_extra_post(void *input,
621  int mesh_id,
622  int cat_id,
623  int ent_flag[5],
624  cs_lnum_t n_cells,
625  cs_lnum_t n_i_faces,
626  cs_lnum_t n_b_faces,
627  const cs_lnum_t cell_ids[],
628  const cs_lnum_t i_face_ids[],
629  const cs_lnum_t b_face_ids[],
630  const cs_time_step_t *time_step);
631 
632 /*----------------------------------------------------------------------------*/
636 /*----------------------------------------------------------------------------*/
637 
638 void
640 
641 /*----------------------------------------------------------------------------*/
642 
644 
645 #endif /* __CS_NAVSTO_SYSTEM_H__ */
cs_equation_t
Main structure to handle the discretization and the resolution of an equation.
cs_navsto_system_is_activated
bool cs_navsto_system_is_activated(void)
Check if the resolution of the Navier-Stokes system has been activated.
Definition: cs_navsto_system.c:216
cs_navsto_system_t::enstrophy
cs_field_t * enstrophy
Definition: cs_navsto_system.h:269
cs_navsto_system_t::coupling_context
void * coupling_context
Definition: cs_navsto_system.h:295
cs_navsto_system_set_solid_cells
void cs_navsto_system_set_solid_cells(cs_lnum_t n_solid_cells, cs_lnum_t solid_cell_ids[])
Set a solid zone related to the Navier-Stokes equations.
Definition: cs_navsto_system.c:1190
field
Definition: field.f90:27
cs_navsto_free_scheme_context_t
void *() cs_navsto_free_scheme_context_t(void *scheme_context)
Free the context structure related to a given discretization scheme for the resolution of the Navier-...
Definition: cs_navsto_system.h:102
cs_navsto_system_t::compute_steady
cs_navsto_compute_t * compute_steady
Definition: cs_navsto_system.h:340
cs_navsto_system_get_param
cs_navsto_param_t * cs_navsto_system_get_param(void)
Retrieve the structure storing the parameters for the Navier–Stokes system.
Definition: cs_navsto_system.c:457
cs_navsto_param_t
Structure storing the parameters related to the resolution of the Navier-Stokes system.
Definition: cs_navsto_param.h:487
cs_navsto_system_finalize_setup
void cs_navsto_system_finalize_setup(const cs_mesh_t *mesh, const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *quant, const cs_time_step_t *time_step)
Last step of the setup of the Navier-Stokes system.
Definition: cs_navsto_system.c:808
cs_navsto_system_set_sles
void cs_navsto_system_set_sles(void)
Define the settings for SLES related to the Navier-Stokes system.
Definition: cs_navsto_system.c:744
cs_navsto_param_model_t
cs_navsto_param_model_t
Describe the system of equations related to the Navier-Stokes to be solved.
Definition: cs_navsto_param.h:80
cs_boundary_t
Structure storing information related to the "physical" boundaries associated with the computational ...
Definition: cs_boundary.h:151
cs_navsto_system_t::init_pressure
cs_navsto_init_values_t * init_pressure
Definition: cs_navsto_system.h:334
cs_navsto_system_t::bf_type
cs_boundary_type_t * bf_type
Definition: cs_navsto_system.h:179
END_C_DECLS
#define END_C_DECLS
Definition: cs_defs.h:493
cs_navsto_compute_t
void() cs_navsto_compute_t(const cs_mesh_t *mesh, const cs_navsto_param_t *nsp, void *scheme_context)
Compute for the current time step the new state for the Navier-Stokes system. This means that equatio...
Definition: cs_navsto_system.h:136
cs_real_t
double cs_real_t
Floating-point value.
Definition: cs_defs.h:304
cs_navsto_system_t::stream_function_eq
cs_equation_t * stream_function_eq
Definition: cs_navsto_system.h:282
cs_navsto_system_update
void cs_navsto_system_update(const cs_mesh_t *mesh, const cs_time_step_t *time_step, const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *cdoq)
Update variables and related quantities when a new state of the Navier-Stokes system has been compute...
Definition: cs_navsto_system.c:1235
BEGIN_C_DECLS
#define BEGIN_C_DECLS
Definition: cs_defs.h:492
cs_navsto_get_mass_flux
cs_real_t * cs_navsto_get_mass_flux(bool previous)
Retrieve the mass flux array related to the Navier-Stokes system.
Definition: cs_navsto_system.c:538
cs_navsto_param.h
cs_navsto_system_t::pressure
cs_field_t * pressure
Definition: cs_navsto_system.h:198
mesh
Definition: mesh.f90:26
cs_navsto_param_post_flag_t
cs_flag_t cs_navsto_param_post_flag_t
Definition: cs_navsto_param.h:57
cs_navsto_system_t::init_velocity
cs_navsto_init_values_t * init_velocity
Definition: cs_navsto_system.h:328
cs_navsto_system_extra_post
void cs_navsto_system_extra_post(void *input, int mesh_id, int cat_id, int ent_flag[5], cs_lnum_t n_cells, cs_lnum_t n_i_faces, cs_lnum_t n_b_faces, const cs_lnum_t cell_ids[], const cs_lnum_t i_face_ids[], const cs_lnum_t b_face_ids[], const cs_time_step_t *time_step)
Predefined post-processing output for the Navier-Stokes system. The prototype of this function is fix...
Definition: cs_navsto_system.c:1529
cs_navsto_system_update_model
void cs_navsto_system_update_model(bool with_thermal)
Update the flag associated to the modelling options.
Definition: cs_navsto_system.c:233
cs_navsto_system_t::turbulence
cs_turbulence_t * turbulence
Definition: cs_navsto_system.h:215
cs_mesh.h
cs_xdef.h
cs_navsto_system_compute_steady_state
void cs_navsto_system_compute_steady_state(const cs_mesh_t *mesh, const cs_time_step_t *time_step, const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *cdoq)
Build, solve and update the Navier-Stokes system in case of a steady-state approach.
Definition: cs_navsto_system.c:1265
cs_navsto_system_t::kinetic_energy
cs_field_t * kinetic_energy
Definition: cs_navsto_system.h:251
cs_navsto_system_t::vorticity
cs_field_t * vorticity
Definition: cs_navsto_system.h:257
cs_navsto_system_t::compute
cs_navsto_compute_t * compute
Definition: cs_navsto_system.h:346
cs_navsto_system_get_momentum_eq
cs_equation_t * cs_navsto_system_get_momentum_eq(void)
Retrieve a pointer to the equation related to the momentum equation.
Definition: cs_navsto_system.c:476
cs_navsto_init_values_t
void() cs_navsto_init_values_t(const cs_navsto_param_t *nsp, const cs_cdo_quantities_t *quant, const cs_time_step_t *ts, cs_field_t *field)
According to the model, coupling algorithm and the space discretization, initialize the field values ...
Definition: cs_navsto_system.h:118
cs_time_step_t
time step descriptor
Definition: cs_time_step.h:64
cs_navsto_system_t::adv_field
cs_adv_field_t * adv_field
Definition: cs_navsto_system.h:160
cs_navsto_system_t::helicity
cs_field_t * helicity
Definition: cs_navsto_system.h:263
cs_navsto_system_t::velocity
cs_field_t * velocity
Definition: cs_navsto_system.h:192
cs_navsto_system_t::mass_flux_array_pre
cs_real_t * mass_flux_array_pre
Definition: cs_navsto_system.h:174
cs_field.h
cs_property.h
cs_thermal_system.h
Routines to handle the cs_thermal_system_t structure. The temperature field is automatically defined ...
cs_cdo_quantities_t
Definition: cs_cdo_quantities.h:124
cs_advection_field.h
cs_navsto_system_extra_op
void cs_navsto_system_extra_op(const cs_mesh_t *mesh, const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *cdoq, const cs_time_step_t *ts)
Predefined extra-operations for the Navier-Stokes system.
Definition: cs_navsto_system.c:1463
cs_navsto_param_model_flag_t
cs_flag_t cs_navsto_param_model_flag_t
Definition: cs_navsto_param.h:56
cs_navsto_system_t::scheme_context
void * scheme_context
Definition: cs_navsto_system.h:302
cs_lnum_t
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:298
cs_navsto_system_t::param
cs_navsto_param_t * param
Definition: cs_navsto_system.h:154
cs_navsto_system_t::init_scheme_context
cs_navsto_init_scheme_context_t * init_scheme_context
Definition: cs_navsto_system.h:315
cs_cdo_connect_t
Definition: cs_cdo_connect.h:76
cs_boundary_type_t
int cs_boundary_type_t
Definition: cs_boundary.h:65
cs_navsto_get_adv_field
cs_adv_field_t * cs_navsto_get_adv_field(void)
Retrieve the advection field structure (the mass flux) related to the Navier-Stokes system.
Definition: cs_navsto_system.c:517
cs_time_step.h
cs_navsto_system_log_setup
void cs_navsto_system_log_setup(void)
Summary of the main cs_navsto_system_t structure.
Definition: cs_navsto_system.c:1655
cs_navsto_system_t::velocity_divergence
cs_field_t * velocity_divergence
Definition: cs_navsto_system.h:244
cs_navsto_system_t::velocity_gradient
cs_field_t * velocity_gradient
Definition: cs_navsto_system.h:274
cs_navsto_system_t::mass_flux_array
cs_real_t * mass_flux_array
Definition: cs_navsto_system.h:167
cs_navsto_system_t::free_scheme_context
cs_navsto_free_scheme_context_t * free_scheme_context
Definition: cs_navsto_system.h:322
cs_navsto_system_t::thm
cs_thermal_system_t * thm
Definition: cs_navsto_system.h:222
cs_param_types.h
cs_equation.h
cs_navsto_param_coupling_t
cs_navsto_param_coupling_t
Choice of algorithm for solving the system.
Definition: cs_navsto_param.h:472
cs_navsto_init_scheme_context_t
void *() cs_navsto_init_scheme_context_t(const cs_navsto_param_t *nsp, cs_adv_field_t *adv_field, cs_real_t *mflux, cs_real_t *mflux_pre, cs_boundary_type_t *fb_type, void *nscc)
Allocate and initialize the context structure related to a given discretization scheme for the resolu...
Definition: cs_navsto_system.h:82
cs_maxwell.h
Structure and routines handling the Maxwell module dedicated to the resolution of electro-magnetic eq...
cs_turbulence_t
Structure storing the parameters related to the resolution of the tubulence modelling....
Definition: cs_cdo_turbulence.h:171
cs_adv_field_t
Definition: cs_advection_field.h:149
cs_field_t
Field descriptor.
Definition: cs_field.h:125
cs_navsto_system_t::mxl
cs_maxwell_t * mxl
Definition: cs_navsto_system.h:229
cs_navsto_system_activate
cs_navsto_system_t * cs_navsto_system_activate(const cs_boundary_t *boundaries, cs_navsto_param_model_t model, cs_navsto_param_model_flag_t model_flag, cs_navsto_param_coupling_t algo_coupling, cs_navsto_param_post_flag_t post_flag)
Allocate and initialize the Navier-Stokes (NS) system.
Definition: cs_navsto_system.c:275
cs_navsto_system_init_setup
void cs_navsto_system_init_setup(void)
Start setting-up the Navier-Stokes system At this stage, numerical settings should be completely dete...
Definition: cs_navsto_system.c:560
cs_cdo_turbulence.h
cs_navsto_system_initialize
void cs_navsto_system_initialize(const cs_mesh_t *mesh, const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *quant, const cs_time_step_t *ts)
Initialize the scheme context structure used to build the algebraic system. This is done after the se...
Definition: cs_navsto_system.c:1124
cs_mesh_t
Definition: cs_mesh.h:84
cs_navsto_system_destroy
void cs_navsto_system_destroy(void)
Free the main structure related to the Navier-Stokes system.
Definition: cs_navsto_system.c:387
cs_thermal_system_t
Definition: cs_thermal_system.h:145
cs_navsto_system_t
Structure managing the Navier-Stokes system.
Definition: cs_navsto_system.h:149
cs_navsto_system_compute
void cs_navsto_system_compute(const cs_mesh_t *mesh, const cs_time_step_t *time_step, const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *cdoq)
Build, solve and update the Navier-Stokes system.
Definition: cs_navsto_system.c:1380