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
905dafa9
Commit
905dafa9
authored
12 years ago
by
Elias Pipping
Committed by
Elias Pipping
12 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Solve velocity problem w/ corresponding Dirichlet
parent
189de4d7
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/one-body-sample.py
+1
-1
1 addition, 1 deletion
src/one-body-sample.py
src/timestepping.cc
+13
-24
13 additions, 24 deletions
src/timestepping.cc
with
14 additions
and
25 deletions
src/one-body-sample.py
+
1
−
1
View file @
905dafa9
...
...
@@ -13,7 +13,7 @@ class neumannCondition:
class
dirichletCondition
:
def
__call__
(
self
,
x
):
return
x
*
.
005
return
.
005
Functions
=
{
'
neumannCondition
'
:
neumannCondition
(),
...
...
This diff is collapsed.
Click to expand it.
src/timestepping.cc
+
13
−
24
View file @
905dafa9
...
...
@@ -56,23 +56,20 @@ class ImplicitEuler
problem_A
=
this
->
A
;
problem_A
*=
this
->
tau
;
//
Treat as Delta u_n for now
problem_iterate
=
this
->
u_old
;
if
(
u_old_old_ptr
)
//
Use the old velocity as an initial iterate if possible
if
(
u_old_old_ptr
)
{
problem_iterate
=
this
->
u_old
;
problem_iterate
-=
*
u_old_old_ptr
;
problem_iterate
/=
this
->
tau
;
}
else
problem_iterate
=
0.0
;
for
(
size_t
i
=
0
;
i
<
this
->
dirichletNodes
.
size
();
++
i
)
if
(
this
->
dirichletNodes
[
i
].
count
()
==
dim
)
{
double
val
;
this
->
dirichletFunction
.
evaluate
(
this
->
time
,
val
);
problem_iterate
[
i
]
=
0
;
// Everything prescribed
problem_iterate
[
i
][
0
]
=
val
-
this
->
u_old
[
i
][
0
];
// Time-dependent X direction
problem_iterate
[
i
]
=
0
;
this
->
dirichletFunction
.
evaluate
(
this
->
time
,
problem_iterate
[
i
][
0
]);
}
else
if
(
this
->
dirichletNodes
[
i
][
1
])
problem_iterate
[
i
][
1
]
=
0
;
// Y direction described
// Make it a velocity
problem_iterate
/=
this
->
tau
;
problem_iterate
[
i
][
1
]
=
0
;
// Y direction prescribed
}
void
virtual
extractSolution
(
VectorType
const
&
problem_iterate
,
...
...
@@ -112,25 +109,17 @@ class ImplicitTwoStep
problem_A
=
this
->
A
;
problem_A
*=
2.0
/
3.0
*
this
->
tau
;
//
The finite difference makes a good start (treat it as such for now)
//
Use the old velocity as an initial iterate
problem_iterate
=
this
->
u_old
;
problem_iterate
-=
*
u_old_old_ptr
;
problem_iterate
/=
this
->
tau
;
for
(
size_t
i
=
0
;
i
<
this
->
dirichletNodes
.
size
();
++
i
)
if
(
this
->
dirichletNodes
[
i
].
count
()
==
dim
)
{
double
val
;
this
->
dirichletFunction
.
evaluate
(
this
->
time
,
val
);
problem_iterate
[
i
]
=
0
;
problem_iterate
[
i
].
axpy
(
-
2
,
this
->
u_old
[
i
]);
problem_iterate
[
i
].
axpy
(
.5
,
(
*
u_old_old_ptr
)[
i
]);
problem_iterate
[
i
][
0
]
=
1.5
*
val
-
2
*
this
->
u_old
[
i
][
0
]
+
.5
*
(
*
u_old_old_ptr
)[
i
][
0
];
this
->
dirichletFunction
.
evaluate
(
this
->
time
,
problem_iterate
[
i
][
0
]);
}
else
if
(
this
->
dirichletNodes
[
i
][
1
])
// Y direction described
problem_iterate
[
i
][
1
]
=
-
2
*
this
->
u_old
[
i
][
1
]
+
.5
*
(
*
u_old_old_ptr
)[
i
][
1
];
// Now treat it as a velocity
problem_iterate
/=
this
->
tau
;
problem_iterate
[
i
][
1
]
=
0
;
// Y direction prescribed
}
void
virtual
extractSolution
(
VectorType
const
&
problem_iterate
,
...
...
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