Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
dune-copasi
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
COPASI
dune-copasi
Commits
c1daad24
Commit
c1daad24
authored
4 years ago
by
Santiago Ospina De Los Ríos
Browse files
Options
Downloads
Patches
Plain Diff
Support 3D model instantiation
parent
5591a612
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!27
Resolve "Support 3D simulations"
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
dune/copasi/grid/mark_stripes.hh
+47
-28
47 additions, 28 deletions
dune/copasi/grid/mark_stripes.hh
dune/copasi/model/diffusion_reaction.hh
+3
-3
3 additions, 3 deletions
dune/copasi/model/diffusion_reaction.hh
with
50 additions
and
31 deletions
dune/copasi/grid/mark_stripes.hh
+
47
−
28
View file @
c1daad24
...
...
@@ -3,57 +3,76 @@
#include
<dune/grid/uggrid.hh>
#include
<s
e
t>
#include
<
li
st>
namespace
Dune
::
Copasi
{
/**
* @brief Mark stripes for refinement
* @details If a cube element is surrounded by
simplici
es in oposite sides
* @details If a cube element is surrounded by
non-cub
es in oposite sides
* such cube is understood to be part of a stripe of cubes. In such
* case, this method should mark the grid such that a stripe is a stripe
* after refinment (e.g. refine in the direction of perpendicular to the simplices)
*
* @warning Grid type should be UGGrid
* @warning Many edge cases have not been tested, if you find a such a case, please report it as a bug
*
* case, this method should mark the grid such that a stripe is a
* stripe after refinment (e.g. refine in the direction of
* perpendicular to the non cubes)
*
* @param grid The grid
* @param[in] mark_others If true, mark
other type of
entities for refinment.
* @param[in] mark_others If true, mark
non-stripe
entities for refinment.
*
* @tparam
Grid
T
he grid
type
* @tparam
dim
Dimension of t
he grid
*/
template
<
class
Grid
>
void
mark_stripes
(
Grid
&
grid
,
bool
mark_others
=
true
)
template
<
int
dim
>
void
mark_stripes
(
UG
Grid
<
dim
>
&
grid
,
bool
mark_others
=
true
)
{
constexpr
std
::
size_t
dim
=
Grid
::
dimension
;
using
RuleType
=
typename
Dune
::
UG_NS
<
dim
>::
RefinementRule
;
using
RuleType
=
typename
UG_NS
<
dim
>::
RefinementRule
;
auto
grid_view
=
grid
.
leafGridView
();
std
::
s
e
t
<
int
>
simplex
_side
;
std
::
li
st
<
int
>
non_cube
_side
;
// Loop over the grid
for
(
auto
&&
entity
:
Dune
::
elements
(
grid_view
))
{
if
(
entity
.
type
().
isCube
())
{
//register side
s
with simplices
simplex
_side
.
clear
();
//
register side
index
with simplices
(see DUNE cheatsheet for entity ids)
non_cube
_side
.
clear
();
for
(
auto
&&
ig
:
Dune
::
intersections
(
grid_view
,
entity
))
if
(
ig
.
neighbor
())
if
(
ig
.
outside
().
type
().
isSimplex
())
simplex_side
.
insert
(
ig
.
indexInInside
()
/
2
);
if
(
not
ig
.
outside
().
type
().
isCube
())
non_cube_side
.
push_back
(
ig
.
indexInInside
());
bool
is_stripe
=
false
;
// For now, lets only do it in 2D
static_assert
(
dim
==
2
);
// oposite facets have consecutive indexing (e.g. [2,3] are oposite)
if
(
non_cube_side
.
size
()
==
2
)
is_stripe
=
!
(
non_cube_side
.
front
()
/
2
-
non_cube_side
.
back
()
/
2
);
if
(
simplex_side
.
size
()
==
1
)
if
(
is_stripe
)
{
// side of the simplices
int
side
=
*
(
simplex_side
.
begin
());
// side to refine (permendicular)
side
=
not
side
;
// mark entity with a blue type refinment
grid
.
mark
(
entity
,
RuleType
::
BLUE
,
side
);
// side orienation of the simplices
[[
maybe_unused
]]
int
orientation
=
*
(
non_cube_side
.
begin
())
/
2
;
if
constexpr
(
dim
==
2
)
{
// mark entity with a blue type refinment
grid
.
mark
(
entity
,
RuleType
::
BLUE
,
!
(
bool
)
orientation
);
}
else
if
constexpr
(
dim
==
3
)
{
DUNE_THROW
(
NotImplemented
,
"Stripes on 3D is not available yet!"
);
// Need a mesh to correctly check which orientation needs which rule!
// if (orientation == 0)
// grid.mark(entity,RuleType::HEX_BISECT_0_1);
// if (orientation == 1)
// grid.mark(entity,RuleType::HEX_BISECT_0_2);
// if (orientation == 2)
// grid.mark(entity,RuleType::HEX_BISECT_0_3);
}
else
{
DUNE_THROW
(
NotImplemented
,
"Stripe refinement not known for grids of dimension '"
<<
dim
<<
"'"
);
}
}
else
if
(
mark_others
)
{
...
...
This diff is collapsed.
Click to expand it.
dune/copasi/model/diffusion_reaction.hh
+
3
−
3
View file @
c1daad24
...
...
@@ -54,7 +54,7 @@ struct ModelP0DiffusionReactionTraits
using
Grid
=
G
;
using
GridView
=
GV
;
using
FEMP0
=
PDELab
::
P0LocalFiniteElementMap
<
typename
Grid
::
ctype
,
double
,
2
>
;
PDELab
::
P0LocalFiniteElementMap
<
typename
Grid
::
ctype
,
double
,
G
::
dimension
>
;
static
constexpr
bool
is_sub_model
=
not
std
::
is_same_v
<
typename
Grid
::
Traits
::
LeafGridView
,
GridView
>
;
...
...
@@ -132,8 +132,8 @@ struct ModelP0PkDiffusionReactionTraits
{
using
Grid
=
G
;
using
GridView
=
GV
;
using
FEMP0
=
PDELab
::
P0LocalFiniteElementMap
<
typename
Grid
::
ctype
,
double
,
2
>
;
using
FEMP0
=
PDELab
::
P0LocalFiniteElementMap
<
typename
Grid
::
ctype
,
double
,
Grid
::
dimension
>
;
template
<
int
order
>
using
FEMPk
=
PDELab
::
PkLocalFiniteElementMap
<
typename
G
::
LeafGridView
,
double
,
double
,
order
>
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment