void DisplacementContinuationSolver::increment_displacement( GRINS::MultiphysicsSystem& system,
                                                               libMesh::EquationSystems& equation_system,
                                                               const libMesh::Real displacement )
  {
    // Get DirichetBoundaries vector.
    libMesh::DirichletBoundaries* d_vector = system.get_dof_map().get_dirichlet_boundaries();

    // Get the DirichletBoundary we want
    libMesh::DirichletBoundary* dirichlet = (*d_vector)[_bc_index];

    // Kill the old FunctionBase object and put in our new one.
    libMesh::FunctionBase<libMesh::Real>* composite_func_ptr = new libMesh::CompositeFunction<libMesh::Real>;
    libMesh::CompositeFunction<libMesh::Real>& composite_func = libMesh::cast_ref<libMesh::CompositeFunction<libMesh::Real>&>( *composite_func_ptr );

    std::vector<VariableIndex> var_idx(1,0); // Hardcoding to Ux displacement component
    composite_func.attach_subfunction( libMesh::ConstFunction<libMesh::Real>(displacement), var_idx );

    // DirichletBoundary now takes ownership of the pointer
    dirichlet->f.reset(composite_func_ptr);

    // Need to reinit system
    equation_system.reinit();

    return;
  }
  void PressureContinuationSolver::increment_pressure( GRINS::MultiphysicsSystem& system,
                                                       libMesh::Real pressure )
  {
    // Get Physics class and cast
    std::tr1::shared_ptr<GRINS::Physics> raw_physics = system.get_physics(elastic_membrane_constant_pressure);
    ElasticMembraneConstantPressure& physics = libMesh::cast_ref<ElasticMembraneConstantPressure&>( *(raw_physics.get()) );

    physics.reset_pressure(pressure);

    return;
  }
示例#3
0
int main(int argc, char* argv[])
{
#if GRINS_HAVE_ANTIOCH
  GRINS::Runner runner(argc,argv);
  runner.init();

  // Parse the wavenumber range to plot over from the input file
  const GetPot & input = runner.get_input_file();

  libMesh::Real nu_min  = input("SpectroscopyExample/wavenumber_range",-1.0,0);
  libMesh::Real nu_max  = input("SpectroscopyExample/wavenumber_range",-1.0,1);
  libMesh::Real nu_step = input("SpectroscopyExample/wavenumber_range",-1.0,2);

  if ( (nu_min < 0) || (nu_max < 0) || (nu_step < 0) )
    libmesh_error_msg("ERROR: please specify a wavenumber range for the SpectroscopyExample as 'nu_min nu_max nu_step'");

  std::string filename = input("SpectroscopyExample/output_prefix","");
  if (filename == "")
    libmesh_error_msg("ERROR: please specify an output file prefix for the SpectroscopyExample");

  runner.run();

  GRINS::Simulation & sim = runner.get_simulation();
  GRINS::MultiphysicsSystem * system = sim.get_multiphysics_system();

  GRINS::CompositeQoI * comp_qoi = libMesh::cast_ptr<GRINS::CompositeQoI*>(system->get_qoi());
  GRINS::SpectroscopicAbsorption & qoi = libMesh::cast_ref<GRINS::SpectroscopicAbsorption &>(comp_qoi->get_qoi(0));
  GRINS::AbsorptionCoeff<GRINS::AntiochChemistry> & abs_coeff = libMesh::cast_ref<GRINS::AbsorptionCoeff<GRINS::AntiochChemistry> &>(qoi.get_function());

  libMesh::QoISet qs;
  qs.add_index(0);

  std::ofstream output;
  if (system->get_mesh().comm().rank() == 0)
    {
      output.open(filename+".dat",std::ofstream::app);
    }

  for (libMesh::Real nu = nu_min; nu <= nu_max; nu += nu_step)
    {
      abs_coeff.set_wavenumber(nu);

      system->assemble_qoi(qs);
      libMesh::Real qoi = sim.get_qoi_value(0);

      if (system->get_mesh().comm().rank() == 0)
        output <<std::fixed <<std::setprecision(8) <<nu <<"," <<std::setprecision(16) <<qoi <<std::endl;
    }

  if (system->get_mesh().comm().rank() == 0)
    output.close();
#else
  libmesh_error_msg("ERROR: GRINS must be built with Antioch to use the Spectroscopy example. Please reconfigure your build to include the Antioch library.");
#endif
  return 0;
}
  void DisplacementContinuationSolver::increment_displacement( GRINS::MultiphysicsSystem& system,
                                                               libMesh::EquationSystems& equation_system,
                                                               const libMesh::Real displacement )
  {
    // Get DirichetBoundaries vector.
    libMesh::DirichletBoundaries* d_vector = system.get_dof_map().get_dirichlet_boundaries();

    // Get the DirichletBoundary we want
    libMesh::DirichletBoundary* dirichlet = (*d_vector)[_bc_index];

    // Kill the old FunctionBase object and put in our new one.
    dirichlet->f.reset( new libMesh::ConstFunction<libMesh::Real>( displacement ) );

    // Need to reinit system
    equation_system.reinit();

    return;
  }