static void update_bdry_inflow(np_t *np, gl_t *gl, long lA, long lB, long lC, long theta, long thetasgn, bool BDRYDIRECFOUND){ double P,T; spec_t w; dim_t V; long spec,dim; assert_np(np[lA],is_node_resumed(np[lA])); P=_P(np[lA],gl); T=_T(np[lA],gl); for (spec=0; spec<ns; spec++) w[spec]=_w(np[lA],spec); for (dim=0; dim<nd; dim++) V[dim]=_V(np[lA],dim); find_U_2(np, lA, gl, w, V, P, T); }
static void update_bdry_outflow_Mach(np_t *np, gl_t *gl, long lA, long lB, long lC, long theta, int ACCURACY){ long spec,dim; spec_t rhok; double P, Mdes, Mextr; double V_temp, Vmag; dim_t V; bool ref_flag; assert_np(np[lA],is_node_resumed(np[lA])); /* Store desired Mach number (Mdes) at C */ V_temp=0.0; for (dim=0; dim<nd; dim++){ V_temp=V_temp+sqr(_V(np[lA],dim)); } Vmag=sqrt(V_temp); Mdes=Vmag/_a(np[lA],gl); /* Extrapolate Mach number (Mextr) at C from A and B */ P=_f_extrapol(ACCURACY,_P(np[lB],gl), _P(np[lC],gl)); for (spec=0; spec<ns; spec++){ rhok[spec]=_f_extrapol(ACCURACY,_rhok(np[lB],spec),_rhok(np[lC],spec)); } reformat_rhok(gl,rhok,"_bdry",&ref_flag); for (dim=0; dim<nd; dim++){ V[dim]=_f_extrapol(ACCURACY,_V(np[lB],dim),_V(np[lC],dim)); } find_U_3(np, lA, gl, rhok, V, P); V_temp=0.0; for (dim=0; dim<nd; dim++){ V_temp=V_temp+sqr(_V(np[lA],dim)); } Vmag = sqrt(V_temp); Mextr=Vmag/_a(np[lA],gl); /* Modify velocity components to give Mdes */ for (dim=0; dim<nd; dim++){ V[dim]=( _V(np[lA],dim)*Mdes/Mextr ); } find_U_3(np, lA, gl, rhok, V, P); }
static void update_bdry_back_pressure(np_t *np, gl_t *gl, long lA, long lB, long lC, long theta, int ACCURACY){ long spec,dim; spec_t rhok; double P; dim_t V; bool ref_flag; assert_np(np[lA],is_node_resumed(np[lA])); P=_P(np[lA],gl); for (spec=0; spec<ns; spec++){ rhok[spec]=_f_extrapol(ACCURACY,_rhok(np[lB],spec),_rhok(np[lC],spec)); } for (dim=0; dim<nd; dim++){ V[dim]=_f_extrapol(ACCURACY,_V(np[lB],dim),_V(np[lC],dim)); } reformat_rhok(gl,rhok,"_bdry",&ref_flag); find_U_3(np, lA, gl, rhok, V, P); }
static void update_bdry_outflow(np_t *np, gl_t *gl, long lA, long lB, long lC, long theta, long thetasgn, bool BDRYDIRECFOUND, int ACCURACY){ double P,T; spec_t w; dim_t V; long spec,dim; bool ref_flag; assert_np(np[lA],is_node_resumed(np[lA])); P=_f_extrapol(ACCURACY,_P(np[lB],gl),_P(np[lC],gl)); T=_f_extrapol(ACCURACY,_T(np[lB],gl),_T(np[lC],gl)); for (spec=0; spec<ns; spec++){ w[spec]=_f_extrapol(ACCURACY,_w(np[lB],spec),_w(np[lC],spec)); } for (dim=0; dim<nd; dim++){ V[dim]=_f_extrapol(ACCURACY,_V(np[lB],dim),_V(np[lC],dim)); } reformat_w(gl,w,"_bdry",&ref_flag); find_U_2(np, lA, gl, w, V, P, T); }
/* Parse a single option. */ static int opts_parse_opt(const char *cmd, int key, char *arg, struct opts *opts) { struct event event; struct event *event_node; memset(&event, 0, sizeof(event)); switch (key) { case 'T': _req_opt('T')->cnt++; opts->htime = arg ? atoi(arg) : -1; break; case 'P': _req_opt('T')->cnt++; opts->ptime = arg ? atoi(arg) : -1; break; case 'c': _req_opt('c')->cnt++; strncpy(opts->ftrace_clock, arg, NAME_MAX); break; case 's': _req_opt('s')->cnt++; opts->ftrace_buffsz = arg ? atoi(arg) : -1; break; case 'v': _req_opt('v')->cnt++; if (arg[0] >= '0' && arg[0] <= '9') *opts->loglevel = arg ? atoi(arg) : 0; else { int ok; *opts->loglevel = str2loglevel(arg, &ok); if (!ok) LOGW("loglevel [%s] invalid. Falling back to default\n", arg); } break; case 'z': _req_opt('z')->cnt++; opts->daemon = 1; break; case 'm': _req_opt('m')->cnt++; strncpy(opts->debugfs_path, arg, PATH_MAX); break; case 'w': _req_opt('w')->cnt++; strncpy(opts->workdir, arg, PATH_MAX); break; case 'o': _req_opt('o')->cnt++; strncpy(opts->outfname, arg, PATH_MAX); break; case 'p': _req_opt('p')->cnt++; opts->pid = arg ? atoi(arg) : 0; break; case 't': _req_opt('t')->cnt++; opts->threads = 1; break; case 'e': _req_opt('e')->cnt++; strncpy(event.name, arg, PATH_MAX); event.id = uq_eid++; assert_np(mlist_add_last(etrace.event_list, &event)); break; case 'f': _req_opt('f')->cnt++; assert_np(event_node = mdata_curr(etrace.event_list)); if (event_node->filter && strnlen(event_node->filter, FILTER_MAX) > 0) { LOGE("Filer [%s] is overwritten by [%s] for event [%s] (#%d)", event_node->filter, arg, event_node->name, mlist_len(etrace.event_list)); LOGE("Check order for options -e and -f\n"); return E_OPT_USAGE; } event_node->filter = strndup(arg, FILTER_MAX); break; case 'i': _req_opt('i')->cnt++; opts->rid = arg ? atoi(arg) : 0; break; case 'u': _req_opt('u')->cnt++; opts_help(stdout, HELP_USAGE | HELP_EXIT); break; case 'h': _req_opt('h')->cnt++; opts_help(stdout, HELP_LONG | HELP_EXIT); break; case 'D': _req_opt('D')->cnt++; doc_print(); etrace_exit(0); break; case '?': /* getopt_long already printed an error message. */ opts_help(stderr, HELP_TRY | HELP_EXIT_ERR); break; case ':': /* getopt_long already printed an error message. */ fprintf(stderr, "%s: option `-%c' requires an argument\n", cmd, optopt); opts_help(stderr, HELP_TRY | HELP_EXIT_ERR); break; case 'V': _req_opt('V')->cnt++; opts_help(stdout, HELP_VERSION | HELP_EXIT); break; default: fprintf(stderr, "etrace: unrecognized option '-%c'\n", (char)key); opts_help(stderr, HELP_TRY | HELP_EXIT_ERR); break; } return OPT_OK; }