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
41531aee
Commit
41531aee
authored
12 years ago
by
Elias Pipping
Committed by
Elias Pipping
12 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Externalise the data writers
parent
411da0d6
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/one-body-sample.org
+34
-19
34 additions, 19 deletions
src/one-body-sample.org
with
34 additions
and
19 deletions
src/one-body-sample.org
+
34
−
19
View file @
41531aee
...
...
@@ -103,9 +103,40 @@
else if (coordinates[0] == lowerLeft[0])
;
}
// Make sure that specialNode was set and points to a frictional node
assert(specialNode != finestSize);
assert(frictionalNodes[specialNode][0]);
}
#+end_src
* Writers
#+name: createWriters
#+begin_src c++
std::fstream state_writer("state", std::fstream::out);
std::fstream displacement_writer("displacement", std::fstream::out);
std::fstream velocity_writer("velocity", std::fstream::out);
std::fstream coefficient_writer("coefficient", std::fstream::out);
#+end_src
#+name: writeData
#+begin_src c++
state_writer << alpha[specialNode][0] << " " << std::endl;
displacement_writer << u[specialNode][0] << " " << std::endl;
velocity_writer << ud[specialNode][0] << " " << std::endl;
coefficient_writer << mu
+ a * std::log(ud[specialNode].two_norm() / V0)
+ b * (alpha[specialNode] + std::log(V0 / L))
<< " " << std::endl;
#+end_src
#+name: closeWriters
#+begin_src c++
state_writer.close();
displacement_writer.close();
velocity_writer.close();
coefficient_writer.close();
#+end_src
* Main
#+begin_src c++ :tangle one-body-sample.cc :noweb yes
#ifdef HAVE_CONFIG_H
...
...
@@ -336,8 +367,6 @@
Dune::BitSetVector<1> neumannNodes(finestSize, false);
Dune::BitSetVector<1> frictionalNodes(finestSize, false);
<<setupBoundary>>
assert(specialNode != finestSize);
assert(frictionalNodes[specialNode][0]);
auto const nodalIntegrals
= assemble_frictional<GridType, GridView, SmallVector, P1Basis>
...
...
@@ -372,10 +401,7 @@
mySolver(parset.sub("solver.tnnmg"), refinements, solver_tolerance,
*grid, ignoreNodes);
std::fstream state_writer("state", std::fstream::out);
std::fstream displacement_writer("displacement", std::fstream::out);
std::fstream velocity_writer("velocity", std::fstream::out);
std::fstream coefficient_writer("coefficient", std::fstream::out);
<<createWriters>>
auto const L = parset.get<double>("boundary.friction.ruina.L");
auto const a = parset.get<double>("boundary.friction.ruina.a");
...
...
@@ -461,15 +487,7 @@
std::cerr << std::endl;
}
{ // Write all kinds of data
state_writer << alpha[specialNode][0] << " " << std::endl;
displacement_writer << u[specialNode][0] << " " << std::endl;
velocity_writer << ud[specialNode][0] << " " << std::endl;
coefficient_writer << mu
+ a * std::log(ud[specialNode].two_norm() / V0)
+ b * (alpha[specialNode] + std::log(V0 / L))
<< " " << std::endl;
}
<<writeData>>
// Compute von Mises stress and write everything to a file
if (parset.get<bool>("writeVTK")) {
...
...
@@ -491,10 +509,7 @@
<< " time steps took " << timer.elapsed()
<< "s" << std::endl;
state_writer.close();
displacement_writer.close();
velocity_writer.close();
coefficient_writer.close();
<<closeWriters>>;
Python::stop();
}
...
...
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