Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-tectonic
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
podlesny
dune-tectonic
Commits
30a2e434
Commit
30a2e434
authored
12 years ago
by
Elias Pipping
Committed by
Elias Pipping
12 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Use enum parser for model as well
parent
6e555ec6
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
src/assemblers.cc
+30
-28
30 additions, 28 deletions
src/assemblers.cc
src/enum_model.cc
+13
-0
13 additions, 0 deletions
src/enum_model.cc
src/enums.hh
+4
-0
4 additions, 0 deletions
src/enums.hh
src/one-body-sample.parset
+1
-1
1 addition, 1 deletion
src/one-body-sample.parset
with
48 additions
and
29 deletions
src/assemblers.cc
+
30
−
28
View file @
30a2e434
...
...
@@ -12,6 +12,10 @@
#include
"assemblers.hh"
#include
"enums.hh"
#include
"enum_parser.cc"
#include
"enum_model.cc"
// Assembles Neumann boundary term in f
template
<
class
GridType
,
class
GridView
,
class
LocalVectorType
,
class
FEBasis
>
void
assemble_neumann
(
GridView
const
&
gridView
,
FEBasis
const
&
feBasis
,
...
...
@@ -67,34 +71,32 @@ assemble_nonlinearity(
auto
normalStress
=
Dune
::
make_shared
<
SingletonVectorType
>
(
size
);
*
normalStress
=
parset
.
get
<
double
>
(
"normalstress"
);
std
::
string
const
friction_model
=
parset
.
get
<
std
::
string
>
(
"model"
);
if
(
friction_model
==
std
::
string
(
"Ruina"
))
{
auto
a
=
Dune
::
make_shared
<
SingletonVectorType
>
(
size
);
*
a
=
parset
.
get
<
double
>
(
"ruina.a"
);
auto
eta
=
Dune
::
make_shared
<
SingletonVectorType
>
(
size
);
*
eta
=
parset
.
get
<
double
>
(
"eta"
);
auto
b
=
Dune
::
make_shared
<
SingletonVectorType
>
(
size
);
*
b
=
parset
.
get
<
double
>
(
"ruina.b"
);
auto
L
=
Dune
::
make_shared
<
SingletonVectorType
>
(
size
);
*
L
=
parset
.
get
<
double
>
(
"ruina.L"
);
return
Dune
::
make_shared
<
Dune
::
GlobalRuinaNonlinearity
<
VectorType
,
MatrixType
>
const
>
(
nodalIntegrals
,
a
,
mu
,
eta
,
normalStress
,
b
,
state
,
L
,
h
);
}
else
if
(
friction_model
==
std
::
string
(
"Laursen"
))
{
return
// TODO: take state and h into account
// FIXME: We should be using a quadratic rather than a linear function
// here!
Dune
::
make_shared
<
Dune
::
GlobalLaursenNonlinearity
<
Dune
::
LinearFunction
,
VectorType
,
MatrixType
>
const
>
(
mu
,
normalStress
,
nodalIntegrals
);
}
else
{
assert
(
false
);
switch
(
parset
.
get
<
Config
::
model
>
(
"model"
))
{
case
Config
::
Exponential
:
{
auto
a
=
Dune
::
make_shared
<
SingletonVectorType
>
(
size
);
*
a
=
parset
.
get
<
double
>
(
"ruina.a"
);
auto
eta
=
Dune
::
make_shared
<
SingletonVectorType
>
(
size
);
*
eta
=
parset
.
get
<
double
>
(
"eta"
);
auto
b
=
Dune
::
make_shared
<
SingletonVectorType
>
(
size
);
*
b
=
parset
.
get
<
double
>
(
"ruina.b"
);
auto
L
=
Dune
::
make_shared
<
SingletonVectorType
>
(
size
);
*
L
=
parset
.
get
<
double
>
(
"ruina.L"
);
return
Dune
::
make_shared
<
Dune
::
GlobalRuinaNonlinearity
<
VectorType
,
MatrixType
>
const
>
(
nodalIntegrals
,
a
,
mu
,
eta
,
normalStress
,
b
,
state
,
L
,
h
);
}
case
Config
::
Laursen
:
return
// TODO: take state and h into account
// FIXME: We should be using a quadratic rather than a linear function
// here!
Dune
::
make_shared
<
Dune
::
GlobalLaursenNonlinearity
<
Dune
::
LinearFunction
,
VectorType
,
MatrixType
>
const
>
(
mu
,
normalStress
,
nodalIntegrals
);
}
}
...
...
This diff is collapsed.
Click to expand it.
src/enum_model.cc
0 → 100644
+
13
−
0
View file @
30a2e434
#include
<dune/common/exceptions.hh>
template
<
>
struct
StringToEnum
<
Config
::
model
>
{
static
Config
::
model
convert
(
std
::
string
const
&
s
)
{
if
(
s
==
"Laursen"
)
return
Config
::
Laursen
;
if
(
s
==
"Exponential"
)
return
Config
::
Exponential
;
DUNE_THROW
(
Dune
::
Exception
,
"failed to parse enum"
);
}
};
This diff is collapsed.
Click to expand it.
src/enums.hh
+
4
−
0
View file @
30a2e434
struct
Config
{
enum
model
{
Laursen
,
Exponential
};
enum
state_model
{
Dieterich
,
Ruina
...
...
This diff is collapsed.
Click to expand it.
src/one-body-sample.parset
+
1
−
1
View file @
30a2e434
...
...
@@ -68,7 +68,7 @@ normalstress = 0.1 # laursen depends a lot more on this
# http://earthquake.usgs.gov/research/physics/lab/prediction.pdf
mu
=
0
.
5
eta
=
1
model
=
Ruina
model
=
Exponential
[
boundary
.
friction
.
state
]
evolve
=
true
...
...
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