My Project
programmer's documentation
Functions
cs_turbomachinery.c File Reference
#include "cs_defs.h"
#include <assert.h>
#include <math.h>
#include <string.h>
#include "bft_mem.h"
#include "bft_printf.h"
#include "fvm_selector.h"
#include "cs_interface.h"
#include "cs_base.h"
#include "cs_boundary_zone.h"
#include "cs_coupling.h"
#include "cs_gradient.h"
#include "cs_gui.h"
#include "cs_gui_mesh.h"
#include "cs_gui_output.h"
#include "cs_gradient_perio.h"
#include "cs_join.h"
#include "cs_halo.h"
#include "cs_halo_perio.h"
#include "cs_matrix_default.h"
#include "cs_mesh.h"
#include "cs_mesh_adjacencies.h"
#include "cs_mesh_coherency.h"
#include "cs_mesh_location.h"
#include "cs_mesh_quantities.h"
#include "cs_mesh_to_builder.h"
#include "cs_multigrid.h"
#include "cs_parall.h"
#include "cs_post.h"
#include "cs_preprocess.h"
#include "cs_prototypes.h"
#include "cs_renumber.h"
#include "cs_rotation.h"
#include "cs_time_step.h"
#include "cs_timer.h"
#include "cs_timer_stats.h"
#include "cs_restart.h"
#include "cs_sat_coupling.h"
#include "cs_preprocessor_data.h"
#include "cs_volume_zone.h"
#include "cs_turbomachinery.h"
Include dependency graph for cs_turbomachinery.c:

Functions

void cs_turbomachinery_set_model (cs_turbomachinery_model_t model)
 Define rotor/stator model. More...
 
cs_turbomachinery_model_t cs_turbomachinery_get_model (void)
 Return rotor/stator model. More...
 
void cs_turbomachinery_add_rotor (const char *cell_criteria, double rotation_velocity, const double rotation_axis[3], const double rotation_invariant[3])
 Define a rotor by its axis and cell selection criteria. More...
 
int cs_turbomachinery_join_add (const char *sel_criteria, float fraction, float plane, int verbosity, int visualization)
 Add a cs_join_t structure to the list of rotor/stator joinings. More...
 
int cs_turbomachinery_coupling_add (const char *sel_criteria, float tolerance, int verbosity)
 Add a cs_join_t structure to the list of rotor/stator couplings. More...
 
void cs_turbomachinery_update_mesh (double t_cur_mob, double *t_elapsed)
 Update mesh for unsteady rotor/stator computation. More...
 
void cs_turbomachinery_restart_mesh (void)
 Update mesh for unsteady rotor/stator computation in case of restart. More...
 
void cs_turbomachinery_define (void)
 Definitions for turbomachinery computation. More...
 
void cs_turbomachinery_initialize (void)
 Initializations for turbomachinery computation. More...
 
void cs_turbomachinery_finalize (void)
 Free turbomachinery structure. More...
 
void cs_turbomachinery_reinit_i_face_fields (void)
 Reinitialize interior face-based fields. More...
 
void cs_turbomachinery_resize_cell_fields (void)
 Resize cell-based fields. More...
 
void cs_turbomachinery_rotation_matrix (int rotor_num, double theta, cs_real_t matrix[3][4])
 Compute rotation matrix. More...
 
int cs_turbomachinery_n_rotors (void)
 Return number of rotors. More...
 
const int * cs_turbomachinery_get_cell_rotor_num (void)
 Return cell rotor number. More...
 
double cs_turbomachinery_get_rotation_velocity (int rotor_num)
 Return rotation velocity. More...
 
void cs_turbomachinery_set_rotation_velocity (int rotor_num, double omega)
 Set rotation velocity. More...
 
void cs_turbomachinery_set_rotation_retry (int n_max_join_retries, double dt_retry_multiplier)
 Set turbomachinery joining retry parameters. More...
 
cs_real_34_tcs_turbomachinery_get_rotation_matrices (double dt)
 Build rotation matrices for a given time interval. More...
 
void cs_turbomachinery_rotate_fields (const cs_real_t dt[])
 Rotation of vector and tensor fields. More...
 
void cs_turbomachinery_relative_velocity (int rotor_num, const cs_real_t coords[3], cs_real_t velocity[3])
 Compute velocity relative to fixed coordinates at a given point. More...
 
void cs_turbomachinery_restart_read (cs_restart_t *r)
 Read turbomachinery metadata from restart file. More...
 
void cs_turbomachinery_restart_write (cs_restart_t *r)
 Write turbomachinery metadata to checkpoint file. More...
 

Function Documentation

◆ cs_turbomachinery_add_rotor()

void cs_turbomachinery_add_rotor ( const char *  cell_criteria,
double  rotation_velocity,
const double  rotation_axis[3],
const double  rotation_invariant[3] 
)

Define a rotor by its axis and cell selection criteria.

Parameters
[in]cell_criteriacell selection criteria string
[in]rotation_velocityrotation velocity, in radians/second
[in]rotation_axisrotation axis vector
[in]rotation_invariantrotation invariant point

◆ cs_turbomachinery_coupling_add()

int cs_turbomachinery_coupling_add ( const char *  sel_criteria,
float  tolerance,
int  verbosity 
)

Add a cs_join_t structure to the list of rotor/stator couplings.

Parameters
[in]sel_criteriaboundary face selection criteria
[in]tolerancevalue of the search tolerance
[in]verbositylevel of verbosity required
Returns
number (1 to n) associated with new coupling

◆ cs_turbomachinery_define()

void cs_turbomachinery_define ( void  )

