kharm/self_init.hpp
/**
 * Initialization of a Bondi problem with specified sonic point, BH mdot, and horizon radius
 * TODO this can/should be just mdot (and the grid ofc), if this problem is to be used as anything more than a test
 */
Initialization of a Bondi problem with specified sonic point, BH mdot, and horizon radius
TODO this can/should be just mdot (and the grid ofc), if this problem is to be used as anything more than a test
Initialization of a Bondi problem with specified sonic point BH mdot and horizon radius TODO this can / should be just mdot ( and the grid ofc ) if this problem is to be used as anything more than a test
GridVarsHost bondi(const Grid& G, const EOS* eos, const Real mdot, const Real rs)
{
#if DEBUG
    cerr << "mdot = " << mdot << endl;
    cerr << "rs   = " << rs << endl;
#endif
    GridVars p_d("prims_initial_all", G.gn1, G.gn2, G.gn3, G.nvar);
    cerr << "Initialized prims array" << endl;
    get_prim_bondi(G, p_d, eos, G.bulk_ng(), mdot, rs);
    cerr << "Initialized bondi on device" << endl;
    auto p_all = Kokkos::create_mirror(p_d);
    Kokkos::deep_copy(p_all, p_d);
    cerr << "Copied to host" << endl;
    auto p_s = subview(p_all, Kokkos::make_pair(G.ng, G.ng + G.n1),
                                Kokkos::make_pair(G.ng, G.ng + G.n2),
                                Kokkos::make_pair(G.ng, G.ng + G.n3),
                                ALL());
    GridVarsHost p("prims_initial", G.n1, G.n2, G.n3, G.nvar);
    Kokkos::deep_copy(p, p_s); 
    cerr << "Copied on host" << endl;
    return p;
}
GridVarsHost bondi ( const Grid & G , const EOS * eos , const Real mdot , const Real rs ) { #if DEBUG cerr << " " << mdot << endl ; cerr << " " << rs << endl ; #endif GridVars p_d ( " " , G . gn1 , G . gn2 , G . gn3 , G . nvar ) ; cerr << " " << endl ; get_prim_bondi ( G , p_d , eos , G . bulk_ng ( ) , mdot , rs ) ; cerr << " " << endl ; auto p_all = Kokkos :: create_mirror ( p_d ) ; Kokkos :: deep_copy ( p_all , p_d ) ; cerr << " " << endl ; auto p_s = subview ( p_all , Kokkos :: make_pair ( G . ng , G . ng + G . n1 ) , Kokkos :: make_pair ( G . ng , G . ng + G . n2 ) , Kokkos :: make_pair ( G . ng , G . ng + G . n3 ) , ALL ( ) ) ; GridVarsHost p ( " " , G . n1 , G . n2 , G . n3 , G . nvar ) ; Kokkos :: deep_copy ( p , p_s ) ; cerr << " " << endl ; return p ; }
Initialization of a Bondi problem with specified sonic point, BH mdot, and horizon radius
 TODO this can/should be just mdot (and the grid ofc), if this problem is to be used as anything more than a test
Initialization of a Bondi problem with specified sonic point BH mdot and horizon radius TODO this can / should be just mdot ( and the grid ofc ) if this problem is to be used as anything more than a test
// TODO print zone? // Initialize with ghost zones // get_prim_bondi will have to be device-side anyway for boundary conditions, // and our default coordinates object is there anyway.  // Copy first to host // Then subview and copy into final memory // TODO see if this or the offset back in main() is faster // Get rid of the stride, it's annoying