Skip to content

Commit

Permalink
main.cc changed SlaybaughLab#10
Browse files Browse the repository at this point in the history
main.cc is adapted to using BartDriver<dim>
  • Loading branch information
Weixiong Zheng committed Jul 24, 2017
1 parent 734385f commit bdb941e
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 71 deletions.
12 changes: 6 additions & 6 deletions src/aqdata/aq_lsgc.cc → src/aqdata/lsgc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,22 @@

#include <iostream>

#include "aq_lsgc.h"
#include "lsgc.h"

template <int dim>
AQLSGC<dim>::AQLSGC (ParameterHandler &prm)
LSGC<dim>::LSGC (ParameterHandler &prm)
:
AQBase<dim> (prm)
{
}

template <int dim>
AQLSGC<dim>::~AQLSGC ()
LSGC<dim>::~LSGC ()
{
}

template <int dim>
void AQLSGC<dim>::produce_angular_quad ()
void LSGC<dim>::produce_angular_quad ()
{
AssertThrow (dim>=2,
ExcMessage("1D is not implemented"));
Expand Down Expand Up @@ -69,5 +69,5 @@ void AQLSGC<dim>::produce_angular_quad ()
}
}

template class AQLSGC<2>;
template class AQLSGC<3>;
template class LSGC<2>;
template class LSGC<3>;
10 changes: 5 additions & 5 deletions src/aqdata/aq_lsgc.h → src/aqdata/lsgc.h
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
#ifndef __aq_lsgc_h__
#define __aq_lsgc_h__
#ifndef __lsgc_h__
#define __lsgc_h__

#include "aq_base.h"

using namespace dealii;

template <int dim>
class AQLSGC : public AQBase<dim>
class LSGC : public AQBase<dim>
{
public:
AQLSGC (ParameterHandler &prm);
~AQLSGC ();
LSGC (ParameterHandler &prm);
~LSGC ();

void produce_angular_quad ();
};
Expand Down
72 changes: 16 additions & 56 deletions src/common/bart_driver.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ dof_handler (triangulation),
err_k_tol(1.0e-6),
err_phi_tol(1.0e-7),
err_phi_eigen_tol(1.0e-5),
prm(prm),
ho_linear_solver_name(prm.get("HO linear solver name")),
ho_preconditioner_name(prm.get("HO preconditioner name")),
pcout(std::cout,
Expand Down Expand Up @@ -57,62 +58,21 @@ TransportBase<dim>::~TransportBase ()
template <int dim>
void TransportBase<dim>::process_input ()
{
// basic parameters
{
// from basic problem definition
transport_model_name = def_ptr->get_transport_model ();
n_group = def_ptr->get_n_group ();
n_material = mat_ptr->get_n_material ();
p_order = def_ptr->get_fe_order ();
discretization = def_ptr->get_discretization ();
have_reflective_bc = def_ptr->get_reflective_bool ();
do_nda = def_ptr->get_nda_bool ();
is_eigen_problem = def_ptr->get_eigen_problem_bool ();
do_print_sn_quad = def_ptr->get_print_sn_quad_bool ();
global_refinements = def_ptr->get_uniform_refinement ();
namebase = def_ptr->get_output_namebase ();

// from angular quadrature data
n_azi = aqd_ptr->get_sn_order ();
n_dir = aqd_ptr->get_n_dir ();
component_index = aqd_ptr->get_component_index_map ();
inverse_component_index = aqd_ptr->get_inv_component_map ();
wi = aqd_ptr->get_angular_weights ();
omega_i = aqd_ptr->get_all_directions ();
if (transport_model_name=="ep" &&
discretization=="dfem")
{
tensor_norms = aqd_ptr->get_tensor_norms ();
c_penalty = 1.0 * p_order * (p_order + 1.0);
}
}

if (have_reflective_bc)
{
is_reflective_bc = msh_ptr->get_reflective_bc_map ();
reflective_direction_index = aqd_ptr->get_reflective_direction_index_map ();
}

// material properties
{
relative_position_to_id = msh_ptr->get_id_map ();
all_sigt = mat_ptr->get_sigma_t ();
all_inv_sigt = mat_ptr->get_inv_sigma_t ();
all_sigs = mat_ptr->get_sigma_s ();
all_sigs_per_ster = mat_ptr->get_sigma_s_per_ster ();
if (is_eigen_problem)
{
is_material_fissile = mat_ptr->get_fissile_id_map ();
all_nusigf = mat_ptr->get_nusigf ();
all_ksi_nusigf = mat_ptr->get_ksi_nusigf ();
all_ksi_nusigf_per_ster = mat_ptr->get_ksi_nusigf_per_ster ();
}
else
{
all_q = mat_ptr->get_q ();
all_q_per_ster = mat_ptr->get_q_per_ster ();
}
}
transport_model_name = def_ptr->get_transport_model ();
n_group = def_ptr->get_n_group ();
n_material = mat_ptr->get_n_material ();
p_order = def_ptr->get_fe_order ();
discretization = def_ptr->get_discretization ();
have_reflective_bc = def_ptr->get_reflective_bool ();
do_nda = def_ptr->get_nda_bool ();
is_eigen_problem = def_ptr->get_eigen_problem_bool ();
do_print_sn_quad = def_ptr->get_print_sn_quad_bool ();
global_refinements = def_ptr->get_uniform_refinement ();
namebase = def_ptr->get_output_namebase ();

// from angular quadrature data
n_azi = aqd_ptr->get_sn_order ();
n_dir = aqd_ptr->get_n_dir ();
}

template <int dim>
Expand Down
3 changes: 2 additions & 1 deletion src/common/bart_driver.h
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,8 @@ class TransportBase
double estimate_phi_diff (std::vector<LA::MPI::Vector*> &phis_newer,
std::vector<LA::MPI::Vector*> &phis_older);

const ParameterHandler &prm;

std_cxx11::shared_ptr<ProblemDefinition> def_ptr;
std_cxx11::shared_ptr<MeshGenerator<dim> > msh_ptr;
std_cxx11::shared_ptr<MaterialProperties> mat_ptr;
Expand All @@ -168,7 +170,6 @@ class TransportBase
std::string namebase;
std::string aq_name;

protected:
unsigned int get_component_index (unsigned int incident_angle_index, unsigned int g);
unsigned int get_component_direction (unsigned int comp_ind);
unsigned int get_component_group (unsigned int comp_ind);
Expand Down
18 changes: 15 additions & 3 deletions src/common/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,21 @@ int main(int argc, char *argv[])
ProblemDefinition::declare_parameters (prm);
prm.read_input(argv[1]);
Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv, 1);
// ModelManager modeler (prm);
dimension =
modeler.build_and_run_model (prm);
unsigned int dim = prm.get_integer ("problem dimension");
switch (dim)
{
case 2:
BartDriver<2> drive (prm);
drive.run ();
break;

case 3:
BartDriver<3> drive (prm);
drive.run ();

default:
break;
}
}
catch (std::exception &exc)
{
Expand Down

0 comments on commit bdb941e

Please sign in to comment.