Definitions for turbomachinery computation.

◆ cs_turbomachinery_finalize()

void cs_turbomachinery_finalize ( void  )

Free turbomachinery structure.

◆ cs_turbomachinery_get_cell_rotor_num()

const int* cs_turbomachinery_get_cell_rotor_num ( void  )

Return cell rotor number.

Each cell may be associated with a given rotor, or rotation, with 0 indicating that that cell does not rotate.

Returns
array defining rotor number associated with each cell (0 for none, 1 to n otherwise)

◆ cs_turbomachinery_get_model()

cs_turbomachinery_model_t cs_turbomachinery_get_model ( void  )

Return rotor/stator model.

◆ cs_turbomachinery_get_rotation_matrices()

cs_real_34_t* cs_turbomachinery_get_rotation_matrices ( double  dt)

Build rotation matrices for a given time interval.

The caller is responsible for freeing the array when not needed.

Parameters
[in]dtassociated time delta (0 for current, unmodified time)
Returns
array of rotation matrices.

◆ cs_turbomachinery_get_rotation_velocity()

double cs_turbomachinery_get_rotation_velocity ( int  rotor_num)

Return rotation velocity.

Parameters
[in]rotor_numrotor number (1 to n numbering)

◆ cs_turbomachinery_initialize()

void cs_turbomachinery_initialize ( void  )

Initializations for turbomachinery computation.

Note
This function should be called after the mesh is built, but before cs_post_init_meshes() so that postprocessing meshes are updated correctly in the transient case.

◆ cs_turbomachinery_join_add()

int cs_turbomachinery_join_add ( const char *  sel_criteria,
float  fraction,
float  plane,
int  verbosity,
int  visualization 
)

Add a cs_join_t structure to the list of rotor/stator joinings.

Parameters
[in]sel_criteriaboundary face selection criteria
[in]fractionvalue of the fraction parameter
[in]planevalue of the plane parameter
[in]verbositylevel of verbosity required
[in]visualizationlevel of visualization required
Returns
number (1 to n) associated with new joining

◆ cs_turbomachinery_n_rotors()

int cs_turbomachinery_n_rotors ( void  )

Return number of rotors.

Note that the number of associated rotations is n_rotors + 1, as the first rotation id is reserved for the fixed portion of the domain.

Returns
number of rotors

◆ cs_turbomachinery_reinit_i_face_fields()

void cs_turbomachinery_reinit_i_face_fields ( void  )

Reinitialize interior face-based fields.

◆ cs_turbomachinery_relative_velocity()

void cs_turbomachinery_relative_velocity ( int  rotor_num,
const cs_real_t  coords[3],
cs_real_t  velocity[3] 
)

Compute velocity relative to fixed coordinates at a given point.

Deprecated:
Use cs_rotation_velocity for more consistent naming of this reference frame velocity.
Parameters
[in]rotor_numrotor number (1 to n numbering)
[in]coordspoint coordinates
[out]velocityvelocity relative to fixed coordinates

◆ cs_turbomachinery_resize_cell_fields()

void cs_turbomachinery_resize_cell_fields ( void  )

Resize cell-based fields.

This function only handles fields owning their values.

◆ cs_turbomachinery_restart_mesh()

void cs_turbomachinery_restart_mesh ( void  )

Update mesh for unsteady rotor/stator computation in case of restart.

Reads mesh from checkpoint when available.

◆ cs_turbomachinery_restart_read()

void cs_turbomachinery_restart_read ( cs_restart_t r)

Read turbomachinery metadata from restart file.

The mesh is handled separately.

Parameters
[in,out]rassociated restart file pointer

◆ cs_turbomachinery_restart_write()

void cs_turbomachinery_restart_write ( cs_restart_t r)

Write turbomachinery metadata to checkpoint file.

The mesh is handled separately.

Parameters
[in,out]rassociated restart file pointer

◆ cs_turbomachinery_rotate_fields()

void cs_turbomachinery_rotate_fields ( const cs_real_t  dt[])

Rotation of vector and tensor fields.

◆ cs_turbomachinery_rotation_matrix()

void cs_turbomachinery_rotation_matrix ( int  rotor_num,
double  theta,
cs_real_t  matrix[3][4] 
)

Compute rotation matrix.

Parameters
[in]rotor_numrotor number (1 to n numbering)
[in]thetarotation angle, in radians
[out]matrixresulting rotation matrix

◆ cs_turbomachinery_set_model()

void cs_turbomachinery_set_model ( cs_turbomachinery_model_t  model)

Define rotor/stator model.

◆ cs_turbomachinery_set_rotation_retry()

void cs_turbomachinery_set_rotation_retry ( int  n_max_join_retries,
double  dt_retry_multiplier 
)

Set turbomachinery joining retry parameters.

When a joing leads to a different number of boundary faces from the previous position, the rotor positions may be perturbed by a small quantity to try to obtain a better joining.

param[in] n_max_join_retries maximum number of retries before considering the joining has failed param[in] dt_retry_multiplier time step multiplier for new position retry

◆ cs_turbomachinery_set_rotation_velocity()

void cs_turbomachinery_set_rotation_velocity ( int  rotor_num,
double  omega 
)

Set rotation velocity.

param[in] rotor_num rotor number (1 to n numbering) param[in] omega rotation velocity

◆ cs_turbomachinery_update_mesh()

void cs_turbomachinery_update_mesh ( double  t_cur_mob,
double *  t_elapsed 
)

Update mesh for unsteady rotor/stator computation.

Parameters
[in]t_cur_mobcurrent rotor time
[out]t_elapsedelapsed computation time