| ²é¿´: 2901 | »Ø¸´: 8 | ||||
[½»Á÷]
UDFµÄÎÊÌâ ÒÑÓÐ2È˲ÎÓë
|
|
UDFµÄÄÚÈÝÈçÏÂ: #include "udf.h" #include <stdio.h> #include "dynamesh_tools.h" static int nozzle_tid = 10; static real g_c = 9.81; static real loc = 0.0; static real initial_weight = 10.0; static real burn_rate = 0.0; static real current_time = -1.0; static real thrust_prev = 0.0; static real missile_velocity = 0.0; static real missile_weight (real time) { return (initial_weight - burn_rate * time); } DEFINE_ON_DEMAND(reset_velocity) { missile_velocity = 0.0; thrust_prev = 0.0; current_time = -1.0; } DEFINE_CG_MOTION(missile_1dof, dt, cg_vel, cg_omega, time, dtime) { #if 1 FILE *fp; #endif /* reset velocities */ NV_S (cg_vel, =, 0.0); NV_S (cg_omega, =, 0.0); if (!Data_Valid_P ()) return; /* Give rocket time to establish thrust for specified time */ if (time < 0.1) Message (" NO MOTION YET: TIME LESS THAN 0.1 SECONDS " ; if (time < 0.1) return; /* update missile velocity only if we are at the next new time level */ if ((time - 0.1*dtime) > current_time) { Domain *domain; Thread *t; face_t f; real force0, force1, force; real area, total, v_avg, dv; real w0, w1, mass_flow; /* update time stamp */ current_time = time; /* get nozzle exit thread (from predefined thread id) */ domain = THREAD_DOMAIN (DT_THREAD ((Dynamic_Thread *)dt)); if (NULLP (t = Lookup_Thread (domain, nozzle_tid))) return; /* compute average exit velocity (weighted by area) */ v_avg = 0.0; total = 0.0; begin_f_loop (f, t) { area = NV_MAG (F_AREA_CACHE (f, t)); #if RP_3D v_avg += area * ND_MAG (F_U (f, t), F_V (f, t), F_W (f, t)); #else v_avg += area * ND_MAG (F_U (f, t), F_V (f, t), 0.0); #endif total += area; } end_f_loop (f, t) v_avg /= total; /* subtract off missile_velocity to get relative velocity */ /* ??? v_avg = v_avg - missile_velocity; */ /* compute thrust from mdot and v_e note: assume nozzle_exit is type mass-flow-exit */ if (THREAD_VAR(t).mfi.flow_spec == MASS_FLOW_TYPE) mass_flow = THREAD_VAR(t).mfi.mass_flow; else { real mass_flow; /* if mass_flux given as profile, then sum up area * mass_flux over face thread, else, mass_flux is constant */ if (IS_PROFILE (THREAD_VAR (t).mfi.mass_flux)) { begin_f_loop (f, t) mass_flow = NV_MAG (F_AREA_CACHE (f, t)) * F_VAR (f, t, THREAD_VAR (t).mfi.mass_flux); end_f_loop (f, t) } else { mass_flow = THREAD_VAR(t).mfi.mass_flux.constant * total; } #if RP_2D if (rp_axi) mass_flow *= 2.0 * M_PI; #endif } force = v_avg * F_VAR (0, t, THREAD_VAR(t).mfi.mass_flux) / total; /* compute change in velocity (use trapezoidal rule) */ w0 = missile_weight (time - dtime); force0 = (thrust_prev - w0 * g_c) / w0; w1 = missile_weight (time); force1 = (force - w1 * g_c) / w1; dv = MAX (0.0, 0.5 * dtime * (force0 + force1)); missile_velocity += dv; loc += missile_velocity * dtime; thrust_prev = force; #if 1 if( (fp=fopen("silo.dat","a" ) !=NULL ){ float check = F_FLUX(f,t)+F_GRID_FLUX(f,t); fprintf(fp,"%f %f %f %f %f %f \n", time,missile_velocity,loc,v_avg,F_FLUX(f,t),F_GRID_FLUX(f,t)); fclose(fp); } #endif Message ("time = %12.5e, x_vel = %12.5e, force = %12.5e, loc(m)= %1.5e\n", time, missile_velocity, 0.5*(force0 + force1), loc); } /* set missile velocity */ cg_vel[0] = missile_velocity; } ±àÒëÐÍUDF£¬buildºóµÄÌáʾÈçÏ£º silo.c ..\..\src\silo.c(94) : error C2440: ¡°=¡±: ÎÞ·¨´Ó¡°Profile¡±×ª»»Îª¡°real¡± Á¬×ųöÁ˺ü¸¸öÎÊÌ⣬ÏÖÔÚ¶¼ÒѾÔκõÁË£¬ÇóÖú£¡£¡£¡£¡£¡ |
» ²ÂÄãϲ»¶
265Çóµ÷¼Á
ÒѾÓÐ6È˻ظ´
²ÄÁÏÇóµ÷¼Á
ÒѾÓÐ13È˻ظ´
Ò»Ö¾Ô¸Ö£ÖÝ´óѧ²ÄÁÏÓ뻯¹¤085600£¬Çóµ÷¼Á
ÒѾÓÐ26È˻ظ´
070300»¯Ñ§279Çóµ÷¼Á
ÒѾÓÐ18È˻ظ´
²ÄÁϵ÷¼Á
ÒѾÓÐ8È˻ظ´
»¯¹¤Çóµ÷¼Á£¡
ÒѾÓÐ6È˻ظ´
290Çóµ÷¼Á085701
ÒѾÓÐ11È˻ظ´
085600²ÄÁÏÓ뻯¹¤×¨Ë¶329 Çóµ÷¼Á
ÒѾÓÐ6È˻ظ´
295Çóµ÷¼Á
ÒѾÓÐ15È˻ظ´
Ò»Ö¾Ô¸ºÓ±±¹¤Òµ´óѧ²ÄÁϹ¤³Ì£¬³õÊÔ344Çóר˶µ÷¼Á
ÒѾÓÐ6È˻ظ´


