Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
dune-fem-dg
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
dune-fem
dune-fem-dg
Commits
cb0c9c2b
Commit
cb0c9c2b
authored
6 years ago
by
Andreas Dedner
Browse files
Options
Downloads
Patches
Plain Diff
try to make the structure in the dgoperator function cleaner
parent
0a05d49f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!4
Latest features added to dune-fem-dg.
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
python/dune/femdg/_operators.py
+49
-41
49 additions, 41 deletions
python/dune/femdg/_operators.py
with
49 additions
and
41 deletions
python/dune/femdg/_operators.py
+
49
−
41
View file @
cb0c9c2b
...
...
@@ -190,47 +190,8 @@ def createFemDGSolver(Model, space,
_
,
destinationIncludes
,
destinationType
,
_
,
_
,
_
=
space
.
storage
includes
=
[
"
dune/fem-dg/solver/dg.hh
"
]
includes
+=
space
.
_includes
+
destinationIncludes
includes
+=
[
"
dune/fem/schemes/diffusionmodel.hh
"
,
"
dune/fempy/parameter.hh
"
]
additionalType
=
'
Additional< typename
'
+
spaceType
+
'
::FunctionSpaceType >
'
solverId
=
"
Dune::Fem::Solver::Enum::fem
"
formId
=
"
Dune::Fem::Formulation::Enum::primal
"
limiterId
=
"
Dune::Fem::AdvectionLimiter::Enum::limited
"
advFluxId
=
"
Dune::Fem::AdvectionFlux::Enum::llf
"
diffFluxId
=
"
Dune::Fem::DiffusionFlux::Enum::primal
"
if
limiter
==
None
or
limiter
==
False
or
limiter
.
lower
()
==
"
unlimiter
"
:
limiterId
=
"
Dune::Fem::AdvectionLimiter::Enum::unlimited
"
typeName
=
'
Dune::Fem::DGOperator<
'
+
\
destinationType
+
'
,
'
+
\
advModelType
+
'
,
'
+
diffModelType
+
'
,
'
+
additionalType
+
\
"
>
"
constructor
=
Constructor
([
'
const
'
+
spaceType
+
'
&space
'
,
'
const
'
+
advModelType
+
'
&advectionModel
'
,
'
const
'
+
diffModelType
+
'
&diffusionModel
'
],
[
'
return new DuneType(space, advectionModel, diffusionModel);
'
],
[
'"
space
"
_a
'
,
'"
advectionModel
"
_a
'
,
'"
diffusionModel
"
_a
'
,
'
pybind11::keep_alive< 1, 2 >()
'
,
'
pybind11::keep_alive< 1, 3 >()
'
,
'
pybind11::keep_alive< 1, 4 >()
'
])
# add method activated to inspect limited cells.
setTimeStepSize
=
Method
(
'
setTimeStepSize
'
,
'
&DuneType::setTimeStepSize
'
)
applyLimiter
=
Method
(
'
applyLimiter
'
,
'''
[](
DuneType &self, typename DuneType::DestinationType &u) {
self.limit(u); }
'''
);
# add method to obtain time step size
deltaT
=
Method
(
'
deltaT
'
,
'
&DuneType::deltaT
'
)
# extra methods for limiter and time step control
###'###############################################
### extra methods for limiter and time step control
struct
=
Struct
(
'
Additional
'
,
targs
=
[
'
class FunctionSpace
'
])
struct
.
append
(
TypeAlias
(
'
DomainType
'
,
'
typename FunctionSpace::DomainType
'
))
struct
.
append
(
TypeAlias
(
'
RangeType
'
,
'
typename FunctionSpace::RangeType
'
))
...
...
@@ -321,6 +282,19 @@ def createFemDGSolver(Model, space,
struct
.
append
([
Declaration
(
Variable
(
"
const bool
"
,
"
hasDiffusion
"
),
initializer
=
hasDiffusion
,
static
=
True
)])
###################################################
## choose details of discretization (i.e. fluxes)
## default settings:
solverId
=
"
Dune::Fem::Solver::Enum::fem
"
formId
=
"
Dune::Fem::Formulation::Enum::primal
"
limiterId
=
"
Dune::Fem::AdvectionLimiter::Enum::limited
"
advFluxId
=
"
Dune::Fem::AdvectionFlux::Enum::llf
"
diffFluxId
=
"
Dune::Fem::DiffusionFlux::Enum::cdg2
"
if
limiter
==
None
or
limiter
==
False
or
limiter
.
lower
()
==
"
unlimiter
"
:
limiterId
=
"
Dune::Fem::AdvectionLimiter::Enum::unlimited
"
struct
.
append
([
Declaration
(
Variable
(
"
const Dune::Fem::Solver::Enum
"
,
"
solverId =
"
+
solverId
),
static
=
True
)])
...
...
@@ -344,6 +318,40 @@ def createFemDGSolver(Model, space,
print
(
writer
.
writer
.
getvalue
())
print
(
"
#################################
"
)
################################################################
### Construct DuneType, includes, and extra methods/constructors
includes
=
[
"
dune/fem-dg/solver/dg.hh
"
]
includes
+=
space
.
_includes
+
destinationIncludes
includes
+=
[
"
dune/fem/schemes/diffusionmodel.hh
"
,
"
dune/fempy/parameter.hh
"
]
additionalType
=
'
Additional< typename
'
+
spaceType
+
'
::FunctionSpaceType >
'
typeName
=
'
Dune::Fem::DGOperator<
'
+
\
destinationType
+
'
,
'
+
\
advModelType
+
'
,
'
+
diffModelType
+
'
,
'
+
additionalType
+
\
"
>
"
constructor
=
Constructor
([
'
const
'
+
spaceType
+
'
&space
'
,
'
const
'
+
advModelType
+
'
&advectionModel
'
,
'
const
'
+
diffModelType
+
'
&diffusionModel
'
],
[
'
return new DuneType(space, advectionModel, diffusionModel);
'
],
[
'"
space
"
_a
'
,
'"
advectionModel
"
_a
'
,
'"
diffusionModel
"
_a
'
,
'
pybind11::keep_alive< 1, 2 >()
'
,
'
pybind11::keep_alive< 1, 3 >()
'
,
'
pybind11::keep_alive< 1, 4 >()
'
])
# add method activated to inspect limited cells.
setTimeStepSize
=
Method
(
'
setTimeStepSize
'
,
'
&DuneType::setTimeStepSize
'
)
applyLimiter
=
Method
(
'
applyLimiter
'
,
'''
[](
DuneType &self, typename DuneType::DestinationType &u) {
self.limit(u); }
'''
);
# add method to obtain time step size
deltaT
=
Method
(
'
deltaT
'
,
'
&DuneType::deltaT
'
)
return
load
(
includes
,
typeName
,
constructor
,
setTimeStepSize
,
deltaT
,
applyLimiter
,
preamble
=
writer
.
writer
.
getvalue
()).
\
Operator
(
space
,
advModel
,
diffModel
)
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