OOFEM 3.0
Loading...
Searching...
No Matches
latticeneumanncouplingnode.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 program is free software; you can redistribute it and/or modify
21 * it under the terms of the GNU General Public License as published by
22 * the Free Software Foundation; either version 2 of the License, or
23 * (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
28 * GNU General Public License for more details.
29 *
30 * You should have received a copy of the GNU General Public License
31 * along with this program; if not, write to the Free Software
32 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
33 */
34
36#include "dof.h"
37#include "slavedof.h"
38#include "simpleslavedof.h"
39#include "nodalload.h"
40#include "timestep.h"
41
42#include "floatarray.h"
43#include "floatmatrix.h"
44#include "intarray.h"
45#include "verbose.h"
46#include "datastream.h"
47#include "contextioerr.h"
48#include "staggeredproblem.h"
49#include "parametermanager.h"
50#include "paramkey.h"
51
52#ifdef __SM_MODULE
54#endif
55
56#include <math.h>
57#include <stdlib.h>
58#include "classfactory.h"
59#include "paramkey.h"
60
61#ifdef __OOFEG
62 #include "oofeggraphiccontext.h"
63#endif
64
65namespace oofem {
67
70
71LatticeNeumannCouplingNode :: LatticeNeumannCouplingNode(int n, Domain *aDomain) :
72 Node(n, aDomain), directionVector(), couplingNodes()
73{}
74
75LatticeNeumannCouplingNode :: ~LatticeNeumannCouplingNode()
76// Destructor.
77{}
78
79void
80LatticeNeumannCouplingNode :: initializeFrom(InputRecord &ir, int priority)
81// Gets from the source line from the data file all the data of the receiver.
82{
83 ParameterManager &ppm = this->giveDomain()->dofmanPPM;
84
85 Node :: initializeFrom(ir, priority);
88}
89
90void
98
99
100void
101LatticeNeumannCouplingNode :: computeLoadVectorAt(FloatArray &answer, TimeStep *stepN, ValueModeType mode)
102// Computes the vector of the nodal loads of the receiver.
103{
104 FloatArray contribution;
105
106 if ( this->giveLoadArray()->isEmpty() ) {
107 answer.resize(0);
108 } else {
109 answer.resize(0);
110 int nLoads = loadArray.giveSize(); // the node may be subjected
111 for ( int i = 1; i <= nLoads; i++ ) { // to more than one load
112 int n = loadArray.at(i);
113 Load *loadN = domain->giveLoad(n);
114 computeLoadVector(contribution, loadN, ExternalForcesVector, stepN, mode);
115 answer.add(contribution);
116 }
117 }
118
119 computeLoadCouplingContribution(contribution, stepN);
120 answer.add(contribution);
121}
122
123void LatticeNeumannCouplingNode :: printYourself()
124// Prints the receiver on screen.
125{
126 int i;
127 double x, y;
128
129 x = this->giveCoordinate(1);
130 y = this->giveCoordinate(2);
131 printf("LatticeNeumannCouplingNode %d coord : x %f y %f\n", number, x, y);
132 for ( i = 0; i < this->giveNumberOfDofs(); i++ ) {
133 if ( dofArray [ i ] ) {
134 dofArray [ i ]->printYourself();
135 } else {
136 printf("dof %d is nil \n", i + 1);
137 }
138 }
139
140 loadArray.printYourself();
141 printf("\n");
142}
143
144void
145LatticeNeumannCouplingNode :: computeLoadCouplingContribution(FloatArray &answer, TimeStep *stepN) {
146 int nCouplingNodes = couplingNodes.giveSize();
147
148 FloatArray contribution;
149 answer.resize(this->directionVector.giveSize() );
150
151 IntArray coupledModels;
152 double waterPressureNew = 0., waterPressureOld = 0.;
153
154 if ( domain->giveEngngModel()->giveMasterEngngModel() ) {
155 ( static_cast< StaggeredProblem * >( domain->giveEngngModel()->giveMasterEngngModel() ) )->giveCoupledModels(coupledModels);
156 if ( coupledModels.at(2) != 0 && !( stepN->giveNumber() <= domain->giveEngngModel()->giveNumberOfFirstStep() ) ) {
157 for ( int k = 0; k < nCouplingNodes; k++ ) {
158 Node *coupledNode = domain->giveEngngModel()->giveMasterEngngModel()->giveSlaveProblem(coupledModels.at(2) )->giveDomain(1)->giveNode(couplingNodes(k) );
159 const auto &couplingCoords = coupledNode->giveCoordinates();
160 TimeStep *previousStep = domain->giveEngngModel()->giveMasterEngngModel()->givePreviousStep();
161
162 waterPressureNew = coupledNode->giveDofWithID(P_f)->giveUnknown(VM_Total, stepN);
163 if ( !stepN->givePreviousStep()->isTheFirstStep() ) {
164 waterPressureOld = coupledNode->giveDofWithID(P_f)->giveUnknown(VM_Total, previousStep);
165 } else {
166 waterPressureOld = 0.;
167 }
168
169 double waterPressure = waterPressureNew - waterPressureOld;
170 double dist = distance(couplingCoords, coordinates);
171 double factor = waterPressure * dist;
172 contribution = this->directionVector;
173 contribution.times(factor);
174 answer.add(contribution);
175 }
176 }
177 }
178
179 return;
180}
181}
#define REGISTER_DofManager(class)
int giveNumberOfDofs() const
Definition dofmanager.C:287
IntArray loadArray
List of applied loads.
Definition dofmanager.h:108
double giveCoordinate(int i) const
Definition dofmanager.h:383
const FloatArray & giveCoordinates() const
Definition dofmanager.h:390
void postInitialize() override
Performs post initialization steps. Called after all components are created and initialized.
Definition dofmanager.C:444
std::vector< Dof * > dofArray
Array of DOFs.
Definition dofmanager.h:106
Dof * giveDofWithID(int dofID) const
Definition dofmanager.C:127
IntArray * giveLoadArray()
Definition dofmanager.C:90
FloatArray coordinates
Array storing nodal coordinates.
Definition dofmanager.h:103
virtual double giveUnknown(ValueModeType mode, TimeStep *tStep)=0
Domain * giveDomain() const
Definition femcmpnn.h:97
Domain * domain
Link to domain object, useful for communicating with other FEM components.
Definition femcmpnn.h:79
int number
Component number.
Definition femcmpnn.h:77
void resize(Index s)
Definition floatarray.C:94
void add(const FloatArray &src)
Definition floatarray.C:218
void times(double s)
Definition floatarray.C:834
int & at(std::size_t i)
Definition intarray.h:104
FloatArray directionVector
Array storing nodal coordinates.
void postInitialize() override
Performs post initialization steps. Called after all components are created and initialized.
void computeLoadCouplingContribution(FloatArray &answer, TimeStep *stepN)
Node(int n, Domain *aDomain)
Definition node.C:73
void computeLoadVector(FloatArray &answer, Load *load, CharType type, TimeStep *tStep, ValueModeType mode) override
Definition node.C:167
int giveNumber()
Returns receiver's number.
Definition timestep.h:144
TimeStep * givePreviousStep()
Returns pointer to previous solution step.
Definition timestep.C:132
bool isTheFirstStep()
Definition timestep.C:148
double distance(const FloatArray &x, const FloatArray &y)
#define PM_ELEMENT_ERROR_IFNOTSET(_pm, _componentnum, _paramkey)
#define PM_UPDATE_PARAMETER(_val, _pm, _ir, _componentnum, _paramkey, _prio)

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