libMesh::FEMPhysics Class Reference

#include <fem_physics.h>

Inheritance diagram for libMesh::FEMPhysics:

List of all members.

Public Member Functions

 FEMPhysics ()
virtual ~FEMPhysics ()
virtual bool eulerian_residual (bool request_jacobian, DiffContext &context)
virtual bool mass_residual (bool request_jacobian, DiffContext &)
virtual AutoPtr
< DifferentiablePhysics
clone_physics ()=0
virtual void clear_physics ()
virtual void init_physics (const System &sys)
virtual bool element_time_derivative (bool request_jacobian, DiffContext &)
virtual bool element_constraint (bool request_jacobian, DiffContext &)
virtual bool side_time_derivative (bool request_jacobian, DiffContext &)
virtual bool side_constraint (bool request_jacobian, DiffContext &)
virtual void time_evolving (unsigned int var)
bool is_time_evolving (unsigned int var) const
virtual bool side_mass_residual (bool request_jacobian, DiffContext &)
virtual void init_context (DiffContext &)
virtual void set_mesh_system (System *sys)
const Systemget_mesh_system () const
Systemget_mesh_system ()
virtual void set_mesh_x_var (unsigned int var)
unsigned int get_mesh_x_var () const
virtual void set_mesh_y_var (unsigned int var)
unsigned int get_mesh_y_var () const
virtual void set_mesh_z_var (unsigned int var)
unsigned int get_mesh_z_var () const

Public Attributes

bool compute_internal_sides

Protected Attributes

System_mesh_sys
unsigned int _mesh_x_var
unsigned int _mesh_y_var
unsigned int _mesh_z_var
std::vector< bool > _time_evolving

Detailed Description

This class provides a specific system class. It aims to generalize any system, linear or nonlinear, which provides both a residual and a Jacobian.

This class is part of the new DifferentiableSystem framework, which is still experimental. Users of this framework should beware of bugs and future API changes.

Author:
Roy H. Stogner 2012

Definition at line 48 of file fem_physics.h.


Constructor & Destructor Documentation

libMesh::FEMPhysics::FEMPhysics (  )  [inline]

Constructor.

Definition at line 55 of file fem_physics.h.

00055                 :
00056     DifferentiablePhysics()
00057     {}

virtual libMesh::FEMPhysics::~FEMPhysics (  )  [inline, virtual]

Destructor.

Definition at line 62 of file fem_physics.h.

00062 {}


Member Function Documentation

virtual void libMesh::DifferentiablePhysics::clear_physics (  )  [virtual, inherited]

Clear any data structures associated with the physics.

Referenced by libMesh::DifferentiableSystem::clear().

virtual AutoPtr<DifferentiablePhysics> libMesh::DifferentiablePhysics::clone_physics (  )  [pure virtual, inherited]

Copy of this object. User should override to copy any needed state.

Implemented in libMesh::DifferentiableSystem.

Referenced by libMesh::DifferentiableSystem::attach_physics().

virtual bool libMesh::DifferentiablePhysics::element_constraint ( bool  request_jacobian,
DiffContext  
) [inline, virtual, inherited]

Adds the constraint contribution on elem to elem_residual. If this method receives request_jacobian = true, then it should compute elem_jacobian and return true if possible. If elem_jacobian has not been computed then the method should return false.

Users may need to reimplement this for their particular PDE. To implement the constraint 0 = G(u), the user should examine u = elem_solution and add (G(u), phi_i) to elem_residual.

Definition at line 121 of file diff_physics.h.

Referenced by libMesh::SteadySolver::element_residual(), libMesh::EulerSolver::element_residual(), libMesh::Euler2Solver::element_residual(), and libMesh::EigenTimeSolver::element_residual().

00122                                                   {
00123     return request_jacobian;
00124   }

virtual bool libMesh::DifferentiablePhysics::element_time_derivative ( bool  request_jacobian,
DiffContext  
) [inline, virtual, inherited]

Adds the time derivative contribution on elem to elem_residual. If this method receives request_jacobian = true, then it should compute elem_jacobian and return true if possible. If elem_jacobian has not been computed then the method should return false.

Users need to reimplement this for their particular PDE. To implement the physics model du/dt = F(u), the user should examine u = elem_solution and add (F(u), phi_i) to elem_residual.

Definition at line 104 of file diff_physics.h.

Referenced by libMesh::SteadySolver::element_residual(), libMesh::EulerSolver::element_residual(), libMesh::Euler2Solver::element_residual(), and libMesh::EigenTimeSolver::element_residual().

00105                                                        {
00106     return request_jacobian;
00107   }

virtual bool libMesh::FEMPhysics::eulerian_residual ( bool  request_jacobian,
DiffContext context 
) [virtual]

Adds a pseudo-convection contribution on elem to elem_residual, if the nodes of elem are being translated by a moving mesh.

This function assumes that the user's time derivative equations (except for any equations involving unknown mesh xyz coordinates themselves) are expressed in an Eulerian frame of reference, and that the user is satisfied with an unstabilized convection term. Lagrangian equations will probably require overriding eulerian_residual() with a blank function; ALE or stabilized formulations will require reimplementing eulerian_residual() entirely.

Reimplemented from libMesh::DifferentiablePhysics.

System * libMesh::DifferentiablePhysics::get_mesh_system (  )  [inline, inherited]

Returns a reference to the system with variables corresponding to mesh nodal coordinates, or NULL if the mesh is fixed.

Definition at line 409 of file diff_physics.h.

References libMesh::DifferentiablePhysics::_mesh_sys.

00410 {
00411   return _mesh_sys;
00412 }

const System * libMesh::DifferentiablePhysics::get_mesh_system (  )  const [inline, inherited]

Returns a const reference to the system with variables corresponding to mesh nodal coordinates, or NULL if the mesh is fixed. Useful for ALE calculations.

Definition at line 403 of file diff_physics.h.

References libMesh::DifferentiablePhysics::_mesh_sys.

Referenced by libMesh::FEMSystem::build_context().

00404 {
00405   return _mesh_sys;
00406 }

unsigned int libMesh::DifferentiablePhysics::get_mesh_x_var (  )  const [inline, inherited]

Returns the variable number corresponding to the mesh x coordinate. Useful for ALE calculations.

Definition at line 415 of file diff_physics.h.

References libMesh::DifferentiablePhysics::_mesh_x_var.

Referenced by libMesh::FEMSystem::build_context().

00416 {
00417   return _mesh_x_var;
00418 }

unsigned int libMesh::DifferentiablePhysics::get_mesh_y_var (  )  const [inline, inherited]

Returns the variable number corresponding to the mesh y coordinate. Useful for ALE calculations.

Definition at line 421 of file diff_physics.h.

References libMesh::DifferentiablePhysics::_mesh_y_var.

Referenced by libMesh::FEMSystem::build_context().

00422 {
00423   return _mesh_y_var;
00424 }

unsigned int libMesh::DifferentiablePhysics::get_mesh_z_var (  )  const [inline, inherited]

Returns the variable number corresponding to the mesh z coordinate. Useful for ALE calculations.

Definition at line 427 of file diff_physics.h.

References libMesh::DifferentiablePhysics::_mesh_z_var.

Referenced by libMesh::FEMSystem::build_context().

00428 {
00429   return _mesh_z_var;
00430 }

virtual void libMesh::DifferentiablePhysics::init_context ( DiffContext  )  [inline, virtual, inherited]

Reimplemented in libMesh::FEMSystem.

Definition at line 246 of file diff_physics.h.

00246 {}

virtual void libMesh::DifferentiablePhysics::init_physics ( const System sys  )  [virtual, inherited]

Initialize any data structures associated with the physics.

Referenced by libMesh::DifferentiableSystem::attach_physics(), and libMesh::DifferentiableSystem::init_data().

bool libMesh::DifferentiablePhysics::is_time_evolving ( unsigned int  var  )  const [inline, inherited]

Returns true iff variable var is evolving with respect to time. In general, the user's init() function should have set time_evolving() for any variables which behave like du/dt = F(u), and should not call time_evolving() for any variables which behave like 0 = G(u).

Definition at line 190 of file diff_physics.h.

References libMesh::DifferentiablePhysics::_time_evolving.

Referenced by libMesh::FEMSystem::init_context().

00190                                                  {
00191     return _time_evolving[var];
00192   }

virtual bool libMesh::FEMPhysics::mass_residual ( bool  request_jacobian,
DiffContext  
) [virtual]

Adds a mass vector contribution on elem to elem_residual. If this method receives request_jacobian = true, then it should compute elem_jacobian and return true if possible. If elem_jacobian has not been computed then the method should return false.

Most problems can use the reimplementation in FEMPhysics::mass_residual; few users will need to reimplement this themselves.

Reimplemented from libMesh::DifferentiablePhysics.

void libMesh::DifferentiablePhysics::set_mesh_system ( System sys  )  [inline, virtual, inherited]

Tells the DifferentiablePhysics that system sys contains the isoparametric Lagrangian variables which correspond to the coordinates of mesh nodes, in problems where the mesh itself is expected to move in time.

The system with mesh coordinate data (which may be this system itself, for fully coupled moving mesh problems) is currently assumed to have new (end of time step) mesh coordinates stored in solution, old (beginning of time step) mesh coordinates stored in _old_nonlinear_solution, and constant velocity motion during each time step.

Activating this function ensures that local (but not neighbor!) element geometry is correctly repositioned when evaluating element residuals.

Currently sys must be *this for a tightly coupled moving mesh problem or NULL to stop mesh movement; loosely coupled moving mesh problems are not implemented.

This code is experimental. "Trust but verify, and not in that order"

Definition at line 359 of file diff_physics.h.

References libMesh::DifferentiablePhysics::_mesh_sys.

00360 {
00361   // For now we assume that we're doing fully coupled mesh motion
00362 //  if (sys && sys != this)
00363 //    libmesh_not_implemented();
00364 
00365   // For the foreseeable future we'll assume that we keep these
00366   // Systems in the same EquationSystems
00367   // libmesh_assert_equal_to (&this->get_equation_systems(),
00368   //                          &sys->get_equation_systems());
00369 
00370   // And for the immediate future this code may not even work
00371   libmesh_experimental();
00372 
00373   _mesh_sys = sys;
00374 }

void libMesh::DifferentiablePhysics::set_mesh_x_var ( unsigned int  var  )  [inline, virtual, inherited]

Tells the DifferentiablePhysics that variable var from the mesh system should be used to update the x coordinate of mesh nodes, in problems where the mesh itself is expected to move in time.

The system with mesh coordinate data (which may be this system itself, for fully coupled moving mesh problems) is currently assumed to have new (end of time step) mesh coordinates stored in solution, old (beginning of time step) mesh coordinates stored in _old_nonlinear_solution, and constant velocity motion during each time step.

Activating this function ensures that local (but not neighbor!) element geometry is correctly repositioned when evaluating element residuals.

Definition at line 379 of file diff_physics.h.

References libMesh::DifferentiablePhysics::_mesh_x_var.

00380 {
00381   _mesh_x_var = var;
00382 }

void libMesh::DifferentiablePhysics::set_mesh_y_var ( unsigned int  var  )  [inline, virtual, inherited]

Tells the DifferentiablePhysics that variable var from the mesh system should be used to update the y coordinate of mesh nodes.

Definition at line 387 of file diff_physics.h.

References libMesh::DifferentiablePhysics::_mesh_y_var.

00388 {
00389   _mesh_y_var = var;
00390 }

void libMesh::DifferentiablePhysics::set_mesh_z_var ( unsigned int  var  )  [inline, virtual, inherited]

