28#ifndef OOMPH_PROJECTION_HEADER
29#define OOMPH_PROJECTION_HEADER
40#ifdef OOMPH_HAS_TRILINOS
133 const unsigned&
fld) = 0;
179 template<
class ELEMENT>
197 ELEMENT::fill_in_contribution_to_residuals(
residuals);
227 ELEMENT::fill_in_contribution_to_jacobian(
residuals, jacobian);
242 const unsigned&
flag)
295 throw OomphLibError(
"Trying to project Lagrangian coordinates in "
296 "non-SolidElement\n",
420 "positions not in SolidElement\n",
518 throw OomphLibError(
"Wrong type specificied in Projection_type. "
519 "This should never happen\n",
533 const unsigned&
i)
const
541 return ELEMENT::zeta_nodal(
n,
k,
i);
665 template<
class ELEMENT>
693 template<
class PROJECTABLE_ELEMENT>
699 template<
class FRIEND_PROJECTABLE_ELEMENT>
701 template<
class FRIEND_PROJECTABLE_ELEMENT>
703 template<
class FRIEND_PROJECTABLE_ELEMENT>
705 template<
class FRIEND_PROJECTABLE_ELEMENT>
755#ifdef OOMPH_HAS_TRILINOS
831 oomph_info <<
"\n=============================\n";
836 oomph_info <<
"=============================\n\n";
847 oomph_info <<
"Very odd -- no elements in target mesh; "
848 <<
" not doing anything in ProjectionProblem::project()\n";
858 <<
"Mesh has no nodes! Please populate the Node_pt vector\n"
859 <<
"otherwise projection won't work!\n";
868 ->nfields_for_projection();
883 el_pt->enable_projection();
895 el_pt->enable_projection();
911 <<
"CPU for setup of multi-domain interaction for projection: "
951 <<
"\n\n=============================================\n";
952 oomph_info <<
"Projecting values for Lagrangian coordinate " <<
i
954 oomph_info <<
"=============================================\n\n";
964 oomph_info <<
"Number of equations for projection of Lagrangian "
975 <<
"Solid mechanics problems will break if "
976 "Problem_is_nonlinear is\n"
977 <<
"set to true in the projection problem because we're using "
979 <<
"actual nodal positions to store the values of the "
981 <<
"coords. There shouldn't be any need for \n"
982 <<
"Problem_is_nonlinear=true anyway, apart from debugging in "
984 <<
"which case you now know why this case will break!\n";
1012 <<
"The number of generalised position dofs "
1014 <<
"\n not the same as the number of generalised lagrangian "
1017 <<
"Projection cannot be done at the moment, sorry.\n";
1044 ->nhistory_values_for_coordinate_projection();
1049 for (
unsigned i = 0;
i <
n_dim;
i++)
1054 <<
"\n\n=============================================\n";
1055 oomph_info <<
"Projecting history values for coordinate " <<
i
1058 <<
"=============================================\n\n";
1079 <<
"Number of equations for projection of coordinate " <<
i
1135 for (
unsigned j = 0;
j <
nnod;
j++)
1138 if (
nod_pt->nvalue() == 0)
1143 for (
unsigned i = 0;
i <
n;
i++)
1148 <<
"\nhas no values. Projection (of coordinates) doesn't "
1150 <<
"for such cases (at the moment), sorry! Send us the code\n"
1151 <<
"where the problem arises and we'll try to implement "
1153 <<
"(up to now unnecessary) capability...\n";
1166 ->nhistory_values_for_coordinate_projection();
1171 for (
unsigned i = 0;
i <
n_dim;
i++)
1176 <<
"\n\n=============================================\n";
1177 oomph_info <<
"Projecting history values for coordinate " <<
i
1180 <<
"=============================================\n\n";
1200 <<
"Number of equations for projection of coordinate " <<
i
1221 for (
unsigned d = 0; d <
d_size; d++)
1224 double coord = data[d].first->value(0, 0);
1242 for (
unsigned e = 0;
e < n_element;
e++)
1247 el_pt->set_project_values();
1264 ->nhistory_values_for_projection(
fld);
1273 oomph_info <<
"\n=========================================\n";
1274 oomph_info <<
"Projecting field " <<
fld <<
" at time level "
1276 oomph_info <<
"========================================\n";
1286 oomph_info <<
"Number of equations for projection of field " <<
fld
1310 for (
unsigned d = 0; d <
d_size; d++)
1330 new_el_pt->flush_all_external_element_storage();
1341 el_pt->flush_all_external_element_storage();
1344 el_pt->disable_projection();
1453 for (
unsigned i = 0;
i <
n_dim;
i++)
1491 for (
unsigned i = 0;
i <
n_dim;
i++)
1515 for (
unsigned j = 0;
j <
nint;
j++)
1519 for (
unsigned i = 0;
i <
nval;
i++)
1526 for (
unsigned j = 0;
j <
nnod;
j++)
1530 for (
unsigned i = 0;
i <
nval;
i++)
1560 for (
unsigned i = 0;
i <
n_dim;
i++)
1590 for (
unsigned f = 0; f <
n_fields; f++)
1597 for (
unsigned d = 0; d <
d_size; d++)
1599 data[d].first->unpin(data[d].
second);
1627 for (
unsigned i = 0;
i <
n_dim;
i++)
1708 for (
unsigned d = 0; d <
d_size; d++)
1710 data[d].first->unpin(data[d].
second);
1728 for (
unsigned d = 0; d <
d_size; d++)
1730 data[d].first->pin(data[d].
second);
1779 new_el_pt->projected_lagrangian_coordinate() =
i;
Class that makes backup (via a deep copy) of a mesh, keeping alive enough information to allow the so...
A class that represents a collection of data; each Data object may contain many different individual ...
This is a base class for all elements that require external sources (e.g. FSI, multi-domain problems ...
Vector< double > & external_element_local_coord(const unsigned &interaction_index, const unsigned &ipt)
Access function to get source element's local coords for specified interaction index at specified int...
void set_ninteraction(const unsigned &n_interaction)
Set the number of interactions in the element This function is usually called in the specific element...
void include_external_geometric_data()
Do include external geometric data when computing the element's Jacobian. This function should be cal...
void describe_local_dofs(std::ostream &out, const std::string &curr_string) const
Function to describe the local dofs of the element. The ostream specifies the output stream to which ...
bool add_external_geometric_data()
Are we including external geometric data in the element's Jacobian.
void ignore_external_interaction_data()
Do not include any external interaction data when computing the element's Jacobian.
bool add_external_interaction_data()
Are we including external data in the element's Jacobian.
FiniteElement *& external_element_pt(const unsigned &interaction_index, const unsigned &ipt)
Access function to source element for specified interaction index at specified integration point.
void include_external_interaction_data()
Do include external geometric data when computing the element's Jacobian This function should be call...
void ignore_external_geometric_data()
Do not include any external geometric data when computing the element's Jacobian. This function shoul...
unsigned ninteraction() const
Return the number of interactions in the element.
FaceGeometry class definition: This policy class is used to allow construction of face elements that ...
A general Finite Element class.
virtual double J_eulerian(const Vector< double > &s) const
Return the Jacobian of mapping from local to global coordinates at local position s.
Integral *const & integral_pt() const
Return the pointer to the integration scheme (const version)
unsigned nnodal_position_type() const
Return the number of coordinate types that the element requires to interpolate the geometry between t...
double size() const
Calculate the size of the element (length, area, volume,...) in Eulerian computational coordinates....
virtual void shape(const Vector< double > &s, Shape &psi) const =0
Calculate the geometric shape functions at local coordinate s. This function must be overloaded for e...
virtual double interpolated_x(const Vector< double > &s, const unsigned &i) const
Return FE interpolated coordinate x[i] at local coordinate s.
unsigned dim() const
Return the spatial dimension of the element, i.e. the number of local coordinates required to paramet...
double nodal_position_gen(const unsigned &n, const unsigned &k, const unsigned &i) const
Return the value of the k-th type of the i-th positional variable at the local node n.
unsigned nnode() const
Return the number of nodes.
Node *& node_pt(const unsigned &n)
Return a pointer to the local node n.
Data *& internal_data_pt(const unsigned &i)
Return a pointer to i-th internal data object.
static DenseMatrix< double > Dummy_matrix
Empty dense matrix used as a dummy argument to combined residual and jacobian functions in the case w...
unsigned ninternal_data() const
Return the number of internal data objects.
unsigned ndim() const
Access function to # of Eulerian coordinates.
virtual double knot(const unsigned &i, const unsigned &j) const =0
Return local coordinate s[j] of i-th integration point.
virtual unsigned nweight() const =0
Return the number of integration points of the scheme.
virtual double weight(const unsigned &i) const =0
Return weight of i-th integration point.
Base class for all linear iterative solvers. This merely defines standard interfaces for linear itera...
Preconditioner *& preconditioner_pt()
Access function to preconditioner.
bool is_doc_time_enabled() const
Is documentation of solve times enabled?
void disable_doc_time()
Disable documentation of solve times.
void enable_doc_time()
Enable documentation of solve times.
static bool mpi_has_been_initialised()
return true if MPI has been initialised
Matrix-based diagonal preconditioner.
FiniteElement * finite_element_pt(const unsigned &e) const
Upcast (downcast?) to FiniteElement (needed to access FiniteElement member functions).
Node *& node_pt(const unsigned long &n)
Return pointer to global node n.
unsigned long nnode() const
Return number of nodes in the mesh.
GeneralisedElement *& element_pt(const unsigned long &e)
Return pointer to element e.
unsigned long nelement() const
Return number of elements in the mesh.
Nodes are derived from Data, but, in addition, have a definite (Eulerian) position in a space of a gi...
unsigned ndim() const
Return (Eulerian) spatial dimension of the node.
unsigned nposition_type() const
Number of coordinate types needed in the mapping between local and global coordinates.
An OomphLibError object which should be thrown when an run-time error is encountered....
An OomphLibWarning object which should be created as a temporary object to issue a warning....
Preconditioner base class. Gives an interface to call all other preconditioners through and stores th...
////////////////////////////////////////////////////////////////// //////////////////////////////////...
unsigned long assign_eqn_numbers(const bool &assign_local_eqn_numbers=true)
Assign all equation numbers for problem: Deals with global data (= data that isn't attached to any el...
void newton_solve()
Use Newton method to solve the problem.
bool Shut_up_in_newton_solve
Boolean to indicate if all output is suppressed in Problem::newton_solve(). Defaults to false.
LinearSolver *& linear_solver_pt()
Return a pointer to the linear solver object.
bool Problem_is_nonlinear
Boolean flag indicating if we're dealing with a linear or nonlinear Problem – if set to false the New...
Mesh *& mesh_pt()
Return a pointer to the global mesh.
void disable_info_in_newton_solve()
Disable the output of information when in the newton solver.
Template-free Base class for projectable elements.
bool Backup_external_interaction_data
Remember if the element includes external data when used in non-projection mode (this is temporarily ...
unsigned Projected_lagrangian
When projecting the Lagrangain coordinates indicate which coordiante is to be projected.
Projection_Type Projection_type
Variable to indicate if we're projecting the history values of the nodal coordinates (Coordinate) the...
virtual unsigned nvalue_of_field(const unsigned &fld)=0
Return number of values (pinned or not) associated with field fld within the element....
virtual Vector< std::pair< Data *, unsigned > > data_values_of_field(const unsigned &fld)=0
Pure virtual function in which the element writer must specify the values associated with field fld....
virtual unsigned nfields_for_projection()=0
Number of fields of the problem, so e.g. for 2D Navier Stokes this would be 3 (for the two velocities...
unsigned Time_level_for_projection
Time level we are projecting (0=current values; >0: history values)
unsigned Backup_ninteraction
Store number of "external" interactions that were assigned to the element before doing the projection...
virtual ~ProjectableElementBase()
Virtual destructor.
ProjectableElementBase()
Constructor: Initialise data so that we don't project but solve the "normal" equations associated wit...
bool Do_projection
Bool to know if we do projection or not. If false (the default) we solve the element's "real" equatio...
bool Backup_external_geometric_data
Remember if the element includes external geometric data when used in non-projection mode (this is te...
Projection_Type
Enumerated collection to specify which projection problem is to be solved.
unsigned Projected_field
Field that is currently being projected.
virtual unsigned nhistory_values_for_coordinate_projection()=0
Number of history values to be stored when projecting the history values of the nodal coordinates (in...
unsigned Projected_coordinate
When projecting the history values of the nodal coordinates, this is the coordinate we're projecting.
virtual int local_equation(const unsigned &fld, const unsigned &ivalue)=0
Return local equation numbers associated with value ivalue of field fld within the element.
virtual unsigned nhistory_values_for_projection(const unsigned &fld)=0
Number of history values to be stored for fld-th field (includes current value!)
virtual double jacobian_and_shape_of_field(const unsigned &fld, const Vector< double > &s, Shape &psi)=0
Return Jacobian of mapping and the shape functions associated with field fld. The number of shape fun...
virtual double get_field(const unsigned &time, const unsigned &fld, const Vector< double > &s)=0
Return the fld-th field at local coordinates s at time-level time (time=0: current value; time>0: his...
Wrapper class for projectable elements. Adds "projectability" to the underlying ELEMENT.
void enable_projection()
Backup the element's state and switch it to projection mode.
ProjectableElement()
Constructor [this was only required explicitly from gcc 4.5.2 onwards...].
virtual void residual_for_projection(Vector< double > &residuals, DenseMatrix< double > &jacobian, const unsigned &flag)
Residual for the projection step. Flag indicates if we want the Jacobian (1) or not (0)....
void set_project_values()
Project (history values of) values.
void fill_in_contribution_to_jacobian(Vector< double > &residuals, DenseMatrix< double > &jacobian)
Overloaded version of fill_in_contribution_to_jacobian.
unsigned & projected_field()
Field that is currently being projected.
void describe_local_dofs(std::ostream &out, const std::string ¤t_string) const
Function to describe the local dofs of the element. The ostream specifies the output stream to which ...
unsigned & projected_lagrangian_coordinate()
When projecting the Lagrangian coordinates this is the coordinate that is being projected.
void set_project_coordinates()
Project (history values of) coordintes.
unsigned & time_level_for_projection()
Which history value are we projecting?
void set_project_lagrangian()
Project (current and only values of) lagrangian coordinates.
void fill_in_contribution_to_residuals(Vector< double > &residuals)
Overloaded version of fill_in_contribution_to_residuals.
double zeta_nodal(const unsigned &n, const unsigned &k, const unsigned &i) const
Use Eulerian coordinates for matching in locate_zeta when doing projection.
void disable_projection()
Helper function to restore the element to the state it was in before we entered the projection mode a...
unsigned & projected_coordinate()
When projecting the history values of the nodal coordinates, this is the coordinate we're projecting.
Projection problem. This is created during the adaptation of unstructured meshes and it is assumed th...
void unpin_dofs_of_field(const unsigned &fld)
Helper function to unpin dofs of fld-th field.
void enable_suppress_output_during_projection()
Suppress all output during projection phases.
ProjectionProblem()
Default constructor (made this private so only the friend class can call the constructor)
void unpin_dofs_of_coordinate(const unsigned &coord)
Helper function to unpin the values of coordinate coord.
void store_positions()
Helper function to store positions (the only things that have been set before doing projection.
bool use_iterative_solver_for_projection()
Return the value of the flag about using an iterative solver for projection.
void set_current_field_for_projection(const unsigned &fld)
Set current field for projection.
bool Output_during_projection_suppressed
Flag to suppress output during projection.
IterativeLinearSolver * Iterative_solver_projection_pt
bool Use_iterative_solver_for_projection
void set_time_level_for_projection(const unsigned &time_level)
Helper function to set time level for projection.
void set_lagrangian_coordinate_for_projection(const unsigned &i)
Set the Lagrangian coordinate for projection.
void pin_all()
Pin all the field values and position unknowns (bit inefficient)
void disable_use_iterative_solver_for_projection()
Disbales the use of an iterative solver for projection.
void disable_suppress_output_during_projection()
Undo suppression of all output during projection phases.
void unpin_all()
Unpin all the field values and position unknowns (bit inefficient)
Preconditioner * Preconditioner_projection_pt
void pin_dofs_of_field(const unsigned &fld)
Helper function to unpin dofs of fld-th field.
void set_coordinate_for_projection(const unsigned &i)
Set the coordinate for projection.
void project(Mesh *base_mesh_pt, const bool &dont_project_positions=false)
Project from base into the problem's own mesh.
void pin_dofs_of_coordinate(const unsigned &coord)
Helper function to unpin the values of coordinate coord.
void restore_positions()
Helper function to restore positions (the only things that have been set before doing projection.
void enable_use_iterative_solver_for_projection()
Enables the use of an iterative solver for projection.
Vector< DenseMatrix< double > > Solid_backup
Backup for pin status of solid node's position Data.
Unstructured refineable Triangle Mesh.
A Class for shape functions. In simple cases, the shape functions have only one index that can be tho...
SolidFiniteElement class.
A Class for nodes that deform elastically (i.e. position is an unknown in the problem)....
TAdvectionDiffusionReactionElement<NREAGENT,DIM,NNODE_1D> elements are isoparametric triangular DIM-d...
An interface to the Trilinos AztecOO classes allowing it to be used as an Oomph-lib LinearSolver....
void setup_multi_domain_interaction(Problem *problem_pt, Mesh *const &mesh_pt, Mesh *const &external_mesh_pt, const unsigned &interaction_index=0)
Function to set up the one-way multi-domain interaction for problems where the meshes pointed to by m...
double timer()
returns the time in seconds after some point in past
DRAIG: Change all instances of (SPATIAL_DIM) to (DIM-1).
OomphInfo oomph_info
Single (global) instantiation of the OomphInfo object – this is used throughout the library as a "rep...