ElmerFoamFSI  2.0
ElmerFoamFSI is fluid-solid interaction simulation application built up from OpenFOAM CFD and Elmer CSM coupled through the IMPACT multiphysics software integration infrastructure.
 All Classes Namespaces Files Functions Variables Typedefs Enumerator Macros Groups Pages
int TransferDisplacementsToFluid ( solidagent solidAgent,
fluidagent fluidAgent 
)
inline

Definition at line 59 of file FsiCoupling.H.

References openfoamagent::Coordinates(), elmeragent::Coordinates(), fluidsAgent, fluidsInterfaceName, openfoamagent::PaneID(), elmeragent::PaneID(), structuresAgent, structuresInterfaceName, transferAgent, and verblevel.

Referenced by Run(), TestingObject< ResultsType >::Test__FluidAgentRun(), TestingObject< ResultsType >::Test__SolidAgentRun(), TestingObject< ResultsType >::Test__TransferDisplacementsToFluid(), and TestingObject< ResultsType >::Test__TransferLoadsToStructures().

60  {
61  std::stringstream outString;
62  // Masoud: Checking quality of coordinate transfer
63  std::vector<double> crdVecSolid1(solidAgent->Coordinates());
64  std::vector<double> crdVecFluid1(fluidAgent->Coordinates());
65  if ( verblevel >= 3 ) {
66  outString << "Solid Coodinates are : " << std::endl;
67  for (int i = 0; i < crdVecSolid1.size()/3; i++)
68  outString << crdVecSolid1[i*3] << " "
69  << crdVecSolid1[i*3+1] << " "
70  << crdVecSolid1[i*3+2] << std::endl;
71  //StdOut(outString.str(),0, true);
72  std::cout << outString.str() << std::endl;
73  outString.clear();
74  outString.str("");
75  outString << " Fluid Coodinates are : " << std::endl;
76  for (int i = 0; i < crdVecFluid1.size()/3; i++)
77  outString << crdVecFluid1[i*3] << " "
78  << crdVecFluid1[i*3+1] << " "
79  << crdVecFluid1[i*3+2] << std::endl;
80  //StdOut(outString.str(),0,true);
81  std::cout << outString.str() << std::endl;
82  outString.clear();
83  outString.str("");
84  }
85  // Masoud: End
86 
87  // Masoud: Checking quality of displacement transfer
88  double *fluidDisp1 = NULL;
89  double *fluidDisp2 = NULL;
90  double *solidDisp1 = NULL;
91  double *solidDisp2 = NULL;
92  std::string fluidsCoordinateName(fluidsInterfaceName+".solidDisplacement");
93  std::string solidsCoordinateName(structuresInterfaceName+".Displacements");
94  COM_get_array(fluidsCoordinateName.c_str(),fluidsAgent->PaneID(),&fluidDisp1);
95  COM_get_array(solidsCoordinateName.c_str(),structuresAgent->PaneID(),&solidDisp1);
96  int numberFluidNodes = fluidsAgent->Coordinates().size()/3;
97  int numberSolidNodes = structuresAgent->Coordinates().size()/3;
98  if (verblevel >= 3){
99  outString << "Fluid displacements before transfer: " << std::endl;
100  for (int i = 0; i < numberFluidNodes; i++)
101  outString << fluidDisp1[i*3] << " "
102  << fluidDisp1[i*3+1] << " "
103  << fluidDisp1[i*3+2] << std::endl;
104  //StdOut(outString.str(),0,true);
105  std::cout << outString.str() << std::endl;
106  outString.clear();
107  outString.str("");
108  outString << " Solid displacements before transfer " << std::endl;
109  outString << "Number of nodes: " << numberSolidNodes << std::endl;
110  for (int i = 0; i < numberSolidNodes; i++)
111  outString << solidDisp1[i*3] << " "
112  << solidDisp1[i*3+1] << " "
113  << solidDisp1[i*3+2] << std::endl;
114  //StdOut(outString.str(),0,true);
115  std::cout << outString.str() << std::endl;
116  outString.clear();
117  outString.str("");
118  }
119 
120  transferAgent->Interpolate("Displacements","solidDisplacement");
121  //transferAgent->Interpolate("solidDisplacement","Displacements");
122 
123  if (verblevel >= 3){
124  COM_get_array(fluidsCoordinateName.c_str(),fluidsAgent->PaneID(),&fluidDisp2);
125  COM_get_array(solidsCoordinateName.c_str(),structuresAgent->PaneID(),&solidDisp2);
126  outString << "Number of fluid nodes: " << numberFluidNodes <<std::endl;
127  outString << "Fluid displacements after transfer : " << std::endl;
128  for (int i = 0; i < numberFluidNodes; i++)
129  outString << fluidDisp2[i*3] << " "
130  << fluidDisp2[i*3+1] << " "
131  << fluidDisp2[i*3+2] << std::endl;
132  //StdOut(outString.str(),0,true);
133  outString << "Number of solid nodes: " << numberFluidNodes <<std::endl;
134  outString << "solid displacements after transfer : " << std::endl;
135  for (int i = 0; i < numberSolidNodes; i++)
136  outString << solidDisp2[i*3] << " "
137  << solidDisp2[i*3+1] << " "
138  << solidDisp2[i*3+2] << std::endl;
139  std::cout << outString.str() << std::endl;
140  outString.clear();
141  outString.str("");
142 
143  // Masoud: Cheking if displacements are updated properly
144  std::vector<double> crdVecSolid2(solidAgent->Coordinates());
145  std::vector<double> crdVecFluid2(fluidAgent->Coordinates());
146  outString << "Fluid Coodinate Updates : " << std::endl;
147  for (int i = 0; i < crdVecFluid2.size(); i = i + 3)
148  {
149  // adding some value to it
150  outString << crdVecFluid2[i] - crdVecFluid1[i] << " "
151  << crdVecFluid2[i+1] - crdVecFluid1[i+1]<< " "
152  << crdVecFluid2[i+2] - crdVecFluid1[i+2]<< std::endl;
153  }
154  //StdOut(outString.str(),0,true);
155  std::cout << outString.str() << std::endl;
156  outString.clear();
157  outString.str("");
158  outString << "Solid Coodinate Updates : " << std::endl;
159  for (int i = 0; i < crdVecSolid2.size(); i = i + 3)
160  {
161  outString << crdVecSolid2[i] - crdVecSolid1[i] << " "
162  << crdVecSolid2[i+1] - crdVecSolid1[i+1]<< " "
163  << crdVecSolid2[i+2] - crdVecSolid1[i+2]<< std::endl;
164  }
165  //StdOut(outString.str(),0,true);
166  std::cout << outString.str() << std::endl;
167  outString.clear();
168  outString.str("");
169  }
170  // Masoud: End
171 
172  return(0);
173  };
fluidagent * fluidsAgent
Definition: FsiCoupling.H:29
solidagent * structuresAgent
Definition: FsiCoupling.H:30
transferagent * transferAgent
Definition: FsiCoupling.H:31
std::string structuresInterfaceName
Definition: FsiCoupling.H:34
int PaneID()
Definition: ElmerAgent.H:80
const std::vector< double > & Coordinates() const
Definition: ElmerAgent.H:79
std::string fluidsInterfaceName
Definition: FsiCoupling.H:33
const std::vector< double > & Coordinates() const
Definition: OpenFoamAgent.H:63

Here is the call graph for this function:

Here is the caller graph for this function: