interaction/fsi_collapsible_channel/fsi_collapsible_channel_adapt.cc File Reference
#include <iostream>
#include "generic.h"
#include "navier_stokes.h"
#include "beam.h"
#include "meshes/one_d_lagrangian_mesh.h"
#include "meshes/collapsible_channel_mesh.h"

Classes

class  UndeformedWall
 
class  FSICollapsibleChannelProblem< ELEMENT >
 Problem class. More...
 

Namespaces

 BL_Squash
 
 Global_Physical_Variables
 Global variables.
 

Functions

double BL_Squash::squash_fct (const double &s)
 
void Global_Physical_Variables::prescribed_traction (const double &t, const Vector< double > &x, const Vector< double > &n, Vector< double > &traction)
 Traction applied on the fluid at the left (inflow) boundary. More...
 
void Global_Physical_Variables::load (const Vector< double > &xi, const Vector< double > &x, const Vector< double > &N, Vector< double > &load)
 Load function: Apply a constant external pressure to the beam. More...
 
int main (int argc, char *argv[])
 

Function Documentation

◆ main()

int main ( int argc  ,
char argv[] 
)

Driver code for a collapsible channel problem with FSI. Presence of command line arguments indicates validation run with coarse resolution and small number of timesteps.

972 {
973 
974  // Store command line arguments
975  CommandLineArgs::setup(argc,argv);
976 
977  // Reduction in resolution for validation run?
978  unsigned coarsening_factor=4;
979  if (CommandLineArgs::Argc>1)
980  {
981  coarsening_factor=4;
982  }
983 
984  // Number of elements in the domain
985  unsigned nup=20/coarsening_factor;
986  unsigned ncollapsible=40/coarsening_factor;
987  unsigned ndown=40/coarsening_factor;
988  unsigned ny=16/coarsening_factor;
989 
990  // Length of the domain
991  double lup=5.0;
992  double lcollapsible=10.0;
993  double ldown=10.0;
994  double ly=1.0;
995 
996  // Set external pressure (on the wall stiffness scale).
998 
999  // Pressure on the left boundary: This is consistent with steady
1000  // Poiseuille flow
1001  Global_Physical_Variables::P_up=12.0*(lup+lcollapsible+ldown);
1002 
1003 
1004 #ifdef MACRO_ELEMENT_NODE_UPDATE
1005 
1006 #ifdef TAYLOR_HOOD
1007 
1008  // Build the problem with QTaylorHoodElements
1011  problem(nup, ncollapsible, ndown, ny,
1012  lup, lcollapsible, ldown, ly);
1013 
1014 #else
1015 
1016  // Build the problem with QCrouzeixRaviartElements
1019  problem(nup, ncollapsible, ndown, ny,
1020  lup, lcollapsible, ldown, ly);
1021 
1022 #endif
1023 
1024 #else
1025 
1026 #ifdef TAYLOR_HOOD
1027 
1028  // Build the problem with QTaylorHoodElements
1031  problem(nup, ncollapsible, ndown, ny,
1032  lup, lcollapsible, ldown, ly);
1033 
1034 #else
1035 
1036  // Build the problem with QCrouzeixRaviartElements
1039  problem(nup, ncollapsible, ndown, ny,
1040  lup, lcollapsible, ldown, ly);
1041 
1042 #endif
1043 
1044 #endif
1045 
1046 
1047  // Timestep. Note: Preliminary runs indicate that the period of
1048  // the oscillation is about 1 so this gives us 40 steps per period.
1049  double dt=1.0/40.0;
1050 
1051  // Initial time for the simulation
1052  double t_min=0.0;
1053 
1054  // Maximum time for simulation
1055  double t_max=3.5;
1056 
1057  // Initialise timestep
1058  problem.time_pt()->time()=t_min;
1059  problem.initialise_dt(dt);
1060 
1061  // Apply initial condition
1062  problem.set_initial_condition();
1063 
1064  //Set output directory
1065  DocInfo doc_info;
1066  doc_info.set_directory("RESLT");
1067 
1068  // Open a trace file
1069  ofstream trace_file;
1070  char filename[100];
1071  sprintf(filename,"%s/trace.dat",doc_info.directory().c_str());
1072  trace_file.open(filename);
1073 
1074  // Output the initial condition
1075  problem.doc_solution(doc_info, trace_file);
1076 
1077  // Increment step number
1078  doc_info.number()++;
1079 
1080  // Find number of timesteps (reduced for validation)
1081  unsigned nstep = unsigned((t_max-t_min)/dt);
1082  if (CommandLineArgs::Argc>1)
1083  {
1084  nstep=3;
1085  }
1086 
1087 
1088  // Set targets for spatial adaptivity
1089  problem.bulk_mesh_pt()->max_permitted_error()=1.0e-3;
1090  problem.bulk_mesh_pt()->min_permitted_error()=1.0e-5;
1091 
1092  // Overwrite for validation run
1093  if (CommandLineArgs::Argc>1)
1094  {
1095  // Set targets for spatial adaptivity
1096  problem.bulk_mesh_pt()->max_permitted_error()=0.5e-2;
1097  problem.bulk_mesh_pt()->min_permitted_error()=0.5e-4;
1098  }
1099 
1100  // When performing the first timestep, we can adapt the mesh as many times
1101  // as we want because the initial condition can be re-set
1102  unsigned max_adapt=3;
1103  bool first=true;
1104 
1105  // Timestepping loop
1106  for (unsigned istep=0;istep<nstep;istep++)
1107  {
1108  // Solve the problem
1109  problem.unsteady_newton_solve(dt,max_adapt,first);
1110 
1111  // Outpt the solution
1112  problem.doc_solution(doc_info, trace_file);
1113 
1114  // Step number
1115  doc_info.number()++;
1116 
1117  // We've done the first step
1118  first=false;
1119  max_adapt=1;
1120  }
1121 
1122 
1123  // Close trace file.
1124  trace_file.close();
1125 
1126 }//end of main
Problem class.
Definition: fsi_chan_problem.h:315
Definition: algebraic_elements.h:540
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
Definition: macro_element_node_update_element.h:265
void setup(Time *time_pt)
Create all GeomObjects needed to define the cylinder and the flag.
Definition: turek_flag_non_fsi.cc:277
double P_ext
External pressure.
Definition: fibre.cc:64
double P_up
Default pressure on the left boundary.
Definition: fsi_collapsible_channel.cc:183
string filename
Definition: MergeRestartFiles.py:39
const double ly
Definition: ConstraintElementsUnitTest.cpp:34
const unsigned ny
Definition: ConstraintElementsUnitTest.cpp:31
int Argc
Number of arguments + 1.
Definition: oomph_utilities.cc:407
Constructor for SteadyAxisymAdvectionDiffusion problem
Definition: steady_axisym_advection_diffusion.cc:213

References oomph::CommandLineArgs::Argc, oomph::DocInfo::directory(), MergeRestartFiles::filename, Mesh_Parameters::ly, oomph::DocInfo::number(), Mesh_Parameters::ny, Global_Physical_Variables::P_ext, Global_Physical_Variables::P_up, problem, oomph::DocInfo::set_directory(), and Flag_definition::setup().