libMesh
Loading...
Searching...
No Matches
naviersystem.h
Go to the documentation of this file.
1// The libMesh Finite Element Library.
2// Copyright (C) 2002-2026 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner
3
4// This library is free software; you can redistribute it and/or
5// modify it under the terms of the GNU Lesser General Public
6// License as published by the Free Software Foundation; either
7// version 2.1 of the License, or (at your option) any later version.
8
9// This library is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12// Lesser General Public License for more details.
13
14// You should have received a copy of the GNU Lesser General Public
15// License along with this library; if not, write to the Free Software
16// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
18// DiffSystem framework files
19#include "libmesh/fem_system.h"
20
21using namespace libMesh;
22
23// The Navier-Stokes system class.
24// FEMSystem, TimeSolver and NewtonSolver will handle most tasks,
25// but we must specify element residuals
26class NavierSystem : public FEMSystem
27{
28public:
29 // Constructor
31 const std::string & name_in,
32 const unsigned int number_in)
33 : FEMSystem(es, name_in, number_in), Reynolds(1.), application(0) {}
34
35 // System initialization
36 virtual void init_data ();
37
38 // Context initialization
39 virtual void init_context(DiffContext & context);
40
41 // Element residual and jacobian calculations
42 // Time dependent parts
43 virtual bool element_time_derivative (bool request_jacobian,
44 DiffContext & context);
45
46 // Constraint parts
47 virtual bool element_constraint (bool request_jacobian,
48 DiffContext & context);
49 virtual bool side_constraint (bool request_jacobian,
50 DiffContext & context);
51
52 // Mass matrix part
53 virtual bool mass_residual (bool request_jacobian,
54 DiffContext & context);
55
56 // Postprocessed output
57 virtual void postprocess ();
58
59 // Indices for each variable;
60 unsigned int p_var, u_var, v_var, w_var;
61
62 // The Reynolds number to solve for
64
65 // The application number controls what boundary conditions and/or
66 // forcing functions are applied. Current options are:
67 // 0 - discontinuous lid velocity driven cavity
68 // 1 - homogeneous Dirichlet BC with smooth forcing
69 unsigned int application;
70
71 // Returns the value of a forcing function at point p. This value
72 // depends on which application is being used.
73 Point forcing(const Point & p);
74};
unsigned int v_var
unsigned int u_var
virtual void init_context(DiffContext &context)
NavierSystem(EquationSystems &es, const std::string &name_in, const unsigned int number_in)
virtual void postprocess()
Runs a postprocessing loop over all elements, and if postprocess_sides is true over all sides.
unsigned int application
virtual bool side_constraint(bool request_jacobian, DiffContext &context)
Adds the constraint contribution on side of elem to elem_residual.
virtual bool element_constraint(bool request_jacobian, DiffContext &context)
Adds the constraint contribution on elem to elem_residual.
virtual bool mass_residual(bool request_jacobian, DiffContext &context)
Subtracts a mass vector contribution on elem from elem_residual.
Point forcing(const Point &p)
unsigned int w_var
unsigned int p_var
virtual void init_data()
Initializes the member data fields associated with the system, so that, e.g., assemble() may be used.
virtual bool element_time_derivative(bool request_jacobian, DiffContext &context)
Adds the time derivative contribution on elem to elem_residual.
This class provides all data required for a physics package (e.g.
This is the EquationSystems class.
This class provides a specific system class.
Definition fem_system.h:55
A Point defines a location in LIBMESH_DIM dimensional Real space.
Definition point.h:40
The libMesh namespace provides an interface to certain functionality in the library.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real