static struct Multiarray_T* constructor_sol_free_stream_trig_x
	(const struct const_Multiarray_T* xyz, const struct Simulation* sim, const struct Sol_Data__fs*const sol_data)
{
	const ptrdiff_t n_n = xyz->extents[0];
	assert(DIM == xyz->extents[1]);
	assert(DIM >= 2);
	assert(sol_data->pert_mag != 0.0);

	struct Test_Case_T* test_case = (struct Test_Case_T*)sim->test_case_rc->tc;
	const int n_var = test_case->n_var;

	const Type*const x = get_col_const_Multiarray_T(0,xyz),
	          *const y = get_col_const_Multiarray_T(1,xyz);

	struct Multiarray_T* sol = constructor_empty_Multiarray_T('C',2,(ptrdiff_t[]){n_n,n_var}); // returned

	const Real rho_fs = sol_data->rho,
	           p_fs   = sol_data->p,
	           c_fs   = sqrt(GAMMA*p_fs/rho_fs);
	const Real mag    = sol_data->pert_mag;

	const Real V_fs   = sol_data->mach*c_fs,
	           u_fs   = V_fs*cos(sol_data->theta),
	           v_fs   = V_fs*sin(sol_data->theta);
	assert(u_fs != 0.0); // For perturbation below.

	Type* rho = get_col_Multiarray_T(0,sol),
	    * u   = get_col_Multiarray_T(1,sol),
	    * v   = get_col_Multiarray_T(2,sol),
	    * p   = get_col_Multiarray_T(n_var-1,sol);
	for (int i = 0; i < n_n; ++i) {
		const Real scale = 1e-1*PI,
		           shift = -0.8712;
/// \todo Delete unused and clean up.
UNUSED(scale); UNUSED(shift); UNUSED(y); UNUSED(mag);
#if 0
		rho[i] = rho_fs + mag*sin(scale*y[i]+shift);
		u[i]   = u_fs;// + mag*cos(scale*y[i]+shift);
		v[i]   = v_fs;
//		p[i]   = p_fs + mag*sin(scale*y[i]+shift);
		p[i]   = pow(rho[i],GAMMA);
#else
UNUSED(v_fs);
UNUSED(x);
		rho[i] = rho_fs;//+ mag*sin(scale*y[i]+shift);
		p[i]   = p_fs;
		const Type c = sqrt_T(GAMMA*p[i]/rho[i]);
//		u[i]   = 2.0/GM1*c-5.4;
		u[i]   = -2.0/GM1*c+6.4;
#if TYPE_RC == TYPE_REAL
//printf("%f %f %f\n",c,u[i],u[i]/c);
#endif
		v[i]   = 0.0;
//		rho[i] = rho_fs;
//		p[i]   = p_fs;
#endif
	}

	if (DIM == 3) {
		EXIT_ADD_SUPPORT;
		Type* w = get_col_Multiarray_T(3,sol);
		for (int i = 0; i < n_n; ++i)
			w[i] = 0.0;
	}
	convert_variables_T(sol,'p','c');

	return sol;
}
Ejemplo n.º 2
0
	cuda_device friend T length(const vector4& v) {
		return sqrt_T(v.dot(v));
	}