aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Docs/source/visualization/ascent.rst188
-rw-r--r--Source/Diagnostics/WarpXIO.cpp56
2 files changed, 194 insertions, 50 deletions
diff --git a/Docs/source/visualization/ascent.rst b/Docs/source/visualization/ascent.rst
index 4f8a2bbd9..12a11d38a 100644
--- a/Docs/source/visualization/ascent.rst
+++ b/Docs/source/visualization/ascent.rst
@@ -45,65 +45,153 @@ The supported parameters are described in the following table.
+-------------------------+------------------------------------------------------+---------+
A typical use case is setting :code:`insitu.int` to a value of one or greater and
-:code:`insitu.start` to the first time step where in situ analyswhere in situ analysis should be
+:code:`insitu.start` to the first time step where in situ analysis should be
performed.
Visualization/Analysis Pipeline Configuration
---------------------------------------------
-Ascent uses the file :code:`ascent_actions.json` to configure analysis and
-visualization pipelines. For example, the following :code:`ascent_actions.json`
+Ascent uses the file :code:`ascent_actions.yaml` to configure analysis and
+visualization pipelines. Ascent looks for the :code:`ascent_actions.yaml` file
+in the current working directory.
+
+For example, the following :code:`ascent_actions.yaml`
file extracts an isosurface of the field Ex for 15 levels and saves the
resulting images to :code:`levels_<nnnn>.png`. `Ascent Actions
<https://ascent.readthedocs.io/en/latest/Actions/index.html>`_ provides an
overview over all available analysis and visualization actions.
.. code-block:: json
+-
+ action: "add_pipelines"
+ pipelines:
+ p1:
+ f1:
+ type: "contour"
+ params:
+ field: "Ex"
+ levels: 15
+-
+ action: "add_scenes"
+ scenes:
+ scene1:
+ image_prefix: "levels_%04d"
+ plots:
+ plot1:
+ type: "pseudocolor"
+ pipeline: "p1"
+ field: "Ex"
+
+Here is another :code:`ascent_actions.yaml` example that renders isosurfaces
+and particles:
- [
- {
- "action": "add_pipelines",
- "pipelines":
- {
- "p1":
- {
- "f1":
- {
- "type" : "contour",
- "params" :
- {
- "field" : "Ex",
- "levels": 15
- }
- }
- }
- }
- },
- {
- "action": "add_scenes",
- "scenes":
- {
- "s1":
- {
- "image_prefix": "levels_%04d",
- "plots":
- {
- "p1":
- {
- "type": "pseudocolor",
- "pipeline": "p1",
- "field": "Ex"
- }
- }
- }
- }
- },
-
- {
- "action": "execute"
- },
-
- {
- "action": "reset"
- }
- ]
+.. code-block:: json
+-
+ action: "add_pipelines"
+ pipelines:
+ p1:
+ f1:
+ type: "contour"
+ params:
+ field: "Bx"
+ levels: 3
+-
+ action: "add_scenes"
+ scenes:
+ scene1:
+ plots:
+ plot1:
+ type: "pseudocolor"
+ pipeline: "p1"
+ field: "Bx"
+ plot2:
+ type: "pseudocolor"
+ field: "particle_electrons_Bx"
+ points:
+ radius: 0.0000005
+ renders:
+ r1:
+ camera:
+ azimuth: 100
+ elevation: 10
+ image_prefix: "out_render_3d_%06d"
+
+
+Finally, here is a more complex :code:`ascent_actions.yaml` example that
+creates the same images as the prior example, but adds a trigger that
+creates a Cinema Database at cycle 300:
+.. code-block:: json
+-
+ action: "add_triggers"
+ triggers:
+ t1:
+ params:
+ condition: "cycle() == 300"
+ actions_file: "trigger.yaml"
+-
+ action: "add_pipelines"
+ pipelines:
+ p1:
+ f1:
+ type: "contour"
+ params:
+ field: "jy"
+ iso_values: [ 1000000000000.0, -1000000000000.0]
+-
+ action: "add_scenes"
+ scenes:
+ scene1:
+ plots:
+ plot1:
+ type: "pseudocolor"
+ pipeline: "p1"
+ field: "jy"
+ plot2:
+ type: "pseudocolor"
+ field: "particle_electrons_w"
+ points:
+ radius: 0.0000002
+ renders:
+ r1:
+ camera:
+ azimuth: 100
+ elevation: 10
+ image_prefix: "out_render_jy_part_w_3d_%06d"
+
+
+When the trigger condition is meet, `cycle() == 300`, the actions in
+:code:`trigger.yaml` are also executed:
+
+.. code-block:: json
+-
+ action: "add_pipelines"
+ pipelines:
+ p1:
+ f1:
+ type: "contour"
+ params:
+ field: "jy"
+ iso_values: [ 1000000000000.0, -1000000000000.0]
+-
+ action: "add_scenes"
+ scenes:
+ scene1:
+ plots:
+ plot1:
+ type: "pseudocolor"
+ pipeline: "p1"
+ field: "jy"
+ plot2:
+ type: "pseudocolor"
+ field: "particle_electrons_w"
+ points:
+ radius: 0.0000001
+ renders:
+ r1:
+ type: "cinema"
+ phi: 10
+ theta: 10
+ db_name: "cinema_out"
+
+You can view the Cinema Database result by opening
+:code:`cinema_databases/cinema_out/index.html`.
diff --git a/Source/Diagnostics/WarpXIO.cpp b/Source/Diagnostics/WarpXIO.cpp
index c944c464d..4dfe9b3e3 100644
--- a/Source/Diagnostics/WarpXIO.cpp
+++ b/Source/Diagnostics/WarpXIO.cpp
@@ -459,6 +459,7 @@ WarpX::UpdateInSitu () const
#endif
#ifdef AMREX_USE_ASCENT
+ // wrap mesh data
conduit::Node bp_mesh;
MultiLevelToBlueprint(finest_level+1,
amrex::GetVecOfConstPtrs(mf_avg),
@@ -469,6 +470,61 @@ WarpX::UpdateInSitu () const
refRatio(),
bp_mesh);
+ // wrap particle data for each species
+ // we prefix the fields with "particle_{species_name}" b/c we
+ // want to to uniquely name all the fields that can be plotted
+
+ std::vector<std::string> species_names = mypc->GetSpeciesNames();
+
+ for (unsigned i = 0, n = species_names.size(); i < n; ++i)
+ {
+
+ Vector<std::string> particle_varnames;
+ Vector<std::string> particle_int_varnames;
+ std::string prefix = "particle_" + species_names[i];
+
+ // Get pc for species
+ auto& pc = mypc->GetParticleContainer(i);
+
+ // get names of real comps
+ std::map<std::string, int> real_comps_map = pc.getParticleComps();
+ std::map<std::string, int>::const_iterator r_itr = real_comps_map.begin();
+
+ // TODO: Looking at other code paths, I am not sure compile time
+ // QED field is included in getParticleComps()?
+ while (r_itr != real_comps_map.end())
+ {
+ // get next real particle name
+ std::string varname = r_itr->first;
+ particle_varnames.push_back(prefix + "_" + varname);
+ r_itr++;
+ }
+
+ // get names of int comps
+ std::map<std::string, int> int_comps_map = pc.getParticleiComps();
+ std::map<std::string, int>::const_iterator i_itr = int_comps_map.begin();
+
+ while (i_itr != int_comps_map.end())
+ {
+ // get next real particle name
+ std::string varname = i_itr->first;
+ particle_int_varnames.push_back(prefix + "_" + varname);
+ i_itr++;
+ }
+
+ // wrap pc for current species into a blueprint topology
+ amrex::ParticleContainerToBlueprint(pc,
+ particle_varnames,
+ particle_int_varnames,
+ bp_mesh,
+ prefix);
+ }
+
+ // // If you want to save blueprint HDF5 files w/o using an Ascent
+ // // extract, you can call the following AMReX helper:
+ // const auto step = istep[0];
+ // WriteBlueprintFiles(bp_mesh,"bp_export",step,"hdf5");
+
ascent::Ascent ascent;
conduit::Node opts;
opts["exceptions"] = "catch";