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
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
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
agnumpde
dune-tectonic
Commits
fe0a5d17
Commit
fe0a5d17
authored
10 years ago
by
Elias Pipping
Browse files
Options
Downloads
Patches
Plain Diff
[Algorit] Use adaptive time stepping
parent
7ea0c5e9
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/sand-wedge-data/parset.cfg
+1
-0
1 addition, 0 deletions
src/sand-wedge-data/parset.cfg
src/sand-wedge.cc
+107
-5
107 additions, 5 deletions
src/sand-wedge.cc
with
108 additions
and
5 deletions
src/sand-wedge-data/parset.cfg
+
1
−
0
View file @
fe0a5d17
...
@@ -36,6 +36,7 @@ a = 0.030 # [1] ?
...
@@ -36,6 +36,7 @@ a = 0.030 # [1] ?
b
=
0.015 # [1] ?
b
=
0.015 # [1] ?
[timeSteps]
[timeSteps]
refinementTolerance
=
1e-5
number
=
100000
number
=
100000
scheme
=
newmark
scheme
=
newmark
...
...
This diff is collapsed.
Click to expand it.
src/sand-wedge.cc
+
107
−
5
View file @
fe0a5d17
...
@@ -488,17 +488,119 @@ int main(int argc, char *argv[]) {
...
@@ -488,17 +488,119 @@ int main(int argc, char *argv[]) {
parset
.
get
<
double
>
(
"boundary.friction.V0"
));
parset
.
get
<
double
>
(
"boundary.friction.V0"
));
auto
const
finalTime
=
parset
.
get
<
double
>
(
"problem.finalTime"
);
auto
const
finalTime
=
parset
.
get
<
double
>
(
"problem.finalTime"
);
auto
const
relativeTau
=
1.0
/
parset
.
get
<
size_t
>
(
"timeSteps.number"
);
double
relativeTime
=
0.0
;
double
relativeTime
=
0.0
;
double
relativeTau
=
1e-6
;
// FIXME (not really important, though)
using
MyStateUpdater
=
StateUpdater
<
ScalarVector
,
Vector
>
;
using
MyTimeStepper
=
TimeSteppingScheme
<
Vector
,
Matrix
,
Function
,
dims
>
;
auto
const
refinementTolerance
=
parset
.
get
<
double
>
(
"timeSteps.refinementTolerance"
);
size_t
timeStep
=
1
;
size_t
timeStep
=
1
;
while
(
relativeTime
<
1.0
-
1e-10
)
{
CoupledTimeStepper
<
NonlinearFactory
,
StateUpdater
<
ScalarVector
,
Vector
>
,
auto
stateUpdaterR1
=
stateUpdater
->
clone
();
TimeSteppingScheme
<
Vector
,
Matrix
,
Function
,
dims
>>
auto
velocityUpdaterR1
=
velocityUpdater
->
clone
();
{
CoupledTimeStepper
<
NonlinearFactory
,
MyStateUpdater
,
MyTimeStepper
>
coupledTimeStepper
(
finalTime
,
factory
,
parset
,
myGlobalFriction
,
coupledTimeStepper
(
finalTime
,
factory
,
parset
,
myGlobalFriction
,
stateUpdater
,
velocityUpdater
,
computeExternalForces
);
stateUpdaterR1
,
velocityUpdaterR1
,
computeExternalForces
);
coupledTimeStepper
.
step
(
relativeTime
,
relativeTau
);
coupledTimeStepper
.
step
(
relativeTime
,
relativeTau
);
}
std
::
shared_ptr
<
MyStateUpdater
>
stateUpdaterR2
=
nullptr
;
std
::
shared_ptr
<
MyTimeStepper
>
velocityUpdaterR2
=
nullptr
;
while
(
relativeTime
<
1.0
-
1e-10
)
{
bool
didCoarsen
=
false
;
while
(
true
)
{
stateUpdaterR2
=
stateUpdaterR1
->
clone
();
velocityUpdaterR2
=
velocityUpdaterR1
->
clone
();
ScalarVector
alphaR2
;
{
CoupledTimeStepper
<
NonlinearFactory
,
MyStateUpdater
,
MyTimeStepper
>
coupledTimeStepper
(
finalTime
,
factory
,
parset
,
myGlobalFriction
,
stateUpdaterR2
,
velocityUpdaterR2
,
computeExternalForces
);
coupledTimeStepper
.
step
(
relativeTime
+
relativeTau
,
relativeTau
);
}
stateUpdaterR2
->
extractAlpha
(
alphaR2
);
auto
stateUpdaterC
=
stateUpdater
->
clone
();
auto
velocityUpdaterC
=
velocityUpdater
->
clone
();
ScalarVector
alphaC
;
{
CoupledTimeStepper
<
NonlinearFactory
,
MyStateUpdater
,
MyTimeStepper
>
coupledTimeStepper
(
finalTime
,
factory
,
parset
,
myGlobalFriction
,
stateUpdaterC
,
velocityUpdaterC
,
computeExternalForces
);
coupledTimeStepper
.
step
(
relativeTime
,
2.0
*
relativeTau
);
}
stateUpdaterC
->
extractAlpha
(
alphaC
);
auto
const
coarseningError
=
stateEnergyNorm
.
diff
(
alphaC
,
alphaR2
);
if
(
coarseningError
<
refinementTolerance
)
{
stateUpdaterR2
=
nullptr
;
velocityUpdaterR2
=
nullptr
;
stateUpdaterR1
=
stateUpdaterC
;
velocityUpdaterR1
=
velocityUpdaterC
;
relativeTau
*=
2.0
;
didCoarsen
=
true
;
}
else
{
break
;
}
}
if
(
!
didCoarsen
)
{
ScalarVector
alphaR1
;
while
(
true
)
{
auto
stateUpdaterF2
=
stateUpdater
->
clone
();
auto
velocityUpdaterF2
=
velocityUpdater
->
clone
();
std
::
shared_ptr
<
MyStateUpdater
>
stateUpdaterF1
;
std
::
shared_ptr
<
MyTimeStepper
>
velocityUpdaterF1
;
ScalarVector
alphaF2
;
{
CoupledTimeStepper
<
NonlinearFactory
,
MyStateUpdater
,
MyTimeStepper
>
coupledTimeStepper
(
finalTime
,
factory
,
parset
,
myGlobalFriction
,
stateUpdaterF2
,
velocityUpdaterF2
,
computeExternalForces
);
coupledTimeStepper
.
step
(
relativeTime
,
relativeTau
/
2.0
);
stateUpdaterF1
=
stateUpdaterF2
->
clone
();
velocityUpdaterF1
=
velocityUpdaterF2
->
clone
();
coupledTimeStepper
.
step
(
relativeTime
+
relativeTau
/
2.0
,
relativeTau
/
2.0
);
}
stateUpdaterF2
->
extractAlpha
(
alphaF2
);
stateUpdaterR1
->
extractAlpha
(
alphaR1
);
auto
const
refinementError
=
stateEnergyNorm
.
diff
(
alphaR1
,
alphaF2
);
if
(
refinementError
<
refinementTolerance
)
{
break
;
}
else
{
stateUpdaterR1
=
stateUpdaterF1
;
velocityUpdaterR1
=
velocityUpdaterF1
;
stateUpdaterR2
=
stateUpdaterF2
;
velocityUpdaterR2
=
velocityUpdaterF2
;
relativeTau
/=
2.0
;
}
}
}
stateUpdater
=
stateUpdaterR1
;
velocityUpdater
=
velocityUpdaterR1
;
stateUpdaterR1
=
stateUpdaterR2
;
velocityUpdaterR1
=
velocityUpdaterR2
;
relativeTime
+=
relativeTau
;
relativeTime
+=
relativeTau
;
Vector
u
,
ur
,
vr
;
Vector
u
,
ur
,
vr
;
...
...
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