Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
FullyCoupling Class Reference

#include <Coupling.h>

Inheritance diagram for FullyCoupling:
Collaboration diagram for FullyCoupling:

Public Member Functions

 FullyCoupling (const char *coupl_name, const char *fluidname, const char *solidname, Control_parameters *p, const RocmanControl_parameters *mp)
 
 FullyCoupling (const char *coupl_name, const char *fluidname, const char *solidname, const char *burnname, Control_parameters *p, const RocmanControl_parameters *mp)
 
virtual void update_integrals (double currentTime)
 
virtual void update_distances (double currentTime)
 
virtual void reload_rocface (const RocmanControl_parameters *param)
 
- Public Member Functions inherited from Coupling
 Coupling (const char *coupl_name, const char *name, Control_parameters *p, const RocmanControl_parameters *mp)
 Constructor. Derived class will add actions for the coupling scheme. More...
 
 Coupling (const char *coupl_name, const char *fluidname, const char *solidname, Control_parameters *p, const RocmanControl_parameters *mp)
 
 Coupling (const char *coupl_name, const char *fluidname, const char *solidname, const char *burnname, Control_parameters *p, const RocmanControl_parameters *mp)
 
virtual ~Coupling ()
 Destructor. More...
 
const char * name ()
 
Agentadd_agent (Agent *)
 Add new agent. More...
 
void schedule ()
 Schedule the top-level actions of the coupling scheme and the actions of the agents. More...
 
void init (double t, double dt, int reinit=0)
 Invoke initialization of the actions in the scheduler and the agents. More...
 
void initialize (int reinit=0)
 
void finalize ()
 Invoke finalization of the actions in the scheduler and the agents. More...
 
double run (double t, double dt, int iPredCorr, double zoom)
 Invoke the scheduler. More...
 
void run_initactions (double t, double dt)
 
void input (double t)
 Invoke input functions of the agents. More...
 
int get_ipc () const
 
int get_max_ipc () const
 
int initial_start () const
 
int in_restart () const
 
int initial_remeshed () const
 true if in initialization step and remeshed is true More...
 
int new_start (double t) const
 
void init_convergence (int iPredCorr)
 
int check_convergence ()
 
void output_restart_files (double t)
 
void output_visualization_files (double t)
 
const Control_parametersget_control_param ()
 
const RocmanControl_parametersget_rocmancontrol_param ()
 
void read_restart_info ()
 
void write_restart_info (double CurrentTime, int iStep)
 
void restart_at_time (double t, int step)
 
void print (const char *fname)
 
void Interrupt (int *, const char *)
 
int ProcessInterrupt ()
 

Protected Attributes

FluidAgentfluid_agent
 
SolidAgentsolid_agent
 
BurnAgentburn_agent
 
- Protected Attributes inherited from Coupling
std::string coupling_name
 
vector< std::string > modules
 
AgentList agents
 
UserScheduler scheduler
 
UserScheduler init_scheduler
 
int comm_rank
 
int init_started
 
int restarting
 
int init_remeshed
 
int iPredCorr
 
int maxPredCorr
 
Control_parametersparam
 
const RocmanControl_parametersrocmanparam
 
std::string restartInfo
 
int overwrite_integ
 
std::string integFname
 
int overwrite_dist
 
std::string distFname
 

Additional Inherited Members

- Protected Member Functions inherited from Coupling
void callMethod (Scheduler_voidfn1_t fn, double t)
 
std::string normalize_modname (const char *mod)
 

Detailed Description

Definition at line 205 of file Coupling.h.

Constructor & Destructor Documentation

FullyCoupling ( const char *  coupl_name,
const char *  fluidname,
const char *  solidname,
Control_parameters p,
const RocmanControl_parameters mp 
)
inline

Definition at line 211 of file Coupling.h.

211  :
212  Coupling(coupl_name, fluidname, solidname, p, mp), burn_agent(NULL) {}
Coupling(const char *coupl_name, const char *name, Control_parameters *p, const RocmanControl_parameters *mp)
Constructor. Derived class will add actions for the coupling scheme.
Definition: Coupling.C:130
BurnAgent * burn_agent
Definition: Coupling.h:209
FullyCoupling ( const char *  coupl_name,
const char *  fluidname,
const char *  solidname,
const char *  burnname,
Control_parameters p,
const RocmanControl_parameters mp 
)
inline

Definition at line 213 of file Coupling.h.

213  :
214  Coupling(coupl_name, fluidname, solidname, burnname, p, mp) {}
Coupling(const char *coupl_name, const char *name, Control_parameters *p, const RocmanControl_parameters *mp)
Constructor. Derived class will add actions for the coupling scheme.
Definition: Coupling.C:130

Member Function Documentation

void reload_rocface ( const RocmanControl_parameters param)
virtual

Reimplemented from Coupling.

