Esempio n. 1
0
/**
* TODO: Implementar las funcion interpolation
*/
void interpolation(fluid fluido, mesh membrana, int x, int y, int z)
{
	//Recorrer todos los nodos de la malla
	float pos[3], distancia[3], delta, a, A, b, B, c, C, ux=0.0, uy=0.0, uz=0.0;
	int nNodos = membrana.darNumeroNodos();
	for(int u=0;u<nNodos;u++)
	{
		membrana.darPosNodo(u, pos);
		a = pos[0]-3.0;
		A = pos[0]+3.0;
		b = pos[1]-3.0;
		B = pos[1]+3.0;
		c = pos[2]-3.0;
		C = pos[2]+3.0;
		
		for(int i = (int) a;i<A;i++)
			for(int j = (int) b;j<B;j++)
				for(int k=(int) c;k<C;k++)
				{
					distancia[0]=pos[0]-i;
					distancia[1]=pos[1]-j;
					distancia[2]=pos[2]-k;
					delta = dirac_4(distancia);
					ux+=delta*fluido.darVelocidad(i,j,k,0);
					uy+=delta*fluido.darVelocidad(i,j,k,1);
					uz+=delta*fluido.darVelocidad(i,j,k,2);
				}
		membrana.setVelocidad(u,ux,uy,uz);
		ux=0.0;
		uy=0.0;
		uz=0.0;
	}
}