Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
fluidparticles
MigFlow
Commits
f19937d4
Commit
f19937d4
authored
Mar 22, 2021
by
Jonathan Lambrechts
Browse files
do not create mesh tree if not needed
parent
38e9193d
Pipeline
#9186
passed with stages
in 4 minutes and 15 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
fluid/fluid_problem.c
View file @
f19937d4
...
...
@@ -35,6 +35,13 @@
#define LOCAL_MATRIX(i,j,a,b) local_matrix[((i)*n_fields*N_SF+N_SF*(a)+(j))*n_fields+(b)]
static
MeshTree
*
get_mesh_tree
(
FluidProblem
*
problem
)
{
if
(
problem
->
mesh_tree
==
NULL
)
problem
->
mesh_tree
=
mesh_tree_create
(
problem
->
mesh
);
return
problem
->
mesh_tree
;
}
static
void
particle_force_f
(
FluidProblem
*
problem
,
double
*
f
,
double
*
dfdu
,
double
*
dfddp
,
double
*
sol
,
double
*
dsol
,
const
double
*
solold
,
const
double
c
,
const
double
*
dc
,
double
a
,
double
dt
,
int
iel
,
int
ip
);
void
fluid_problem_interpolate_rho_and_nu
(
const
FluidProblem
*
problem
,
double
a
,
double
*
rho
,
double
*
mu
)
{
if
(
problem
->
n_fluids
==
1
){
...
...
@@ -1626,7 +1633,7 @@ void fluid_problem_set_mesh(FluidProblem *problem, Mesh *mesh) {
problem
->
mesh
=
mesh
;
if
(
problem
->
mesh_tree
)
mesh_tree_free
(
problem
->
mesh_tree
);
problem
->
mesh_tree
=
mesh_tree_create
(
mesh
)
;
problem
->
mesh_tree
=
NULL
;
free
(
problem
->
bulk_force
);
problem
->
bulk_force
=
malloc
(
sizeof
(
double
)
*
mesh
->
n_nodes
*
DIMENSION
);
for
(
int
i
=
0
;
i
<
mesh
->
n_nodes
*
DIMENSION
;
++
i
)
...
...
@@ -1687,7 +1694,7 @@ void fluid_problem_adapt_mesh(FluidProblem *problem, Mesh *new_mesh, int old_n_p
for
(
int
i
=
0
;
i
<
new_mesh
->
n_nodes
;
++
i
)
for
(
int
k
=
0
;
k
<
D
;
++
k
)
newx
[
i
*
D
+
k
]
=
new_mesh
->
x
[
i
*
3
+
k
];
mesh_tree_particle_to_mesh
(
problem
->
mesh_tree
,
new_mesh
->
n_nodes
,
newx
,
new_eid
,
new_xi
);
mesh_tree_particle_to_mesh
(
get_mesh_tree
(
problem
)
,
new_mesh
->
n_nodes
,
newx
,
new_eid
,
new_xi
);
for
(
int
i
=
0
;
i
<
new_mesh
->
n_nodes
;
++
i
)
{
const
int
*
el
=
problem
->
mesh
->
elements
+
new_eid
[
i
]
*
N_N
;
if
(
new_eid
[
i
]
<
0
)
{
...
...
@@ -1734,10 +1741,10 @@ void fluid_problem_adapt_mesh(FluidProblem *problem, Mesh *new_mesh, int old_n_p
old_particle_element_id
[
i
]
=
-
1
;
}
double
*
old_particle_uvw
=
malloc
(
sizeof
(
double
)
*
D
*
old_n_particles
);
mesh_tree_particle_to_mesh
(
problem
->
mesh_tree
,
old_n_particles
,
old_particle_position
,
old_particle_element_id
,
old_particle_uvw
);
mesh_tree_particle_to_mesh
(
get_mesh_tree
(
problem
)
,
old_n_particles
,
old_particle_position
,
old_particle_element_id
,
old_particle_uvw
);
compute_porosity
(
problem
->
mesh
,
problem
->
node_volume
,
problem
->
oldporosity
,
old_n_particles
,
old_particle_position
,
old_particle_volume
,
old_particle_element_id
,
old_particle_uvw
,
NULL
);
mesh_tree_particle_to_mesh
(
problem
->
mesh_tree
,
problem
->
n_particles
,
problem
->
particle_position
,
problem
->
particle_element_id
,
problem
->
particle_uvw
);
mesh_tree_particle_to_mesh
(
get_mesh_tree
(
problem
)
,
problem
->
n_particles
,
problem
->
particle_position
,
problem
->
particle_element_id
,
problem
->
particle_uvw
);
compute_porosity
(
problem
->
mesh
,
problem
->
node_volume
,
problem
->
porosity
,
problem
->
n_particles
,
problem
->
particle_position
,
problem
->
particle_volume
,
problem
->
particle_element_id
,
problem
->
particle_uvw
,
NULL
);
free
(
old_particle_element_id
);
...
...
@@ -1750,8 +1757,8 @@ void fluid_problem_set_coordinates(FluidProblem *problem, double *x) {
}
if
(
problem
->
mesh_tree
)
mesh_tree_free
(
problem
->
mesh_tree
);
problem
->
mesh_tree
=
mesh_tree_create
(
problem
->
mesh
)
;
mesh_tree_particle_to_mesh
(
problem
->
mesh_tree
,
problem
->
n_particles
,
problem
->
particle_position
,
problem
->
particle_element_id
,
problem
->
particle_uvw
);
problem
->
mesh_tree
=
NULL
;
mesh_tree_particle_to_mesh
(
get_mesh_tree
(
problem
)
,
problem
->
n_particles
,
problem
->
particle_position
,
problem
->
particle_element_id
,
problem
->
particle_uvw
);
compute_porosity
(
problem
->
mesh
,
problem
->
node_volume
,
problem
->
porosity
,
problem
->
n_particles
,
problem
->
particle_position
,
problem
->
particle_volume
,
problem
->
particle_element_id
,
problem
->
particle_uvw
,
NULL
);
}
...
...
@@ -1785,7 +1792,7 @@ void fluid_problem_set_particles(FluidProblem *problem, int n, double *mass, dou
}
problem
->
particle_element_id
[
i
]
=-
1
;
}
mesh_tree_particle_to_mesh
(
problem
->
mesh_tree
,
n
,
position
,
problem
->
particle_element_id
,
problem
->
particle_uvw
);
mesh_tree_particle_to_mesh
(
get_mesh_tree
(
problem
)
,
n
,
position
,
problem
->
particle_element_id
,
problem
->
particle_uvw
);
double
*
c
=
malloc
(
sizeof
(
double
)
*
problem
->
mesh
->
n_nodes
);
for
(
int
i
=
0
;
i
<
problem
->
mesh
->
n_nodes
;
++
i
)
{
...
...
@@ -1817,7 +1824,7 @@ void fluid_problem_move_particles(FluidProblem *problem, int n, double *position
for
(
int
i
=
0
;
i
<
n
;
++
i
)
{
old_element_id
[
i
]
=
problem
->
particle_element_id
[
i
];
}
mesh_tree_particle_to_mesh
(
problem
->
mesh_tree
,
n
,
position
,
problem
->
particle_element_id
,
problem
->
particle_uvw
);
mesh_tree_particle_to_mesh
(
get_mesh_tree
(
problem
)
,
n
,
position
,
problem
->
particle_element_id
,
problem
->
particle_uvw
);
int
*
particle_enter
=
malloc
(
sizeof
(
int
)
*
n
);
int
*
particle_leave
=
malloc
(
sizeof
(
int
)
*
n
);
for
(
int
i
=
0
;
i
<
n
;
++
i
)
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment