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
efa23601
Commit
efa23601
authored
13 years ago
by
Elias Pipping
Committed by
Elias Pipping
13 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Move assembler invocations to separate file
parent
1e031b13
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/assemblers.cc
+92
-0
92 additions, 0 deletions
src/assemblers.cc
src/assemblers.hh
+35
-0
35 additions, 0 deletions
src/assemblers.hh
src/one-body-sample.cc
+2
-91
2 additions, 91 deletions
src/one-body-sample.cc
with
129 additions
and
91 deletions
src/assemblers.cc
0 → 100644
+
92
−
0
View file @
efa23601
#include
<dune/fufem/boundarypatch.hh>
#include
<dune/fufem/functions/constantfunction.hh>
#include
<dune/fufem/assemblers/localassemblers/neumannboundaryassembler.hh>
#include
<dune/fufem/assemblers/boundaryfunctionalassembler.hh>
#include
<dune/tectonic/globallaursennonlinearity.hh>
#include
<dune/tectonic/globalruinanonlinearity.hh>
// Assembles Neumann boundary term in f
template
<
class
GridType
,
class
GridView
,
class
LocalVectorType
,
class
FEBasis
>
void
assemble_neumann
(
GridView
const
&
gridView
,
FEBasis
const
&
feBasis
,
Dune
::
BitSetVector
<
1
>
const
&
neumannNodes
,
Dune
::
BlockVector
<
LocalVectorType
>
&
f
,
Dune
::
VirtualFunction
<
double
,
double
>
const
&
neumann
,
double
time
)
{
// constant sample function on neumann
// boundary
BoundaryPatch
<
GridView
>
const
neumannBoundary
(
gridView
,
neumannNodes
);
LocalVectorType
SampleVector
(
0
);
neumann
.
evaluate
(
time
,
SampleVector
[
0
]);
SampleVector
[
1
]
=
0
;
ConstantFunction
<
LocalVectorType
,
LocalVectorType
>
const
fNeumann
(
SampleVector
);
NeumannBoundaryAssembler
<
GridType
,
LocalVectorType
>
neumannBoundaryAssembler
(
fNeumann
);
BoundaryFunctionalAssembler
<
FEBasis
>
(
feBasis
,
neumannBoundary
).
assemble
(
neumannBoundaryAssembler
,
f
,
true
);
// resize and zero output vector
}
// Assembles constant 1-function on frictional boundary in nodalIntegrals
template
<
class
GridType
,
class
GridView
,
class
LocalVectorType
,
class
FEBasis
>
Dune
::
shared_ptr
<
Dune
::
BlockVector
<
Dune
::
FieldVector
<
double
,
1
>>>
assemble_frictional
(
GridView
const
&
gridView
,
FEBasis
const
&
feBasis
,
Dune
::
BitSetVector
<
1
>
const
&
frictionalNodes
)
{
typedef
Dune
::
FieldVector
<
double
,
1
>
Singleton
;
BoundaryPatch
<
GridView
>
const
frictionalBoundary
(
gridView
,
frictionalNodes
);
ConstantFunction
<
LocalVectorType
,
Singleton
>
const
constantOneFunction
(
1
);
NeumannBoundaryAssembler
<
GridType
,
Singleton
>
frictionalBoundaryAssembler
(
constantOneFunction
);
auto
const
nodalIntegrals
=
Dune
::
make_shared
<
Dune
::
BlockVector
<
Singleton
>>
();
BoundaryFunctionalAssembler
<
FEBasis
>
(
feBasis
,
frictionalBoundary
)
.
assemble
(
frictionalBoundaryAssembler
,
*
nodalIntegrals
,
true
);
// resize and zero output vector
return
nodalIntegrals
;
}
template
<
class
VectorType
,
class
MatrixType
>
Dune
::
shared_ptr
<
Dune
::
GlobalNonlinearity
<
VectorType
,
MatrixType
>
const
>
assemble_nonlinearity
(
int
size
,
Dune
::
ParameterTree
const
&
parset
,
Dune
::
shared_ptr
<
Dune
::
BlockVector
<
Dune
::
FieldVector
<
double
,
1
>>>
nodalIntegrals
,
Dune
::
shared_ptr
<
Dune
::
BlockVector
<
Dune
::
FieldVector
<
double
,
1
>>>
state
,
double
h
)
{
typedef
Dune
::
BlockVector
<
Dune
::
FieldVector
<
double
,
1
>>
SingletonVectorType
;
// {{{ Assemble terms for the nonlinearity
auto
mu
=
Dune
::
make_shared
<
SingletonVectorType
>
(
size
);
*
mu
=
parset
.
get
<
double
>
(
"boundary.friction.mu"
);
auto
normalStress
=
Dune
::
make_shared
<
SingletonVectorType
>
(
size
);
*
normalStress
=
parset
.
get
<
double
>
(
"boundary.friction.normalstress"
);
std
::
string
const
friction_model
=
parset
.
get
<
std
::
string
>
(
"boundary.friction.model"
);
if
(
friction_model
==
std
::
string
(
"Ruina"
))
{
auto
a
=
Dune
::
make_shared
<
SingletonVectorType
>
(
size
);
*
a
=
parset
.
get
<
double
>
(
"boundary.friction.ruina.a"
);
auto
eta
=
Dune
::
make_shared
<
SingletonVectorType
>
(
size
);
*
eta
=
parset
.
get
<
double
>
(
"boundary.friction.eta"
);
auto
b
=
Dune
::
make_shared
<
SingletonVectorType
>
(
size
);
*
b
=
parset
.
get
<
double
>
(
"boundary.friction.ruina.b"
);
auto
L
=
Dune
::
make_shared
<
SingletonVectorType
>
(
size
);
*
L
=
parset
.
get
<
double
>
(
"boundary.friction.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
Dune
::
make_shared
<
Dune
::
GlobalLaursenNonlinearity
<
Dune
::
LinearFunction
,
VectorType
,
MatrixType
>
const
>
(
mu
,
normalStress
,
nodalIntegrals
);
}
else
{
assert
(
false
);
}
}
This diff is collapsed.
Click to expand it.
src/assemblers.hh
0 → 100644
+
35
−
0
View file @
efa23601
#ifndef ASSEMBLERS_HH
#define ASSEMBLERS_HH
#include
<dune/common/bitsetvector.hh>
#include
<dune/common/function.hh>
#include
<dune/common/fvector.hh>
#include
<dune/common/parametertree.hh>
#include
<dune/common/shared_ptr.hh>
#include
<dune/istl/bvector.hh>
#include
<dune/tectonic/globalnonlinearity.hh>
template
<
class
GridType
,
class
GridView
,
class
LocalVectorType
,
class
FEBasis
>
void
assemble_neumann
(
GridView
const
&
gridView
,
FEBasis
const
&
feBasis
,
Dune
::
BitSetVector
<
1
>
const
&
neumannNodes
,
Dune
::
BlockVector
<
LocalVectorType
>
&
f
,
Dune
::
VirtualFunction
<
double
,
double
>
const
&
neumann
,
double
time
);
template
<
class
GridType
,
class
GridView
,
class
LocalVectorType
,
class
FEBasis
>
Dune
::
shared_ptr
<
Dune
::
BlockVector
<
Dune
::
FieldVector
<
double
,
1
>>>
assemble_frictional
(
GridView
const
&
gridView
,
FEBasis
const
&
feBasis
,
Dune
::
BitSetVector
<
1
>
const
&
frictionalNodes
);
template
<
class
VectorType
,
class
MatrixType
>
Dune
::
shared_ptr
<
Dune
::
GlobalNonlinearity
<
VectorType
,
MatrixType
>
const
>
assemble_nonlinearity
(
int
size
,
Dune
::
ParameterTree
const
&
parset
,
Dune
::
shared_ptr
<
Dune
::
BlockVector
<
Dune
::
FieldVector
<
double
,
1
>>>
nodalIntegrals
,
Dune
::
shared_ptr
<
Dune
::
BlockVector
<
Dune
::
FieldVector
<
double
,
1
>>>
state
,
double
h
);
#include
"assemblers.cc"
#endif
This diff is collapsed.
Click to expand it.
src/one-body-sample.cc
+
2
−
91
View file @
efa23601
...
...
@@ -41,17 +41,13 @@
#include
<dune/istl/bcrsmatrix.hh>
#include
<dune/istl/bvector.hh>
#include
<dune/fufem/assemblers/boundaryfunctionalassembler.hh>
#include
<dune/fufem/assemblers/functionalassembler.hh>
#include
<dune/fufem/assemblers/localassemblers/neumannboundaryassembler.hh>
#include
<dune/fufem/assemblers/localassemblers/stvenantkirchhoffassembler.hh>
#include
<dune/fufem/assemblers/localassemblers/vonmisesstressassembler.hh>
#include
<dune/fufem/assemblers/operatorassembler.hh>
#include
<dune/fufem/assemblers/transferoperatorassembler.hh>
#include
<dune/fufem/boundarypatch.hh>
#include
<dune/fufem/dunepython.hh>
#include
<dune/fufem/functions/basisgridfunction.hh>
#include
<dune/fufem/functions/constantfunction.hh>
#include
<dune/fufem/functions/vtkbasisgridfunction.hh>
#include
<dune/fufem/functionspacebases/p0basis.hh>
#include
<dune/fufem/functionspacebases/p1nodalbasis.hh>
...
...
@@ -66,12 +62,12 @@
#include
<dune/tnnmg/iterationsteps/genericnonlineargs.hh>
#include
<dune/tnnmg/iterationsteps/tnnmgstep.hh>
#include
<dune/tectonic/globallaursennonlinearity.hh>
#include
<dune/tectonic/globalruinanonlinearity.hh>
#include
<dune/tectonic/myblockproblem.hh>
#include
<dune/tectonic/myconvexproblem.hh>
#include
<dune/tectonic/mydirectionalconvexfunction.hh>
#include
"assemblers.hh"
int
const
dim
=
2
;
template
<
class
GridView
>
...
...
@@ -112,91 +108,6 @@ void setup_boundary(GridView const &gridView,
std
::
cout
<<
"Number of frictional nodes: "
<<
dirichlet_nodes
<<
std
::
endl
;
}
// Assembles Neumann boundary term in f
template
<
class
GridType
,
class
GridView
,
class
LocalVectorType
,
class
FEBasis
>
void
assemble_neumann
(
GridView
const
&
gridView
,
FEBasis
const
&
feBasis
,
Dune
::
BitSetVector
<
1
>
const
&
neumannNodes
,
Dune
::
BlockVector
<
LocalVectorType
>
&
f
,
Dune
::
VirtualFunction
<
double
,
double
>
const
&
neumann
,
double
time
)
{
// constant sample function on neumann
// boundary
BoundaryPatch
<
GridView
>
const
neumannBoundary
(
gridView
,
neumannNodes
);
LocalVectorType
SampleVector
(
0
);
neumann
.
evaluate
(
time
,
SampleVector
[
0
]);
SampleVector
[
1
]
=
0
;
ConstantFunction
<
LocalVectorType
,
LocalVectorType
>
const
fNeumann
(
SampleVector
);
NeumannBoundaryAssembler
<
GridType
,
LocalVectorType
>
neumannBoundaryAssembler
(
fNeumann
);
BoundaryFunctionalAssembler
<
FEBasis
>
(
feBasis
,
neumannBoundary
).
assemble
(
neumannBoundaryAssembler
,
f
,
true
);
// resize and zero output vector
}
// Assembles constant 1-function on frictional boundary in nodalIntegrals
template
<
class
GridType
,
class
GridView
,
class
LocalVectorType
,
class
FEBasis
>
Dune
::
shared_ptr
<
Dune
::
BlockVector
<
Dune
::
FieldVector
<
double
,
1
>>>
assemble_frictional
(
GridView
const
&
gridView
,
FEBasis
const
&
feBasis
,
Dune
::
BitSetVector
<
1
>
const
&
frictionalNodes
)
{
typedef
Dune
::
FieldVector
<
double
,
1
>
Singleton
;
BoundaryPatch
<
GridView
>
const
frictionalBoundary
(
gridView
,
frictionalNodes
);
ConstantFunction
<
LocalVectorType
,
Singleton
>
const
constantOneFunction
(
1
);
NeumannBoundaryAssembler
<
GridType
,
Singleton
>
frictionalBoundaryAssembler
(
constantOneFunction
);
auto
const
nodalIntegrals
=
Dune
::
make_shared
<
Dune
::
BlockVector
<
Singleton
>>
();
BoundaryFunctionalAssembler
<
FEBasis
>
(
feBasis
,
frictionalBoundary
)
.
assemble
(
frictionalBoundaryAssembler
,
*
nodalIntegrals
,
true
);
// resize and zero output vector
return
nodalIntegrals
;
}
template
<
class
VectorType
,
class
MatrixType
>
Dune
::
shared_ptr
<
Dune
::
GlobalNonlinearity
<
VectorType
,
MatrixType
>
const
>
assemble_nonlinearity
(
int
size
,
Dune
::
ParameterTree
const
&
parset
,
Dune
::
shared_ptr
<
Dune
::
BlockVector
<
Dune
::
FieldVector
<
double
,
1
>>>
nodalIntegrals
,
Dune
::
shared_ptr
<
Dune
::
BlockVector
<
Dune
::
FieldVector
<
double
,
1
>>>
state
,
double
h
)
{
typedef
Dune
::
BlockVector
<
Dune
::
FieldVector
<
double
,
1
>>
SingletonVectorType
;
// {{{ Assemble terms for the nonlinearity
auto
mu
=
Dune
::
make_shared
<
SingletonVectorType
>
(
size
);
*
mu
=
parset
.
get
<
double
>
(
"boundary.friction.mu"
);
auto
normalStress
=
Dune
::
make_shared
<
SingletonVectorType
>
(
size
);
*
normalStress
=
parset
.
get
<
double
>
(
"boundary.friction.normalstress"
);
std
::
string
const
friction_model
=
parset
.
get
<
std
::
string
>
(
"boundary.friction.model"
);
if
(
friction_model
==
std
::
string
(
"Ruina"
))
{
auto
a
=
Dune
::
make_shared
<
SingletonVectorType
>
(
size
);
*
a
=
parset
.
get
<
double
>
(
"boundary.friction.ruina.a"
);
auto
eta
=
Dune
::
make_shared
<
SingletonVectorType
>
(
size
);
*
eta
=
parset
.
get
<
double
>
(
"boundary.friction.eta"
);
auto
b
=
Dune
::
make_shared
<
SingletonVectorType
>
(
size
);
*
b
=
parset
.
get
<
double
>
(
"boundary.friction.ruina.b"
);
auto
L
=
Dune
::
make_shared
<
SingletonVectorType
>
(
size
);
*
L
=
parset
.
get
<
double
>
(
"boundary.friction.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
Dune
::
make_shared
<
Dune
::
GlobalLaursenNonlinearity
<
Dune
::
LinearFunction
,
VectorType
,
MatrixType
>
const
>
(
mu
,
normalStress
,
nodalIntegrals
);
}
else
{
assert
(
false
);
}
}
// The nonlinearity exp(-x)
class
DecayingExponential
{
public:
...
...
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