Tells the DifferentiablePhysics that variable var from the mesh system should be used to update the z coordinate of mesh nodes.

Definition at line 395 of file diff_physics.h.

References libMesh::DifferentiablePhysics::_mesh_z_var.

00396 {
00397   _mesh_z_var = var;
00398 }

virtual bool libMesh::DifferentiablePhysics::side_constraint ( bool  request_jacobian,
DiffContext  
) [inline, virtual, inherited]

Adds the time derivative contribution on side of elem to elem_residual. If this method receives request_jacobian = true, then it should compute elem_jacobian and return true if possible. If elem_jacobian has not been computed then the method should return false.

Users may need to reimplement this for their particular PDE depending on the boundary conditions.

Definition at line 161 of file diff_physics.h.

Referenced by libMesh::SteadySolver::side_residual(), libMesh::EulerSolver::side_residual(), libMesh::Euler2Solver::side_residual(), and libMesh::EigenTimeSolver::side_residual().

00162                                                {
00163     return request_jacobian;
00164   }

virtual bool libMesh::DifferentiablePhysics::side_mass_residual ( bool  request_jacobian,
DiffContext  
) [inline, virtual, inherited]

Adds a mass vector contribution on side of elem to elem_residual. If this method receives request_jacobian = true, then it should compute elem_jacobian and return true if possible. If elem_jacobian has not been computed then the method should return false.

For most problems, the default implementation of "do nothing" is correct; users with boundary conditions including time derivatives may need to reimplement this themselves.

Definition at line 235 of file diff_physics.h.

Referenced by libMesh::EulerSolver::side_residual(), libMesh::Euler2Solver::side_residual(), and libMesh::EigenTimeSolver::side_residual().

00236                                                   {
00237     return request_jacobian;
00238   }

virtual bool libMesh::DifferentiablePhysics::side_time_derivative ( bool  request_jacobian,
DiffContext  
) [inline, virtual, inherited]

Adds the time derivative contribution on side of elem to elem_residual. If this method receives request_jacobian = true, then it should compute elem_jacobian and return true if possible. If elem_jacobian has not been computed then the method should return false.

Users may need to reimplement this for their particular PDE depending on the boundary conditions.

Definition at line 145 of file diff_physics.h.

Referenced by libMesh::SteadySolver::side_residual(), libMesh::EulerSolver::side_residual(), libMesh::Euler2Solver::side_residual(), and libMesh::EigenTimeSolver::side_residual().

00146                                                     {
00147     return request_jacobian;
00148   }

virtual void libMesh::DifferentiablePhysics::time_evolving ( unsigned int  var  )  [inline, virtual, inherited]

Tells the DiffSystem that variable var is evolving with respect to time. In general, the user's init() function should call time_evolving() for any variables which behave like du/dt = F(u), and should not call time_evolving() for any variables which behave like 0 = G(u).

Most derived systems will not have to reimplment this function; however any system which reimplements mass_residual() may have to reimplement time_evolving() to prepare data structures.

Definition at line 177 of file diff_physics.h.

References libMesh::DifferentiablePhysics::_time_evolving.

00177                                                 {
00178     if (_time_evolving.size() <= var)
00179       _time_evolving.resize(var+1, false);
00180     _time_evolving[var] = true;
00181   }


Member Data Documentation

std::vector<bool> libMesh::DifferentiablePhysics::_time_evolving [protected, inherited]

Stores bools to tell us which variables are evolving in time and which are just constraints

Definition at line 349 of file diff_physics.h.

Referenced by libMesh::DifferentiablePhysics::is_time_evolving(), and libMesh::DifferentiablePhysics::time_evolving().

compute_internal_sides is false by default, indicating that side_* computations will only be done on boundary sides. If compute_internal_sides is true, computations will be done on sides between elements as well.

Definition at line 132 of file diff_physics.h.


The documentation for this class was generated from the following file:

Site Created By: libMesh Developers
Last modified: February 05 2013 19:55:25 UTC

Hosted By:
SourceForge.net Logo