Definition at line 753 of file Coupling.C.

References _load_rocface(), fluid_agent, and solid_agent.

754 {
756 }
FluidAgent * fluid_agent
Definition: Coupling.h:207
void _load_rocface(FluidAgent *fagent, SolidAgent *sagent, const RocmanControl_parameters *param)
SolidAgent * solid_agent
Definition: Coupling.h:208

Here is the call graph for this function:

void update_distances ( double  currentTime)
virtual

Reimplemented from Coupling.

Definition at line 714 of file Coupling.C.

References COM_call_function(), COM_get_function_handle(), Coupling::comm_rank, Agent::communicator, Coupling::distFname, cimg_library::cimg::fclose(), fluid_agent, cimg_library::cimg::fopen(), Agent::get_communicator(), MAN_DEBUG, RocBlas::max_scalar_MPI, RocBlas::min_scalar_MPI, MPI_COMM_WORLD, FluidAgent::nc_hdl, FluidAgent::nc_tmp_hdl, RocBlas::nrm2, Coupling::overwrite_dist, solid_agent, FluidAgent::sq_dist_hdl, sqrt(), RocBlas::sub, RocBlas::sum_scalar_MPI, and SolidAgent::y_hdl.

715 {
716  double dist_max=-1, dist_min=-1, dist_nrm2=-1;
717 
718  MPI_Comm communicator = fluid_agent->get_communicator();
719 
720  int RFC_interpolate = COM_get_function_handle("RFC.interpolate");
721  COM_call_function( RFC_interpolate, &solid_agent->y_hdl, &fluid_agent->nc_tmp_hdl);
724  COM_call_function( RocBlas::max_scalar_MPI, &fluid_agent->sq_dist_hdl, &dist_max, &communicator);
725  COM_call_function( RocBlas::min_scalar_MPI, &fluid_agent->sq_dist_hdl, &dist_min, &communicator);
726  COM_call_function( RocBlas::sum_scalar_MPI, &fluid_agent->sq_dist_hdl, &dist_nrm2, &communicator);
727 
728  if ( comm_rank == 0) {
729  FILE *fp;
730  if ( overwrite_dist)
731  fp = fopen(distFname.c_str(), "w");
732  else
733  fp = fopen(distFname.c_str(), "a");
734  if (fp == NULL) {
735  std::cerr << "Rocstar: Failed to open distance file, " << distFname
736  << "." << std::endl;
737  MPI_Abort( MPI_COMM_WORLD, -1);
738  }
739  MAN_DEBUG(3, ("Rocstar: FullyCoupling::update_distances with t: %f.\n", currentTime));
740  if ( overwrite_dist) {
741  fprintf( fp, "# time distance-min distance-max distance-norm2 \n");
742  overwrite_dist = 0;
743  }
744  fprintf( fp, "%.18le %.18le %.18le %.18le\n",
745  currentTime, sqrt(dist_min), sqrt(dist_max), sqrt(dist_nrm2));
746 
747  fclose( fp);
748  }
749 }
here we put it at the!beginning of the common block The point to point and collective!routines know about but MPI_TYPE_STRUCT as yet does not!MPI_STATUS_IGNORE and MPI_STATUSES_IGNORE are similar objects!Until the underlying MPI library implements the C version of these are declared as arrays of MPI_STATUS_SIZE!The types and are OPTIONAL!Their values are zero if they are not available Note that!using these reduces the portability of MPI_IO INTEGER MPI_BOTTOM INTEGER MPI_DOUBLE_PRECISION INTEGER MPI_LOGICAL INTEGER MPI_2REAL INTEGER MPI_2DOUBLE_COMPLEX INTEGER MPI_LB INTEGER MPI_WTIME_IS_GLOBAL INTEGER MPI_COMM_WORLD
std::string distFname
Definition: Coupling.h:123
int sq_dist_hdl
Definition: FluidAgent.h:92
int nc_hdl
Definition: FluidAgent.h:92
static int min_scalar_MPI
Definition: RocBlas.h:49
static int sum_scalar_MPI
Definition: RocBlas.h:50
double sqrt(double d)
Definition: double.h:73
int fclose(std::FILE *file)
Close a file, and check for possible errors.
Definition: CImg.h:5507
FluidAgent * fluid_agent
Definition: Coupling.h:207
void COM_call_function(const int wf, int argc,...)
Definition: roccom_c.C:48
SolidAgent * solid_agent
Definition: Coupling.h:208
#define MAN_DEBUG(l, x)
Definition: rocman.h:98
int comm_rank
Definition: Coupling.h:105
int nc_tmp_hdl
Definition: FluidAgent.h:92
static int max_scalar_MPI
Definition: RocBlas.h:48
static int sub
Definition: RocBlas.h:36
int overwrite_dist
Definition: Coupling.h:122
MPI_Comm get_communicator() const
Definition: Agent.h:220
std::FILE * fopen(const char *const path, const char *const mode)
Open a file, and check for possible errors.
Definition: CImg.h:5494
int COM_get_function_handle(const char *wfname)
Definition: roccom_c++.h:428
static int nrm2
Definition: RocBlas.h:42

