Hermes2D is a C++ library for rapid development of adaptive hp-FEM / hp-DG solvers. Novel hp-adaptivity algorithms help solve a large variety of problems ranging from ODE and stationary linear PDE to complex time-dependent nonlinear multiphysics PDE systems.
The Trailblazer Ride from the If Jungle into a Civilised Railway Station - Or...Ruby Meditation
Speech of Orban Botond, Ruby Developer at Toptal, at Ruby Meditation 27, Dnipro, 19.05.2019
Slideshare -
Next conference - http://www.rubymeditation.com/
Software development is a domain where everybody can make a beautiful sculpture or can quickly build an unsolvable maze. According to my observations the later happens more often unfortunately.
In the title for my presentation both the If Jungle and the Civilised Railway Station are methaphors representing the opposite ends of the scale of quality code.
In my presentation I am going to present my personal experiences on how to get out from the trap of the if jungle by making the code to adhere to the SRP and DRY principles. I am also going to show the advantages of the Railway Oriented Programing using the 3 different libraries.
The examples are going to be stereotypical errors, fun and easy to follow.
Announcements and conference materials https://www.fb.me/RubyMeditation
News https://twitter.com/RubyMeditation
Photos https://www.instagram.com/RubyMeditation
The stream of Ruby conferences (not just ours) https://t.me/RubyMeditation
IJERA (International journal of Engineering Research and Applications) is International online, ... peer reviewed journal. For more detail or submit your article, please visit www.ijera.com
A recursive function is a function that calls itself. A recursive function is used for repeating code. If the state of the function does not change, and it has no preset exit condition that is reached, a recursive call can turn into an infinite loop.
In a nutshell, an Arduino is an open hardware development board that can be used by tinkerers, hobbyists, and makers to design and build devices that interact with the real world. While Arduino refers to a specific type of board design, it can also be used to refer to a company which manufactures a specific implementation of these boards, and is typically also used to describe the community around compatible boards made by other people or companies which function in a similar way.
The Trailblazer Ride from the If Jungle into a Civilised Railway Station - Or...Ruby Meditation
Speech of Orban Botond, Ruby Developer at Toptal, at Ruby Meditation 27, Dnipro, 19.05.2019
Slideshare -
Next conference - http://www.rubymeditation.com/
Software development is a domain where everybody can make a beautiful sculpture or can quickly build an unsolvable maze. According to my observations the later happens more often unfortunately.
In the title for my presentation both the If Jungle and the Civilised Railway Station are methaphors representing the opposite ends of the scale of quality code.
In my presentation I am going to present my personal experiences on how to get out from the trap of the if jungle by making the code to adhere to the SRP and DRY principles. I am also going to show the advantages of the Railway Oriented Programing using the 3 different libraries.
The examples are going to be stereotypical errors, fun and easy to follow.
Announcements and conference materials https://www.fb.me/RubyMeditation
News https://twitter.com/RubyMeditation
Photos https://www.instagram.com/RubyMeditation
The stream of Ruby conferences (not just ours) https://t.me/RubyMeditation
IJERA (International journal of Engineering Research and Applications) is International online, ... peer reviewed journal. For more detail or submit your article, please visit www.ijera.com
A recursive function is a function that calls itself. A recursive function is used for repeating code. If the state of the function does not change, and it has no preset exit condition that is reached, a recursive call can turn into an infinite loop.
In a nutshell, an Arduino is an open hardware development board that can be used by tinkerers, hobbyists, and makers to design and build devices that interact with the real world. While Arduino refers to a specific type of board design, it can also be used to refer to a company which manufactures a specific implementation of these boards, and is typically also used to describe the community around compatible boards made by other people or companies which function in a similar way.
Software development is a domain where everybody can make a beautiful sculpture or can quickly build an unsolvable maze. According to my observations the later happens more often unfortunately.
In the title for my presentation both the If Jungle and the Civilised Railway Station are methaphors representing the opposite ends of the scale of quality code.
In this presentation I am going to present my personal experiences on how to get out from the trap of the if jungle by making the code to adhere to the SRP and DRY principles. I am also going to show the advantages of the Railway Oriented Programing using the 3 different libraries.
The examples are going to be stereotypical errors, fun and easy to follow.
Le slide deck de l'Université que nous avons donnée avec Rémi Forax à Devoxx France 2019.
Comme promis, Java sort sa version majeure tous les 6 mois. Le train passe et amène son lot de nouveautés. Parmi elles, certaines sont sorties : une nouvelle syntaxe pour les clauses switch et l'instruction de byte code CONSTANT_DYNAMIC. D'autres sont en chantier, plus ou moins avancé : une nouvelle façon d'écrire des méthodes de façon condensée, un instanceof 'intelligent', des constantes évaluées au moment où elles sont utilisées. Les projets progressent. Loom, et son nouveau modèle de programmation concurrente que l'ont peut tester avec Jetty. Amber, qui introduit les data types et des nouvelles syntaxes. Valhalla, dont les value types donnent leurs premiers résultats. S'il est difficile de prévoir une date de sortie pour ces nouveautés, on sait en revanche qu'une fois prêtes elles sortiront en moins de 6 mois. De tout ceci nous parlerons donc au futur et en public, avec des démonstrations de code, des slides, du code, de la joie et de la bonne humeur !
Writing NodeJS applications is an easy task for JavaScript developers. However, getting what is happening under the hood in NodeJS may be intimidating, but understanding it is vital for web developers.
Indeed, when you try to learn NodeJS, most tutorials are about the NodeJS ecosystem like Express, Socket.IO, PassportJS. It is really rare to see some tutorials about the NodeJS runtime itself.
By this meetup, I want to spot the light on some advanced NodeJS topics so as to help developers answering questions an experienced NodeJS developer is expected to answer. Understanding these topics is essential to make you a much more desirable developer. I want to explore several topics including the famous event-loop along with NodeJS Module Patterns and how dependencies actually work in NodeJS.
I hope that this meetup would help you to be more comfortable understanding advanced code written in NodeJS.
Hoje em dia é fácil juntar quantidades absurdamente grandes de dados. Mas, uma vez de posse deles, como fazer para extrair informações dessas montanhas amorfas de dados? Nesse minicurso vamos apresentar o modelo de programação MapReduce: entender como ele funciona, para que serve e como construir aplicações usando-o. Vamos ver também como usar o Elastic MapReduce, o serviço da Amazon que cria clusters MapReduce sob-demanda, para que você não se preocupe em administrar e conseguir acesso a um cluster de máquinas, mas em como fazer seu código digerir de forma distribuída os dados que você possui. Veremos exemplos práticos em ação e codificaremos juntos alguns desafios.
This is the slide for what I shared in JS Group meetup, 2014, Taiwan. It covers what JavaScript could do for making the program more "functional", the benefits, price and the limitation.
Software development is a domain where everybody can make a beautiful sculpture or can quickly build an unsolvable maze. According to my observations the later happens more often unfortunately.
In the title for my presentation both the If Jungle and the Civilised Railway Station are methaphors representing the opposite ends of the scale of quality code.
In this presentation I am going to present my personal experiences on how to get out from the trap of the if jungle by making the code to adhere to the SRP and DRY principles. I am also going to show the advantages of the Railway Oriented Programing using the 3 different libraries.
The examples are going to be stereotypical errors, fun and easy to follow.
Le slide deck de l'Université que nous avons donnée avec Rémi Forax à Devoxx France 2019.
Comme promis, Java sort sa version majeure tous les 6 mois. Le train passe et amène son lot de nouveautés. Parmi elles, certaines sont sorties : une nouvelle syntaxe pour les clauses switch et l'instruction de byte code CONSTANT_DYNAMIC. D'autres sont en chantier, plus ou moins avancé : une nouvelle façon d'écrire des méthodes de façon condensée, un instanceof 'intelligent', des constantes évaluées au moment où elles sont utilisées. Les projets progressent. Loom, et son nouveau modèle de programmation concurrente que l'ont peut tester avec Jetty. Amber, qui introduit les data types et des nouvelles syntaxes. Valhalla, dont les value types donnent leurs premiers résultats. S'il est difficile de prévoir une date de sortie pour ces nouveautés, on sait en revanche qu'une fois prêtes elles sortiront en moins de 6 mois. De tout ceci nous parlerons donc au futur et en public, avec des démonstrations de code, des slides, du code, de la joie et de la bonne humeur !
Writing NodeJS applications is an easy task for JavaScript developers. However, getting what is happening under the hood in NodeJS may be intimidating, but understanding it is vital for web developers.
Indeed, when you try to learn NodeJS, most tutorials are about the NodeJS ecosystem like Express, Socket.IO, PassportJS. It is really rare to see some tutorials about the NodeJS runtime itself.
By this meetup, I want to spot the light on some advanced NodeJS topics so as to help developers answering questions an experienced NodeJS developer is expected to answer. Understanding these topics is essential to make you a much more desirable developer. I want to explore several topics including the famous event-loop along with NodeJS Module Patterns and how dependencies actually work in NodeJS.
I hope that this meetup would help you to be more comfortable understanding advanced code written in NodeJS.
Hoje em dia é fácil juntar quantidades absurdamente grandes de dados. Mas, uma vez de posse deles, como fazer para extrair informações dessas montanhas amorfas de dados? Nesse minicurso vamos apresentar o modelo de programação MapReduce: entender como ele funciona, para que serve e como construir aplicações usando-o. Vamos ver também como usar o Elastic MapReduce, o serviço da Amazon que cria clusters MapReduce sob-demanda, para que você não se preocupe em administrar e conseguir acesso a um cluster de máquinas, mas em como fazer seu código digerir de forma distribuída os dados que você possui. Veremos exemplos práticos em ação e codificaremos juntos alguns desafios.
This is the slide for what I shared in JS Group meetup, 2014, Taiwan. It covers what JavaScript could do for making the program more "functional", the benefits, price and the limitation.
Lost in Translation: When Industrial Protocol Translation goes Wrong [CONFide...Marco Balduzzi
Protocol gateways are embedded devices used in industrial facilities to integrate legacy equipment such as serial PLCs with modern control networks. Given the importance that these devices play in the operation of manufacturing plants, we conducted a vendor agnostic analysis of the technology behind protocol translation, by identifying new unexplored weaknesses and vulnerabilities. We evaluated five popular gateway products and discovered translation problems that enable potential adversaries to conduct stealthy and difficult-to-detect attacks, for example to arbitrarily disable, or enable a targeted machinery by mean of innocent-looking packets that bypass common ICS firewalls. In this presentation, we share the results of our findings and discuss the impact to the problems that we identified and their potential countermeasures.
Just Click on Below Link to Download This Course:
https://www.devrycoursehelp.com/product/devry-gsp-115-week-3-assignment-latest/
DeVry GSP 115 Week 3 Assignment latest
Week 3: Loops and Branching
Instructions
Complete the following assignments. Copy and paste your finished code into a Word document, clearly identifying which assignment it is. Also, capture the output of the program and paste that into the Word document. If there are questions to be answered, put the answers after the output. When you complete all three of this week’s assignments, save the document as yourLastName_GSP115_W3_Assignments.docx.Submit it to the Week 3 assignment Dropbox.
In this presentation , i provide in depth information about the how MapReduce works. It contains many details about the execution steps , Fault tolerance , master / worker responsibilities.
Deep Behavioral Phenotyping in Systems Neuroscience for Functional Atlasing a...Ana Luísa Pinho
Functional Magnetic Resonance Imaging (fMRI) provides means to characterize brain activations in response to behavior. However, cognitive neuroscience has been limited to group-level effects referring to the performance of specific tasks. To obtain the functional profile of elementary cognitive mechanisms, the combination of brain responses to many tasks is required. Yet, to date, both structural atlases and parcellation-based activations do not fully account for cognitive function and still present several limitations. Further, they do not adapt overall to individual characteristics. In this talk, I will give an account of deep-behavioral phenotyping strategies, namely data-driven methods in large task-fMRI datasets, to optimize functional brain-data collection and improve inference of effects-of-interest related to mental processes. Key to this approach is the employment of fast multi-functional paradigms rich on features that can be well parametrized and, consequently, facilitate the creation of psycho-physiological constructs to be modelled with imaging data. Particular emphasis will be given to music stimuli when studying high-order cognitive mechanisms, due to their ecological nature and quality to enable complex behavior compounded by discrete entities. I will also discuss how deep-behavioral phenotyping and individualized models applied to neuroimaging data can better account for the subject-specific organization of domain-general cognitive systems in the human brain. Finally, the accumulation of functional brain signatures brings the possibility to clarify relationships among tasks and create a univocal link between brain systems and mental functions through: (1) the development of ontologies proposing an organization of cognitive processes; and (2) brain-network taxonomies describing functional specialization. To this end, tools to improve commensurability in cognitive science are necessary, such as public repositories, ontology-based platforms and automated meta-analysis tools. I will thus discuss some brain-atlasing resources currently under development, and their applicability in cognitive as well as clinical neuroscience.
Nutraceutical market, scope and growth: Herbal drug technologyLokesh Patil
As consumer awareness of health and wellness rises, the nutraceutical market—which includes goods like functional meals, drinks, and dietary supplements that provide health advantages beyond basic nutrition—is growing significantly. As healthcare expenses rise, the population ages, and people want natural and preventative health solutions more and more, this industry is increasing quickly. Further driving market expansion are product formulation innovations and the use of cutting-edge technology for customized nutrition. With its worldwide reach, the nutraceutical industry is expected to keep growing and provide significant chances for research and investment in a number of categories, including vitamins, minerals, probiotics, and herbal supplements.
Salas, V. (2024) "John of St. Thomas (Poinsot) on the Science of Sacred Theol...Studia Poinsotiana
I Introduction
II Subalternation and Theology
III Theology and Dogmatic Declarations
IV The Mixed Principles of Theology
V Virtual Revelation: The Unity of Theology
VI Theology as a Natural Science
VII Theology’s Certitude
VIII Conclusion
Notes
Bibliography
All the contents are fully attributable to the author, Doctor Victor Salas. Should you wish to get this text republished, get in touch with the author or the editorial committee of the Studia Poinsotiana. Insofar as possible, we will be happy to broker your contact.
Toxic effects of heavy metals : Lead and Arsenicsanjana502982
Heavy metals are naturally occuring metallic chemical elements that have relatively high density, and are toxic at even low concentrations. All toxic metals are termed as heavy metals irrespective of their atomic mass and density, eg. arsenic, lead, mercury, cadmium, thallium, chromium, etc.
Comparing Evolved Extractive Text Summary Scores of Bidirectional Encoder Rep...University of Maribor
Slides from:
11th International Conference on Electrical, Electronics and Computer Engineering (IcETRAN), Niš, 3-6 June 2024
Track: Artificial Intelligence
https://www.etran.rs/2024/en/home-english/
Professional air quality monitoring systems provide immediate, on-site data for analysis, compliance, and decision-making.
Monitor common gases, weather parameters, particulates.
DERIVATION OF MODIFIED BERNOULLI EQUATION WITH VISCOUS EFFECTS AND TERMINAL V...Wasswaderrick3
In this book, we use conservation of energy techniques on a fluid element to derive the Modified Bernoulli equation of flow with viscous or friction effects. We derive the general equation of flow/ velocity and then from this we derive the Pouiselle flow equation, the transition flow equation and the turbulent flow equation. In the situations where there are no viscous effects , the equation reduces to the Bernoulli equation. From experimental results, we are able to include other terms in the Bernoulli equation. We also look at cases where pressure gradients exist. We use the Modified Bernoulli equation to derive equations of flow rate for pipes of different cross sectional areas connected together. We also extend our techniques of energy conservation to a sphere falling in a viscous medium under the effect of gravity. We demonstrate Stokes equation of terminal velocity and turbulent flow equation. We look at a way of calculating the time taken for a body to fall in a viscous medium. We also look at the general equation of terminal velocity.
1. Hermes2D
C++ library for rapid development of adaptive
hp-FEM / hp-DG solvers
Lukas Korous
Johannesburg, 12th Oct 2016
2. Hermes2d Overview
What it is?
- C++ multi-platform (Win, Linux, MacOS) library for rapid prototyping of FEM & DG solvers
- “When you want to solve a non-trivial PDE in 2d with the least possible effort. And you know some C/C++.”
- “When you want to test drive something small (a preconditioner, error estimate, FE space), and you don’t want to write all the rest for it. And
you know some OOP in C++.”
How can I try it out?
- https://github.com/hpfem/hermes
- On Linux
- Download, get dependencies via package managers, configure, build
- On Windows
- Download, get dependencies from https://github.com/l-korous/hermes-windows, configure, build
What technologies are used in Hermes2d?
- (Modern) C++, (well) documented, and exception-safe
- OpenMP for parallelization of the most CPU-intensive tasks
- Real-time OpenGL visualization
- External linear solvers (UMFPACK, PARALUTION, MUMPS, Trilinos)
- Usual exchange formats (XML, BSON, VTK, ExodusII, MatrixMarket, Matlab)
Hermes2D – Lukas Korous
3. Hermes2d Overview > Features
What can it do?
- Stationary / Time-dependent / Harmonic equations
- Number of manual, and automatic mesh refinement (AMR) / Spatial adaptivity options
- Granular AMR setup based on customizable error estimate calculations
- Nonlinear equation handling using Newton’s and Picard’s method
- Fully automatic & configurable Newton’s method with damping coefficient control, jacobian reuse control, arbitrary stopping criteria control
- Time-adaptivity, Space-time adaptivity using embedded Runge-Kutta methods
- Time-error space distribution, arbitrary calculations of any error estimate pluggable into AMR, and time-step controllers
- Weak & Strong coupled problems
- No matter what the coupling is, when you can write the weak formulation of your problem on paper, you can do that in Hermes2d as well.
What it cannot do (does not do)
- Problem specific optimizations, caching, shortcuts, etc.
- But #1: In some cases, the Hermes2D API provides methods that can be used for some optimizations.
- But #2: Due to the use of OOP, users of the library are welcome to sub-class Hermes2d core classes and implement the missing functionality.
Hermes2D – Lukas Korous
4. Hermes2d Structures > Introduction
As a user, I have a problem:
Hermes2D – Lukas Korous
Domain
Geometry
Weak
Formulation
Essential Boundary
Conditions & Initial
Conditions
Problem
Knowledge
Desired Output
Domain needs to be meshed usually via a specific
tool (GMSH, Cubit, etc.).
Since triangulation is very crucial part of the FE
method, even though Graphical User Interface
software (e.g. Agros2D) is generally able to accept
the geometry (and it triangulates internally), the
mesh is available for inspection by the user.
Mesh
5. Hermes2d Structures > Introduction
As a user, I have a problem:
Hermes2D – Lukas Korous
Domain
Geometry
Weak
Formulation
Essential Boundary
Conditions & Initial
Conditions
Problem
Knowledge
Desired Output
Problem Knowledge translates to selecting suitable FE
spaces / solvers & their attributes / preconditioners,
manual mesh refinements in problematic areas, etc.
Desired Output translates to selecting desired post-
processing tools - integral calculations, point values,
graphical representation of the solution, or any function
of solution(s).
Mesh
6. Hermes2d Structures > Mapping
As a user, I have a problem:
Hermes2D – Lukas Korous
Domain
Geometry
Weak
Formulation
Essential Boundary
Conditions & Initial
Conditions
Problem
Knowledge
Desired Output
Mesh
Mesh WeakForm
EssentialBoundaryCondition
Space
- H1Space
- L2Space (DG)
- HcurlSpace View
Filter
IntegralCalculator
ExactSolution
Solver
- LinearSolver
- NewtonSolver
7. Hermes2d Structures > Mesh
Functionality:
Input / Output – own format (plain text,
XML), Cubit, GMSH (through Agros2D)
Graphical representation – direct (OpenGL
view), VTK format
Refinements – set of methods for manual
mesh refinement
Data:
Element []
Vertex []
Edge []
Hermes2D – Lukas Korous
8. Hermes2d Structures > Space
Functionality:
Input / Output – own format (XML, BSON)
Graphical representation
– direct (OpenGL view), VTK format
– OrderView (top), BaseView (bottom)
Element order handling – Get/Set, increase,
decrease, uniform settings
Essential boundary conditions handling:
virtual Scalar value(double x, double y)
Data:
Mesh
Shapeset
ElementOrder []
EssentialBoundaryCondition []
Hermes2D – Lukas Korous
9. Hermes2d Structures > WeakForm, Solver
WeakForm Functionality:
For each Form (=integral), performs calculations:
Scalar matrix_form(int n, double *wt, Func<double> *u, Func<double> *v)
Ord matrix_form(int n, double *wt, Func<Ord> *u, Func<Ord> *v)
Scalar vector_form(int n, double *wt, Func<double> *v)
Ord vector_form(int n, double *wt, Func<Ord> *v)
- n ... Number of integration points
- wt ... Integration weights
- u ... Basis function values(, derivatives) at integration
points
- v ... Test function values(, derivatives) at integration
points
WeakForm Data:
Form []
Hermes2D – Lukas Korous
Solver Subtypes:
LinearSolver
NewtonSolver
PicardSolver
Solver Functionality:
Damping factor handling
- in case of Newton’s method
Algebraic solver selection
Solver Data:
Space
WeakForm
10. Examples > Magnetostatics
In this example, we solve the equation
𝛻 ×
1
𝜇
(𝛻 × u) = J, u| 𝛿Ω = 0
Where
- J is the current density,
- 𝜇 is (nonlinear) permeability,
- u is the (sought) magnetic vector potential (its z-component),
- Ω is the space domain (picture on next slide).
The features illustrated on this example are
- Newton’s method for nonlinear problems,
- nonlinear term specification using a table of values, and cubic spline interpolation.
Hermes2D – Lukas Korous
12. Examples > Magnetostatics
Refining the mesh according to a criterion
mesh->refine_by_criterion(&refinement_criterion);
- header: int refinement_criterion(Element* e), returning whether or not to refine a particular Element.
Used to refine the mesh around the copper <> iron interface.
CubicSpline class used for nonlinearity description
// Define nonlinear magnetic permeability via a cubic spline.
std::vector<double> mu_inv_pts({ 0.0, 0.5, 0.9, ... });
std::vector<double> mu_inv_val({ 1. / 1500.0, 1. / 1480.0, 1. / 1440.0, ... });
CubicSpline mu_inv_iron(mu_inv_pts, mu_inv_val, ...);
Newton’s method for a strong nonlinearity
// Automatic damping ratio – if a step is unsuccessful, damping factor will be multiplied by this, if successful, it will be divided by this.
newton.set_auto_damping_ratio(1.5);
// Initial damping factor – we can start with a small one, automation will increase it if possible.
newton.set_initial_auto_damping_coeff(.1);
// The redidual norm after a step must be at most this factor times the norm from the previous step to pronounce the step ‘successful’.
// Now for very strong nonlinearities, we may even need this > 1.
newton.set_sufficient_improvement_factor(1.25);
// This is a strong nonlinearity, where we can’t afford to reuse Jacobian matrix from a step in subsequent steps.
newton.set_max_steps_with_reused_jacobian(0);
// Maximum number of iterations. Hermes will throw an exception if this number is exceeded and the tolerance is not met.
newton.set_max_allowed_iterations(100);
// The tolerance – simple in this case, but can be a combination of relative / absolute thresholds of residual norm, solution norm, solution difference norm, ...
newton.set_tolerance(1e-8, Hermes::Solvers::ResidualNormAbsolute);
Hermes2D – Lukas Korous
13. Examples > Advection
In this example, we solve the equation
𝛻 ⋅ (−𝑥2, 𝑥1)u = 0, u| 𝛿Ω = g
Where
- u is the sought solution,
- Ω is the space domain - square (0, 1) x (0, 1),
- g is defined as follows:
- g = 1, where (−𝑥2, 𝑥1) ∙ 𝑛 Ԧ𝑥 > 0,
- g = 0, where (−𝑥2, 𝑥1) ∙ 𝑛 Ԧ𝑥 ≤ 0.
The features illustrated on this example are
- Discontinuous Galerkin (DG) implementation of integrating over internal edges,
- Post-processing of results – in this case using a limiter preventing spurious oscillations that occur in DG method.
Hermes2D – Lukas Korous
15. Examples > Advection
Integration over internal edges
- Regular forms (simplified)
matrix_form(int n, double *wt, Func<double> *u, Func<double> *v)
- n ... Number of integration points
- wt ... Integration weights
- u ... Basis function values(, derivatives) at integration points
- v ... Test function values(, derivatives) at integration points
- DG forms (simplified)
matrix_form(int n, double *wt, DiscontinuousFunc<double> *u, DiscontinuousFunc<double> *v)
- n, wt ... As above
- u, v ... DiscontinuousFunc<double> = { Func<double> u->central, Func<double>* u->neighbor } ... Only one is filled for each matrix_form call.
Postprocessing
- e.g. Vertex-based limiter (Kuzmin, D.: A vertex-based hierarchical slope limiter for -adaptive discontinuous Galerkin methods, JCAM, 233(12):3077-3085)
// sln_vector ... Algebraic system solution
// space ... FE space of the solution
// Instantiate the limiter
PostProcessing::VertexBasedLimiter limiter(space, sln_vector);
// Get a limited solution, already as a Hermes2D Solution object
Hermes::Hermes2D::Solution<double> limited_sln = limiter.get_solution();
Hermes2D – Lukas Korous
16. Examples > Advection > Automatic adaptivity (AMR)
We solve the same problem – equation & boundary conditions:
𝛻 ⋅ (−𝑥2, 𝑥1)u = 0, u| 𝛿Ω = g
But this time, we start from a very coarse mesh:
And we employ AMR (h-adaptivity) to get results on the next slide.
Hermes2D – Lukas Korous
17. Examples > Advection > Automatic adaptivity (AMR)
Hermes2D – Lukas Korous
AMR step 1, Element count: 32 AMR step 2, Element count: 116 AMR step 3, Element count: 272
AMR step 4, Element count: 504 AMR step 5, Element count: 848
18. Examples > Advection > Automatic adaptivity (AMR)
How automatic hp-adaptivity in Hermes works?
- based on a reference solution approach:
1. Solution is searched for in a “fine” Space.
Hermes2D – Lukas Korous
19. Examples > Advection > Automatic adaptivity (AMR)
How automatic hp-adaptivity in Hermes works?
- based on a reference solution approach:
1. Solution is searched for in a “fine” Space.
2. Obtained Solution is projected to a “coarse” Space.
• One level of refinement coarser mesh, and degree p-1
Hermes2D – Lukas Korous
20. Examples > Advection > Automatic adaptivity (AMR)
How automatic hp-adaptivity in Hermes works?
- based on a reference solution approach:
1. Solution is searched for in a “fine” Space.
2. Obtained Solution is projected to a “coarse” Space.
• One level of refinement coarser mesh, and degree p-1
3. Error is calculated as the appropriate norm of the difference.
• In an element-wise manner
• This is fully overridable by custom ErrorCalculator classes
Hermes2D – Lukas Korous
21. Examples > Advection > Automatic adaptivity (AMR)
How automatic hp-adaptivity in Hermes works?
- based on a reference solution approach:
1. Solution is searched for in a “fine” Space.
2. Obtained Solution is projected to a “coarse” Space.
• One level of refinement coarser mesh, and degree p-1
3. Error is calculated as the appropriate norm of the difference.
• In an element-wise manner
• This is fully overridable by custom ErrorCalculator classes
4. The Elements with the largest errors are selected for
refinement.
Hermes2D – Lukas Korous
22. Examples > Advection > Automatic adaptivity (AMR)
How automatic hp-adaptivity in Hermes works?
- based on a reference solution approach:
1. Solution is searched for in a “fine” Space.
2. Obtained Solution is projected to a “coarse” Space.
• One level of refinement coarser mesh, and degree p-1
3. Error is calculated as the appropriate norm of the difference.
• In an element-wise manner
• This is fully overridable by custom ErrorCalculator classes
4. The Elements with the largest errors are selected for
refinement.
5. For these Elements, the appropriate refinement is selected
from candidates using local projections of the “fine”
Solution.
• Standard lists of the candidates for illustrations are on the right.
Hermes2D – Lukas Korous
23. Examples > Advection > Automatic adaptivity (AMR)
int adaptivity_step = 1; bool done = false;
do
{
// Construct globally refined reference mesh and setup reference space.
Mesh::ReferenceMeshCreator ref_mesh_creator(mesh);
MeshSharedPtr ref_mesh = ref_mesh_creator.create_ref_mesh();
Space<double>::ReferenceSpaceCreator refspace_creator(space, ref_mesh, USE_TAYLOR_SHAPESET ? 0 : 1);
SpaceSharedPtr<double> refspace = refspace_creator.create_ref_space();
// Solve the problem on the reference space.
linear_solver.set_space(refspace);
linear_solver.solve();
// Get the Hermes2D Solution object from the solution vector.
Solution<double>::vector_to_solution(linear_solver.get_sln_vector(), refspace, refsln);
// Project the reference solution to the coarse space in L2 norm for error calculation.
OGProjection<double>::project_global(space, refsln, sln, HERMES_L2_NORM);
// Calculate element errors and total error estimate.
errorCalculator.calculate_errors(sln, refsln);
double total_error_estimate = errorCalculator.get_total_error_squared() * 100;
// If error is too large, adapt the (coarse) space.
if (error_estimate > ERR_STOP)
adaptivity.adapt(&selector);
else
done = true;
// Increase the step counter.
adaptivity_step++;
} while (done == false);
Hermes2D – Lukas Korous
24. Examples > Navier-Stokes
In this example, we solve the equations
𝛿𝑢
𝛿𝑡
−
∆𝑢
𝑅𝑒
+ 𝑢 ⋅ 𝛻 𝑢 + 𝛻𝑝 = 0, u| 𝛿ΩΓ 𝑜
= g
𝛻 ∙ 𝑢 = 0
Where
- Γ𝑜 is the output boundary,
- u, p is the sought solution,
- Ω is the space domain – see next slide,
- g is defined as follows:
- 𝑔1 = 0 everywhere except inlet,
- 𝑔2 = 0 everywhere,
- 𝑔1 is a parabolic profile on the inlet.
The features illustrated on this example are
- OpenGL visualization of vector fields,
- Simple time-stepping using implicit Euler scheme.
Hermes2D – Lukas Korous
25. Examples > Navier-Stokes > OpenGL visualization of vector fields
Solution
- Velocity (vector field) top
- Pressure bottom
- t = 30s
Hermes2D – Lukas Korous
26. Examples > Navier-Stokes > OpenGL visualization of vector fields
Solution
- Velocity (vector field) top
- Pressure bottom
- t = 40s
Hermes2D – Lukas Korous
27. Examples > Navier-Stokes > OpenGL visualization of vector fields
Solution
- Velocity (vector field) top
- Pressure bottom
- t = 55s
Hermes2D – Lukas Korous
28. Examples > Navier-Stokes
Simple time-stepping using implicit Euler scheme
for (int time_step = 1; time_step <= T_FINAL / TAU; time_step++, current_time += TAU)
{
// Update time-dependent essential BCs.
newton.set_time(current_time);
// Solve Newton.
// Weak formulation implements the implicit Euler scheme, and uses previous time step solutions.
newton.solve(coeff_vec);
// Get the solutions, insert as Hermes2D Solution object into the previous time step solutions.
Hermes::Hermes2D::Solution<double>::vector_to_solutions(newton.get_sln_vector(), spaces, sln_prev_time);
// Visualization.
vview.set_title("Velocity, time %g", current_time);
vview.show(xvel_prev_time, yvel_prev_time);
pview.set_title("Pressure, time %g", current_time);
pview.show(p_prev_time);
}
Hermes2D – Lukas Korous
29. Example > Complex
This problem describes the distribution of the vector potential in a domain comprising a wire carrying electrical current, air, and
an iron which is not under voltage. We solve the equation
−
1
𝜇
∆𝐴 + 𝑖𝜔𝜎𝐴 − = 0, u|Γ1
= 0, ቤ
𝛿𝑢
𝛿𝑛 Γ2
= 0
Where
- Ω is the space domain - rectangle (0, 0.004) x (0, 0.003),
- Γ1 is the top and right and left edge of Ω,
- Γ2 is the bottom edge of Ω,
- A is the sought solution, 𝜔 is the given angular velocity, 𝜎 given conductivity
The features illustrated on this example are
- hp-adaptive FEM,
- Handling of complex equations in Hermes2D,
- Spatial error inspection.
Hermes2D – Lukas Korous
30. Example > Complex > hp-FEM step #1
Hermes2D – Lukas Korous
Solution
- Reference
space
Coarse mesh Fine mesh
Spatial error
inspection
Element-wise error
for the coarse mesh
31. Example > Complex > hp-FEM step #5
Hermes2D – Lukas Korous
Solution
- Reference
space
Coarse mesh Fine mesh
Spatial error
inspection
Element-wise error
for the coarse mesh
32. Example > Complex > hp-FEM step #15
Hermes2D – Lukas Korous
Solution
- Reference
space
Coarse mesh Fine mesh
Spatial error
inspection
Element-wise error
for the coarse mesh
33. Example > Complex > hp-FEM step #29
Hermes2D – Lukas Korous
Solution
- Reference
space
Coarse mesh Fine mesh
Spatial error
inspection
Element-wise error
for the coarse mesh
34. Example > Complex
Handling of complex equations in Hermes2D
- Very easy, all relevant Hermes2d classes have the number (real | complex) as their template argument:
- For real numbers we use double - H1Space<double>(mesh, boundary_conditions)
- For complex numbers we use std::complex<double> - H1Space<std::complex<double> >(mesh, boundary_conditions)
hp-adaptive FEM
- Basic settings to control the AMR process
// Error calculation & adaptivity. We specify the norm here, and the type of error
DefaultErrorCalculator<::complex, HERMES_H1_NORM> errorCalculator(RelativeErrorToGlobalNorm);
// Stopping criterion for an adaptivity step. Influences the number of elements refined at each step.
AdaptStoppingCriterionSingleElement<::complex> stoppingCriterion(0.9);
// Adaptivity processor class. Gets the error calculator and stopping criterion
Adapt<::complex> adaptivity(&errorCalculator, &stoppingCriterion);
// Stopping criterion for adaptivity.
const double TOTAL_ERROR_ESTIMATE_STOP = 1e-3;
Hermes2D – Lukas Korous
35. Examples > Wave Equation
In this example, we solve the equations
1
𝑐2
𝛿2 𝑢
𝛿𝑡2
− ∆𝑢 = 0, u| 𝛿Ω = 0, ቤ
𝛿𝑢
𝛿𝑡 𝛿Ω
= 0 (1)
Where
- u is the sought solution,
- Ω is the space domain – see next slide,
- c is the wave speed.
We transform (1) into
𝛿𝑢
𝛿𝑡
= v
𝛿𝑣
𝛿𝑡
= 𝑐2
Δ𝑢
The features illustrated on this example are
- Using an arbitrary Runge-Kutta method for time discretization,
- Time-adaptivity using embedded Runge-Kutta methods.
Hermes2D – Lukas Korous
36. Example > Wave Equation
Hermes2D – Lukas Korous
u (left), v(right), t = 1e-2s
37. Example > Wave Equation
Hermes2D – Lukas Korous
u (left), v(right), t = 5.1e-1s
38. Example > Wave Equation
Hermes2D – Lukas Korous
u (left), v(right), t = 1.01s
39. Example > Wave Equation
Hermes2D – Lukas Korous
u (left), v(right), t = 1.51s
40. Example > Wave Equation
Hermes2D – Lukas Korous
u (left), v(right), t = 2.01s
42. Example > Wave Equation
Time-adaptivity using embedded Runge-Kutta methods
runge_kutta.rk_time_step_newton(previous_solution, new_solution, time_error_function);
...
Hermes::Hermes2D::Views::ScalarView time_error_view;
time_error_view.show(time_error_function);
...
DefaultNormCalculator<double, HERMES_H1_NORM> normCalculator;
normCalculator.calculate_norms(time_error_function);
double relative_time_error_estimate = normCalculator.get_total_norm_squared() * 100.;
Image – temporal error in u (top), v (bottom), t = 0.3s
Hermes2D – Lukas Korous
43. Example > Wave Equation
Time-adaptivity using embedded Runge-Kutta methods
runge_kutta.rk_time_step_newton(previous_solution, new_solution, time_error_function);
...
Hermes::Hermes2D::Views::ScalarView time_error_view;
time_error_view.show(time_error_function);
...
DefaultNormCalculator<double, HERMES_H1_NORM> normCalculator;
normCalculator.calculate_norms(time_error_function);
double relative_time_error_estimate = normCalculator.get_total_norm_squared() * 100.;
Image – temporal error in u (top), v (bottom), t = 0.8s
Hermes2D – Lukas Korous
44. Example > Benchmark Interior Layer
We solve the equation
−∆𝑢 = f, u| 𝛿Ω = ሚ𝑓
Where
- Ω is the space domain - square (0, 1) x (0, 1),
- ሚ𝑓 is the (known) exact solution,
- 𝑓 is the Laplacian of the exact solution,
- u is the sought solution
The features illustrated on this example are
- Calculating exact error,
- Anisotropic refinements usage in AMR.
Hermes2D – Lukas Korous
45. Example > Benchmark Interior Layer
Hermes2D – Lukas Korous
solution (left), FE space (right), adaptivity step #1
46. Example > Benchmark Interior Layer
Hermes2D – Lukas Korous
solution (left), FE space (right), adaptivity step #2
47. Example > Benchmark Interior Layer
Hermes2D – Lukas Korous
solution (left), FE space (right), adaptivity step #3
48. Example > Benchmark Interior Layer
Hermes2D – Lukas Korous
solution (left), FE space (right), adaptivity step #6
49. Example > Benchmark Interior Layer
Hermes2D – Lukas Korous
solution (left), FE space (right), adaptivity step #11
50. Example > Benchmark Interior Layer
Hermes2D – Lukas Korous
solution (left), FE space (right), adaptivity step #19
51. Example > Benchmark Interior Layer
Calculating exact error – through sub-classing existing Hermes2D class ExactSolutionScalar<double>:
class CustomExactSolution : public ExactSolutionScalar<double>{
public:
// Implement the actual function expression.
virtual double value(double x, double y) const;
// Implement the derivatives expression.
virtual void derivatives (double x, double y, double& dx, double& dy) const;
// Overwrite the expression calculating polynomial order (for integration order deduction).
virtual Ord value(Ord x, Ord y) const;
};
- and then employing standard ErrorCalculator<double> class for error calculation
Anisotropic refinements usage in AMR
// Predefined list of element refinement candidates.
// H2D_HP_ANISO stands for h-, and p-candidates, anisotropic in shape, and polynomial orders.
const CandList CAND_LIST = H2D_HP_ANISO;
// Class which for each element selected for refinement, selects the best refinement candidate.
H1ProjBasedSelector<double> selector(CAND_LIST);
...
// As before, adapt the FE space – using the selector provided
adaptivity.adapt(&selector);
Hermes2D – Lukas Korous
52. Example > Heat and Moisture
We solve the system of equations
𝑐 𝑇𝑇
𝛿𝑇
𝛿𝑡
+ 𝑐 𝑇𝑤
𝛿𝑤
𝛿𝑡
− 𝑑 𝑇𝑇∆T − 𝑑 𝑇𝑤∆𝑤 = 0,
𝑐 𝑤𝑇
𝛿𝑇
𝛿𝑡
+ 𝑐 𝑤𝑤
𝛿𝑤
𝛿𝑡
− 𝑑 𝑤𝑇∆T −𝑑 𝑤𝑤∆𝑤 = 0.
Where
- 𝑇, 𝑤 is the sought solution,
- 𝑐 𝑎𝑏
, 𝑑 𝑎𝑏
are thermal capacity and thermal conductivity properties,
- (complicated) boundary conditions (Axisymmetric, Dirichlet, Newton) are prescribed.
The features illustrated on this example are
- Multimesh,
- Dynamical meshes.
Hermes2D – Lukas Korous
53. Example > Heat and Moisture
Hermes2D – Lukas Korous
Meshes for T, w (left); Solutions for T, w (right), t = 10 days.
54. Example > Heat and Moisture
Hermes2D – Lukas Korous
Meshes for T, w (left); Solutions for T, w (right), t = 10 days.
55. Example > Heat and Moisture
Hermes2D – Lukas Korous
Meshes for T, w (left); Solutions for T, w (right), t = 10 days.
56. Example > Heat and Moisture
Hermes2D – Lukas Korous
Meshes for T, w (left); Solutions for T, w (right), t = 10 days.
57. Example > Heat and Moisture
- Multimesh & Dynamical meshes
- The key functionality here is de-refining the FE space, either periodically or when some indicator indicates us to.
if (should_unrefine_in_this_step)
{
// Unrefine one layer of refinements on the mesh for T.
T_mesh->unrefine_all_elements();
// Also coarsen the polynomial order.
T_space->adjust_element_order(-1);
// Do the above also for the mesh for w.
w_mesh->unrefine_all_elements();
w_space->adjust_element_order(-1);
// Assign DOFs after the change.
T_space->assign_dofs();
w_space->assign_dofs();
}
- Note:
- In the above, it is clearly seen that there are two Space, and two Mesh structures – different for each component.
- This is enough input from the user to achieve multi-mesh behavior. Hermes2D takes care of the rest.
Hermes2D – Lukas Korous
58. Example > GAMM channel
We solve the Euler equations of compressible flow
Where
- w is the sought solution,
- 𝑅, 𝑐 𝑣are constants
- (complicated) Boundary conditions (reflective, ‘do nothing’, and inlet) are prescribed.
The feature illustrated on this example are:
- Post-processing filters (calculating Mach number, pressure)
Hermes2D – Lukas Korous
59. Example > GAMM channel
Hermes2D – Lukas Korous
Mach number (left), Pressure (right), t = 3e-4 s.
60. Example > GAMM channel
Hermes2D – Lukas Korous
Mach number (left), Pressure (right), t = 0.09 s.
61. Example > GAMM channel
Hermes2D – Lukas Korous
Mach number (left), Pressure (right), t = 0.21 s.
62. Example > GAMM channel
Hermes2D – Lukas Korous
Mach number (left), Pressure (right), t = 0.36 s.
63. Example > GAMM channel
Post-processing filters
- Implemented by sub-classing Filter classes
class MachNumberFilter : public Hermes::Hermes2D::SimpleFilter<double>
{
// Constructors, etc.
...
// Overriden method performing the actual calculation
virtual void filter_fn(int n, const std::vector<const double*>& source_values, double* result)
{
// Calculate result for each integration point.
for (int i = 0; i < n; i++)
{
double density = source_values.at(0)[i];
double momentum_x = source_values.at(1)[i];
double momentum_y = source_values.at(2)[i];
double energy = source_values.at(3)[i];
// Expression to calculate Mach number in the integration point.
result[i] = std::sqrt((momentum_x / density) * (momentum_x / density) + (momentum_y / density) * (momentum_y / density))
/ std::sqrt(kappa * QuantityCalculator::calc_pressure(density, momentum_x, momentum_y, energy, kappa) / density);
}
}
};
Hermes2D – Lukas Korous
64. Example > Helmholtz Waveguide
This example shows how to model harmonic steady state in parallel plate waveguide. We solve the (complex) equation
−∆𝐸 − 𝜔2
𝜇𝜀𝐸 + 𝑗𝜔𝜎𝜇 = 0,
In this domain:
Where
- E is the sought solution,
- 𝜔 is angular velocity,
- 𝜎 is conductivity,
- 𝜀 is permittivity,
- 𝜇 is permeability,
- (complicated) boundary conditions (perfect conductor, impedance, Dirichlet) are prescribed.
The feature illustrated on this example is
- writing a simple program using Hermes2d.
Hermes2D – Lukas Korous