40 #include "materials.hh"
43 static void flow_cs(
struct Transport *transport);
44 static void output_AGE(
struct Transport *transport,
double time);
46 static void clear_tbc(
struct Transport *transport);
49 static void sfsec(
struct Transport *transport);
56 static void output_FCS(
struct Transport *transport);
67 if(transport->fsec->elc != NULL){
84 problem->ftrans_out = get_b(
"Output",
"Write_ftrans_out",
false );
85 problem->cross_section = get_b(
"Output",
"Cross_section",
false );
86 problem->cs_params = get_s(
"Output",
"Cs_params",
"0 0 0 0 0 0 0" );
89 problem->specify_elm_output = get_b(
"Output",
"Specify_elm_type",
false );
90 problem->output_elm_type = get_i(
"Output",
"Output_elm_type", 1 );
91 problem->fsec_params = get_s(
"Output",
"FCs_params",
"0 0 0 0 0" );
102 fsec = transport->fsec;
108 if( sscanf( transport->fsec->fcs_params,
"%lf %lf %lf %lf %d",
121 fsec->
eqn[i] /= norm;
131 void sfsec(
struct Transport *transport)
133 Mesh* mesh = (
Mesh*) ConstantDB::getInstance()->getObject(MESH::MAIN_INSTANCE);
142 fs = transport->fsec;
147 nod->
aux =
SGN(nod->faux);
154 if(elm->node[i]->aux == -1){
158 if(elm->node[i]->aux == 1)
162 ec =
new_ec(transport,elm,ec);
169 if(elm->side[i]->node[j]->aux != 0)
171 if((b1 == 1) && (elm->aux == -1)){
172 ec =
new_ec(transport,elm,ec);
193 if(transport->fsec->elc == NULL)
194 transport->fsec->elc = ec;
199 transport->fsec->n_elm++;
210 val = eqn[0] * node->
getX() +
211 eqn[1] * node->
getY() +
212 eqn[2] * node->
getZ() +
230 if(elm->node[i]->aux == 0)
235 for(j=n;j<elm->n_nodes;j++)
236 if((elm->node[i]->aux != 0) && (elm->node[j]->aux != 0)){
238 cut_point(elm->node[i],elm->node[j],transport->fsec->eqn);
265 double v[3],t,d,*
point;
269 v[0] = node0->
getX() - node1->
getX();
270 v[1] = node0->
getY() - node1->
getY();
271 v[2] = node0->
getZ() - node1->
getZ();
279 if((t <= 1) && (t >
ZERO)){
280 point = (
double*)
xmalloc(3*
sizeof(
double));
281 point[0] = node1->
getX() + t * v[0];
282 point[1] = node1->
getY() + t * v[1];
283 point[2] = node1->
getZ() + t * v[2];
294 point = (
double*)
xmalloc(3*
sizeof(
double));
295 point[0] = node->
getX();
296 point[1] = node->
getY();
297 point[2] = node->
getZ();
307 double vector[3],u[3],v[3],en[3],flux,l;
334 u[ 0 ] = elm->node[ 1 ]->getX() - elm->node[ 0 ]->getX();
335 u[ 1 ] = elm->node[ 1 ]->getY() - elm->node[ 0 ]->getY();
336 u[ 2 ] = elm->node[ 1 ]->getZ() - elm->node[ 0 ]->getZ();
337 v[ 0 ] = elm->node[ 2 ]->getX() - elm->node[ 0 ]->getX();
338 v[ 1 ] = elm->node[ 2 ]->getY() - elm->node[ 0 ]->getY();
339 v[ 2 ] = elm->node[ 2 ]->getZ() - elm->node[ 0 ]->getZ();
368 sprintf( dbl_fmt,
"%%.%dg", ConstantDB::getInstance()->getInt(
"Out_digit"));
369 sprintf(file,
"%s.fcs", IONameHandler::get_instance()->get_output_file_name(
OptGetFileName(
"Output",
"Output_file", NULL)) );
377 xfprintf(out,dbl_fmt,ec->
point[0][transport->fsec->axis_output]);
382 if(ec->
point[0][transport->fsec->axis_output] > ec->
point[1][transport->fsec->axis_output]){
383 xfprintf(out,dbl_fmt,ec->
point[0][transport->fsec->axis_output]);
385 xfprintf(out,dbl_fmt,ec->
point[1][transport->fsec->axis_output]);
388 xfprintf(out,dbl_fmt,ec->
point[1][transport->fsec->axis_output]);
390 xfprintf(out,dbl_fmt,ec->
point[0][transport->fsec->axis_output]);
399 xfprintf(out,
"Total flux of cut : ");
475 Mesh* mesh = (
Mesh*) ConstantDB::getInstance()->getObject(MESH::MAIN_INSTANCE);
480 for(i=start;i<stop;i++){
481 transport->conc[
MOBILE][0][i] = 0.0;
482 transport->pconc[
MOBILE][0][i] = 0.0;
void vector_product(double u[], double v[], double x[])
#define FOR_ELEMENT_NODES(i, j)
static int create_flow_section(struct Transport *transport)
ElementVector::Iter ElementIter
static double * assign_node_coordinates(Node *node)
#define FOR_ELEMENTS(_mesh_, __i)
int xfclose(FILE *stream)
FCLOSE WITH ERROR HANDLING.
int xfprintf(FILE *out, const char *fmt,...)
FPRINTF WITH ERROR HANDLING.
#define FOR_ELEMENT_SIDES(i, j)
static void sfsec(struct Transport *transport)
void normalize_vector(double u[])
double vector_length(double v[])
I/O functions with filename storing, able to track current line in opened file. All standard stdio fu...
char * OptGetFileName(const char *section, const char *key, const char *defval)
static void output_FCS(struct Transport *transport)
static struct ElementCut * new_ec(struct Transport *transport, ElementIter elm, struct ElementCut *prev_ec)
unsigned int n_elements() const
static void clear_tbc(struct Transport *transport)
static void flow_cs(struct Transport *transport)
unsigned int n_boundaries() const
double scalar_product(double u[], double v[])
#define FOR_SIDE_NODES(i, j)
#define FOR_NODES(_mesh_, i)
static double particle_test(struct Transport *transport)
static void compute_cutplane(struct Transport *trannsport)
static void compute_flux(struct ElementCut *ec, struct FSection *fs)
void * xmalloc(size_t size)
Memory allocation with checking.
#define FOR_ELEMENTCUT(i)
static void output_AGE(struct Transport *transport, double time)
void vector_difference(double u[], double v[], double x[])
static double * cut_point(Node *node0, Node *node1, double eqn[4])
FILE * xfopen(const std::string &fname, const char *mode)
char * OptGetStr(const char *section, const char *key, const char *defval)
Create new string from selected variable from ini file.
static double node_pos(Node *node, double *eqn)