Commit 5c320973 authored by Matthieu Constant's avatar Matthieu Constant
Browse files

3d adapt

parent bb5b56ec
......@@ -673,7 +673,6 @@ static void _particleProblemSolveContactsQueue(ParticleProblem *p, double dt, do
fifoPush(queue, i);
activeContact[i] = 1;
}
for (size_t ic = fifoPop(queue); ic != FIFO_EMPTY; ic=fifoPop(queue)){
Contact *c = &p->contacts[ic];
double dp;
......
......@@ -717,22 +717,27 @@ void fluid_problem_adapt_gen_mesh(FluidProblem *problem, double gradmin, double
}
}
double nOfEl = 0.0;
#if DIMENSION==2
for (int i = 0; i < mesh->n_nodes; ++i){
new_mesh_size[i] /= num_lc[i];
double nOfElByNode = 4*problem->node_volume[i]/(new_mesh_size[i]*new_mesh_size[i]*sqrt(3));
nOfEl += nOfElByNode;
}
printf("Total number of element before rescale = %g\n",nOfEl);
double ratioEl = n_el/nOfEl;
for (int i = 0; i < mesh->n_nodes; ++i){
new_mesh_size[i] = fmax(new_mesh_size[i]/sqrt(ratioEl),lcmin);
}
nOfEl = 0.;
#else
for (int i = 0; i < mesh->n_nodes; ++i){
double nOfElByNode = 4*problem->node_volume[i]/(new_mesh_size[i]*new_mesh_size[i]*sqrt(3));
new_mesh_size[i] /= num_lc[i];
double nOfElByNode = 12*problem->node_volume[i]/(new_mesh_size[i]*new_mesh_size[i]*new_mesh_size[i]*sqrt(2));
nOfEl += nOfElByNode;
}
printf("Total number of element after rescale = %g\n",nOfEl);
double ratioEl = n_el/nOfEl;
for (int i = 0; i < mesh->n_nodes; ++i){
new_mesh_size[i] = fmax(new_mesh_size[i]/cbrt(ratioEl),lcmin);
}
#endif
FILE *f = fopen("adapt/lc.pos", "w");
if(!f)
printf("cannot open file adapt/lc.pos for writing\n");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment