void PoroMechanicsAction::act() { TensorMechanicsAction::act(); //Prepare displacements and set value for dim std::vector<NonlinearVariableName> displacements = getParam<std::vector<NonlinearVariableName> >("displacements"); unsigned int dim = displacements.size(); // all the kernels added below have porepressure as a coupled variable // add this to the kernel's params std::string type("PoroMechanicsCoupling"); InputParameters params = _factory.getValidParams(type); VariableName pp_var(getParam<NonlinearVariableName>("porepressure")); params.addCoupledVar("porepressure", ""); params.set<std::vector<VariableName> >("porepressure") = {pp_var}; // now add the kernels for (unsigned int i = 0; i < dim; ++i) { std::string kernel_name = "PoroMechanics" + Moose::stringify(i); params.set<unsigned int>("component") = i; params.set<NonlinearVariableName>("variable") = displacements[i]; _problem->addKernel(type, kernel_name, params); } }
// Render the given term into the output stream. void print(std::ostream& os, Tree* t) { if (not t) { os << "<null>"; return; } switch (t->kind) { case id_tree: return pp_terminal(os, as<Id_tree>(t)); case lit_tree: return pp_terminal(os, as<Lit_tree>(t)); case var_tree: return pp_var(os, as<Var_tree>(t)); case init_tree: return pp_init(os, as<Init_tree>(t)); case abs_tree: return pp_abs(os, as<Abs_tree>(t)); case fn_tree: return pp_fn(os, as<Fn_tree>(t)); case app_tree: return pp_app(os, as<App_tree>(t)); case if_tree: return pp_if(os, as<If_tree>(t)); case succ_tree: return pp_succ(os, as<Succ_tree>(t)); case pred_tree: return pp_pred(os, as<Pred_tree>(t)); case ls_tree: return pp_ls(os, as<Ls_tree>(t));//Rishi case mkdir_tree: return pp_mkdir(os, as<Mkdir_tree>(t));//Rishi case rmdir_tree: return pp_rmdir(os, as<Rmdir_tree>(t));//Rishi case cd_tree: return pp_cd(os, as<Cd_tree>(t));//Rishi case mv_tree: return pp_mv(os, as<Mv_tree>(t));//Rishi case iszero_tree: return pp_iszero(os, as<Iszero_tree>(t)); case arrow_tree: return pp_arrow(os, as<Arrow_tree>(t)); case def_tree: return pp_def(os, as<Def_tree>(t)); case print_tree: return pp_print(os, as<Print_tree>(t)); case typeof_tree: return pp_typeof(os, as<Typeof_tree>(t)); case tuple_tree: return pp_tuple(os, as<Tuple_tree>(t)); case list_tree: return pp_list(os, as<List_tree>(t)); case variant_tree: return pp_variant(os, as<Variant_tree>(t)); case comma_tree: return pp_comma(os, as<Comma_tree>(t)); case dot_tree: return pp_dot(os, as<Dot_tree>(t)); case prog_tree: return pp_prog(os, as<Prog_tree>(t)); } lang_unreachable(format("print unknown node '{}'", node_name(t))); }