2Â¥2015-11-03 16:48:11
ls315920
гæ (СÓÐÃûÆø)
- Ó¦Öú: 0 (Ó×¶ùÔ°)
- ½ð±Ò: 140.5
- Ìû×Ó: 64
- ÔÚÏß: 20.9Сʱ
- ³æºÅ: 4120687
- ×¢²á: 2015-10-05
- ÐÔ±ð: GG
- רҵ: ´«ÈÈ´«ÖÊѧ

3Â¥2015-11-03 18:44:31

4Â¥2015-11-04 11:42:11

5Â¥2015-11-04 15:55:15

6Â¥2015-11-05 08:53:32
ËÀÌì
ר¼Ò¹ËÎÊ (ÖøÃûдÊÖ)
-

ר¼Ò¾Ñé: +60 - Ó¦Öú: 399 (˶ʿ)
- ½ð±Ò: 3648.9
- ºì»¨: 89
- Ìû×Ó: 1336
- ÔÚÏß: 443.8Сʱ
- ³æºÅ: 2643057
- ×¢²á: 2013-09-09
- רҵ: Á÷ÌåÁ¦Ñ§
- ¹ÜϽ: ·ÂտģÄâ
¡ï
Сľ³æ: ½ð±Ò+0.5, ¸ø¸öºì°ü£¬Ð»Ð»»ØÌû
Сľ³æ: ½ð±Ò+0.5, ¸ø¸öºì°ü£¬Ð»Ð»»ØÌû
|
mass_flow = THREAD_VAR(t).mfi.mass_flow;Õâ¸öÓÐÎÊÌâ THREAD_VAR(t).mfi.mass_flowµÄÒâ˼ÊÇ£¬Í¨Ë×µÄ˵THREAD_VAR(t)ÁбíϵÄmfiÁбíϵÄmass_flowµÄ±äÁ¿È¡Öµ£¬Èç¹ûÎÒûÓмǴíµÄ»°£¨ÊÖͷûÓÐUDF£¬Ã»·¨²éѯ£©£¬Õâ¸ö±äÁ¿µÄ·µ»ØÖµ²»ÊÇ¿ÉÓÃÓÚ¼ÆËãµÄÖµ£¬¶øÊÇfluent×Ô¶¨ÒåµÄ±äÁ¿ÀàÐÍ¡£ |
7Â¥2015-11-05 12:21:16

8Â¥2015-11-11 15:10:00
ËÀÌì
ר¼Ò¹ËÎÊ (ÖøÃûдÊÖ)
-

ר¼Ò¾Ñé: +60 - Ó¦Öú: 399 (˶ʿ)
- ½ð±Ò: 3648.9
- ºì»¨: 89
- Ìû×Ó: 1336
- ÔÚÏß: 443.8Сʱ
- ³æºÅ: 2643057
- ×¢²á: 2013-09-09
- רҵ: Á÷ÌåÁ¦Ñ§
- ¹ÜϽ: ·ÂտģÄâ
9Â¥2015-11-11 18:42:32














;
»Ø¸´´ËÂ¥