Here is the call graph for this function:

void update_integrals ( double  currentTime)
virtual

Reimplemented from Coupling.

Definition at line 676 of file Coupling.C.

References Coupling::agents, Coupling::comm_rank, cimg_library::cimg::fclose(), fluid_agent, cimg_library::cimg::fopen(), Agent::get_integrals(), i, Coupling::integFname, MAN_DEBUG, MAN_INTEG_IBAREA, MAN_INTEG_INBAREA, MAN_INTEG_MASS, MAN_INTEG_VOL, MAN_INTEG_VOL_UND, MPI_COMM_WORLD, n, Coupling::overwrite_integ, and solid_agent.

677 {
678  int i, n, count=0;
679  for ( i=0, n=agents.size(); i<n; ++i) {
680  count += agents[i]->compute_integrals();
681  }
682 
683  if ( comm_rank == 0 && count == 2) {
684  FILE *fp;
685  if ( overwrite_integ)
686  fp = fopen(integFname.c_str(), "w");
687  else
688  fp = fopen(integFname.c_str(), "a");
689  if (fp == NULL) {
690  std::cerr << "Rocstar: Failed to open integral file, "
691  << integFname << "." << std::endl;
692  MPI_Abort( MPI_COMM_WORLD, -1);
693  }
694  MAN_DEBUG(3, ("Rocstar: FullyCoupling::update_integrals with t: %f.\n", currentTime));
695  if ( overwrite_integ) {
696  fprintf( fp, " time f-volume s-volume f-mass s-mass f-burn area s-burn area f-non-burn area s-non-burn area s-volume-undef\n");
697  overwrite_integ = 0;
698  }
699  double *f_integrals = fluid_agent->get_integrals();
700  double *s_integrals = solid_agent->get_integrals();
701  fprintf( fp, "%.18le %.18le %.18le %.18le %.18le %.18le %.18le %.18le %.18le %.18le\n",
702  currentTime,
703  f_integrals[MAN_INTEG_VOL], s_integrals[MAN_INTEG_VOL],
704  f_integrals[MAN_INTEG_MASS], s_integrals[MAN_INTEG_MASS],
705  f_integrals[MAN_INTEG_IBAREA], s_integrals[MAN_INTEG_IBAREA],
706  f_integrals[MAN_INTEG_INBAREA], s_integrals[MAN_INTEG_INBAREA],
707  f_integrals[MAN_INTEG_VOL_UND]);
708 
709  fclose( fp);
710  }
711 }
here we put it at the!beginning of the common block The point to point and collective!routines know about but MPI_TYPE_STRUCT as yet does not!MPI_STATUS_IGNORE and MPI_STATUSES_IGNORE are similar objects!Until the underlying MPI library implements the C version of these are declared as arrays of MPI_STATUS_SIZE!The types and are OPTIONAL!Their values are zero if they are not available Note that!using these reduces the portability of MPI_IO INTEGER MPI_BOTTOM INTEGER MPI_DOUBLE_PRECISION INTEGER MPI_LOGICAL INTEGER MPI_2REAL INTEGER MPI_2DOUBLE_COMPLEX INTEGER MPI_LB INTEGER MPI_WTIME_IS_GLOBAL INTEGER MPI_COMM_WORLD
AgentList agents
Definition: Coupling.h:102
int fclose(std::FILE *file)
Close a file, and check for possible errors.
Definition: CImg.h:5507
FluidAgent * fluid_agent
Definition: Coupling.h:207
std::string integFname
Definition: Coupling.h:120
blockLoc i
Definition: read.cpp:79
const NT & n
SolidAgent * solid_agent
Definition: Coupling.h:208
#define MAN_DEBUG(l, x)
Definition: rocman.h:98
int comm_rank
Definition: Coupling.h:105
double * get_integrals()
Definition: Agent.h:232
int overwrite_integ
Definition: Coupling.h:119
std::FILE * fopen(const char *const path, const char *const mode)
Open a file, and check for possible errors.
Definition: CImg.h:5494

Here is the call graph for this function:

Member Data Documentation

BurnAgent* burn_agent
protected

Definition at line 209 of file Coupling.h.

FluidAgent* fluid_agent
protected

Definition at line 207 of file Coupling.h.

Referenced by reload_rocface(), update_distances(), and update_integrals().

SolidAgent* solid_agent
protected

Definition at line 208 of file Coupling.h.

Referenced by reload_rocface(), update_distances(), and update_integrals().


The documentation for this class was generated from the following files: