Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • Paul.Dechamps/dartflo
1 result
Show changes
Showing with 24 additions and 103 deletions
......@@ -33,7 +33,9 @@ class DART_API BlowingResidual
public:
// Newton
static Eigen::VectorXd build(tbox::Element const &e, std::vector<double> const &phi, F0El const &f);
static Eigen::VectorXd buildGradientBlowing(tbox::Element const &e);
static Eigen::MatrixXd buildGradientMesh(tbox::Element const &e, std::vector<double> const &phi, F0El const &f, int const nDim);
};
} // namespace dart
#endif //WBLOWINGRESIDUAL_H
#endif // WBLOWINGRESIDUAL_H
......@@ -22,8 +22,6 @@
#include "wElement.h"
#include "wNode.h"
#include <unordered_set>
#include <iomanip>
#include <fstream>
using namespace tbox;
using namespace dart;
......@@ -111,84 +109,7 @@ void Body::create()
nLoads.resize(nodes.size(), Eigen::Vector3d::Zero());
}
/**
* @brief Save nodal data for further post-processing
*/
void Body::save(std::string const &name, Results const &res)
{
// Write to file
std::cout << "writing file: " << name + ".dat"
<< "... " << std::flush;
std::ofstream outfile;
outfile.open(name + ".dat");
// Header
outfile << "$Body data" << std::endl;
// Aerodynamic coefficients
outfile << "$Aerodynamic coefficients" << std::endl;
outfile << "!" << std::fixed
<< std::setw(14) << "Cl"
<< std::setw(15) << "Cd"
<< std::setw(15) << "Cs"
<< std::setw(15) << "Cm"
<< std::endl;
outfile << std::fixed
<< std::setw(15) << Cl
<< std::setw(15) << Cd
<< std::setw(15) << Cs
<< std::setw(15) << Cm
<< std::endl;
// Elements (connectvity)
outfile << "$Elements" << std::endl;
outfile << groups[0]->tag->elems.size() << std::endl;
for (auto e : groups[0]->tag->elems)
{
outfile << std::fixed
<< std::setw(10) << e->no;
for (auto n : e->nodes)
outfile << std::setw(10) << n->no;
outfile << std::endl;
}
//Nodes (data)
outfile << "$Nodal data" << std::endl;
outfile << nodes.size() << std::endl;
outfile << "!" << std::fixed
<< std::setw(9) << "no"
<< std::setw(15) << "x"
<< std::setw(15) << "y"
<< std::setw(15) << "z";
for (auto &p : res.scalars_at_nodes)
outfile << std::setw(15) << p.first;
for (auto &p : res.vectors_at_nodes)
{
outfile << std::setw(14) << p.first << "x"
<< std::setw(14) << p.first << "y"
<< std::setw(14) << p.first << "z";
}
outfile << std::endl;
for (auto n : nodes)
{
outfile << std::fixed
<< std::setw(10) << n->no
<< std::scientific << std::setprecision(6)
<< std::setw(15) << n->pos(0)
<< std::setw(15) << n->pos(1)
<< std::setw(15) << n->pos(2);
for (auto &p : res.scalars_at_nodes)
outfile << std::setw(15) << (*(p.second))[n->row];
for (auto &p : res.vectors_at_nodes)
outfile << std::setw(15) << (*(p.second))[n->row](0)
<< std::setw(15) << (*(p.second))[n->row](1)
<< std::setw(15) << (*(p.second))[n->row](2);
outfile << std::endl;
}
// Footer
outfile << std::endl;
// Close file
outfile.close();
std::cout << "done" << std::endl;
}
void Body::write(std::ostream &out) const
{
out << *groups[0]->tag << " is a Body immersed in " << *groups[1]->tag << std::endl;
}
\ No newline at end of file
}
......@@ -49,8 +49,6 @@ public:
Body(std::shared_ptr<tbox::MshData> _msh, std::vector<std::string> const &names);
virtual ~Body() { std::cout << "~Body()\n"; }
void save(std::string const &name, tbox::Results const &res);
#ifndef SWIG
virtual void write(std::ostream &out) const override;
#endif
......@@ -61,4 +59,4 @@ private:
} // namespace dart
#endif //WBODY_H
#endif // WBODY_H
......@@ -54,4 +54,4 @@ public:
} // namespace dart
#endif //WF0PS_H
#endif // WF0PS_H
......@@ -96,4 +96,4 @@ public:
} // namespace dart
#endif //WF1CT_H
#endif // WF1CT_H
......@@ -62,4 +62,4 @@ public:
} // namespace dart
#endif //WF1EL_H
#endif // WF1EL_H
......@@ -85,4 +85,4 @@ public:
} // namespace dart
#endif //WFACE_H
#endif // WFACE_H
......@@ -59,4 +59,4 @@ public:
} // namespace dart
#endif //WFLUID_H
#endif // WFLUID_H
......@@ -49,4 +49,4 @@ public:
} // namespace dart
#endif //WFPELSFUNCTION_H
#endif // WFPELSFUNCTION_H
......@@ -45,4 +45,4 @@ public:
} // namespace dart
#endif //WFREESTREAM_H
#endif // WFREESTREAM_H
......@@ -38,4 +38,4 @@ public:
};
} // namespace dart
#endif //WFREESTREAMRESIDUAL_H
#endif // WFREESTREAMRESIDUAL_H
......@@ -82,10 +82,10 @@ void Kutta::connectNodes()
// Create the node map
for (auto nUp : nodesUp)
{
//std::cout << "MASTER: " << nUp->pos(0) << ',' << nUp->pos(1) << ',' << nUp->pos(2) << std::endl;
// std::cout << "MASTER: " << nUp->pos(0) << ',' << nUp->pos(1) << ',' << nUp->pos(2) << std::endl;
for (auto nLw : nodesLw)
{
//std::cout << " SLAVE: " << nLw->pos(0) << ',' << nLw->pos(1) << ',' << nLw->pos(2) << std::endl;
// std::cout << " SLAVE: " << nLw->pos(0) << ',' << nLw->pos(1) << ',' << nLw->pos(2) << std::endl;
if ((nUp->pos - nLw->pos).norm() <= 1e-14)
{
nodMap.push_back(std::pair<Node *, Node *>(nUp, nLw));
......
......@@ -56,4 +56,4 @@ private:
} // namespace dart
#endif //WKUTTA_H
#endif // WKUTTA_H
......@@ -65,4 +65,4 @@ private:
} // namespace dart
#endif //WKUTTAELEMENT_H
#endif // WKUTTAELEMENT_H
......@@ -131,7 +131,7 @@ Eigen::MatrixXd KuttaResidual::buildGradientFlow(KuttaElement const &ke, std::ve
/**
* @brief Build the gradient of the residual vector with respect to the nodes, on one Kutta element
*
*
* A = d( 1/S * \int (psi + grad_psi*v_inf) * (grad_phi)^2 dS )
* = d1/S * \int (psi + grad_psi*v_inf) * (grad_phi)^2 dS
* + 1/S * \int dgrad_psi*v_inf * (grad_phi)^2 dS
......
......@@ -41,4 +41,4 @@ public:
};
} // namespace dart
#endif //WKUTTARESIDUAL_H
#endif // WKUTTARESIDUAL_H
......@@ -39,4 +39,4 @@ public:
};
} // namespace dart
#endif //WLOADFUNCTIONAL_H
#endif // WLOADFUNCTIONAL_H
......@@ -115,7 +115,7 @@ Status Newton::run()
// Linesearch
FpeLSFunction fpe(*this, phi, phi, dPhi_, rPhi_);
BankRoseLS ls(fpe);
//FleuryLS ls(fpe, 1., 1e-2, false);
// FleuryLS ls(fpe, 1., 1e-2, false);
ls.set(maxLsIt, lsTol, verbose);
// Display residual
......@@ -291,7 +291,7 @@ void Newton::buildJac(Eigen::SparseMatrix<double, Eigen::RowMajor> &J)
tbb::parallel_for_each(fluid->adjMap.begin(), fluid->adjMap.end(), [&](std::pair<Element *, std::vector<Element *>> p) {
// Current element
Element *e = p.first;
//Upwind element
// Upwind element
Element *eU = p.second[0];
// Build elementary matrices
Eigen::MatrixXd Ae1, Ae2;
......
......@@ -63,4 +63,4 @@ private:
} // namespace dart
#endif //WNEWTON_H
#endif // WNEWTON_H
......@@ -205,7 +205,7 @@ Status Picard::run()
/**
* @brief Build LHS matrix and RHS vector for Picard iteration
*
*
* A = \int rho * grad_phi * grad_psi dV
* b = \int rho * grad_phi * n * psi dS
*/
......