vibrating_shell_non_newtonian.cc File Reference
#include <fenv.h>
#include "generic.h"
#include "generalised_newtonian_navier_stokes.h"
#include "solid.h"
#include "constitutive.h"
#include "fluid_interface.h"
#include "meshes/triangle_mesh.h"
#include "overloaded_cartesian_element_body.h"

Classes

class  oomph::MyTaylorHoodElement< DIM >
 Overload TaylorHood element to modify output. More...
 
class  oomph::FaceGeometry< MyTaylorHoodElement >
 
class  oomph::FaceGeometry< FaceGeometry< MyTaylorHoodElement > >
 
class  VibratingShellProblem< ELEMENT >
 Problem class to simulate the settling of a viscous drop. More...
 

Namespaces

 oomph
 DRAIG: Change all instances of (SPATIAL_DIM) to (DIM-1).
 
 oomph::Problem_Parameter
 Namespace for Problem Parameter.
 

Functions

void oomph::Problem_Parameter::oscillation (const double &time, const Vector< double > &x, Vector< double > &force)
 Function describing the oscillation. More...
 
double oomph::Problem_Parameter::free_surface_profile (const double r)
 
int main (int argc, char **argv)
 Driver code for vibrating drop problem. More...
 

Function Documentation

◆ main()

int main ( int argc  ,
char **  argv 
)

Driver code for vibrating drop problem.

