OOFEM 3.0
Loading...
Searching...
No Matches
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 - 2025 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"
42#include "pfem.h"
43#include "function.h"
44
45namespace oofem {
47
48void
49InteractionLoad :: initializeFrom(InputRecord &ir)
50{
51 LinearEdgeLoad :: initializeFrom(ir);
52
54}
55
56
57void InteractionLoad :: giveInputRecord(DynamicInputRecord &input)
58{
59 LinearEdgeLoad :: giveInputRecord(input);
60}
61
62void
63InteractionLoad :: computeValueAt(FloatArray &answer, TimeStep *tStep, const FloatArray &coords, ValueModeType mode)
64{
65 int nSize, nDofs;
66 double factor;
68
69 // Evaluates the value at specific integration point
70 if ( ( mode != VM_Total ) && ( mode != VM_Incremental ) ) {
71 OOFEM_ERROR("computeValueAt: unknown mode");
72 }
73
74 this->computeNArray(N, coords);
75 nSize = N.giveSize();
76
77 nDofs = this->componentArray.giveSize() / nSize;
78
79 FloatArray pressureArray = this->componentArray;
80 FluidStructureProblem *fsiProblem = dynamic_cast< FluidStructureProblem * >( domain->giveEngngModel()->giveMasterEngngModel() );
81 if ( fsiProblem ) {
82 for ( int i = 1; i <= fsiProblem->giveNumberOfSlaveProblems(); i++ ) {
83 PFEM *pfem = dynamic_cast< PFEM * >( fsiProblem->giveSlaveProblem(i) );
84 if ( pfem ) {
85 for ( int j = 1; j <= coupledParticles.giveSize(); j++ ) {
86 DofManager *dman = pfem->giveDomain(1)->giveDofManager( coupledParticles.at(j) );
87 Dof *pressureDof = dman->giveDofWithID(P_f);
88 double pressureValue = pfem->giveUnknownComponent(VM_Total, tStep, pfem->giveDomain(1), pressureDof);
89 pressureValue = pressureValue > 0 ? pressureValue : 0.0;
90 for ( int k = 1; k <= nDofs; k++ ) {
91 pressureArray.at(nDofs * ( j - 1 ) + k) *= pressureValue;
92 }
93 }
94 }
95 }
96 }
97
98 answer.resize(nDofs);
99
100 if ( ( pressureArray.giveSize() / nSize ) != nDofs ) {
101 OOFEM_ERROR("computeValueAt: componentArray size mismatch");
102 }
103
104 for ( int i = 1; i <= nDofs; i++ ) {
105 double value = 0.;
106 for ( int j = 1; j <= nSize; j++ ) {
107 value += N.at(j) * pressureArray.at(i + ( j - 1 ) * nDofs);
108 }
109
110 answer.at(i) = value;
111 }
112
113 factor = this->giveTimeFunction()->evaluate(tStep, mode);
114
115 answer.times(factor);
116}
117
118void
119InteractionLoad :: computeNArray(FloatArray &answer, const FloatArray &coords) const
120{
121 LinearEdgeLoad :: computeNArray(answer, coords);
122}
123} // end namespace oofem
#define N(a, b)
#define REGISTER_BoundaryCondition(class)
Dof * giveDofWithID(int dofID) const
Definition dofmanager.C:127
DofManager * giveDofManager(int n)
Definition domain.C:317
Domain * giveDomain(int n)
Definition engngm.C:1936
Domain * domain
Link to domain object, useful for communicating with other FEM components.
Definition femcmpnn.h:79
void resize(Index s)
Definition floatarray.C:94
double & at(Index i)
Definition floatarray.h:202
Index giveSize() const
Returns the size of receiver.
Definition floatarray.h:261
void times(double s)
Definition floatarray.C:834
int giveNumberOfSlaveProblems() override
Returns number of slave problems.
void computeNArray(FloatArray &answer, const FloatArray &coords) const override
IntArray coupledParticles
Coordinates of start and end point.
FloatArray componentArray
Components of boundary condition.
Definition load.h:86
double giveUnknownComponent(ValueModeType mode, TimeStep *tStep, Domain *d, Dof *dof) override
Definition pfem.C:257
EngngModel * giveSlaveProblem(int i) override
Returns i-th slave problem.
#define OOFEM_ERROR(...)
Definition error.h:79
#define IR_GIVE_FIELD(__ir, __value, __id)
Definition inputrecord.h:67
#define _IFT_InteractionLoad_CoupledParticles

This page is part of the OOFEM-3.0 documentation. Copyright Copyright (C) 1994-2025 Borek Patzak Bořek Patzák
Project e-mail: oofem@fsv.cvut.cz
Generated at for OOFEM by doxygen 1.15.0 written by Dimitri van Heesch, © 1997-2011