yade-dev team mailing list archive
-
yade-dev team
-
Mailing list archive
-
Message #11558
[Branch ~yade-pkg/yade/git-trunk] Rev 3497: FlowEngine: set cell's id in periodic triangulations + couple smallfix
------------------------------------------------------------
revno: 3497
committer: Bruno Chareyre <bruno.chareyre@xxxxxxxxxxx>
timestamp: Tue 2014-10-21 23:28:01 +0200
message:
FlowEngine: set cell's id in periodic triangulations + couple smallfix
modified:
lib/triangulation/FlowBoundingSphere.ipp
pkg/pfv/FlowEngine.hpp.in
pkg/pfv/PeriodicFlowEngine.cpp
--
lp:yade
https://code.launchpad.net/~yade-pkg/yade/git-trunk
Your team Yade developers is subscribed to branch lp:yade.
To unsubscribe from this branch go to https://code.launchpad.net/~yade-pkg/yade/git-trunk/+edit-subscription
=== modified file 'lib/triangulation/FlowBoundingSphere.ipp'
--- lib/triangulation/FlowBoundingSphere.ipp 2014-10-15 10:12:53 +0000
+++ lib/triangulation/FlowBoundingSphere.ipp 2014-10-21 21:28:01 +0000
@@ -96,6 +96,7 @@
template <class Tesselation>
void FlowBoundingSphere<Tesselation>::averageRelativeCellVelocity()
{
+ if (noCache && T[!currentTes].Max_id()<=0) return;
RTriangulation& Tri = T[noCache?(!currentTes):currentTes].Triangulation();
Point posAvFacet;
int numCells = 0;
@@ -142,6 +143,7 @@
template <class Tesselation>
void FlowBoundingSphere<Tesselation>::averageFluidVelocity()
{
+ if (noCache && T[!currentTes].Max_id()<=0) return 0;
averageRelativeCellVelocity();
RTriangulation& Tri = T[noCache?(!currentTes):currentTes].Triangulation();
int numVertex = 0;
@@ -187,7 +189,8 @@
}
template <class Tesselation>
vector<Real> FlowBoundingSphere<Tesselation>::averageFluidVelocityOnSphere(unsigned int Id_sph)
-{
+{ //FIXME: we are computing everything again for each other Id_sph...
+ if (noCache && T[!currentTes].Max_id()<=0) return vector<Real>(3,0);
averageRelativeCellVelocity();
RTriangulation& Tri = T[noCache?(!currentTes):currentTes].Triangulation();
Real volumes; CGT::CVector velocityVolumes;
@@ -220,7 +223,7 @@
template <class Tesselation>
int FlowBoundingSphere<Tesselation>::getCell (double X, double Y, double Z)
{
- if (noCache) {cout<<"Triangulation does not exist. Waht did you do?!"<<endl; return -1;}
+ if (noCache && T[!currentTes].Max_id()<=0) {cout<<"Triangulation does not exist. Sorry."<<endl; return -1;}
RTriangulation& Tri = T[noCache?(!currentTes):currentTes].Triangulation();
CellHandle cell = Tri.locate(Point(X,Y,Z));
return cell->info().id;
@@ -948,14 +951,16 @@
template <class Tesselation>
double FlowBoundingSphere<Tesselation>::boundaryFlux(unsigned int boundaryId)
{
- RTriangulation& Tri = T[currentTes].Triangulation();
+ if (noCache && T[!currentTes].Max_id()<=0) return 0;
+ bool tes = noCache?(!currentTes):currentTes;
+ RTriangulation& Tri = T[tes].Triangulation();
double Q1=0;
VectorCell tmpCells;
tmpCells.resize(10000);
VCellIterator cells_it = tmpCells.begin();
- VCellIterator cell_up_end = Tri.incident_cells(T[currentTes].vertexHandles[boundaryId],cells_it);
+ VCellIterator cell_up_end = Tri.incident_cells(T[tes].vertexHandles[boundaryId],cells_it);
for (VCellIterator it = tmpCells.begin(); it != cell_up_end; it++)
{
const CellHandle& cell = *it;
@@ -1090,6 +1095,7 @@
template <class Tesselation>
void FlowBoundingSphere<Tesselation>::saveVtk(const char* folder)
{
+ if (noCache && T[!currentTes].Max_id()<=0) {cout<<"Triangulation does not exist. Sorry."<<endl; return;}
RTriangulation& Tri = T[noCache?(!currentTes):currentTes].Triangulation();
static unsigned int number = 0;
char filename[250];
=== modified file 'pkg/pfv/FlowEngine.hpp.in'
--- pkg/pfv/FlowEngine.hpp.in 2014-10-15 08:42:29 +0000
+++ pkg/pfv/FlowEngine.hpp.in 2014-10-21 21:28:01 +0000
@@ -309,7 +309,7 @@
ellapsedIter=0;
metisForced=false;
,
- .def("imposeFlux",&TemplateFlowEngine_@TEMPLATE_FLOW_NAME@::imposeFlux,(boost::python::arg("pos"),boost::python::arg("p")),"Impose incoming flux in boundary cell of location 'pos'.")
+ .def("imposeFlux",&TemplateFlowEngine_@TEMPLATE_FLOW_NAME@::imposeFlux,(boost::python::arg("pos"),boost::python::arg("p")),"Impose a flux in cell located at 'pos' (i.e. add a source term in the flow problem). Outflux positive, influx negative.")
.def("imposePressureFromId",&TemplateFlowEngine_@TEMPLATE_FLOW_NAME@::imposePressureFromId,(boost::python::arg("id"),boost::python::arg("p")),"Impose pressure in cell of index 'id' (after remeshing the same condition will apply for the same location, regardless of what the new cell index is at this location). The index of the condition itself is returned (for multiple imposed pressures at different points).")
.def("imposePressure",&TemplateFlowEngine_@TEMPLATE_FLOW_NAME@::imposePressure,(boost::python::arg("pos"),boost::python::arg("p")),"Impose pressure in cell of location 'pos'. The index of the condition is returned (for multiple imposed pressures at different points).")
.def("setImposedPressure",&TemplateFlowEngine_@TEMPLATE_FLOW_NAME@::setImposedPressure,(boost::python::arg("cond"),boost::python::arg("p")),"Set pressure value at the point indexed 'cond'.")
=== modified file 'pkg/pfv/PeriodicFlowEngine.cpp'
--- pkg/pfv/PeriodicFlowEngine.cpp 2014-07-03 07:16:58 +0000
+++ pkg/pfv/PeriodicFlowEngine.cpp 2014-10-21 21:28:01 +0000
@@ -407,7 +407,7 @@
}
void PeriodicFlowEngine::updateVolumes (FlowSolver& flow)
-{
+{ //FIXME: replace by the non-periodic version
if ( debug ) cout << "Updating volumes.............." << endl;
Real invDeltaT = 1/scene->dt;
double newVol, dVol;
@@ -438,6 +438,9 @@
cell->info().dv() = dVol * invDeltaT;
cell->info().volume() = newVol;
}
+ for (unsigned int n=0; n<flow.imposedF.size();n++) {
+ flow.IFCells[n]->info().dv()+=flow.imposedF[n].second;
+ flow.IFCells[n]->info().Pcondition=false;}
if ( debug ) cout << "Updated volumes, total =" <<totVol<<", dVol="<<totDVol<<" "<< totVol0<<" "<< totVol1<<endl;
}
@@ -493,6 +496,7 @@
if (flow.errorCode>0) return;
//Fill this vector than can be later used to speedup loops
if (!cell->info().isGhost) Tes.cellHandles[cell->info().baseIndex]=cell;
+ cell->info().id=cell->info().baseIndex;
}
Tes.cellHandles.resize(baseIndex+1);