37 int Rocrem_remesh(
const char* solver,
const char* indir,
const char* outdir,
38 double time,
bool pt,
bool remesh_surf,
39 bool transfer_surf,
double scaleFactor, MPI_Comm myComm,
40 int fieldWidth,
int fileBase,
int debug,
int ngLayers);
102 distFname =
"Rocman/Modout/GENX_dist.txt";
115 std::string manwinname =
"Rocman";
116 std::string manfuncname = manwinname+
".interrupt";
117 std::string coupobjname = manwinname+
".coup";
127 coupobjname.c_str(),
"bii",types);
133 coupling_name(coupl_name), param(param_), rocmanparam(mp)
140 const char *solidname,
143 coupling_name(coupl_name), param(param_), rocmanparam(mp)
151 const char *solidname,
const char *burnname,
154 coupling_name(coupl_name), param(param_), rocmanparam(mp)
195 for ( i=0, n=
agents.size(); i<
n; ++
i)
198 for ( i=0, n=
agents.size(); i<
n; ++
i)
199 agents[i]->init_buffers( t);
202 for ( i=0, n=
agents.size(); i<
n; ++
i) {
204 agents[
i]->init_module( t, dt);
223 for ( i=0, n=
agents.size(); i<
n; ++
i)
279 agents[
i]->init_convergence( iPredCorr);
286 int InterfaceConverged;
288 InterfaceConverged = 0;
291 InterfaceConverged = 1;
294 InterfaceConverged = 1;
295 return InterfaceConverged;
301 agents[
i]->output_restart_files( t);
308 agents[
i]->output_visualization_files( t);
318 std::cerr <<
"Rocstar: Error: READ_RESTART: Failed to read file " <<
restartInfo << std::endl;
324 fscanf(fp,
"%d %le", &curStep, &initialTime);
328 MAN_DEBUG(1,(
"Rocstar: This run is a restart continued at iteration %d with initial time %f.",curStep, initialTime));
333 MAN_DEBUG(2,(
"Rocstar: This run is not a restart.\n"));
341 if ( CurrentTime == 0.0)
346 std::cerr <<
"Rocstar: Error: Failed to open restart info file, "
350 fprintf( fp,
"%d %.20le \n", iStep, CurrentTime);
376 MAN_DEBUG(3, (
"Rocstar: Coupling::restart_at_time with t: %f step:%d.\n", t, step));
380 system(
"rm RocburnAPN/Rocout/*");
382 system(
"rm RocburnAPN/Rocout/*");
393 for ( i=0, n=
agents.size(); i<
n; ++
i) {
419 for ( i=0, n=
agents.size(); i<
n; ++
i) {
438 FILE *f =
fopen(fname,
"w");
440 fprintf(f,
"graph: { title: \"Coupling\" \n\
441 display_edge_labels: yes \n\
442 layoutalgorithm: tree \n\
443 scaling: maxspect \n\
444 node.color : green \n\
445 node.textcolor : black \n\
446 node.bordercolor: black \n\
447 node.borderwidth: 1 \n\
448 edge.color : blue \n\
449 edge.arrowsize : 7 \n\
450 edge.thickness : 2 \n\
451 edge.fontname:\"helvO08\" \n\
452 node.label: \"no type\" \n");
455 for (
unsigned int i=0;
i<
agents.size();
i++) {
466 std::string
mod = modname;
467 if (mod ==
"RocfluDummy")
469 if (mod ==
"RocfloDummy")
471 if (mod ==
"RocfracDummy")
473 if (mod ==
"RocsolidDummy")
484 std::cout <<
"Rocstar::Interrupt invoked." << std::endl
485 <<
"Rocstar: ***************************************************"
487 <<
"Rocstar: " << (message ? message :
"") << std::endl
488 <<
"Rocstar: ***************************************************"
495 std::cout <<
"Rocstar: Halting simulation." << std::endl;
502 std::cout <<
"Rocstar: Writing restart files and halting simulation."
520 std::cout <<
"Rocstar: Directed to warm restart from last dump "
521 <<
"and increase dump frequency." << std::endl;
527 std::cout <<
"Rocstar: Directed to remesh and warm restart from "
535 std::cout <<
"Rocstar: Directed to restart from "
539 std::cout <<
"MESSAGE: " << message << std::endl;
544 std::cout <<
"Rocstar: Directed to dump at (time/step): ("
552 std::cout <<
"Rocstar: Directed to dump and restart at (time/step): ("
558 std::cout <<
"MESSAGE: " << message << std::endl;
563 std::cout <<
"Rocstar: Unknown interrupt action." << std::endl;
564 MAN_DEBUG(0,(
"Rocstar: Coupling::Interrupt(unknown action): %s.\n",
576 int fluid_agent_index = 0;
581 std::cout <<
"Rocstar: Processing interrupt." << std::endl;
589 std::cout <<
"Rocstar: Restarting from (time/step): ("
599 std::string::size_type
x =
agents[
i]->get_agent_name().find(
"lu");
600 if( x != string::npos){
601 fluid_agent_index =
i;
606 std::cerr <<
"Rocstar: Could not find fluid agent. Dying."
629 agents[fluid_agent_index]->get_communicator(),
632 std::cerr <<
"Rocstar: Remeshing failed. Stopping simulation."
641 std::cerr <<
"Rocstar: Online remeshing not enabled. Shutting down." << std::endl;
649 std::cout <<
"Rocstar: Restarting after remesh at (time/step): ("
659 std::cout <<
"Rocstar: Warm restarting at (time/step): ("
666 std::cout <<
"Rocstar: Unknown interrupt action: " << action <<
"."
679 for ( i=0, n=
agents.size(); i<
n; ++
i) {
680 count +=
agents[
i]->compute_integrals();
690 std::cerr <<
"Rocstar: Failed to open integral file, "
694 MAN_DEBUG(3, (
"Rocstar: FullyCoupling::update_integrals with t: %f.\n", currentTime));
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");
701 fprintf( fp,
"%.18le %.18le %.18le %.18le %.18le %.18le %.18le %.18le %.18le %.18le\n",
716 double dist_max=-1, dist_min=-1, dist_nrm2=-1;
735 std::cerr <<
"Rocstar: Failed to open distance file, " <<
distFname
739 MAN_DEBUG(3, (
"Rocstar: FullyCoupling::update_distances with t: %f.\n", currentTime));
741 fprintf( fp,
"# time distance-min distance-max distance-norm2 \n");
744 fprintf( fp,
"%.18le %.18le %.18le %.18le\n",
745 currentTime,
sqrt(dist_min),
sqrt(dist_max),
sqrt(dist_nrm2));
int COMMPI_Comm_rank(MPI_Comm c)
void update_start_time(int step, double t)
int COM_Type
Indices for derived data types.
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
void write_restart_info(double CurrentTime, int iStep)
T mod(const T &x, const T &m)
Return the modulo of a number.
double max_timestep(double t, double dt)
std::string get_agent_name() const
void RocstarShutdown(int=0)
void print(const char *fname)
static int min_scalar_MPI
static int sum_scalar_MPI
void input(double t)
Invoke input functions of the agents.
Agent * add_agent(Agent *)
Add new agent.
void COM_set_object(const char *wa_str, int pane_id, Type *addr)
int fclose(std::FILE *file)
Close a file, and check for possible errors.
virtual void update_integrals(double currentTime)
static int nrm2_scalar_MPI
void output_visualization_files(double t)
const RocmanControl_parameters * rocmanparam
void set_alpha(double alpha)
void restart_at_time(double t, int step)
void schedule()
Schedule the top-level actions of the coupling scheme and the actions of the agents.
void init(double t, double dt, int reinit=0)
Invoke initialization of the actions in the scheduler and the agents.
void init_convergence(int iPredCorr)
std::string normalize_modname(const char *mod)
Control_parameters * param
void Interrupt(int *, const char *)
#define COM_UNLOAD_MODULE_STATIC_DYNAMIC(moduleName, windowString)
static void initHandles()
UserScheduler init_scheduler
void _load_rocface(FluidAgent *fagent, SolidAgent *sagent, const RocmanControl_parameters *param)
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.
void COM_new_window(const char *wname, MPI_Comm c=MPI_COMM_NULL)
void restarting(double t)
void COM_call_function(const int wf, int argc,...)
int system(const char *const command, const char *const module_name=0)
int new_start(double t) const
void(Scheduler::* Scheduler_voidfn1_t)(double)
int COM_get_window_handle(const char *wname)
Vector_n min(const Array_n_const &v1, const Array_n_const &v2)
void callMethod(Scheduler_voidfn1_t fn, double t)
virtual void reload_rocface(const RocmanControl_parameters *param)
void run_initactions(double t, double dt)
unsigned long time()
Get the value of a system timer with a millisecond precision.
virtual void update_distances(double currentTime)
double run(double t, double dt, int iPredCorr, double zoom)
Invoke the scheduler.
virtual void init_module(double t, double dt)
void output_restart_files(double t)
virtual void reload_rocface(const RocmanControl_parameters *param)
virtual ~Coupling()
Destructor.
static int max_scalar_MPI
void COM_new_attribute(const char *wa_str, const char loc, const int type, int ncomp, const char *unit)
Registering an attribute type.
void COM_set_member_function(const char *wf_str, Member_func_ptr func, const char *wa_str, const char *intents, const COM_Type *types)
void finalize()
Invoke finalization of the actions in the scheduler and the agents.
MPI_Comm get_communicator() const
void init_actions(double t)
void run_actions(double t, double dt)
const Control_parameters * get_control_param()
void initialize(int reinit=0)
std::FILE * fopen(const char *const path, const char *const mode)
Open a file, and check for possible errors.
#define COM_LOAD_MODULE_STATIC_DYNAMIC(moduleName, windowString)
int COM_get_function_handle(const char *wfname)
vector< std::string > modules
#define COM_EXTERN_MODULE(moduleName)
double outputIntervalTime