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
Roy Fabrice
pFoF
Commits
0286c131
Commit
0286c131
authored
Nov 27, 2019
by
Roy Fabrice
Browse files
use cell min and max level
cells too large or too small are removed
parent
8f391d95
Changes
2
Hide whitespace changes
Inline
Side-by-side
amr2cell_hdf5/src/amr2cell_hdf5.f90
View file @
0286c131
...
...
@@ -78,7 +78,7 @@ program amr2cell_hdf5
call
ramses_output
%
Deallocate
()
call
cells_array
%
Clean
(
amr2cell_hdf5_parameters
%
cube_level
)
call
cells_array
%
Clean
(
amr2cell_hdf5_parameters
)
call
cubes_array
%
Init
(
amr2cell_hdf5_parameters
,
ramses_info
)
...
...
amr2cell_hdf5/src/cells_array_m.f90
View file @
0286c131
...
...
@@ -51,6 +51,7 @@ module cells_array_m
procedure
Clean
=>
Clean_unused_cells
procedure
,
private
::
Remove_duplicate_cells
procedure
,
private
::
Remove_large_cells
procedure
,
private
::
Remove_small_cells
procedure
Sort
=>
Sort_cells_array
procedure
,
private
::
Sort_heapify_cells
procedure
,
private
::
Sort_sink_cells
...
...
@@ -89,14 +90,17 @@ contains
end
subroutine
Allocate_cells_array
!------------------------------------------------------------------------------------------------------------------------------------
subroutine
Clean_unused_cells
(
this
,
cube_level
)
subroutine
Clean_unused_cells
(
this
,
amr2cell_hdf5_parameters
)
use
amr2cell_hdf5_parameters_m
,
only
:
amr2cell_hdf5_parameters_t
type
(
amr2cell_hdf5_parameters_t
),
intent
(
in
)
::
amr2cell_hdf5_parameters
class
(
cells_array_t
),
intent
(
inout
)
::
this
integer
,
intent
(
in
)
::
cube_level
call
this
%
Sort
()
call
this
%
Remove_duplicate_cells
()
call
this
%
Remove_large_cells
(
cube_level
)
call
this
%
Remove_large_cells
(
amr2cell_hdf5_parameters
%
cell_level_min
)
call
this
%
Remove_small_cells
(
amr2cell_hdf5_parameters
%
cell_level_max
)
end
subroutine
Clean_unused_cells
...
...
@@ -383,10 +387,10 @@ contains
end
subroutine
Remove_duplicate_cells
!------------------------------------------------------------------------------------------------------------------------------------
subroutine
Remove_large_cells
(
this
,
cube_
level
)
subroutine
Remove_large_cells
(
this
,
level
_min
)
class
(
cells_array_t
),
intent
(
inout
)
::
this
integer
,
intent
(
in
)
::
cube_
level
integer
,
intent
(
in
)
::
level
_min
integer
::
icell
integer
::
n_large
...
...
@@ -401,7 +405,7 @@ contains
n_large
=
0
do
icell
=
1
,
this
%
ncells
if
(
this
%
elts
(
icell
)
%
level
<
cube_
level
)
then
if
(
this
%
elts
(
icell
)
%
level
<
level
_min
)
then
n_large
=
n_large
+
1
else
exit
...
...
@@ -428,6 +432,52 @@ contains
end
subroutine
Remove_large_cells
!------------------------------------------------------------------------------------------------------------------------------------
subroutine
Remove_small_cells
(
this
,
level_max
)
class
(
cells_array_t
),
intent
(
inout
)
::
this
integer
,
intent
(
in
)
::
level_max
integer
::
icell
integer
::
n_small
integer
(
kind
=
IDKIND
)
::
nc
integer
::
nntp
,
nps
type
(
cells_array_t
)
::
tmp
#ifdef DEBUG
write
(
ERROR_UNIT
,
'(a,i0)'
)
'Remove_small_cells begins on process '
,
mpi_process
%
rank
#endif
call
timer
%
Set_ref
()
n_small
=
0
do
icell
=
1
,
this
%
ncells
if
(
this
%
elts
(
icell
)
%
level
>
level_max
)
then
n_small
=
n_small
+
1
else
exit
end
if
enddo
nntp
=
this
%
elts
(
1
)
%
n_non_thermal_pressures
nps
=
this
%
elts
(
1
)
%
n_passive_scalars
nc
=
this
%
ncells
-
n_small
call
tmp
%
Allocate
(
nntp
,
nps
,
nc
)
tmp
%
elts
(
1
:
tmp
%
ncells
)
=
this
%
elts
(
1
:
tmp
%
ncells
)
if
(
allocated
(
this
%
elts
))
then
call
this
%
Deallocate
()
end
if
call
move_alloc
(
tmp
%
elts
,
this
%
elts
)
this
%
ncells
=
tmp
%
ncells
call
timer
%
Inc_comp
()
#ifdef DEBUG
write
(
ERROR_UNIT
,
'(a,i0)'
)
'number of cells after small ones removed: '
,
this
%
ncells
write
(
ERROR_UNIT
,
'(a,i0)'
)
'Remove_small_cells ends on process '
,
mpi_process
%
rank
#endif
end
subroutine
Remove_small_cells
!------------------------------------------------------------------------------------------------------------------------------------
subroutine
Sort_cells_array
(
this
)
...
...
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