Discussion:
[ff3d-users] Some questions
Augusto Almeida
18 years ago
Permalink
Hi!

I need to make the classic simulation os two parallel "infinite" plates, to
obtain the 3d vector field and a cut plane with 2d vector field in middle of
enviroment.

At first :

- I need a 70x70x70 mesh of the enviroment (the edges does not necessary),
because I compare with a parabolic behaviour;

- How I save a 3d vector field in format (u, v, w) (the size is 343000
registers) and (u, v) (4900 registers).

- A mesh 70x70x70 really uses too much memory??? (I got a 1Gb but with
44x44x44, ff3d consums aroud 800Mb!)

Follow the code (sorry I wrote something in Portuguese)

double limite_inf = 0.0;
double limite_sup = 1.0;
double dimensao = 5.0;
double dimensao_refinada = 44.0;

// Definindo a dimensao do solido (deve ser menor para evitar calculos
// desnecessarios pois dentro do solido a velocidade e zero)
vector normal = (dimensao, dimensao, dimensao);

// Definindo a dimensao da malha onde o fluido percorre
vector refinado = (dimensao_refinada, dimensao_refinada, dimensao_refinada);

// Definindo os limites superiores e inferiores da "caixa" onde ocorre a
// simulacao
vertex ini = (limite_inf, limite_inf, limite_inf);
vertex fin = (limite_sup, limite_sup, limite_sup);

// Criando as malhas
mesh MALHA = structured(normal , ini, fin);
mesh MALHA_REFINADA = structured(refinado, ini, fin);

// Carregando o arquivo com as geometrias usadas no experimento
scene placas = pov("placas_paralelas.pov");

// Definindo o dominio fora (outside) dos solidos
domain DOMINIO = domain(placas, outside(<0,0,1>) && outside(<0,1,0>));

// Definindo solido com refinamento inferior ao da malha
mesh obstacle = surface(DOMINIO, MALHA);

// Funcao de penalizacao para nao realizar calculo dentro do solido
function P = 1E3 * (one(<0,0,1>) + one(<0,1,0>)) + 1;

// Calculo da area
double area = int[MALHA](1);

function uin = 0.001;
function mu = 0.1;
femfunction u0(MALHA) = 0;
femfunction v0(MALHA) = 0;
femfunction w0(MALHA) = 0;
femfunction p0(MALHA_REFINADA) = 0;

double dt = 0.01;
double pp;
double qq;

double i = 1;

function u = 0;
function v = 0;
function w = 0;

do{
cout << "========== Placas Paralelas, Navier-Stokes passo " << i <<
"\n";

// Calculo da componente x
solve(u) in MALHA
krylov(type=cg, precond=ichol)
{
pde(u)
(P / dt) * u - div(mu * grad(u)) = ((1 / dt) * convect([u0,v0,w0], dt,
u0) - dx(p0));
u = uin on MALHA xmin;
u = 0 on MALHA ymin;
u = 0 on MALHA ymax;
u = 0 on MALHA zmin;
u = 0 on MALHA zmax;
};

// Calculo da componente y
solve(v) in MALHA
krylov(type=cg,precond=ichol)
{
pde(v)
(P / dt) * v - div(mu * grad(v)) = ((1 / dt) * convect([u0,v0,w0], dt,
v0) - dy(p0));
v = 0 on MALHA xmin;
v = 0 on MALHA ymin;
v = 0 on MALHA ymax;
v = 0 on MALHA zmin;
v = 0 on MALHA zmax;
};

// Calculo da componente z
solve(w) in MALHA
krylov(type=cg,precond=ichol)
{
pde(w)
(P / dt) * w - div(mu * grad(w)) = ((1 / dt) * convect([u0,v0,w0], dt,
w0) - dz(p0));
w = 0 on MALHA xmin;
w = 0 on MALHA ymin;
w = 0 on MALHA ymax;
w = 0 on MALHA zmin;
w = 0 on MALHA zmax;
};

qq = int[MALHA](dx(u) + dy(v) + dz(w)) / area;
solve(q) in MALHA_REFINADA
krylov(type=cg,precond=ichol)
{
pde(q)
- div(dt * grad(q)) = (dx(u) + dy(v) + dz(w) - qq);

q = 0 on MALHA_REFINADA xmax;
};

p0 = p0 - q;
pp = int[MALHA](p0) / area;
p0 = p0 - pp;
u0 = u + (dt * dx(q));
v0 = v + (dt * dy(q));
w0 = w + (dt * dz(q));

i = i + 1;

} while(i <= 10);

// transforma o objeto em uma figura tetraédrica
mesh T = tetrahedrize(DOMINIO, MALHA_REFINADA);

// salva a malha
save(vtk, "ns_placas",[u,v,w],MALHA_REFINADA);

save(raw,"veloclaminas00.vec", [u, v], MALHA_REFINADA);
save(raw,"veloclaminas003d.vec", [u, v, w], MALHA_REFINADA);
save(medit,"placas_paralelas_vel",T);
save(medit,"placas_paralelas_vel",[u,v,w],T);
save(medit,"placas_paralelas_pressao",T);
save(medit,"placas_paralelas_pressao",p0,T);


..POV

box {<0.0,0.0,0.0>,<1.0,0.3,1.0> pigment {color rgb <0,0,1>}}

box {<0.0,0.7,0.0>,<1.0,1.0,1.0> pigment {color rgb <0,1,0>}}

Thanks!

_________________________________________________________________
Verifique já a segurança do seu PC com o Verificador de Segurança do Windows
Live OneCare! http://onecare.live.com/site/pt-br/default.htm
Stephane Del Pino
18 years ago
Permalink
Hello again.
Post by Augusto Almeida
- A mesh 70x70x70 really uses too much memory??? (I got a 1Gb but with
44x44x44, ff3d consums aroud 800Mb!)
Yes. This uses a lot of memory since the matrices are stored into memory. This
can be reduced using the options :

memory(matrix=none),
krylov(type=cg,precond=diagonal)

for each solver. It is a bit slower but uses much less memory.

Best regards,
Stéphane.

Continue reading on narkive:
Loading...