Object oriented programming using oomphlib Learning Object Oriented

Object oriented programming using oomph-lib Learning Object Oriented Programming in the Context of Using a Multi-physics Finite Element Library Solution of the flow around a cylinder using a FE library Software Lab – 2 nd Presentation Iason Papaioannou Orkun Özkan Dönmez Supervisor : Stefan Kollmansberger Lehrstuhl für Bauinformatik 1/15

Object oriented programming using oomph-lib Overview • Introduction • Specific problem description • Implementation – – Creating a refineable mesh Defining the problem Timestepping Driver code • Results – Steady case – Unsteady case • Summary and further steps Lehrstuhl für Bauinformatik 2/15

Object oriented programming using oomph-lib Introduction is an object-oriented, open-source finite-element library for the simulation of multi-physics problems. The basic features of the library are compiled in virtual classes or classes with basic implemented member functions. The user must write a code for each specific problem following a predefined structure, i. e. creating classes derived from precompiled base classes. Basic attributes are passed into classes using class templates. Lehrstuhl für Bauinformatik 3/15

Object oriented programming using oomph-lib Specific problem description 0. 15 m 0. 16 m inlet 0. 1 m U=V=0 outlet 0. 15 m (0, 0) 2. 2 m Non-dimensional form of Navier-Stokes equations: • Conservation of mass: • Conservation of momentum: Discretization: 9 -node quadrilateral Crozier-Raviart finite elements • Biquadratic interpolation of velocity • Bilinear interpolation of pressure Lehrstuhl für Bauinformatik 4/15

Object oriented programming using oomph-lib Implementation Creating a refineable mesh class Rectangle. With. Hole. Domain: public Domain; • • Pass a pointer to the curvilinear geometric object (circle) Pass the dimensions of the rectangle Generate macro elements (ME) Implement interpolation functions for each ME boundary template<class ELEMENT> class Rectangle. With. Hole. Mesh: public virtual Mesh; • Create the domain • Convert ME to finite elements (FE) Lehrstuhl für Bauinformatik 5/15

Object oriented programming using oomph-lib Implementation Creating a refineable mesh template<class ELEMENT> class Adaptive. Rectangle. With. Hole. Mesh : public Rectangle. With. Hole. Mesh<ELEMENT>, public Refineable. Quad. Mesh<ELEMENT>; • Associate each FE with a Quad Tree • Setup Quad Tree forest for mesh refinement • Mesh is refined/unrefined adaptively in regions in which the solution undergoes rapid/slow variations Lehrstuhl für Bauinformatik 6/15

Object oriented programming using oomph-lib Implementation Defining the problem template<class ELEMENT, class TIMESTEPPER> class Flow. Around. Cylinder. Problem : public Problem; • • Allocate the timestepper Build the refineable mesh Set the error estimator for the adaptive refinement Set parameters (Re) and boundary conditions template<class ELEMENT, class TIMESTEPPER> class Flow. Around. Cylinder. Problem<ELEMENT, TIMESTEPPER>: : actions_after_adapt(); Lehrstuhl für Bauinformatik 7/15

Object oriented programming using oomph-lib Implementation Timestepping template<class ELEMENT, class TIMESTEPPER> class Flow. Around. Cylinder. Problem<ELEMENT, TIMESTEPPER>: : unsteady_run(Doc. Info& doc_info); • Set value of time step and number of time steps • Set maximum number of adaptations • Loop over the time steps – Solve adaptively using an unsteady Newton solver – Shift the time values back – Advance the Problem’s global time and calculate the weights for the timestepper – Call the nonlinear solver to find unknowns at current time – Document the solution Lehrstuhl für Bauinformatik 8/15

Object oriented programming using oomph-lib Implementation: Driver code int main(){ // Set physical parameters and dimensions. . . //Create a new ellipse object as the central cylinder. . . // Set up doc info Doc. Info doc_info; doc_info. number()=0; doc_info. set_directory("RESLT"); pass the element type and timestepper // Set up problem Flow. Around. Cylinder. Problem <Refineable. Quad. Crozier. Raviart. Element, BDF<2> > problem(cylinder_pt, length, height); // Refine the mesh a couple of times problem. refine_uniformly(); // Run the unsteady simulation problem. unsteady_run(doc_info); } Lehrstuhl für Bauinformatik 9/15
![Object oriented programming using oomph-lib Results Steady case: Re = 20 [m/s] • Euclidean Object oriented programming using oomph-lib Results Steady case: Re = 20 [m/s] • Euclidean](http://slidetodoc.com/presentation_image_h2/b1bfff3344fb9a0dfb91b9436ba97ddf/image-10.jpg)
Object oriented programming using oomph-lib Results Steady case: Re = 20 [m/s] • Euclidean Norm of velocity vector [Pa] • Pressure distribution measure points for the pressure difference Lehrstuhl für Bauinformatik 10/15

Object oriented programming using oomph-lib Results Steady case: Re = 20 Comparison of pressure difference between front and end point of the cylinder with reference solutions Method Unknowns ΔP FD - Blockstructured 13299 51159 200607 0. 1169 0. 1172 FV – Blockstuctured 15000 60000 240000 0. 1166 0. 1173 0. 1175 FE – Unstructured Tailor-Hood 2298 6297 20487 0. 1110 0. 1160 0. 1170 22077 89213 13049 (adapt. ) 0. 11697 0. 11710 0. 11738 FE – Crozier Raviart Lehrstuhl für Bauinformatik 11/15
![Object oriented programming using oomph-lib Results Unsteady case: Re = 100 [m/s] • Euclidean Object oriented programming using oomph-lib Results Unsteady case: Re = 100 [m/s] • Euclidean](http://slidetodoc.com/presentation_image_h2/b1bfff3344fb9a0dfb91b9436ba97ddf/image-12.jpg)
Object oriented programming using oomph-lib Results Unsteady case: Re = 100 [m/s] • Euclidean Norm of velocity vector [Pa] • Pressure distribution Lehrstuhl für Bauinformatik 12/15

Object oriented programming using oomph-lib Results Unsteady case: Re = 100 Comparison of pressure difference between front and end point of the cylinder with reference FV solution (CFX) Lehrstuhl für Bauinformatik 13/15

Object oriented programming using oomph-lib Summary and further steps until now we. . . familiarised ourselves with the library‘s structure. . . implemented two example problems – a 1 D poisson problem – a steady 2 D driven cavity problem . . . solved the flow around a cylinder our further step is. . . to solve a flow around a moving cylinder Lehrstuhl für Bauinformatik 14/15

Object oriented programming using oomph-lib Learning Object Oriented Programming in the Context of Using a Multi-physics Finite Element Library Solution of the flow around a cylinder using a FE library Software Lab – 2 nd Presentation Iason Papaioannou Orkun Özkan Dönmez Supervisor : Stefan Kollmansberger Lehrstuhl für Bauinformatik 15/15
- Slides: 15