Skip to content

AMReX and Friends

Cyrus Harrison edited this page Nov 19, 2018 · 18 revisions

Using Ascent in WarpX

General WrapX build instructions: https://ecp-warpx.github.io/installation.html

Here are the repos I used:

AMReX (Use this instead of what the instructions suggest)

PICASR: (Use as instructions suggest)

WarpX: (LBL folks need to add you to access the repo, use as instructions suggest)

(Note: I think this is now on github?)

Here is my example build (make command) that I used on my mac laptop (make sure you have mpicc in your path)

make COMP=clang USE_OMP=FALSE
USE_CONDUIT=TRUE USE_ASCENT=TRUE
CONDUIT_DIR={path to conduit install}
ASCENT_DIR={path to ascent install}

This will build an exe called something like "Bin/main3d.llvm.TPROF.MPI.ex"

For input I am using the "Plasma Wakefield example w/o mesh refinement" from:

https://ecp-warpx.github.io/running_cpp/examples.html

To actually use Ascent, here is the integration code

==== Add to Source/WarpXIO.cpp :: WarpX::WritePlotFile () after plot files are written ==

MultiLevelToBlueprint( finest_level+1,
                       amrex::GetVecOfConstPtrs(mf),
                       varnames,
                       Geom(),
                       t_new[0],
                       istep,
                       refRatio(),
                       bp_mesh);

///////////////////////////////////////////////////////////////////
// Render with Ascent
///////////////////////////////////////////////////////////////////

// add a scene with a pseudocolor plot
Node scenes;
scenes["s1/plots/p1/type"] = "pseudocolor";
scenes["s1/plots/p1/params/field"] = "divB";
scenes["s1/plots/p1/pipeline"] = "pl1";
// Set the output file name (ascent will add ".png")
scenes["s1/image_prefix"] = amrex::Concatenate("ascent_render_",istep[0]);

Node pipelines;
pipelines["pl1/f1/type"] = "threshold";
conduit::Node &thresh_params = pipelines["pl1/f1/params"];
thresh_params["field"] = "divB";
thresh_params["min_value"] = 25;
thresh_params["max_value"] = 1000;

// setup actions
Node actions;

Node &add_pipes = actions.append();
add_pipes["action"] = "add_pipelines";
add_pipes["pipelines"] = pipelines;

Node &add_act = actions.append();
add_act["action"] = "add_scenes";
add_act["scenes"] = scenes;

actions.append()["action"] = "execute";
actions.append()["action"] = "reset";

Ascent ascent;
Node opts;
opts["exceptions"] = "catch";
opts["mpi_comm"] = MPI_Comm_c2f(ParallelDescriptor::Communicator());
ascent.open(opts);
ascent.publish(bp_mesh);
ascent.execute(actions);
ascent.close();

// end code

-Cyrus

Clone this wiki locally