1679 {
1680 
1682 
1683  // Store command line arguments
1684  CommandLineArgs::setup(argc,argv);
1685 
1686  // Define possible command line arguments and parse the ones that
1687  // were actually specified
1688 
1689  // Suppress writing of restart files (they're big!)
1690  CommandLineArgs::specify_command_line_flag("--suppress_restart_files");
1691 
1692 
1693  // Use extrapolated strain rate when determining viscosity?
1695  ("--use_current_strainrate_for_viscosity");
1696 
1697  // Name of restart file
1699  ("--restart_file",
1701 
1702  // Output directory
1704  "--dir",
1706 
1707  // Multiplier for oscillatory body force (hierher MH hack)
1709  "--osc_body_force_multiplier",
1711 
1712  // BDF TYPE (1,2 or 4)
1714  "--bdf_type",
1716 
1717  // Number of previous values to be used for extrapolation
1718  // of strain rate (<= Problem_Parameter::BDF_type)
1720  "--nprev_for_extrapolation_of_strain_rate",
1722 
1723  // Min number of steps period (as timestep limitation)
1724  unsigned min_ntstep_per_period=40;
1726  "--min_ntstep_per_period",&min_ntstep_per_period);
1727 
1728  // Initial number of steps period
1729  unsigned initial_ntstep_per_period=40;
1731  "--initial_ntstep_per_period",&initial_ntstep_per_period);
1732 
1733  // Manual adaptation?
1734  unsigned nadapt_interval=1;
1736  "--manual_adapt",&nadapt_interval);
1737 
1738  // Uniform element area
1740  "--uniform_element_area",
1742 
1743  // Use Newtonian constitutive equation (and specify its
1744  // viscosity ratio)
1745  double newtonian_viscosity_ratio=1.0;
1747  "--use_newtonian_constitutive_equation",
1748  &newtonian_viscosity_ratio);
1749 
1750  // Use Casson const eqn
1752  "--use_casson_constitutive_equation",
1754 
1755  // Use Herschel Bulkley const eqn
1757  "--use_herschel_bulkley_constitutive_equation",
1759 
1760  // Use Sisko const eqn
1762  "--use_sisko_constitutive_equation",
1764 
1765  // Temporal accuray
1766  double epsilon_t=2.0e-7;
1768  "--epsilon_t",&epsilon_t);
1769 
1770  // Flag indicating whether we use fixed point iteration or not
1771  // Number of fixed point iterations before we use Aitken extrapolation
1772  unsigned fixed_point_steps_before_aitken_extrapolation=0;
1774  "--use_fixed_point_iteration",
1775  &fixed_point_steps_before_aitken_extrapolation);
1776 
1777  // Validation command line flag
1779 
1780  // Parse command line
1782 
1783  // Doc what has actually been specified on the command line
1785 
1786 
1787  // Choose constitutive equation
1788  if (CommandLineArgs::command_line_flag_has_been_set("--use_newtonian_constitutive_equation"))
1789  {
1790  oomph_info << "Using Newtonian constitutive equation with viscosity ratio: "
1791  << newtonian_viscosity_ratio << std::endl;
1793  new NewtonianConstitutiveEquation<2>(newtonian_viscosity_ratio);
1794  }
1796  ("--use_casson_constitutive_equation"))
1797  {
1798  oomph_info << "Using Casson constitutive equation"
1799  << " with cutoff strain rate: "
1801  << std::endl;
1806 
1811  }
1813  ("--use_herschel_bulkley_constitutive_equation"))
1814  {
1815  oomph_info << "Using Herschel Bulkley constitutive equation"
1816  << " with cutoff strain rate: "
1818  << std::endl;
1824 
1829  }
1831  ("--use_sisko_constitutive_equation")) ||
1833  ("--validation")) )
1834  {
1835  oomph_info << "Using Sisko constitutive equation"
1836  << " with cutoff strain rate: "
1838  << std::endl;
1844 
1849  }
1850  else
1851  {
1852  oomph_info << "Please select constitutive equation!\n";
1853  abort();
1854  }
1855 
1856 
1858  {
1860  nadapt_interval=5;
1861  fixed_point_steps_before_aitken_extrapolation=500;
1864  }
1865 
1866  // Create generalised Hookean constitutive equations
1869 
1870  // Open trace file
1871  Problem_Parameter::Trace_file.open((Problem_Parameter::Directory+"/trace.dat").c_str());
1872 
1873  // Write trace file
1875  << "VARIABLES="
1876  << "\"time\", " // 1
1877  << "\"drop height\"," // 2
1878  << "\"body force\"," // 3
1879  << "\"volume\"," // 4
1880  << "\"number of elements\","// 5
1881  << "\"max element area \"," // 6
1882  << "\"min element area \"," // 7
1883  << "\"max spatial error\"," // 8
1884  << "\"min spatial error\"," // 9
1885  << "\"norm of strain invariant\"," // 10
1886  << "\"norm of extrapolated strain invariant\"," // 11
1887  << "\"norm of error in extrapolated strain invariant\"," // 12
1888  << "\"min_invariant \"," // 13
1889  << "\"max_invariant \"," // 14
1890  << "\"min_viscosity \"," // 15
1891  << "\"max_viscosity \"," // 16
1892  << "\"norm of viscosity \"," // 17
1893  << "\"dt\"," // 18
1894  << "\"global temporal error norm\"," // 19
1895  << "\"doc number\"" // 20
1896  << std::endl;
1897 
1898 
1899  // Open norm file
1900  Problem_Parameter::Norm_file.open((Problem_Parameter::Directory+"/norm.dat").c_str()); // hierher needed? Maybe keep
1901  // alive for distant future when this becomes a demo driver code...
1902 
1903  // Output directory
1906 
1907  // Doc constitutive equation
1908  ofstream constitutive_file;
1909  constitutive_file.open((Problem_Parameter::Directory+"/constitutive.dat").c_str());
1910  double invariant_min=1.0e-15;
1911  double invariant_max=1.0e2;
1912  unsigned nstep_per_decade=10;
1913  double ratio=pow(0.1,double(1.0/nstep_per_decade));
1914  double invariant=invariant_max;
1915  while (invariant>invariant_min)
1916  {
1917  constitutive_file << invariant << " "
1919  << std::endl;
1920  invariant*=ratio;
1921  }
1922  constitutive_file.close();
1923 
1924  // Create problem in initial configuration
1928 
1929  // Timestepping parameters:
1930  //-------------------------
1931 
1932  oomph_info << "Tolerance for adaptive timestepping: epsilon_t = "
1933  << epsilon_t << std::endl;
1934 
1935  // Initial tiemstep
1936  double dt_new=1.0/double(initial_ntstep_per_period);
1937 
1938  // max. permitted timestep
1939  double dt_max=1.0/double(min_ntstep_per_period);
1940 
1941  // Do timestepping until tmax
1942  double t_max=500.25; //2.0
1943 
1944  // Tolerance for fixed point iteration in %
1945  double fixed_point_tol=1.0; //1.0e-6;
1946 
1947  // Restart?
1949  {
1950  problem.restart();
1951  oomph_info << "Done restart\n";
1952 
1953  // Have read in next timestep
1954  dt_new=problem.next_dt();
1955 
1956  // Doc the read-in initial conditions
1957  problem.doc_solution();
1958  }
1959  else
1960  {
1961  oomph_info << "Not doing restart\n";
1962 
1963  // Initialise timestepper
1964  problem.next_dt()=dt_new;
1965  problem.initialise_dt(problem.next_dt());
1966 
1967  // Perform impulsive start from current state
1968  problem.assign_initial_values_impulsive();
1969 
1970  oomph_info << "zeroth order extrapol (one prev value)" << std::endl;
1971  problem.set_nprev_for_extrapolation_of_strain_rate_for_all_elements(1);
1972 
1973  // Take one timestep and doc
1974  problem.unsteady_newton_solve(dt_new);
1975  problem.doc_solution();
1976 
1977  // Take a few timesteps with fixed timestep and without adaptation
1978  // to get some history values under our belt
1979  unsigned nstep=unsigned(t_max/problem.next_dt()); // hierher //5;
1980  oomph_info << "Doing " << nstep
1981  << " steps with constant timestep and mesh " << std::endl;
1982  //for (unsigned i=0;i<nstep;i++)
1983  unsigned count = 0;
1984  while (problem.time_pt()->time()<t_max)
1985  {
1986  // Adapt?
1987  if( (CommandLineArgs::command_line_flag_has_been_set("--manual_adapt") ||
1989  ((Problem_Parameter::Doc_info_trace.number())%nadapt_interval==0))
1990  {
1991  oomph_info << "hierher: time for another adaptation at doc number ="
1992  << Problem_Parameter::Doc_info_trace.number() << std::endl;
1993  problem.adapt();
1994  }
1995 
1996  if (count==3)
1997  {
1998  oomph_info << "next order extrapol (two prev values)" << std::endl;
1999  problem.set_nprev_for_extrapolation_of_strain_rate_for_all_elements(2);
2000  }
2001 
2002  oomph_info << "HIERHER: SKIPPING FOURTH ORDER STUFF!\n";
2003  // if (i==7)
2004  // {
2005  // oomph_info << "next order extrapol (four prev values)" << std::endl;
2006  // problem.set_nprev_for_extrapolation_of_strain_rate_for_all_elements(4);
2007  // }
2008 
2009 
2010  // problem.unsteady_newton_solve(dt_new);
2011 
2012  // Adaptive timestep with specified temporal tolerance epsilon_t
2013  dt_new=problem.adaptive_unsteady_newton_solve(problem.next_dt(),epsilon_t);
2014 
2015  // Next timestep
2016  cout << "Suggested new dt: " << dt_new << std::endl;
2017  if(dt_new > dt_max)
2018  {
2019  dt_new=dt_max;
2020  cout<<"dt limited (from above) to: "<<dt_new<<endl;
2021  }
2022  if(dt_new < Problem_Parameter::Dt_min)
2023  {
2025  cout<<"dt limited (from below) to: "<<Problem_Parameter::Dt_min<<endl;
2026  }
2027  problem.next_dt()=dt_new;
2028 
2029  //problem.doc_solution();
2030 
2031  //if(i<3) continue;
2032 
2033  // Fixed point iteration?
2034  if ( CommandLineArgs::command_line_flag_has_been_set("--use_fixed_point_iteration") ||
2036  {
2037  oomph_info << "DOING FIXED POINT ITERATION\n";
2038 
2039  problem.enable_fixed_point_iteration_for_strain_rate_for_all_elements();
2040 
2041  unsigned i_fp=0;
2042  double error_fixed_point_iteration = DBL_MAX;
2043 
2044  //for (unsigned i_fp=0;i_fp<nfixed_point;i_fp++)
2045  while(error_fixed_point_iteration > fixed_point_tol)
2046  {
2047  if(i_fp == fixed_point_steps_before_aitken_extrapolation)
2048  {
2049  oomph_info << "DOING AITKEN EXTRAPOLATION\n";
2050  problem.enable_aitken_extrapolation_for_all_elements();
2051  }
2052  oomph_info << "FIXED POINT RE-SOLVE " << i_fp << " FOR t = "
2053  << problem.time_pt()->time() << "\n";
2054  problem.newton_solve();
2055  //problem.doc_solution();
2056  error_fixed_point_iteration=
2057  problem.calculate_error_of_fixed_point_iteration();
2058 
2059  // if( error_fixed_point_iteration < fixed_point_tol)
2060  // {
2061  // oomph_info << "Error in fixed point iteration is less than the "
2062  // << "specified tolerance of "<<fixed_point_tol<<"%\n";
2063 
2064  // oomph_info << "\nSTOPPING FIXED POINT ITERATION\n";
2065  // problem.doc_solution();
2066  // break;
2067  // }
2068 
2069  // if(i_fp==nfixed_point-1)
2070  // {
2071  // oomph_info << "Maximum number of fixed point iterations ("
2072  // <<nfixed_point<<") reached.\n";
2073 
2074  // oomph_info << "\nSTOPPING FIXED POINT ITERATION\n";
2075  // problem.doc_solution();
2076  // break;
2077  // }
2078 
2079  // Update latest guess
2080  problem.update_latest_fixed_point_iteration_guess_for_strain_rate_for_all_elements();
2081 
2082  i_fp++;
2083  }
2084 
2085  problem.doc_solution();
2086 
2087  // Switch off
2088  problem.disable_fixed_point_iteration_for_strain_rate_for_all_elements();
2089  }
2090  else
2091  {
2092  problem.doc_solution();
2093  }
2094 
2095  count++;
2096 
2097  if( (count==20) &&
2099  {
2100  break;
2101  }
2102 
2103  }
2104  oomph_info << "hierher bailing out after const timesteps\n";
2105  exit(0);
2106  }
2107 
2108 
2109  // Now do temporally adaptive solves, explicitly adaptiving every specified number
2110  //--------------------------------------------------------------------------------
2111  // of steps
2112  //---------
2114  {
2115  while (problem.time_pt()->time()<t_max)
2116  {
2117  // Adaptive timestep with specified temporal tolerance epsilon_t
2118  dt_new=problem.adaptive_unsteady_newton_solve(problem.next_dt(),epsilon_t);
2119 
2120  // Next timestep
2121  cout << "Suggested new dt: " << dt_new << std::endl;
2122  if(dt_new > dt_max)
2123  {
2124  dt_new=dt_max;
2125  cout<<"dt limited (from above) to: "<<dt_new<<endl;
2126  }
2127  if(dt_new < Problem_Parameter::Dt_min)
2128  {
2130  cout<<"dt limited from below to: "<<Problem_Parameter::Dt_min<<endl;
2131  }
2132  problem.next_dt()=dt_new;
2133 
2134  // Doc it...
2135  problem.doc_solution();
2136 
2137  // Adapt?
2138  if ((Problem_Parameter::Doc_info_trace.number())%nadapt_interval==0)
2139  {
2140  oomph_info << "hierher: time for another adaptation at doc number ="
2141  << Problem_Parameter::Doc_info_trace.number() << std::endl;
2142  problem.adapt();
2143  }
2144  }
2145  }
2146  // Doubly adaptive run
2147  //--------------------
2148  else
2149  {
2150  unsigned max_adapt=1;
2151  bool first=false;
2152  dt_new=problem.doubly_adaptive_unsteady_newton_solve(problem.next_dt(),epsilon_t,
2153  max_adapt,first);
2154 
2155  // Next timestep
2156  cout << "Suggested new dt: " << dt_new << std::endl;
2157  if(dt_new > dt_max)
2158  {
2159  dt_new=dt_max;
2160  cout<<"dt limited (from above) to: "<<dt_new<<endl;
2161  }
2162  if(dt_new < Problem_Parameter::Dt_min)
2163  {
2165  cout<<"dt limited from below to: "<<Problem_Parameter::Dt_min<<endl;
2166  }
2167  problem.next_dt()=dt_new;
2168 
2169  // Doc it...
2170  problem.doc_solution();
2171  }
2172 
2173 
2174 
2175 
2176 
2177 
2178 
2179 
2180  exit(0);
2181 
2182 } //End of main
Array< double, 1, 3 > e(1./3., 0.5, 2.)
EIGEN_DEVICE_FUNC const GlobalUnaryPowReturnType< Derived, ScalarExponent > pow(const Eigen::ArrayBase< Derived > &x, const ScalarExponent &exponent)
Definition: GlobalFunctions.h:137
Problem class to simulate the settling of a viscous drop.
Definition: vibrating_shell_non_newtonian.cc:279
Definition: generalised_newtonian_constitutive_models.h:891
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: constitutive_laws.h:699
virtual double viscosity(const double &second_invariant_of_rate_of_strain_tensor)=0
Definition: generalised_newtonian_constitutive_models.h:360
Overload TaylorHood element to modify output.
Definition: pressure_driven_torus.cc:98
Definition: generalised_newtonian_constitutive_models.h:72
Taylor Hood upgraded to become projectable.
Definition: generalised_newtonian_navier_stokes_elements.h:2450
Definition: generalised_newtonian_constitutive_models.h:685
string Directory
Directory.
Definition: all_foeppl_von_karman/axisym_displ_based_fvk.cc:70
void setup(Time *time_pt)
Create all GeomObjects needed to define the cylinder and the flag.
Definition: turek_flag_non_fsi.cc:277
ofstream Norm_file
Definition: refineable_two_layer_interface.cc:341
ofstream Trace_file
Trace file.
Definition: refineable_two_layer_interface.cc:335
ConstitutiveLaw * Constitutive_law_pt
Constitutive law used to determine the mesh deformation.
Definition: jeffery_orbit.cc:82
double St
Strouhal number.
Definition: jeffery_orbit.cc:62
double Nu
Pseudo-solid (mesh) Poisson ratio.
Definition: jeffery_orbit.cc:75
double Re
Reynolds number.
Definition: jeffery_orbit.cc:59
bool command_line_flag_has_been_set(const std::string &flag)
Definition: oomph_utilities.cc:501
void specify_command_line_flag(const std::string &command_line_flag, const std::string &doc)
Specify possible argument-free command line flag.
Definition: oomph_utilities.cc:451
void parse_and_assign(int argc, char *argv[], const bool &throw_on_unrecognised_args)
Definition: oomph_utilities.cc:760
void doc_specified_flags()
Document specified command line flags.
Definition: oomph_utilities.cc:610
std::string Restart_file
Name of restart file.
Definition: axisym_vibrating_shell_non_newtonian.cc:67
double C_St
Strouhal number.
Definition: axisym_vibrating_shell_non_newtonian.cc:161
double HB_Re
Reynolds number.
Definition: axisym_vibrating_shell_non_newtonian.cc:178
double Uniform_element_area
Uniform initial element area.
Definition: axisym_vibrating_shell_non_newtonian.cc:61
double S_St
Strouhal number.
Definition: axisym_vibrating_shell_non_newtonian.cc:201
double S_Re_St
Reynolds multiplied Strouhal.
Definition: axisym_vibrating_shell_non_newtonian.cc:204
double S_Re
Reynolds number.
Definition: axisym_vibrating_shell_non_newtonian.cc:198
double HB_Re_St
Reynolds multiplied Strouhal.
Definition: axisym_vibrating_shell_non_newtonian.cc:184
double S_flow_index
Flow index in Sisko model.
Definition: axisym_vibrating_shell_non_newtonian.cc:195
GeneralisedNewtonianConstitutiveEquation< 3 > * Const_eqn_pt
Fluid constitutive equation.
Definition: axisym_vibrating_shell_non_newtonian.cc:213
double HB_flow_index
Power law exponent.
Definition: axisym_vibrating_shell_non_newtonian.cc:175
DocInfo Doc_info_soln
Doc info solutions.
Definition: axisym_vibrating_shell_non_newtonian.cc:73
unsigned BDF_type
Which bdf timestepper do we use?
Definition: axisym_vibrating_shell_non_newtonian.cc:54
double Critical_strain_rate
Critical strain rate.
Definition: axisym_vibrating_shell_non_newtonian.cc:210
double Yield_stress
have a generic yield stress, required for the output function
Definition: axisym_vibrating_shell_non_newtonian.cc:149
double C_yield_stress
Yield stress.
Definition: axisym_vibrating_shell_non_newtonian.cc:155
DocInfo Doc_info_trace
Doc info trace file.
Definition: axisym_vibrating_shell_non_newtonian.cc:70
double C_Re_St
Reynolds multiplied Strouhal.
Definition: axisym_vibrating_shell_non_newtonian.cc:164
unsigned Nprev_for_extrapolation_of_strain_rate
Definition: axisym_vibrating_shell_non_newtonian.cc:58
double C_Re
Reynolds number.
Definition: axisym_vibrating_shell_non_newtonian.cc:158
double Initial_settling_time
Time after which oscillation starts.
Definition: axisym_vibrating_shell_non_newtonian.cc:100
double HB_St
Strouhal number.
Definition: axisym_vibrating_shell_non_newtonian.cc:181
double Re_St
Reynolds multiplied Strouhal.
Definition: axisym_vibrating_shell_non_newtonian.cc:91
double Dt_min
Minimum allowable timestep.
Definition: axisym_vibrating_shell_non_newtonian.cc:103
double S_alpha
Pre-factor in Sisko model K / ( mu_inf T^(n-1) )
Definition: axisym_vibrating_shell_non_newtonian.cc:192
double HB_yield_stress
Yield stress.
Definition: axisym_vibrating_shell_non_newtonian.cc:172
double Oscillating_body_force_multiplier
Body force multiplier.
Definition: axisym_vibrating_shell_non_newtonian.cc:97
double Tolerable_error
Definition: unstructured_two_d_mesh_geometry_base.cc:1103
OomphInfo oomph_info
Definition: oomph_definitions.cc:319
Constructor for SteadyAxisymAdvectionDiffusion problem
Definition: steady_axisym_advection_diffusion.cc:213

References oomph::Problem_Parameter::BDF_type, oomph::Problem_Parameter::C_Re, oomph::Problem_Parameter::C_Re_St, oomph::Problem_Parameter::C_St, oomph::Problem_Parameter::C_yield_stress, oomph::CommandLineArgs::command_line_flag_has_been_set(), oomph::Problem_Parameter::Const_eqn_pt, Problem_Parameter::Constitutive_law_pt, oomph::Problem_Parameter::Critical_strain_rate, AxisymFvKParameters::Directory, oomph::Problem_Parameter::Doc_info_soln, oomph::Problem_Parameter::Doc_info_trace, oomph::CommandLineArgs::doc_specified_flags(), oomph::Problem_Parameter::Dt_min, e(), oomph::Problem_Parameter::HB_flow_index, oomph::Problem_Parameter::HB_Re, oomph::Problem_Parameter::HB_Re_St, oomph::Problem_Parameter::HB_St, oomph::Problem_Parameter::HB_yield_stress, oomph::Problem_Parameter::Initial_settling_time, Problem_Parameter::Norm_file, oomph::Problem_Parameter::Nprev_for_extrapolation_of_strain_rate, Problem_Parameter::Nu, oomph::DocInfo::number(), oomph::oomph_info, oomph::Problem_Parameter::Oscillating_body_force_multiplier, oomph::CommandLineArgs::parse_and_assign(), Eigen::bfloat16_impl::pow(), problem, Problem_Parameter::Re, oomph::Problem_Parameter::Re_St, oomph::Problem_Parameter::Restart_file, oomph::Problem_Parameter::S_alpha, oomph::Problem_Parameter::S_flow_index, oomph::Problem_Parameter::S_Re, oomph::Problem_Parameter::S_Re_St, oomph::Problem_Parameter::S_St, oomph::DocInfo::set_directory(), Flag_definition::setup(), oomph::CommandLineArgs::specify_command_line_flag(), Problem_Parameter::St, oomph::ToleranceForVertexMismatchInPolygons::Tolerable_error, Problem_Parameter::Trace_file, oomph::Problem_Parameter::Uniform_element_area, oomph::GeneralisedNewtonianConstitutiveEquation< DIM >::viscosity(), and oomph::Problem_Parameter::Yield_stress.