collapsible_channel_algebraic.cc File Reference
#include <iostream>
#include "generic.h"
#include "navier_stokes.h"
#include "my_alg_channel_mesh.h"

Classes

class  OscillatingWall
 
class  CollapsibleChannelProblem< 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...
 
int main (int argc, char *argv[])
 

Function Documentation

◆ main()

int main ( int argc  ,
char argv[] 
)

Driver code for an unsteady adaptive collapsible channel problem with prescribed wall motion. Presence of command line arguments indicates validation run with coarse resolution and small number of timesteps.

805 {
806 
807  // Store command line arguments
808  CommandLineArgs::setup(argc,argv);
809 
810  // Reduction in resolution for validation run?
811  unsigned coarsening_factor=1;
812  if (CommandLineArgs::Argc>1)
813  {
814  coarsening_factor=4;
815  }
816 
817  // Number of elements in the domain
818  unsigned nup=20/coarsening_factor;
819  unsigned ncollapsible=40/coarsening_factor;
820  unsigned ndown=40/coarsening_factor;
821  unsigned ny=16/coarsening_factor;
822 
823  // Length of the domain
824  double lup=5.0;
825  double lcollapsible=10.0;
826  double ldown=10.0;
827  double ly=1.0;
828 
829  // Initial amplitude of the wall deformation
830  double amplitude=1.0e-2; // ADJUST
831 
832  // Period of oscillation
833  double period=0.45;
834 
835  // Pressure/applied traction on the left boundary: This is consistent with
836  // steady Poiseuille flow
837  Global_Physical_Variables::P_up=12.0*(lup+lcollapsible+ldown);
838 
839 
840  //Set output directory
841  DocInfo doc_info;
842  doc_info.set_directory("RESLT");
843 
844  // Open a trace file
845  ofstream trace_file;
846  char filename[100];
847  sprintf(filename,"%s/trace.dat",doc_info.directory().c_str());
848  trace_file.open(filename);
849 
850 
851 #ifdef ADAPTIVE
852 
853  // Build the problem with Crouzeix Raviart Element
855  problem(nup, ncollapsible, ndown, ny,
856  lup, lcollapsible, ldown, ly,
857  amplitude,period);
858 
859 #else
860 
861  // Build the problem with Crouzeix Raviart Element
863  problem(nup, ncollapsible, ndown, ny,
864  lup, lcollapsible, ldown, ly,
865  amplitude,period);
866 
867 
868 #endif
869 
870 
871 
872  // Number of timesteps per period
873  unsigned nsteps_per_period=40;
874 
875  // Number of periods
876  unsigned nperiod=3;
877 
878  // Number of timesteps (reduced for validation)
879  unsigned nstep=nsteps_per_period*nperiod;
880  if (CommandLineArgs::Argc>1)
881  {
882  nstep=3;
883  }
884 
885  //Timestep:
886  double dt=period/double(nsteps_per_period);
887 
888  // Start time
889  double t_min=0.0;
890 
891  // Initialise timestep and set initial conditions
892  problem.time_pt()->time()=t_min;
893  problem.initialise_dt(dt);
894  problem.set_initial_condition();
895 
896  // Output the initial solution
897  problem.doc_solution(doc_info, trace_file);
898 
899  // Step number
900  doc_info.number()++;
901 
902 #ifdef ADAPTIVE
903 
904  // Set targets for spatial adaptivity
905  problem.bulk_mesh_pt()->max_permitted_error()=1.0e-3;
906  problem.bulk_mesh_pt()->min_permitted_error()=1.0e-5;
907 
908  // Overwrite with reduced targets for validation run to force
909  // some refinement during the first few timesteps
910  if (CommandLineArgs::Argc>1)
911  {
912  problem.bulk_mesh_pt()->max_permitted_error()=1.0e-4;
913  problem.bulk_mesh_pt()->min_permitted_error()=1.0e-6;
914  }
915 
916  // First timestep: We may re-assign the initial condition
917  // following any mesh adaptation.
918  bool first=true;
919 
920  // Max. number of adaptations during first timestep
921  unsigned max_adapt=10;
922 
923 #endif
924 
925  // Timestepping loop
926  for (unsigned istep=0;istep<nstep;istep++)
927  {
928 
929 #ifdef ADAPTIVE
930 
931  // Solve the problem
932  problem.unsteady_newton_solve(dt, max_adapt, first);
933 
934 #else
935 
936 
937  // Solve the problem
938  problem.unsteady_newton_solve(dt);
939 
940 #endif
941 
942  // Outpt the solution
943  problem.doc_solution(doc_info, trace_file);
944 
945  // Step number
946  doc_info.number()++;
947 
948 #ifdef ADAPTIVE
949 
950  // We've done one step: Don't re-assign the initial conditions
951  // and limit the number of adaptive mesh refinements to one
952  // per timestep.
953  first=false;
954  max_adapt=1;
955 
956 #endif
957 
958  }
959 
960  trace_file.close();
961 
962 } //end of driver code
Problem class.
Definition: collapsible_channel.cc:236
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
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_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_up, problem, oomph::DocInfo::set_directory(), and Flag_definition::setup().