Hello,
I am developing an adapter using preCICE for the Giraffe solver, an FEM that uses beam elements, similar to MBDyn, for FSI coupling with OpenFOAM.
I am conducting various tests to ensure that the adapter works well with preCICE, using the perpendicular flap tutorial. So far, all the tests with my adapter have been with the solid as the first solver and the fluid as the second in the coupling. This setup has worked well with both explicit and implicit couplings, with and without acceleration. However, when I configured the solid as the second solver, I encountered an error using implicit coupling with Quasi-Newton scheme acceleration. The error is shown below, first with the QR1 filter and then with the QR2 filter.
ASSERTION FAILED
Location: void precice::acceleration::impl::QRFactorization::reset(const MatrixXd&, int, double, double, double)
File: /home/rodolfo/programas/precice-3.1.2/src/acceleration/impl/QRFactorization.cpp:745
Expression: _Q.rows() == _rows
Rank: 0
Arguments:
0: _Q.rows() == 0
1: _rows == 258
ASSERTION FAILED
Location: virtual void precice::acceleration::IQNILSAcceleration::removeMatrixColumn(int)
File: /home/rodolfo/programas/precice-3.1.2/src/acceleration/IQNILSAcceleration.cpp:273
Expression: _matrixV.cols() > 1
Rank: 0
Arguments: none
This happens in the second timestep when I instruct preCICE to advance after sending the displacements using the writeData function.
I suspect that the issue might be related to how I am passing the displacement variable to preCICE because in the first error, the number 258 appears, which corresponds to the size of the displacements vector, 86 x 3. Below is the relevant portion of my adapter code to see if anyone can identify the problem or suggest an alternative approach. I followed the step-by-step guide on the preCICE site for coupling my adapter, creating the variables using std::vector.
std::vector<double> preCICE_Coords;
std::vector<double> preCICE_Displacements;
std::vector<double> preCICE_Forces;
I initialize them as follows, where in this case nodesSize is 86 and dim is 3:
nodesSize = mesh->MeshNode.size();
nodesIDs.reserve(nodesSize-1);
// initialize nodes IDs
for(int i = 0; i < nodesSize; i++){
nodesIDs.push_back(i);
}
const int dim = participant->getMeshDimensions(meshName);
const int forceDim = participant->getDataDimensions(meshName, readDataName);
const int displDim = participant->getDataDimensions(meshName, writeDataName);
preCICE_Coords.reserve(nodesSize*dim);
preCICE_Displacements.reserve(nodesSize*displDim);
preCICE_Forces.reserve(nodesSize*forceDim);
// copy coordinates from mesh and intiates the preCICE vectors Displacements and Forces
int j = 0;
for (int node = 0; node < nodesSize; node++) {
for (int i =0; i < dim; i++){
preCICE_Coords.push_back(mesh->MeshNode[node].meshCoords[i]);
preCICE_Displacements.push_back(0);
preCICE_Forces.push_back(0);
}
}
While isCouplingOngoing(), I replace the values in the preCICE_Displacements vector after the FEM has calculated the displacements.
int k = 0;
for(int i=0; i < nodesSize; i++){
for(int j=0; j < dim; j++){
preCICE_Displacements[k] = displacementSocket[k] - initialPosition[k];
k = k + 1;
}
}
Finally, I pass the displacements to preCICE, where the error occurs when calling advance.
participant->writeData(meshName, writeDataName, nodesIDs, preCICE_Displacements);
participant->advance(dt);
The precice-config is the same to the tutorial and the error only happens with implicity coupling with Quasi-Newton schemes accleration.
Any help would be greatly appreciated!
Thanks,
Rodolfo Curci Puraca
precice-config.xml (2.4 KB)
log_fluid.txt (19.5 KB)
log_solid.txt (13.8 KB)