young_laplace.cc File Reference

Classes

class  YoungLaplaceProblem< ELEMENT >
 

Functions

void run_it (const string &output_directory)
 
int main (int argc, char *argv[])
 

Function Documentation

◆ main()

int main ( int argc  ,
char argv[] 
)

Driver code for 2D YoungLaplace problem. Input arguments: none (for validation) or case (0,1,2 for all pinned, barrel and T junction) and number of steps.

550 {
551 
552  // Store command line arguments
553  CommandLineArgs::setup(argc,argv);
554 
555  // Cases to run (By default (validation) run all
556  unsigned case_lo=0;
557  unsigned case_hi=2;
558 
559  // No command line args: Running every case with
560  // limited number of steps
561  if (CommandLineArgs::Argc==1)
562  {
563  std::cout
564  << "Running every case with limited number of steps for validation"
565  << std::endl;
566 
567  // Number of steps
569  }
570  else
571  {
572  // Which case to run?
573  case_lo=atoi(argv[1]);
574  case_hi=atoi(argv[1]);
575 
576  // Number of steps
577  GlobalParameters::Nsteps=atoi(argv[2]);
578  }
579 
580 
581  // Loop over chosen case(s)
582  //-------------------------
583  for (unsigned my_case=case_lo;my_case<=case_hi;my_case++)
584  {
585 
586  // Choose
587  switch (my_case)
588  {
589 
590  case 0:
591 
592  cout << endl << endl
593  << "//////////////////////////////////////////////////////////\n"
594  << "All pinned solution \n"
595  << "//////////////////////////////////////////////////////////\n\n";
596 
598 
599  // Run with spines
601  run_it("RESLT_all_pinned");
602 
603  break;
604 
605  case 1:
606 
607  cout << endl << endl
608  << "//////////////////////////////////////////////////////////\n"
609  << "Barrel-shaped solution \n"
610  << "/////////////////////////////////////////////////////////\n\n";
611 
613 
614  // Run with spines
616  run_it("RESLT_barrel_shape");
617 
618  break;
619 
620  case 2:
621 
622  cout << endl << endl
623  << "//////////////////////////////////////////////////////////\n"
624  << "T-junction solution \n"
625  << "//////////////////////////////////////////////////////////\n\n";
626 
629 
630  // Adjust spine orientation
633 
634  // Run with spines
636  run_it("RESLT_T_junction");
637 
638  break;
639 
640  default:
641 
642  std::cout << "Wrong case! Options are:\n"
643  << "0: All pinned\n"
644  << "1: Barrel \n"
645  << "2: T_junction\n"
646  << std::endl;
647  assert(false);
648 
649  }
650 
651  }
652 
653 
654 } //end of main
#define assert(e,...)
Definition: Logger.h:744
double Pi
Definition: two_d_biharmonic.cc:235
void setup(Time *time_pt)
Create all GeomObjects needed to define the cylinder and the flag.
Definition: turek_flag_non_fsi.cc:277
double Controlled_height_increment
Increment for height control.
Definition: common_young_laplace_stuff.h:85
bool Use_spines
Use spines (true) or not (false)
Definition: common_young_laplace_stuff.h:40
unsigned Nsteps
Number of steps.
Definition: common_young_laplace_stuff.h:79
double Gamma
Parameter for timescale of step translation.
Definition: two_d_unsteady_heat_2adapt_load_balance.cc:144
@ Barrel_shape
Definition: common_young_laplace_stuff.h:48
@ All_pinned
Definition: common_young_laplace_stuff.h:47
@ T_junction_with_nonzero_contact_angle
Definition: common_young_laplace_stuff.h:49
int Case
What case are we considering: Choose one from the enumeration Cases.
Definition: common_young_laplace_stuff.h:53
int Argc
Number of arguments + 1.
Definition: oomph_utilities.cc:407
void run_it(const string &output_directory)
Definition: young_laplace.cc:478

References GlobalParameters::All_pinned, oomph::CommandLineArgs::Argc, assert, GlobalParameters::Barrel_shape, GlobalParameters::Case, GlobalParameters::Controlled_height_increment, GlobalParameters::Gamma, GlobalParameters::Nsteps, BiharmonicTestFunctions2::Pi, run_it(), Flag_definition::setup(), GlobalParameters::T_junction_with_nonzero_contact_angle, and GlobalParameters::Use_spines.

◆ run_it()

void run_it ( const string &  output_directory)

Run code for current setting of parameter values – specify name of output directory

479 {
480 
481  // Create label for output
482  //------------------------
483  DocInfo doc_info;
484 
485  // Set outputs
486  //------------
487 
488  // Trace file
489  ofstream trace_file;
490 
491  // Set output directory
492  doc_info.set_directory(output_directory);
493 
494  //Open a trace file
495  char filename[100];
496  sprintf(filename,"%s/trace.dat",doc_info.directory().c_str());
497  trace_file.open(filename);
498 
499  // Write kappa, exact kappa if exists and height values
500  trace_file
501  << "VARIABLES=\"<GREEK>k</GREEK>\",\"<GREEK>k</GREEK>_{ex}\",\"h\""
502  << std::endl;
503  trace_file << "ZONE" << std::endl;
504 
505  //Set up the problem
506  //------------------
507 
508  // Create the problem with 2D nine-node elements from the
509  // QYoungLaplaceElement family.
511 
512  //Output the solution
513  problem.doc_solution(doc_info,trace_file);
514 
515  //Increment counter for solutions
516  doc_info.number()++;
517 
518 
519  // Parameter incrementation
520  //-------------------------
521 
522  // Loop over steps
523  for (unsigned istep=0;istep<GlobalParameters::Nsteps;istep++)
524  {
525 
526  // Solve the problem
527  problem.newton_solve();
528 
529  //Output the solution
530  problem.doc_solution(doc_info,trace_file);
531 
532  //Increment counter for solutions
533  doc_info.number()++;
534 
535  }
536 
537  // Close output file
538  trace_file.close();
539 
540 } //end of run_it()
Definition: barrel.cc:140
Definition: oomph_utilities.h:499
std::string directory() const
Output directory.
Definition: oomph_utilities.h:524
void set_directory(const std::string &directory)
Definition: oomph_utilities.cc:298
unsigned & number()
Number used (e.g.) for labeling output files.
Definition: oomph_utilities.h:554
string filename
Definition: MergeRestartFiles.py:39
Constructor for SteadyAxisymAdvectionDiffusion problem
Definition: steady_axisym_advection_diffusion.cc:213

References oomph::DocInfo::directory(), MergeRestartFiles::filename, GlobalParameters::Nsteps, oomph::DocInfo::number(), problem, and oomph::DocInfo::set_directory().

Referenced by main().