Driver code for a collapsible channel problem with FSI.
Run with the -help flag for more information on command line arguments to run with an approximation to the Jacobian, to run steady calculations and to perform validation runs with coarse resolution and small number of timesteps.
Disclaimer: this code is intended to demonstrate how to ask for various approximations to be made to the Jacobian matrix which can result in reduced calculations per Newton step (and to test this).However these approximations to the Jacobian may increase the overall number of Newton steps, or even cause the Newton solve to diverge. Therefore for any particular FSI problem some experiementation is required to determine whether approximating the Jacobian is beneficial. Note: In tests using this code, approximating the Jacobain increased the overall time per Newton solve, however for a 3D equivalent to this problem significant speed ups were found.
921 bool print_help =
false;
922 bool approx_jacobian =
false;
924 while (arg_index < argc)
926 if ( strcmp(argv[arg_index],
"-validation_run") == 0 )
931 else if ( strcmp(argv[arg_index],
"-steady_run") == 0 )
936 else if ( strcmp(argv[arg_index],
"-approx_jacobian") == 0 )
939 approx_jacobian=
true;
941 else if ( strcmp(argv[arg_index],
"-help") == 0 )
955 oomph_info <<
"-validation run Perform validation run with coarse mesh\n"
956 <<
" and fewer Newton solves\n\n";
957 oomph_info <<
"-steady_run Solve series of steady problems with\n"
958 <<
" different wall positions, otherwise\n"
959 <<
" solve unsteady problem\n\n";
960 oomph_info <<
"-approx_jacobian Use Jacobian approximation\n\n";
965 bool wall_jacobian_ignores_fluid_shear_stress_data =
false;
966 bool wall_jacobian_ignores_geometric_data =
false;
967 bool fluid_jacobian_ignores_geometric_data =
false;
970 wall_jacobian_ignores_fluid_shear_stress_data =
true;
971 wall_jacobian_ignores_geometric_data =
true;
977 fluid_jacobian_ignores_geometric_data =
true;
982 unsigned coarsening_factor=1;
989 unsigned nup=20/coarsening_factor;
990 unsigned ncollapsible=40/coarsening_factor;
991 unsigned ndown=40/coarsening_factor;
992 unsigned ny=16/coarsening_factor;
996 double lcollapsible=10.0;
1010 wall_jacobian_ignores_fluid_shear_stress_data,
1011 wall_jacobian_ignores_geometric_data,
1012 fluid_jacobian_ignores_geometric_data);
1041 problem.time_pt()->time()=t_min;
1045 problem.set_initial_condition();
1051 if (approx_jacobian)
1053 oomph_info <<
"Using approximate Jacobian\n";
1074 ofstream trace_file;
1080 problem.doc_solution(doc_info, trace_file);
1088 unsigned nstep = 20;
1095 for (
unsigned istep=0;istep<nstep;istep++)
1097 oomph_info <<
"\nSteady Newton solve " << istep
1098 <<
" for wall displacement of "
1100 <<
"====================================================\n";
1105 cout <<
"External pressure="
1110 problem.doc_solution(doc_info, trace_file);
1122 unsigned nstep =
unsigned((t_max-t_min)/dt);
1129 for (
unsigned istep=0;istep<nstep;istep++)
1131 oomph_info <<
"\nNewton solve " << istep <<
"\n"
1132 <<
"================\n";
1135 problem.unsteady_newton_solve(dt);
1138 problem.doc_solution(doc_info, trace_file);
Problem class.
Definition: fsi_chan_problem.h:315
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
bool Steady_run
Steady run or unsteady run?
Definition: fsi_jacobian_approximation.cc:181
bool Validation_run
Normal run or validation run?
Definition: fsi_jacobian_approximation.cc:178
void setup(Time *time_pt)
Create all GeomObjects needed to define the cylinder and the flag.
Definition: turek_flag_non_fsi.cc:277
double ReSt
Womersley number.
Definition: rayleigh_instability.cc:56
double & external_pressure()
Access function to value of external pressure.
Definition: steady_ring.cc:79
double Prescribed_y
Prescribed position of control point.
Definition: mpi/distribution/clamped_shell/clamped_shell_with_arclength_cont.cc:54
double Re
Reynolds number.
Definition: fibre.cc:55
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
OomphInfo oomph_info
Definition: oomph_definitions.cc:319
Constructor for SteadyAxisymAdvectionDiffusion problem
Definition: steady_axisym_advection_diffusion.cc:213