|
My Project
programmer's documentation
|
Local variables to be added
Initialization and finalization
Initialization and finalization is similar to that of the base examples
int *nborne;
char name[8];
Computation of intensity (A/m2) for each electrode
Pre initialisation
for (int i = 0; i < nbelec; i++) {
sir[i] = 0.;
sii[i] = 0.;
}
for (int i = 0; i < nbtrf; i++) {
sirt[i] = 0.;
siit[i] = 0.;
nborne[i] = 0;
}
for (int i = 0; i < nbtrf; i++) {
}
}
for (int i = 0; i < nbelec; i++) {
sprintf(name,
"%07d", transfo->
ielecc[i]);
for (
cs_lnum_t ilelt = 0; ilelt < nelts; ilelt++) {
sir[i] += cpro_curre[cell_id][id] * b_face_normal[id][face_id];
sii[i] += cpro_curim[cell_id][id] * b_face_normal[id][face_id];
}
}
Definition of Voltage on each termin of transformers
Computation of Intensity on each termin of transformers:
for (int i = 0; i < nbelec; i++) {
}
for (int i = 0; i < nbelec; i++) {
if (transfo->
ielect[i] != 0) {
}
}
RVoltage on each termin:
for (int ntf = 0; ntf < nbtrf; ntf++) {
if (transfo->
ibrpr[ntf] == 0 &&
nborne[ntf] = 3;
double rnbs2 = 3. * transfo->
rnbs[ntf]
ur[ntf][0] = 1.154675 * transfo->
tenspr[ntf]
+ (transfo->
zr[ntf] * sirb[ntf][0]
- transfo->
zi[ntf] * siib[ntf][0]) / rnbs2;
ur[ntf][1] = -0.5773 * transfo->
tenspr[ntf]
+ (transfo->
zr[ntf] * sirb[ntf][1]
- transfo->
zi[ntf] * siib[ntf][1]) / rnbs2;
ur[ntf][2] =-0.5773 * transfo->
tenspr[ntf]
+ (transfo->
zr[ntf] * sirb[ntf][2]
- transfo->
zi[ntf] * siib[ntf][2]) / rnbs2;
ui[ntf][0] = (transfo->
zi[ntf] * sirb[ntf][0]
- transfo->
zr[ntf] * siib[ntf][0]) / rnbs2;
ui[ntf][1] = (transfo->
zi[ntf] * sirb[ntf][1]
- transfo->
zr[ntf] * siib[ntf][1]) / rnbs2;
ui[ntf][2] = (transfo->
zi[ntf] * sirb[ntf][2]
- transfo->
zr[ntf] * siib[ntf][2]) / rnbs2;
}
else
"transformer matrix not defined\n"));
}
Total intensity for a transformer (zero valued WHEN Offset established):
for (int ntf = 0; ntf < nbtrf; ntf++) {
sirt[ntf] = 0.;
siit[ntf] = 0.;
}
for (int i = 0; i < nbelec; i++) {
if (transfo->
ielect[i] != 0) {
sirt[i] += sir[i];
siit[i] += sii[i];
}
}
Take in account of Offset:
double capaeq = 3.;
for (int ntf = 0; ntf < nbtrf; ntf++) {
transfo->
uroff[ntf] += sirt[ntf] / capaeq;
transfo->
uioff[ntf] += siit[ntf] / capaeq;
}
}
for (int ntf = 0; ntf < nbtrf; ntf++) {
for (int nb = 0; nb < nborne[ntf]; nb++) {
ur[ntf][nb] += transfo->
uroff[ntf];
ui[ntf][nb] += transfo->
uioff[ntf];
}
}
bft_printf(
" ---------------------------------------\n");
bft_printf(
" ---------------------------------\n");
bft_printf(
" ---------------------------------\n");
for (int ntf = 0; ntf < nbtrf; ntf++)
bft_printf(
" ---------------------------------------\n");
Take in account of Boundary Conditions
for (int i = 0; i < nbelec; i++) {
sprintf(name,
"%07d", transfo->
ielecc[i]);
for (
cs_lnum_t ilelt = 0; ilelt < nelts; ilelt++) {
if (transfo->
ielect[i] != 0) {
icodcl[ivar * n_b_faces + face_id] = 1;
icodcl[ivar * n_b_faces + face_id] = 1;
}
}
else {
icodcl[ivar * n_b_faces + face_id] = 3;
rcodcl[2 * n_b_faces *
nvar + ivar * n_b_faces + face_id] = 0.;
icodcl[ivar * n_b_faces + face_id] = 3;
rcodcl[2 * n_b_faces *
nvar + ivar * n_b_faces + face_id] = 0.;
}
}
}
}
bool found = false;
for (
cs_lnum_t face_id = 0; face_id < n_b_faces; face_id++) {
if (
icodcl[ivar * n_b_faces + face_id] == 1) {
if (fabs(
rcodcl[ivar * n_b_faces + face_id]) < 1.e-20)
found = true;
}
double val = fabs(
rcodcl[ivar * n_b_faces + face_id]);
if (fabs(
rcodcl[ivar * n_b_faces + face_id]) < 1.e-20 &&
val < 1.e-20)
found = true;
}
}
}
}
if (!found)
"Lack of reference : choose a transformer for wich\n"
"offset is assumed zero or a face at ground on the\n"
"boundary\n"));
}
Finalization step
Test, if not any reference transformer a piece of wall may be at ground:
const cs_data_joule_effect_t * cs_glob_transformer
Definition: cs_field_pointer.h:173
Definition: cs_field_pointer.h:166
cs_mesh_quantities_t * cs_glob_mesh_quantities
cs_real_t cs_real_3_t[3]
vector of 3 floating-point values
Definition: cs_defs.h:315
cs_real_t * zr
Definition: cs_elec_model.h:86
cs_real_t * b_face_normal
Definition: cs_mesh_quantities.h:98
#define _(String)
Definition: cs_defs.h:52
cs_real_t * tenspr
Definition: cs_elec_model.h:84
Definition: cs_field_pointer.h:165
integer ieljou
pointer to specify Joule effect module (Laplace forces not taken into account) with indicator ippmod(...
Definition: ppincl.f90:167
void const int const int const int const int int int int int int int int int int int int int int int * icodcl
Definition: cs_gui_boundary_conditions.h:64
int nt_cur
Definition: cs_time_step.h:61
double cs_real_t
Floating-point value.
Definition: cs_defs.h:302
int * ielect
Definition: cs_elec_model.h:78
cs_lnum_t * b_face_cells
Definition: cs_mesh.h:88
cs_real_t * rnbs
Definition: cs_elec_model.h:85
cs_data_joule_effect_t * cs_get_glob_transformer(void)
Definition: cs_elec_model.c:562
cs_lnum_t n_b_faces
Definition: cs_mesh.h:75
void const cs_int_t const cs_int_t * nvar
Definition: cs_prototypes.h:104
int cs_glob_physical_model_flag[CS_N_PHYSICAL_MODEL_TYPES]
Definition: cs_physical_model.c:109
void bft_error(const char *const file_name, const int line_num, const int sys_error_code, const char *const format,...)
Calls the error handler (set by bft_error_handler_set() or default).
Definition: bft_error.c:193
int * ielecc
Definition: cs_elec_model.h:77
Definition: cs_physical_model.h:69
int cs_field_get_key_int(const cs_field_t *f, int key_id)
Return a integer value for a given key associated with a field.
Definition: cs_field.c:2976
#define BFT_MALLOC(_ptr, _ni, _type)
Allocate memory for _ni elements of type _type.
Definition: bft_mem.h:62
#define BFT_FREE(_ptr)
Free allocated memory.
Definition: bft_mem.h:101
#define CS_F_(e)
Macro used to return a field pointer by its enumerated value.
Definition: cs_field_pointer.h:51
Definition: cs_parameters.h:137
int * ibrsec
Definition: cs_elec_model.h:83
cs_real_t cs_real_6_t[6]
vector of 6 floating-point values
Definition: cs_defs.h:317
Definition: cs_field_pointer.h:172
int * ibrpr
Definition: cs_elec_model.h:82
int * ielecb
Definition: cs_elec_model.h:79
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:298
int nt_prev
Definition: cs_time_step.h:59
int nbtrf
Definition: cs_elec_model.h:80
cs_real_t * uroff
Definition: cs_elec_model.h:88
cs_real_t * uioff
Definition: cs_elec_model.h:89
int cs_field_key_id(const char *name)
Return an id associated with a given key name.
Definition: cs_field.c:2490
cs_real_t * zi
Definition: cs_elec_model.h:87
void cs_selector_get_b_face_list(const char *criteria, cs_lnum_t *n_b_faces, cs_lnum_t b_face_list[])
Fill a list of boundary faces verifying a given selection criteria.
Definition: cs_selector.c:213
int nbelec
Definition: cs_elec_model.h:76
int ntfref
Definition: cs_elec_model.h:81
const cs_time_step_t * cs_glob_time_step
void cs_int_t cs_int_t * lstelt
Definition: cs_syr_coupling.h:194
Field descriptor.
Definition: cs_field.h:124
void const int const int const int const int int int int int int int int int int int int int int int double double double double double double double double double double int double * rcodcl
Definition: cs_gui_boundary_conditions.h:64
int bft_printf(const char *const format,...)
Replacement for printf() with modifiable behavior.
Definition: bft_printf.c:140
Structure to read transformer parameters in dp_ELE.
Definition: cs_elec_model.h:75