OOFEM  2.4
OOFEM.org - Object Oriented Finite Element Solver
interactionload.C
Go to the documentation of this file.
1 /*
2  *
3  * ##### ##### ###### ###### ### ###
4  * ## ## ## ## ## ## ## ### ##
5  * ## ## ## ## #### #### ## # ##
6  * ## ## ## ## ## ## ## ##
7  * ## ## ## ## ## ## ## ##
8  * ##### ##### ## ###### ## ##
9  *
10  *
11  * OOFEM : Object Oriented Finite Element Code
12  *
13  * Copyright (C) 1993 - 2013 Borek Patzak
14  *
15  *
16  *
17  * Czech Technical University, Faculty of Civil Engineering,
18  * Department of Structural Mechanics, 166 29 Prague, Czech Republic
19  *
20  * This library is free software; you can redistribute it and/or
21  * modify it under the terms of the GNU Lesser General Public
22  * License as published by the Free Software Foundation; either
23  * version 2.1 of the License, or (at your option) any later version.
24  *
25  * This program is distributed in the hope that it will be useful,
26  * but WITHOUT ANY WARRANTY; without even the implied warranty of
27  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
28  * Lesser General Public License for more details.
29  *
30  * You should have received a copy of the GNU Lesser General Public
31  * License along with this library; if not, write to the Free Software
32  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
33  */
34 
35 #include "interactionload.h"
36 #include "floatarray.h"
37 #include "mathfem.h"
38 #include "classfactory.h"
39 #include "dynamicinputrecord.h"
40 #include "timestep.h"
41 #include "fluidstructureproblem.h"
42 #include "pfem.h"
43 #include "function.h"
44 
45 namespace oofem {
46 REGISTER_BoundaryCondition(InteractionLoad);
47 
50 {
51  IRResultType result; // Required by IR_GIVE_FIELD macro
52 
54 
55 
57 }
58 
59 
61 {
63 }
64 
65 void
67 {
68  int nSize, nDofs;
69  double factor;
70  FloatArray N;
71 
72  // Evaluates the value at specific integration point
73  if ( ( mode != VM_Total ) && ( mode != VM_Incremental ) ) {
74  OOFEM_ERROR("computeValueAt: unknown mode");
75  }
76 
77  this->computeNArray(N, coords);
78  nSize = N.giveSize();
79 
80  nDofs = this->componentArray.giveSize() / nSize;
81 
82  FloatArray pressureArray = this->componentArray;
84  if ( fsiProblem ) {
85  for ( int i = 1; i <= fsiProblem->giveNumberOfSlaveProblems(); i++ ) {
86  PFEM *pfem = dynamic_cast< PFEM * >( fsiProblem->giveSlaveProblem(i) );
87  if ( pfem ) {
88  for ( int j = 1; j <= coupledParticles.giveSize(); j++ ) {
89  DofManager *dman = pfem->giveDomain(1)->giveDofManager( coupledParticles.at(j) );
90  Dof *pressureDof = dman->giveDofWithID(P_f);
91  double pressureValue = pfem->giveUnknownComponent(VM_Total, tStep, pfem->giveDomain(1), pressureDof);
92  pressureValue = pressureValue > 0 ? pressureValue : 0.0;
93  for ( int k = 1; k <= nDofs; k++ ) {
94  pressureArray.at(nDofs * ( j - 1 ) + k) *= pressureValue;
95  }
96  }
97  }
98  }
99  }
100 
101  answer.resize(nDofs);
102 
103  if ( ( pressureArray.giveSize() / nSize ) != nDofs ) {
104  OOFEM_ERROR("computeValueAt: componentArray size mismatch");
105  }
106 
107  for ( int i = 1; i <= nDofs; i++ ) {
108  double value = 0.;
109  for ( int j = 1; j <= nSize; j++ ) {
110  value += N.at(j) * pressureArray.at(i + ( j - 1 ) * nDofs);
111  }
112 
113  answer.at(i) = value;
114  }
115 
116  factor = this->giveTimeFunction()->evaluate(tStep, mode);
117 
118  answer.times(factor);
119 }
120 
121 void
123 {
124  LinearEdgeLoad :: computeNArray(answer, coords);
125 }
126 } // end namespace oofem
REGISTER_BoundaryCondition(BoundaryCondition)
virtual EngngModel * giveSlaveProblem(int i)
Returns i-th slave problem.
Domain * domain
Link to domain object, useful for communicating with other FEM components.
Definition: femcmpnn.h:82
FloatArray componentArray
Components of boundary condition.
Definition: load.h:85
double & at(int i)
Coefficient access function.
Definition: floatarray.h:131
ValueModeType
Type representing the mode of UnknownType or CharType, or similar types.
Definition: valuemodetype.h:78
This class represents PFEM method for solving incompressible Navier-Stokes equations.
Definition: pfem.h:124
EngngModel * giveEngngModel()
Returns engineering model to which receiver is associated.
Definition: domain.C:433
virtual void computeNArray(FloatArray &answer, const FloatArray &coords) const
Abstract function, for computing approximation matrix of receiver at given point. ...
Base class for dof managers.
Definition: dofmanager.h:113
double evaluate(TimeStep *tStep, ValueModeType mode)
Returns the value of load time function at given time.
Definition: function.C:55
virtual IRResultType initializeFrom(InputRecord *ir)
Initializes receiver according to object description stored in input record.
int & at(int i)
Coefficient access function.
Definition: intarray.h:103
IntArray coupledParticles
Coordinates of start and end point.
double giveUnknownComponent(ValueModeType mode, TimeStep *tStep, Domain *d, Dof *dof)
Returns requested unknown.
Definition: pfem.C:263
virtual IRResultType initializeFrom(InputRecord *ir)
Initializes receiver according to object description stored in input record.
virtual void giveInputRecord(DynamicInputRecord &input)
Setups the input record string of receiver.
#define OOFEM_ERROR(...)
Definition: error.h:61
Implementation of fluid-structure interaction ) problem based on Dirichlet-Neumann approach...
virtual void computeValueAt(FloatArray &answer, TimeStep *tStep, const FloatArray &coords, ValueModeType mode)
Computes components values of load at given point - global coordinates (coordinates given)...
#define N(p, q)
Definition: mdm.C:367
EngngModel * giveMasterEngngModel()
Returns the master engnmodel.
Definition: engngm.h:516
Class representing vector of real numbers.
Definition: floatarray.h:82
IRResultType
Type defining the return values of InputRecord reading operations.
Definition: irresulttype.h:47
virtual void computeNArray(FloatArray &answer, const FloatArray &coords) const
Abstract function, for computing approximation matrix of receiver at given point. ...
Class representing the general Input Record.
Definition: inputrecord.h:101
#define _IFT_InteractionLoad_CoupledParticles
Dof * giveDofWithID(int dofID) const
Returns DOF with given dofID; issues error if not present.
Definition: dofmanager.C:119
Class representing the a dynamic Input Record.
void times(double s)
Multiplies receiver with scalar.
Definition: floatarray.C:818
int giveSize() const
Definition: intarray.h:203
int giveSize() const
Returns the size of receiver.
Definition: floatarray.h:218
the oofem namespace is to define a context or scope in which all oofem names are defined.
Domain * giveDomain(int n)
Service for accessing particular problem domain.
Definition: engngm.C:1720
#define IR_GIVE_FIELD(__ir, __value, __id)
Macro facilitating the use of input record reading methods.
Definition: inputrecord.h:69
Abstract class Dof represents Degree Of Freedom in finite element mesh.
Definition: dof.h:93
virtual int giveNumberOfSlaveProblems()
Returns number of slave problems.
DofManager * giveDofManager(int n)
Service for accessing particular domain dof manager.
Definition: domain.C:314
virtual void giveInputRecord(DynamicInputRecord &input)
Setups the input record string of receiver.
Class representing solution step.
Definition: timestep.h:80
void resize(int s)
Resizes receiver towards requested size.
Definition: floatarray.C:631

This page is part of the OOFEM documentation. Copyright (c) 2011 Borek Patzak
Project e-mail: info@oofem.org
Generated at Tue Jan 2 2018 20:07:29 for OOFEM by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2011