-
Notifications
You must be signed in to change notification settings - Fork 242
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a signal before building patches for visualization output #5787
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
Copyright (C) 2022 by the authors of the ASPECT code. | ||
|
||
This file is part of ASPECT. | ||
|
||
ASPECT is free software; you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation; either version 2, or (at your option) | ||
any later version. | ||
|
||
ASPECT is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
|
||
You should have received a copy of the GNU General Public License | ||
along with ASPECT; see the file LICENSE. If not see | ||
<http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#include <aspect/simulator_signals.h> | ||
#include <aspect/simulator_access.h> | ||
|
||
#include <iostream> | ||
|
||
namespace aspect | ||
{ | ||
template <int dim> | ||
void pre_data_out_build_patches (DataOut<dim> &) | ||
{ | ||
std::cout << "\npre_data_out_build_patches:\n"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this output is not triggered or am I wrong? Are you generating graphical output in every step? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
} | ||
|
||
|
||
template <int dim> | ||
void signal_connector (SimulatorSignals<dim> &signals) | ||
{ | ||
std::cout << "Connecting signals" << std::endl; | ||
signals.pre_data_out_build_patches.connect (&pre_data_out_build_patches<dim>); | ||
} | ||
|
||
|
||
ASPECT_REGISTER_SIGNALS_CONNECTOR(signal_connector<2>, | ||
signal_connector<3>) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
# A copy of stokes_solver.prm | ||
# to test the pre_data_out_build_patches signal | ||
# in visualization.cc. | ||
|
||
set Dimension = 2 | ||
set CFL number = 1.0 | ||
set End time = 0.1 | ||
set Start time = 0 | ||
set Adiabatic surface temperature = 0 | ||
set Surface pressure = 0 | ||
set Use years in output instead of seconds = false | ||
set Nonlinear solver scheme = single Advection, single Stokes | ||
|
||
subsection Boundary temperature model | ||
set List of model names = box | ||
set Fixed temperature boundary indicators = 0, 1 | ||
end | ||
|
||
subsection Gravity model | ||
set Model name = vertical | ||
end | ||
|
||
subsection Geometry model | ||
set Model name = box | ||
|
||
subsection Box | ||
set X extent = 1.2 | ||
set Y extent = 1 | ||
set Z extent = 1 | ||
end | ||
end | ||
|
||
subsection Initial temperature model | ||
set Model name = perturbed box | ||
end | ||
|
||
subsection Material model | ||
set Model name = simpler | ||
|
||
subsection Simpler model | ||
set Reference density = 1 | ||
set Reference specific heat = 1250 | ||
set Reference temperature = 1 | ||
set Thermal conductivity = 1e-6 | ||
set Thermal expansion coefficient = 2e-5 | ||
set Viscosity = 1 | ||
end | ||
end | ||
|
||
subsection Mesh refinement | ||
set Initial adaptive refinement = 0 | ||
set Initial global refinement = 5 | ||
end | ||
|
||
subsection Boundary velocity model | ||
set Tangential velocity boundary indicators = 1 | ||
set Zero velocity boundary indicators = 0, 2, 3 | ||
end | ||
|
||
subsection Postprocess | ||
set List of postprocessors = visualization, velocity statistics | ||
|
||
subsection Visualization | ||
set List of output variables = density, viscosity | ||
end | ||
end | ||
|
||
subsection Solver parameters | ||
subsection Stokes solver parameters | ||
set Number of cheap Stokes solver steps = 30 | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
|
||
Loading shared library <./libpre_data_out_build_patches.debug.so> | ||
|
||
Connecting signals | ||
Number of active cells: 1,024 (on 6 levels) | ||
Number of degrees of freedom: 13,764 (8,450+1,089+4,225) | ||
|
||
*** Timestep 0: t=0 seconds, dt=0 seconds | ||
Solving temperature system... 0 iterations. | ||
Rebuilding Stokes preconditioner... | ||
Solving Stokes system... 30+7 iterations. | ||
|
||
Postprocessing: | ||
|
||
pre_data_out_build_patches: | ||
Writing graphical output: output-pre_data_out_build_patches/solution/solution-00000 | ||
RMS, max velocity: 9e-09 m/s, 3.23e-08 m/s | ||
|
||
*** Timestep 1: t=0.1 seconds, dt=0.1 seconds | ||
Solving temperature system... 4 iterations. | ||
Solving Stokes system... 8+0 iterations. | ||
|
||
Postprocessing: | ||
RMS, max velocity: 9e-09 m/s, 3.23e-08 m/s | ||
|
||
Termination requested by criterion: end time | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# 1: Time step number | ||
# 2: Time (seconds) | ||
# 3: Time step size (seconds) | ||
# 4: Number of mesh cells | ||
# 5: Number of Stokes degrees of freedom | ||
# 6: Number of temperature degrees of freedom | ||
# 7: Iterations for temperature solver | ||
# 8: Iterations for Stokes solver | ||
# 9: Velocity iterations in Stokes preconditioner | ||
# 10: Schur complement iterations in Stokes preconditioner | ||
# 11: Visualization file name | ||
# 12: RMS velocity (m/s) | ||
# 13: Max. velocity (m/s) | ||
0 0.000000000000e+00 0.000000000000e+00 1024 9539 4225 0 37 85 38 output-pre_data_out_build_patches/solution/solution-00000 9.00076484e-09 3.23376827e-08 | ||
1 1.000000000000e-01 1.000000000000e-01 1024 9539 4225 4 7 9 9 "" 9.00076831e-09 3.23376980e-08 |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is one way. I assume you want to use this to let the called function attach itself to the DataOut? Why not have a signal that returns a function object selecting individual cells that can then directly be attached to DoFHandler?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As just discussed, we tried to keep the signal as general as possible as other things could be done with DataOut.