yade-dev team mailing list archive
-
yade-dev team
-
Mailing list archive
-
Message #10589
[Branch ~yade-pkg/yade/git-trunk] Rev 3843: some renaming and code cleaning in PFV code
------------------------------------------------------------
revno: 3843
committer: Bruno Chareyre <bruno.chareyre@xxxxxxxxxxxxxxx>
timestamp: Fri 2014-03-21 19:45:24 +0100
message:
some renaming and code cleaning in PFV code
modified:
lib/triangulation/FlowBoundingSphere.hpp
lib/triangulation/FlowBoundingSphere.ipp
lib/triangulation/FlowBoundingSphereLinSolv.hpp
lib/triangulation/FlowBoundingSphereLinSolv.ipp
lib/triangulation/Network.hpp
lib/triangulation/Network.ipp
lib/triangulation/PeriodicFlow.cpp
lib/triangulation/PeriodicFlow.hpp
lib/triangulation/PeriodicFlowLinSolv.hpp
lib/triangulation/PeriodicFlowLinSolv.ipp
lib/triangulation/RegularTriangulation.h
lib/triangulation/Tenseur3.cpp
lib/triangulation/Tesselation.h
lib/triangulation/Tesselation.ipp
lib/triangulation/def_types.h
pkg/common/PersistentTriangulationCollider.cpp
pkg/dem/FlowEngine.cpp
pkg/dem/FlowEngine.hpp
pkg/dem/Law2_ScGeom_CapillaryPhys_Capillarity.cpp
pkg/dem/Law2_ScGeom_CapillaryPhys_Capillarity.hpp
pkg/dem/TesselationWrapper.cpp
pkg/dem/TesselationWrapper.hpp
--
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.hpp'
--- lib/triangulation/FlowBoundingSphere.hpp 2014-02-03 16:10:48 +0000
+++ lib/triangulation/FlowBoundingSphere.hpp 2014-03-21 18:45:24 +0000
@@ -29,15 +29,14 @@
DECLARE_TESSELATION_TYPES(Network<Tesselation>)
//painfull, but we need that for templates inheritance...
- using _N::T; using _N::x_min; using _N::x_max; using _N::y_min; using _N::y_max; using _N::z_min; using _N::z_max; using _N::Rmoy; using _N::SectionArea; using _N::Height; using _N::Vtotale; using _N::currentTes; using _N::DEBUG_OUT; using _N::nOfSpheres; using _N::x_min_id; using _N::x_max_id; using _N::y_min_id; using _N::y_max_id; using _N::z_min_id; using _N::z_max_id; using _N::boundsIds; using _N::Corner_min; using _N::Corner_max; using _N::Vsolid_tot; using _N::Vtotalissimo; using _N::Vporale; using _N::Ssolid_tot; using _N::V_porale_porosity; using _N::V_totale_porosity; using _N::boundaries; using _N::id_offset; using _N::vtk_infinite_vertices; using _N::vtk_infinite_cells; using _N::num_particles; using _N::boundingCells; using _N::facetVertices; using _N::facetNFictious;
+ using _N::T; using _N::xMin; using _N::xMax; using _N::yMin; using _N::yMax; using _N::zMin; using _N::zMax; using _N::Rmoy; using _N::sectionArea; using _N::Height; using _N::vTotal; using _N::currentTes; using _N::debugOut; using _N::nOfSpheres; using _N::xMinId; using _N::xMaxId; using _N::yMinId; using _N::yMaxId; using _N::zMinId; using _N::zMaxId; using _N::boundsIds; using _N::cornerMin; using _N::cornerMax; using _N::VSolidTot; using _N::Vtotalissimo; using _N::vPoral; using _N::sSolidTot; using _N::vPoralPorosity; using _N::vTotalePorosity; using _N::boundaries; using _N::idOffset; using _N::vtkInfiniteVertices; using _N::vtkInfiniteCells; using _N::num_particles; using _N::boundingCells; using _N::facetVertices; using _N::facetNFictious;
//same for functions
- using _N::Define_fictious_cells; using _N::AddBoundingPlanes; using _N::boundary;
+ using _N::defineFictiousCells; using _N::addBoundingPlanes; using _N::boundary;
virtual ~FlowBoundingSphere();
FlowBoundingSphere();
- bool SLIP_ON_LATERALS;
-// bool areaR2Permeability;
+ bool slipOnLaterals;
double TOLERANCE;
double RELAX;
double ks; //Hydraulic Conductivity
@@ -48,17 +47,17 @@
bool pressureChanged;//are imposed pressures modified (on python side)? When it happens, we have to reApplyBoundaryConditions
int errorCode;
- //Handling imposed pressures/fluxes on elements in the form of {point,value} pairs, IPCells contains the cell handles corresponding to point
+ //Handling imposed pressures/fluxes on elements in the form of {point,value} pairs, ipCells contains the cell handles corresponding to point
vector<pair<Point,Real> > imposedP;
- vector<Cell_handle> IPCells;
+ vector<CellHandle> ipCells;
vector<pair<Point,Real> > imposedF;
- vector<Cell_handle> IFCells;
+ vector<CellHandle> ifCells;
void initNewTri () {noCache=true; /*isLinearSystemSet=false; areCellsOrdered=false;*/}//set flags after retriangulation
- bool permeability_map;
+ bool permeabilityMap;
bool computeAllCells;//exececute computeHydraulicRadius for all facets and all spheres (double cpu time but needed for now in order to define crossSections correctly)
- double K_opt_factor;
+ double KOptFactor;
double minKdivKmean;
double maxKdivKmean;
int Iterations;
@@ -71,15 +70,16 @@
vector< vector<const Vecteur*> > perVertexUnitForce;
vector< vector<const Real*> > perVertexPressure;
#endif
- vector <Finite_edges_iterator> Edge_list;
- vector <double> Edge_Surfaces;
- vector <pair<int,int> > Edge_ids;
+ vector <double> edgeSurfaces;
+ vector <pair<int,int> > edgeIds;
vector <Real> edgeNormalLubF;
- vector <Vector3r> viscousShearForces;
- vector <Vector3r> viscousShearTorques;
- vector <Vector3r> normLubForce;
- vector <Matrix3r> viscousBodyStress;
- vector <Matrix3r> lubBodyStress;
+ vector <Vector3r> shearLubricationForces;
+ vector <Vector3r> shearLubricationTorques;
+ vector <Vector3r> pumpLubricationTorques;
+ vector <Vector3r> twistLubricationTorques;
+ vector <Vector3r> normalLubricationForce;
+ vector <Matrix3r> shearLubricationBodyStress;
+ vector <Matrix3r> normalLubricationBodyStress;
vector <Vector3r> deltaNormVel;
vector <Vector3r> deltaShearVel;
vector <Vector3r> normalV;
@@ -89,76 +89,78 @@
vector <Matrix3r> normalStressInteraction;
void Localize();
- void Compute_Permeability();
- virtual void GaussSeidel (Real dt=0);
- virtual void ResetNetwork();
-
- void Fictious_cells ( );
-
- double k_factor; //permeability moltiplicator
+ void computePermeability();
+ virtual void gaussSeidel (Real dt=0);
+ virtual void resetNetwork();
+
+
+ double kFactor; //permeability moltiplicator
std::string key; //to give to consolidation files a name with iteration number
- std::vector<double> Pressures; //for automatic write maximum pressures during consolidation
- bool tess_based_force; //allow the force computation method to be chosen from FlowEngine
+// std::vector<double> pressures; //for automatic write maximum pressures during consolidation
+ bool tessBasedForce; //allow the force computation method to be chosen from FlowEngine
Real minPermLength; //min branch length for Poiseuille
- double P_SUP, P_INF, P_INS, VISCOSITY;
+ double VISCOSITY;
double fluidBulkModulus;
- Tesselation& Compute_Action ( );
- Tesselation& Compute_Action ( int argc, char *argv[ ], char *envp[ ] );
- Tesselation& LoadPositions(int argc, char *argv[ ], char *envp[ ]);
- void SpheresFileCreator ();
- void DisplayStatistics();
- void Initialize_pressures ( double P_zero );
+ Tesselation& computeAction ( );
+ Tesselation& computeAction ( int argc, char *argv[ ], char *envp[ ] );
+ Tesselation& loadPositions(int argc, char *argv[ ], char *envp[ ]);
+ void displayStatistics();
+ void initializePressures ( double pZero );
bool reApplyBoundaryConditions ();
/// Define forces using the same averaging volumes as for permeability
- void ComputeTetrahedralForces();
+ void computeTetrahedralForces();
/// Define forces spliting drag and buoyancy terms
- void ComputeFacetForcesWithCache(bool onlyCache=false);
- void saveVtk (const char* folder);
+ void computeFacetForcesWithCache(bool onlyCache=false);
+ void saveVtk (const char* folder );
#ifdef XVIEW
- void Dessine_Triangulation ( Vue3D &Vue, RTriangulation &T );
- void Dessine_Short_Tesselation ( Vue3D &Vue, Tesselation &Tes );
+ void dessineTriangulation ( Vue3D &Vue, RTriangulation &T );
+ void dessineShortTesselation ( Vue3D &Vue, Tesselation &Tes );
#endif
- double Permeameter ( double P_Inf, double P_Sup, double Section, double DeltaY, const char *file );
- double Sample_Permeability( double& x_Min,double& x_Max ,double& y_Min,double& y_Max,double& z_Min,double& z_Max);
- double Compute_HydraulicRadius (Cell_handle cell, int j );
+ double permeameter ( double PInf, double PSup, double Section, double DeltaY, const char *file );
+ double samplePermeability( double& xMin,double& xMax ,double& yMin,double& yMax,double& zMin,double& zMax);
+ double computeHydraulicRadius (CellHandle cell, int j );
Real checkSphereFacetOverlap(const Sphere& v0, const Sphere& v1, const Sphere& v2);
double dotProduct ( Vecteur x, Vecteur y );
- double Compute_EffectiveRadius(Cell_handle cell, int j);
- double Compute_EquivalentRadius(Cell_handle cell, int j);
+ double computeEffectiveRadius(CellHandle cell, int j);
+ double computeEquivalentRadius(CellHandle cell, int j);
//return the list of constriction values
vector<double> getConstrictions();
vector<Constriction> getConstrictionsFull();
- void GenerateVoxelFile ( );
+ void generateVoxelFile ( );
void computeEdgesSurfaces();
Vector3r computeViscousShearForce(const Vector3r& deltaV, const int& edge_id, const Real& Rh);
Real computeNormalLubricationForce(const Real& deltaNormV, const Real& dist, const int& edge_id, const Real& eps, const Real& stiffness, const Real& dt, const Real& meanRad);
Vector3r computeShearLubricationForce(const Vector3r& deltaShearV, const Real& dist, const int& edge_id, const Real& eps, const Real& centerDist, const Real& meanRad);
-
- RTriangulation& Build_Triangulation ( Real x, Real y, Real z, Real radius, unsigned const id );
+ Vector3r computePumpTorque(const Vector3r& deltaShearAngV, const Real& dist, const int& edge_id, const Real& eps, const Real& meanRad );
+ Vector3r computeTwistTorque(const Vector3r& deltaNormAngV, const Real& dist, const int& edge_id, const Real& eps, const Real& meanRad );
+
+
+
+ RTriangulation& buildTriangulation ( Real x, Real y, Real z, Real radius, unsigned const id );
bool isInsideSphere ( double& x, double& y, double& z );
- void SliceField (const char *filename);
- void ComsolField();
+ void sliceField (const char *filename);
+ void comsolField();
- void Interpolate ( Tesselation& Tes, Tesselation& NewTes );
- virtual void Average_Relative_Cell_Velocity();
- void Average_Fluid_Velocity();
- void ApplySinusoidalPressure(RTriangulation& Tri, double Amplitude, double Average_Pressure, double load_intervals);
+ void interpolate ( Tesselation& Tes, Tesselation& NewTes );
+ virtual void averageRelativeCellVelocity();
+ void averageFluidVelocity();
+ void applySinusoidalPressure(RTriangulation& Tri, double amplitude, double averagePressure, double loadIntervals);
bool isOnSolid (double X, double Y, double Z);
double getPorePressure (double X, double Y, double Z);
- void measurePressureProfile(double Wall_up_y, double Wall_down_y);
+ void measurePressureProfile(double WallUpy, double WallDowny);
double averageSlicePressure(double Y);
double averagePressure();
double getCell (double X,double Y,double Z);
double boundaryFlux(unsigned int boundaryId);
- vector<Real> Average_Fluid_Velocity_On_Sphere(unsigned int Id_sph);
+ vector<Real> averageFluidVelocityOnSphere(unsigned int Id_sph);
//Solver?
int useSolver;//(0 : GaussSeidel, 1 : TAUCS, 2 : PARDISO, 3:CHOLMOD)
};
=== modified file 'lib/triangulation/FlowBoundingSphere.ipp'
--- lib/triangulation/FlowBoundingSphere.ipp 2014-02-03 16:10:48 +0000
+++ lib/triangulation/FlowBoundingSphere.ipp 2014-03-21 18:45:24 +0000
@@ -65,32 +65,32 @@
template <class Tesselation>
FlowBoundingSphere<Tesselation>::FlowBoundingSphere()
{
- x_min = 1000.0, x_max = -10000.0, y_min = 1000.0, y_max = -10000.0, z_min = 1000.0, z_max = -10000.0;
+ xMin = 1000.0, xMax = -10000.0, yMin = 1000.0, yMax = -10000.0, zMin = 1000.0, zMax = -10000.0;
currentTes = 0;
nOfSpheres = 0;
- SectionArea = 0, Height=0, Vtotale=0;
- vtk_infinite_vertices=0, vtk_infinite_cells=0;
+ sectionArea = 0, Height=0, vTotal=0;
+ vtkInfiniteVertices=0, vtkInfiniteCells=0;
VISCOSITY = 1;
fluidBulkModulus = 0;
- tess_based_force = true;
+ tessBasedForce = true;
for (int i=0;i<6;i++) boundsIds[i] = 0;
minPermLength=-1;
- SLIP_ON_LATERALS = false;//no-slip/symmetry conditions on lateral boundaries
+ slipOnLaterals = false;//no-slip/symmetry conditions on lateral boundaries
TOLERANCE = 1e-07;
RELAX = 1.9;
ks=0;
distance_correction = true;
clampKValues = true;
- meanKStat = true; K_opt_factor=0;
+ meanKStat = true; KOptFactor=0;
noCache=true;
pressureChanged=false;
computeAllCells=true;//might be turned false IF the code is reorganized (we can make a separate function to compute unitForceVectors outside Compute_Permeability) AND it really matters for CPU time
- DEBUG_OUT = true;
+ debugOut = true;
RAVERAGE = false; /** use the average between the effective radius (inscribed sphere in facet) and the equivalent (circle surface = facet fluid surface) **/
OUTPUT_BOUDARIES_RADII = false;
RAVERAGE = false; /** if true use the average between the effective radius (inscribed sphere in facet) and the equivalent (circle surface = facet fluid surface) **/
// areaR2Permeability=true;
- permeability_map = false;
+ permeabilityMap = false;
computedOnce=false;
minKdivKmean=0.0001;
maxKdivKmean=100.;
@@ -99,15 +99,15 @@
}
template <class Tesselation>
-void FlowBoundingSphere<Tesselation>::ResetNetwork() {T[0].Clear();noCache=true;}
+void FlowBoundingSphere<Tesselation>::resetNetwork() {T[0].Clear();noCache=true;}
template <class Tesselation>
-Tesselation& FlowBoundingSphere<Tesselation>::Compute_Action()
+Tesselation& FlowBoundingSphere<Tesselation>::computeAction()
{
- return Compute_Action(0,NULL,NULL);
+ return computeAction(0,NULL,NULL);
}
template <class Tesselation>
-Tesselation& FlowBoundingSphere<Tesselation>::Compute_Action(int argc, char *argv[ ], char *envp[ ])
+Tesselation& FlowBoundingSphere<Tesselation>::computeAction(int argc, char *argv[ ], char *envp[ ])
{
double factor = 1.001;
VectorR X, Y, Z, R;
@@ -128,24 +128,24 @@
R.push_back(factor*r);
nOfSpheres++;
Rmoy += r;
- x_min = min(x_min,x-r);
- x_max = max(x_max,x+r);
- y_min = min(y_min,y-r);
- y_max = max(y_max,y+r);
- z_min = min(z_min,z-r);
- z_max = max(z_max,z+r);
+ xMin = min(xMin,x-r);
+ xMax = max(xMax,x+r);
+ yMin = min(yMin,y-r);
+ yMax = max(yMax,y+r);
+ zMin = min(zMin,z-r);
+ zMax = max(zMax,z+r);
}
Rmoy /= nOfSpheres;
minPermLength = Rmoy*minLength;
- if (DEBUG_OUT) cout << "Rmoy = " << Rmoy << endl;
- if (DEBUG_OUT) cout << "x_min = " << x_min << " x_max = " << x_max << " y_min = " << y_min << " y_max = " << y_max << " y_max = " << z_min << " x_min = " << z_max << endl;
+ if (debugOut) cout << "Rmoy = " << Rmoy << endl;
+ if (debugOut) cout << "xMin = " << xMin << " xMax = " << xMax << " yMin = " << yMin << " yMax = " << yMax << " zMin = " << zMin << " zMax = " << zMax << endl;
- Vertex_handle Vh;
- Cell_handle neighbour_cell, cell, location;
+ VertexHandle Vh;
+ CellHandle neighbourCell, cell, location;
int V = X.size();
- if (DEBUG_OUT) cout << "V =" << V << "nOfSpheres = " << nOfSpheres << endl;
- if (DEBUG_OUT) cout << Tes.Max_id() << endl;
+ if (debugOut) cout << "V =" << V << "nOfSpheres = " << nOfSpheres << endl;
+ if (debugOut) cout << Tes.Max_id() << endl;
clock.top("loading spheres");
@@ -157,7 +157,7 @@
testT.insert(vs.begin(),vs.end());
clock.top("test speed");
- AddBoundingPlanes();
+ addBoundingPlanes();
for (int i=0; i<V; i++) {
int id = Tes.Max_id() +1;
Vh = Tes.insert(X[i],Y[i],Z[i],R[i],id); /** EMPILEMENT QUELCONQUE **/
@@ -166,25 +166,25 @@
Vue1.Dessine_Sphere(X[i],Y[i],Z[i], R[i], 15);
#endif
}
- Height = y_max-y_min;
- SectionArea = (x_max-x_min) * (z_max-z_min);
- Vtotale = (x_max-x_min) * (y_max-y_min) * (z_max-z_min);
+ Height = yMax-yMin;
+ sectionArea = (xMax-xMin) * (zMax-zMin);
+ vTotal = (xMax-xMin) * (yMax-yMin) * (zMax-zMin);
clock.top("Triangulation");
Tes.Compute();
clock.top("tesselation");
- boundary(y_min_id).flowCondition=0;
- boundary(y_max_id).flowCondition=0;
- boundary(y_min_id).value=0;
- boundary(y_max_id).value=1;
- Define_fictious_cells();
- clock.top("BoundaryConditions");
+ boundary(yMinId).flowCondition=0;
+ boundary(yMaxId).flowCondition=0;
+ boundary(yMinId).value=0;
+ boundary(yMaxId).value=1;
+ defineFictiousCells();
+ clock.top("boundaryConditions");
/** INITIALIZATION OF VOLUMES AND PRESSURES **/
- Finite_cells_iterator cell_end = Tri.finite_cells_end();
- for (Finite_cells_iterator cell = Tri.finite_cells_begin(); cell != cell_end; cell++) {
- cell->info().volume() = ( std::abs ( ( CGT::Tetraedre ( cell->vertex(0)->point(),cell->vertex(1)->point(),cell->vertex(2)->point(),cell->vertex(3)->point()).volume() ) ) );
+ FiniteCellsIterator cellEnd = Tri.finiteCellsEnd();
+ for (FiniteCellsIterator cell = Tri.finite_cells_begin(); cell != cellEnd; cell++) {
+ cell->info().volume() = ( std::abs ( ( CGT::Tetrahedron ( cell->vertex(0)->point(),cell->vertex(1)->point(),cell->vertex(2)->point(),cell->vertex(3)->point()).volume() ) ) );
cell->info().dv() = 0;
}
@@ -192,47 +192,47 @@
/** PERMEABILITY **/
/** START PERMEABILITY CALCULATION**/
- k_factor = 1;
- Compute_Permeability();
- clock.top("Compute_Permeability");
+ kFactor = 1;
+ computePermeability();
+ clock.top("computePermeability");
/** END PERMEABILITY CALCULATION**/
- if(DEBUG_OUT) cerr << "TOTAL VOID VOLUME: " << Vporale <<endl;
- if(DEBUG_OUT) cerr << "Porosity = " << V_porale_porosity / V_totale_porosity << endl;
+ if(debugOut) cerr << "TOTAL VOID VOLUME: " << vPoral <<endl;
+ if(debugOut) cerr << "Porosity = " << vPoralPorosity / vTotalePorosity << endl;
/** STATISTICS **/
- DisplayStatistics();
- clock.top("DisplayStatistics");
+ displayStatistics();
+ clock.top("displayStatistics");
/** START GAUSS SEIDEL */
// Boundary_Conditions ( Tri );
- double P_zero = abs((boundary(y_min_id).value-boundary(y_max_id).value)/2);
- Initialize_pressures( P_zero );
- clock.top("Initialize_pressures");
- GaussSeidel();
- clock.top("GaussSeidel");
+ double pZero = abs((boundary(yMinId).value-boundary(yMaxId).value)/2);
+ initializePressures( pZero );
+ clock.top("initializePressures");
+ gaussSeidel();
+ clock.top("gaussSeidel");
/** END GAUSS SEIDEL */
const char* file ="Permeability";
- ks = Permeameter(boundary(y_min_id).value, boundary(y_max_id).value, SectionArea, Height, file);
- clock.top("Permeameter");
+ ks = permeameter(boundary(yMinId).value, boundary(yMaxId).value, sectionArea, Height, file);
+ clock.top("permeameter");
- ComputeFacetForcesWithCache();
+ computeFacetForcesWithCache();
clock.top("Compute_Forces");
///*** VUE 3D ***///
#ifdef XVIEW
Vue1.SetCouleurSegments(0.1,0,1);
- Dessine_Short_Tesselation(Vue1, Tes);
+ dessineShortTesselation(Vue1, Tes);
Vue1.Affiche();
#endif
- if (SLIP_ON_LATERALS && DEBUG_OUT) cout << "SLIP CONDITION IS ACTIVATED" << endl;
- else if (DEBUG_OUT) cout << "NOSLIP CONDITION IS ACTIVATED" << endl;
+ if (slipOnLaterals && debugOut) cout << "SLIP CONDITION IS ACTIVATED" << endl;
+ else if (debugOut) cout << "NOSLIP CONDITION IS ACTIVATED" << endl;
// }
return Tes;
}
template <class Tesselation>
-Tesselation& FlowBoundingSphere<Tesselation>::LoadPositions(int argc, char *argv[ ], char *envp[ ])
+Tesselation& FlowBoundingSphere<Tesselation>::loadPositions(int argc, char *argv[ ], char *envp[ ])
{
double factor = 1.001;
VectorR X, Y, Z, R;
@@ -249,23 +249,23 @@
R.push_back(factor*r);
nOfSpheres++;
Rmoy += r;
- x_min = min(x_min,x-r);
- x_max = max(x_max,x+r);
- y_min = min(y_min,y-r);
- y_max = max(y_max,y+r);
- z_min = min(z_min,z-r);
- z_max = max(z_max,z+r);
+ xMin = min(xMin,x-r);
+ xMax = max(xMax,x+r);
+ yMin = min(yMin,y-r);
+ yMax = max(yMax,y+r);
+ zMin = min(zMin,z-r);
+ zMax = max(zMax,z+r);
}
Rmoy /= nOfSpheres;
minPermLength = Rmoy*minLength;
- Vertex_handle Vh;
- Cell_handle neighbour_cell, cell, location;
+ VertexHandle Vh;
+ CellHandle neighbourCell, cell, location;
int V = X.size();
- if (DEBUG_OUT) cout << "V =" << V << "nOfSpheres = " << nOfSpheres << endl;
- if (DEBUG_OUT) cout << Tes.Max_id() << endl;
+ if (debugOut) cout << "V =" << V << "nOfSpheres = " << nOfSpheres << endl;
+ if (debugOut) cout << Tes.Max_id() << endl;
- AddBoundingPlanes();
+ addBoundingPlanes();
for (int i=0; i<V; i++) {
int id = Tes.Max_id() +1;
Vh = Tes.insert(X[i],Y[i],Z[i],R[i],id); /** EMPILEMENT QUELCONQUE **/
@@ -274,43 +274,43 @@
Vue1.Dessine_Sphere(X[i],Y[i],Z[i], R[i], 15);
#endif
}
- Height = y_max-y_min;
- SectionArea = (x_max-x_min) * (z_max-z_min);
- Vtotale = (x_max-x_min) * (y_max-y_min) * (z_max-z_min);
+ Height = yMax-yMin;
+ sectionArea = (xMax-xMin) * (zMax-zMin);
+ vTotal = (xMax-xMin) * (yMax-yMin) * (zMax-zMin);
Tes.Compute();
- Define_fictious_cells();
+ defineFictiousCells();
return Tes;
}
template <class Tesselation>
-void FlowBoundingSphere<Tesselation>::Average_Relative_Cell_Velocity()
+void FlowBoundingSphere<Tesselation>::averageRelativeCellVelocity()
{
RTriangulation& Tri = T[noCache?(!currentTes):currentTes].Triangulation();
- Point pos_av_facet;
- int num_cells = 0;
- double facet_flow_rate = 0;
- Finite_cells_iterator cell_end = Tri.finite_cells_end();
- for ( Finite_cells_iterator cell = Tri.finite_cells_begin(); cell != cell_end; cell++ ) {
+ Point posAvFacet;
+ int numCells = 0;
+ double facetFlowRate = 0;
+ FiniteCellsIterator cellEnd = Tri.finite_cells_end();
+ for ( FiniteCellsIterator cell = Tri.finite_cells_begin(); cell != cellEnd; cell++ ) {
if (cell->info().isGhost) continue;
- cell->info().av_vel() =CGAL::NULL_VECTOR;
- num_cells++;
- Real tot_flow_rate = 0;//used to acount for influxes in elements where pressure is imposed
+ cell->info().averageVelocity() =CGAL::NULL_VECTOR;
+ numCells++;
+ Real totFlowRate = 0;//used to acount for influxes in elements where pressure is imposed
for ( int i=0; i<4; i++ ) if (!Tri.is_infinite(cell->neighbor(i))){
Vecteur Surfk = cell->info()-cell->neighbor(i)->info();
Real area = sqrt ( Surfk.squared_length() );
Surfk = Surfk/area;
Vecteur branch = cell->vertex ( facetVertices[i][0] )->point() - cell->info();
- pos_av_facet = (Point) cell->info() + ( branch*Surfk ) *Surfk;
- facet_flow_rate = (cell->info().k_norm())[i] * (cell->info().shiftedP() - cell->neighbor (i)->info().shiftedP());
- tot_flow_rate += facet_flow_rate;
- cell->info().av_vel() = cell->info().av_vel() + (facet_flow_rate) * ( pos_av_facet-CGAL::ORIGIN );
+ posAvFacet = (Point) cell->info() + ( branch*Surfk ) *Surfk;
+ facetFlowRate = (cell->info().kNorm())[i] * (cell->info().shiftedP() - cell->neighbor (i)->info().shiftedP());
+ totFlowRate += facetFlowRate;
+ cell->info().averageVelocity() = cell->info().averageVelocity() + (facetFlowRate) * ( posAvFacet-CGAL::ORIGIN );
}
//This is the influx term
- if (cell->info().Pcondition) cell->info().av_vel() = cell->info().av_vel() - (tot_flow_rate)*((Point) cell->info()-CGAL::ORIGIN );
+ if (cell->info().Pcondition) cell->info().averageVelocity() = cell->info().averageVelocity() - (totFlowRate)*((Point) cell->info()-CGAL::ORIGIN );
//now divide by volume
- cell->info().av_vel() = cell->info().av_vel() /abs(cell->info().volume());
+ cell->info().averageVelocity() = cell->info().averageVelocity() /abs(cell->info().volume());
}
}
@@ -320,8 +320,8 @@
bool FlowBoundingSphere<Tesselation>::isOnSolid (double X, double Y, double Z)
{
RTriangulation& Tri = T[currentTes].Triangulation();
- Finite_cells_iterator cell_end = Tri.finite_cells_end();
- for (Finite_cells_iterator cell = Tri.finite_cells_begin(); cell != cell_end; cell++) {
+ FiniteCellsIterator cellEnd = Tri.finiteCellsEnd();
+ for (FiniteCellsIterator cell = Tri.finite_cells_begin(); cell != cellEnd; cell++) {
for (int i=0; i<4; i++){
double radius = sqrt(cell->vertex(i)->point().weight());
if (X < (cell->vertex(i)->point().x()+radius) && X > (cell->vertex(i)->point().x()-radius)){
@@ -331,74 +331,74 @@
return false;
}
template <class Tesselation>
-void FlowBoundingSphere<Tesselation>::Average_Fluid_Velocity()
+void FlowBoundingSphere<Tesselation>::averageFluidVelocity()
{
- Average_Relative_Cell_Velocity();
+ averageRelativeCellVelocity();
RTriangulation& Tri = T[noCache?(!currentTes):currentTes].Triangulation();
- int num_vertex = 0;
- Finite_vertices_iterator vertices_end = Tri.finite_vertices_end();
- for (Finite_vertices_iterator V_it = Tri.finite_vertices_begin(); V_it != vertices_end; V_it++) {
- num_vertex++;}
-
- vector<Real> Volumes;
- vector<CGT::Vecteur> VelocityVolumes;
- VelocityVolumes.resize(num_vertex);
- Volumes.resize(num_vertex);
-
- for (Finite_vertices_iterator V_it = Tri.finite_vertices_begin(); V_it != vertices_end; V_it++) {
- VelocityVolumes[V_it->info().id()]=CGAL::NULL_VECTOR;
- Volumes[V_it->info().id()]=0.f;}
-
- Finite_cells_iterator cell_end = Tri.finite_cells_end();
- for ( Finite_cells_iterator cell = Tri.finite_cells_begin(); cell != cell_end; cell++ )
+ int numVertex = 0;
+ FiniteVerticesIterator verticesEnd = Tri.finite_vertices_end();
+ for (FiniteVerticesIterator vIt = Tri.finite_vertices_begin(); vIt != verticesEnd; vIt++) {
+ numVertex++;}
+
+ vector<Real> volumes;
+ vector<CGT::Vecteur> velocityVolumes;
+ velocityVolumes.resize(numVertex);
+ volumes.resize(numVertex);
+
+ for (FiniteVerticesIterator vIt = Tri.finite_vertices_begin(); vIt != verticesEnd; vIt++) {
+ velocityVolumes[vIt->info().id()]=CGAL::NULL_VECTOR;
+ volumes[vIt->info().id()]=0.f;}
+
+ FiniteCellsIterator cellEnd = Tri.finiteCellsEnd();
+ for ( FiniteCellsIterator cell = Tri.finite_cells_begin(); cell != cellEnd; cell++ )
{
if (cell->info().fictious()==0){
for (int i=0;i<4;i++){
- VelocityVolumes[cell->vertex(i)->info().id()] = VelocityVolumes[cell->vertex(i)->info().id()] + cell->info().av_vel()*cell->info().volume();
- Volumes[cell->vertex(i)->info().id()] = Volumes[cell->vertex(i)->info().id()] + cell->info().volume();}
+ velocityVolumes[cell->vertex(i)->info().id()] = velocityVolumes[cell->vertex(i)->info().id()] + cell->info().averageVelocity()*cell->info().volume();
+ volumes[cell->vertex(i)->info().id()] = volumes[cell->vertex(i)->info().id()] + cell->info().volume();}
}}
std::ofstream fluid_vel ("Velocity", std::ios::out);
- double Rx = (x_max-x_min) /10;
- double Ry = (y_max-y_min) /12;
- double Rz = (z_max-z_min) /20;
- Cell_handle cellula;
+ double Rx = (xMax-xMin) /10;
+ double Ry = (yMax-yMin) /12;
+ double Rz = (zMax-zMin) /20;
+ CellHandle cellula;
- Vecteur Velocity = CGAL::NULL_VECTOR;
+ Vecteur velocity = CGAL::NULL_VECTOR;
int i=0;
- for(double X=x_min+Rx;X<x_max;X+=Rx){
- for (double Y=y_min+Ry;Y<y_max;Y+=Ry){
- Velocity = CGAL::NULL_VECTOR; i=0;
- for (double Z=z_min+Rz;Z<z_max;Z+=Rz){
+ for(double X=xMin+Rx;X<xMax;X+=Rx){
+ for (double Y=yMin+Ry;Y<yMax;Y+=Ry){
+ velocity = CGAL::NULL_VECTOR; i=0;
+ for (double Z=zMin+Rz;Z<zMax;Z+=Rz){
cellula = Tri.locate(Point(X,Y,Z));
- for (int y=0;y<4;y++) {if (!cellula->vertex(y)->info().isFictious) {Velocity = Velocity + (VelocityVolumes[cellula->vertex(y)->info().id()]/Volumes[cellula->vertex(y)->info().id()]);i++;}}
- }Velocity = Velocity/i;
- fluid_vel << X << " " << Y << " " << Velocity << endl;
+ for (int y=0;y<4;y++) {if (!cellula->vertex(y)->info().isFictious) {velocity = velocity + (velocityVolumes[cellula->vertex(y)->info().id()]/volumes[cellula->vertex(y)->info().id()]);i++;}}
+ }velocity = velocity/i;
+ fluid_vel << X << " " << Y << " " << velocity << endl;
}}
}
template <class Tesselation>
-vector<Real> FlowBoundingSphere<Tesselation>::Average_Fluid_Velocity_On_Sphere(unsigned int Id_sph)
+vector<Real> FlowBoundingSphere<Tesselation>::averageFluidVelocityOnSphere(unsigned int Id_sph)
{
- Average_Relative_Cell_Velocity();
+ averageRelativeCellVelocity();
RTriangulation& Tri = T[noCache?(!currentTes):currentTes].Triangulation();
- Real Volumes; CGT::Vecteur VelocityVolumes;
+ Real volumes; CGT::Vecteur velocityVolumes;
vector<Real> result;
result.resize(3);
- VelocityVolumes=CGAL::NULL_VECTOR;
- Volumes=0.f;
+ velocityVolumes=CGAL::NULL_VECTOR;
+ volumes=0.f;
- Finite_cells_iterator cell_end = Tri.finite_cells_end();
- for ( Finite_cells_iterator cell = Tri.finite_cells_begin(); cell != cell_end; cell++ )
+ FiniteCellsIterator cellEnd = Tri.finite_cells_end();
+ for ( FiniteCellsIterator cell = Tri.finite_cells_begin(); cell != cellEnd; cell++ )
{
if (cell->info().fictious()==0){
for (unsigned int i=0;i<4;i++){
if (cell->vertex(i)->info().id()==Id_sph){
- VelocityVolumes = VelocityVolumes + cell->info().av_vel()*cell->info().volume();
- Volumes = Volumes + cell->info().volume();}}}}
+ velocityVolumes = velocityVolumes + cell->info().averageVelocity()*cell->info().volume();
+ volumes = volumes + cell->info().volume();}}}}
- for (int i=0;i<3;i++) result[i] += VelocityVolumes[i]/Volumes;
+ for (int i=0;i<3;i++) result[i] += velocityVolumes[i]/volumes;
return result;
}
template <class Tesselation>
@@ -406,7 +406,7 @@
{
if (noCache && T[!currentTes].Max_id()<=0) return 0;//the engine never solved anything
RTriangulation& Tri = T[noCache?(!currentTes):currentTes].Triangulation();
- Cell_handle cell = Tri.locate(Point(X,Y,Z));
+ CellHandle cell = Tri.locate(Point(X,Y,Z));
return cell->info().p();
}
@@ -415,28 +415,28 @@
{
if (noCache) {cerr<<"Triangulation does not exist. Waht did you do?!"<<endl; return -1;}
RTriangulation& Tri = T[noCache?(!currentTes):currentTes].Triangulation();
- Cell_handle cell = Tri.locate(Point(X,Y,Z));
+ CellHandle cell = Tri.locate(Point(X,Y,Z));
return cell->info().id;
}
template <class Tesselation>
-void FlowBoundingSphere<Tesselation>::measurePressureProfile(double Wall_up_y, double Wall_down_y)
+void FlowBoundingSphere<Tesselation>::measurePressureProfile(double WallUpy, double WallDowny)
{
if (noCache && T[!currentTes].Max_id()<=0) return;//the engine never solved anything
RTriangulation& Tri = T[noCache?(!currentTes):currentTes].Triangulation();
- Cell_handle permeameter;
+ CellHandle permeameter;
std::ofstream capture ("Pressure_profile", std::ios::app);
int intervals = 5;
int captures = 6;
- double Rz = (z_max-z_min)/intervals;
- double Ry = (Wall_up_y-Wall_down_y)/captures;
+ double Rz = (zMax-zMin)/intervals;
+ double Ry = (WallUpy-WallDowny)/captures;
- double X=(x_max+x_min)/2;
- double Y = Wall_down_y;
+ double X=(xMax+xMin)/2;
+ double Y = WallDowny;
double pressure = 0.f;
int cell=0;
for (int i=0; i<captures; i++){
- for (double Z=min(z_min,z_max); Z<=max(z_min,z_max); Z+=abs(Rz)) {
+ for (double Z=min(zMin,zMax); Z<=max(zMin,zMax); Z+=abs(Rz)) {
permeameter = Tri.locate(Point(X, Y, Z));
pressure+=permeameter->info().p();
cell++;
@@ -451,11 +451,11 @@
RTriangulation& Tri = T[currentTes].Triangulation();
double P_ave = 0.f;
int n = 0;
- double Ry = (y_max-y_min)/30;
- double Rx = (x_max-x_min)/30;
- double Rz = (z_max-z_min)/30;
- for (double X=x_min; X<=x_max+Ry/10; X=X+Rx) {
- for (double Z=z_min; Z<=z_max+Ry/10; Z=Z+Rz) {
+ double Ry = (yMax-yMin)/30;
+ double Rx = (xMax-xMin)/30;
+ double Rz = (zMax-zMin)/30;
+ for (double X=xMin; X<=xMax+Ry/10; X=X+Rx) {
+ for (double Z=zMin; Z<=zMax+Ry/10; Z=Z+Rz) {
P_ave+=Tri.locate(Point(X, Y, Z))->info().p();
n++;
}
@@ -469,7 +469,7 @@
RTriangulation& Tri = T[currentTes].Triangulation();
double P = 0.f, Ppond=0.f, Vpond=0.f;
int n = 0;
- for (Finite_cells_iterator cell = Tri.finite_cells_begin(); cell != Tri.finite_cells_end(); cell++) {
+ for (FiniteCellsIterator cell = Tri.finite_cells_begin(); cell != Tri.finite_cells_end(); cell++) {
P+=cell->info().p();
n++;
Ppond+=cell->info().p()*cell->info().volume();
@@ -482,33 +482,30 @@
template <class Tesselation>
-void FlowBoundingSphere<Tesselation>::ComputeFacetForcesWithCache(bool onlyCache)
+void FlowBoundingSphere<Tesselation>::computeFacetForcesWithCache(bool onlyCache)
{
RTriangulation& Tri = T[currentTes].Triangulation();
Vecteur nullVect(0,0,0);
//reset forces
- if (!onlyCache) for (Finite_vertices_iterator v = Tri.finite_vertices_begin(); v != Tri.finite_vertices_end(); ++v) v->info().forces=nullVect;
+ if (!onlyCache) for (FiniteVerticesIterator v = Tri.finite_vertices_begin(); v != Tri.finite_vertices_end(); ++v) v->info().forces=nullVect;
#ifdef parallel_forces
if (noCache) {
perVertexUnitForce.clear(); perVertexPressure.clear();
-// vector<const Vecteur*> exf; exf.reserve(20);
-// vector<const Real*> exp; exp.reserve(20);
- perVertexUnitForce.resize(T[currentTes].max_id+1);
- perVertexPressure.resize(T[currentTes].max_id+1);}
+ perVertexUnitForce.resize(T[currentTes].maxId+1);
+ perVertexPressure.resize(T[currentTes].maxId+1);}
#endif
- Cell_handle neighbour_cell;
- Vertex_handle mirror_vertex;
+ CellHandle neighbourCell;
+ VertexHandle mirrorVertex;
Vecteur tempVect;
//FIXME : Ema, be carefull with this (noCache), it needs to be turned true after retriangulation
- if (noCache) {for (VCell_iterator cell_it=T[currentTes].cellHandles.begin(); cell_it!=T[currentTes].cellHandles.end(); cell_it++){
-// if (noCache) for (Finite_cells_iterator cell = Tri.finite_cells_begin(); cell != cell_end; cell++) {
- Cell_handle& cell = *cell_it;
+ if (noCache) {for (VCellIterator cellIt=T[currentTes].cellHandles.begin(); cellIt!=T[currentTes].cellHandles.end(); cellIt++){
+ CellHandle& cell = *cellIt;
//reset cache
for (int k=0;k<4;k++) cell->info().unitForceVectors[k]=nullVect;
for (int j=0; j<4; j++) if (!Tri.is_infinite(cell->neighbor(j))) {
- neighbour_cell = cell->neighbor(j);
+ neighbourCell = cell->neighbor(j);
const Vecteur& Surfk = cell->info().facetSurfaces[j];
//FIXME : later compute that fluidSurf only once in hydraulicRadius, for now keep full surface not modified in cell->info for comparison with other forces schemes
//The ratio void surface / facet surface
@@ -525,14 +522,14 @@
cell->info().unitForceVectors[j]=cell->info().unitForceVectors[j]+ tempVect;
}
/// Apply weighted forces f_k=sqRad_k/sumSqRad*f
- Vecteur Facet_Unit_Force = -fluidSurfk*cell->info().solidSurfaces[j][3];
- Vecteur Facet_Force = cell->info().p()*Facet_Unit_Force;
+ Vecteur facetUnitForce = -fluidSurfk*cell->info().solidSurfaces[j][3];
+ Vecteur facetForce = cell->info().p()*facetUnitForce;
for (int y=0; y<3;y++) {
- cell->vertex(facetVertices[j][y])->info().forces = cell->vertex(facetVertices[j][y])->info().forces + Facet_Force*cell->info().solidSurfaces[j][y];
+ cell->vertex(facetVertices[j][y])->info().forces = cell->vertex(facetVertices[j][y])->info().forces + facetForce*cell->info().solidSurfaces[j][y];
//add to cached value
- cell->info().unitForceVectors[facetVertices[j][y]]=cell->info().unitForceVectors[facetVertices[j][y]]+Facet_Unit_Force*cell->info().solidSurfaces[j][y];
+ cell->info().unitForceVectors[facetVertices[j][y]]=cell->info().unitForceVectors[facetVertices[j][y]]+facetUnitForce*cell->info().solidSurfaces[j][y];
//uncomment to get total force / comment to get only viscous forces (Bruno)
if (!cell->vertex(facetVertices[j][y])->info().isFictious) {
cell->vertex(facetVertices[j][y])->info().forces = cell->vertex(facetVertices[j][y])->info().forces -facetNormal*cell->info().p()*crossSections[j][y];
@@ -550,15 +547,14 @@
if (onlyCache) return;
} else {//use cached values
#ifndef parallel_forces
- for (Finite_cells_iterator cell = Tri.finite_cells_begin(); cell != cell_end; cell++) {
+ for (FiniteCellsIterator cell = Tri.finite_cells_begin(); cell != cellEnd; cell++) {
for (int yy=0;yy<4;yy++) cell->vertex(yy)->info().forces = cell->vertex(yy)->info().forces + cell->info().unitForceVectors[yy]*cell->info().p();}
#else
#pragma omp parallel for num_threads(ompThreads)
- for (int vn=0; vn<= T[currentTes].max_id; vn++) {
+ for (int vn=0; vn<= T[currentTes].maxId; vn++) {
if (T[currentTes].vertexHandles[vn]==NULL) continue;
- Vertex_handle& v = T[currentTes].vertexHandles[vn];
-// for (Finite_vertices_iterator v = Tri.finite_vertices_begin(); v != Tri.finite_vertices_end(); ++v){
+ VertexHandle& v = T[currentTes].vertexHandles[vn];
const int& id = v->info().id();
Vecteur tf (0,0,0);
int k=0;
@@ -568,30 +564,30 @@
}
#endif
}
- if (DEBUG_OUT) {
- Vecteur TotalForce = nullVect;
- for (Finite_vertices_iterator v = Tri.finite_vertices_begin(); v != Tri.finite_vertices_end(); ++v) {
- if (!v->info().isFictious) TotalForce = TotalForce + v->info().forces;
- else if (boundary(v->info().id()).flowCondition==1) TotalForce = TotalForce + v->info().forces; }
- cout << "TotalForce = "<< TotalForce << endl;}
+ if (debugOut) {
+ Vecteur totalForce = nullVect;
+ for (FiniteVerticesIterator v = Tri.finite_vertices_begin(); v != Tri.finite_vertices_end(); ++v) {
+ if (!v->info().isFictious) totalForce = totalForce + v->info().forces;
+ else if (boundary(v->info().id()).flowCondition==1) totalForce = totalForce + v->info().forces; }
+ cout << "totalForce = "<< totalForce << endl;}
}
template <class Tesselation>
-void FlowBoundingSphere<Tesselation>::ComputeTetrahedralForces()
+void FlowBoundingSphere<Tesselation>::computeTetrahedralForces()
{
RTriangulation& Tri = T[currentTes].Triangulation();
- Finite_cells_iterator cell_end = Tri.finite_cells_end();
+ FiniteCellsIterator cellEnd = Tri.finiteCellsEnd();
Vecteur nullVect(0,0,0);
bool ref = Tri.finite_cells_begin()->info().isvisited;
- for (Finite_vertices_iterator v = Tri.finite_vertices_begin(); v != Tri.finite_vertices_end(); ++v) {
+ for (FiniteVerticesIterator v = Tri.finite_vertices_begin(); v != Tri.finite_vertices_end(); ++v) {
v->info().forces=nullVect;
}
- Cell_handle neighbour_cell;
- Vertex_handle mirror_vertex;
- for (Finite_cells_iterator cell = Tri.finite_cells_begin(); cell != cell_end; cell++) {
+ CellHandle neighbourCell;
+ VertexHandle mirrorVertex;
+ for (FiniteCellsIterator cell = Tri.finite_cells_begin(); cell != cellEnd; cell++) {
for (int j=0; j<4; j++) if (!Tri.is_infinite(cell->neighbor(j)) && cell->neighbor(j)->info().isvisited==ref) {
- neighbour_cell = cell->neighbor(j);
+ neighbourCell = cell->neighbor(j);
const Vecteur& Surfk = cell->info().facetSurfaces[j];
/// handle fictious vertex since we can get the projected surface easily here
if (cell->vertex(j)->info().isFictious) {
@@ -599,77 +595,66 @@
cell->vertex(j)->info().forces = cell->vertex(j)->info().forces -projSurf*boundary(cell->vertex(j)->info().id()).normal*cell->info().p();
}
/// handle the opposite fictious vertex (remember each facet is seen only once)
- mirror_vertex = neighbour_cell->vertex(Tri.mirror_index(cell,j));
- Vertex_Info& info = neighbour_cell->vertex(Tri.mirror_index(cell,j))->info();
+ mirrorVertex = neighbourCell->vertex(Tri.mirror_index(cell,j));
+ VertexInfo& info = neighbourCell->vertex(Tri.mirror_index(cell,j))->info();
if (info.isFictious) {
Real projSurf=abs(Surfk[boundary(info.id()).coordinate]);
- info.forces = info.forces - projSurf*boundary(info.id()).normal*neighbour_cell->info().p();
+ info.forces = info.forces - projSurf*boundary(info.id()).normal*neighbourCell->info().p();
}
/// Apply weighted forces f_k=sqRad_k/sumSqRad*f
- Vecteur Facet_Force = (neighbour_cell->info().p()-cell->info().p())*Surfk*cell->info().solidSurfaces[j][3];
+ Vecteur facetForce = (neighbourCell->info().p()-cell->info().p())*Surfk*cell->info().solidSurfaces[j][3];
for (int y=0; y<3;y++) {
- cell->vertex(facetVertices[j][y])->info().forces = cell->vertex(facetVertices[j][y])->info().forces + Facet_Force*cell->info().solidSurfaces[j][y];
+ cell->vertex(facetVertices[j][y])->info().forces = cell->vertex(facetVertices[j][y])->info().forces + facetForce*cell->info().solidSurfaces[j][y];
}
}
cell->info().isvisited=!ref;
}
-// if (DEBUG_OUT) cout << "tetrahedral scheme" <<endl;
-// Vecteur TotalForce = nullVect;
-// for (Finite_vertices_iterator v = Tri.finite_vertices_begin(); v != Tri.finite_vertices_end(); ++v) {
-// if (!v->info().isFictious) {
-// TotalForce = TotalForce + v->info().forces;
-// } else {
-// if (boundary(v->info().id()).flowCondition==1) TotalForce = TotalForce + v->info().forces;
-// if (DEBUG_OUT) cout << "fictious_id = " << v->info().id() << " force = " << v->info().forces << endl;
-// }
-// }
-// if (DEBUG_OUT) cout << "TotalForce = "<< TotalForce << endl;
}
template <class Tesselation>
-void FlowBoundingSphere<Tesselation>::ApplySinusoidalPressure(RTriangulation& Tri, double Amplitude, double Average_Pressure, double load_intervals)
+void FlowBoundingSphere<Tesselation>::applySinusoidalPressure(RTriangulation& Tri, double amplitude, double averagePressure, double loadIntervals)
{
- double step = 1/load_intervals;
- Vector_Cell tmp_cells;
- tmp_cells.resize(10000);
- VCell_iterator cells_it = tmp_cells.begin();
+ double step = 1/loadIntervals;
+ VectorCell tmpCells;
+ tmpCells.resize(10000);
+ VCellIterator cellsIt = tmpCells.begin();
for (double alpha=0; alpha<1.001; alpha+=step)
{
- VCell_iterator cells_end = Tri.incident_cells(T[currentTes].vertexHandles[y_max_id],cells_it);
- for (VCell_iterator it = tmp_cells.begin(); it != cells_end; it++)
+ VCellIterator cellsEnd = Tri.incident_cells(T[currentTes].vertexHandles[yMaxId],cellsIt);
+ for (VCellIterator it = tmpCells.begin(); it != cellsEnd; it++)
{
if(!Tri.is_infinite(*it)){
Point& p1 = (*it)->info();
- Cell_handle& cell = *it;
- if (p1.x()<x_min) cell->info().p() = Average_Pressure+Amplitude;
- else if (p1.x()>x_max) cell->info().p() = Average_Pressure-Amplitude;
- else if (p1.x()>(x_min+alpha*(x_max-x_min)) && p1.x()<(x_min+(alpha+step)*(x_max-x_min))) cell->info().p() = Average_Pressure + (Amplitude)*(cos(alpha*M_PI));
+ CellHandle& cell = *it;
+ if (p1.x()<xMin) cell->info().p() = averagePressure+amplitude;
+ else if (p1.x()>xMax) cell->info().p() = averagePressure-amplitude;
+ else if (p1.x()>(xMin+alpha*(xMax-xMin)) && p1.x()<(xMin+(alpha+step)*(xMax-xMin))) cell->info().p() = averagePressure + (amplitude)*(cos(alpha*M_PI));
}
}
}
}
template <class Tesselation>
-void FlowBoundingSphere<Tesselation>::Interpolate(Tesselation& Tes, Tesselation& NewTes)
+void FlowBoundingSphere<Tesselation>::interpolate(Tesselation& Tes, Tesselation& NewTes)
{
- Cell_handle old_cell;
+ CellHandle oldCell;
RTriangulation& Tri = Tes.Triangulation();
- for (typename Vector_Cell::iterator cell_it=NewTes.cellHandles.begin(); cell_it!=NewTes.cellHandles.end(); cell_it++){
- Cell_handle& new_cell = *cell_it;
- if (new_cell->info().Pcondition || new_cell->info().isGhost) continue;
+ for (typename VectorCell::iterator cellIt=NewTes.cellHandles.begin(); cellIt!=NewTes.cellHandles.end(); cellIt++){
+ CellHandle& newCell = *cellIt;
+ if (newCell->info().Pcondition || newCell->info().isGhost) continue;
Vecteur center ( 0,0,0 );
- if (new_cell->info().fictious()==0) for ( int k=0;k<4;k++ ) center= center + 0.25* (Tes.vertex(new_cell->vertex(k)->info().id())->point()-CGAL::ORIGIN);
+ if (newCell->info().fictious()==0) for ( int k=0;k<4;k++ ) center= center + 0.25* (Tes.vertex(newCell->vertex(k)->info().id())->point()-CGAL::ORIGIN);
else {
Real boundPos=0; int coord=0;
for ( int k=0;k<4;k++ ) {
- if (!new_cell->vertex (k)->info().isFictious) center= center+0.3333333333*(Tes.vertex(new_cell->vertex(k)->info().id())->point()-CGAL::ORIGIN);
+ if (!newCell->vertex (k)->info().isFictious) center= center+0.3333333333*(Tes.vertex(newCell->vertex(k)->info().id())->point()-CGAL::ORIGIN);
else {
- coord=boundary (new_cell->vertex(k)->info().id()).coordinate;
- boundPos=boundary (new_cell->vertex(k)->info().id()).p[coord];
+ coord=boundary (newCell->vertex(k)->info().id()).coordinate;
+ boundPos=boundary (newCell->vertex(k)->info().id()).p[coord];
}
}
center=Vecteur(coord==0?boundPos:center[0],coord==1?boundPos:center[1],coord==2?boundPos:center[2]);
}
- old_cell = Tri.locate(Point(center[0],center[1],center[2]));
- new_cell->info().p() = old_cell->info().shiftedP();
+ oldCell = Tri.locate(Point(center[0],center[1],center[2]));
+ newCell->info().p() = oldCell->info().shiftedP();
}
// Tes.Clear();//Don't reset to avoid segfault when getting pressure in scripts just after interpolation
}
@@ -693,35 +678,33 @@
}
template <class Tesselation>
-void FlowBoundingSphere<Tesselation>::Compute_Permeability()
+void FlowBoundingSphere<Tesselation>::computePermeability()
{
- if (DEBUG_OUT) cout << "----Computing_Permeability------" << endl;
+ if (debugOut) cout << "----Computing_Permeability------" << endl;
RTriangulation& Tri = T[currentTes].Triangulation();
- Vsolid_tot = 0, Vtotalissimo = 0, Vporale = 0, Ssolid_tot = 0, V_totale_porosity=0, V_porale_porosity=0;
- Finite_cells_iterator cell_end = Tri.finite_cells_end();
+ VSolidTot = 0, Vtotalissimo = 0, vPoral = 0, sSolidTot = 0, vTotalePorosity=0, vPoralPorosity=0;
+ FiniteCellsIterator cellEnd = Tri.finite_cells_end();
- Cell_handle neighbour_cell;
+ CellHandle neighbourCell;
double k=0, distance = 0, radius = 0, viscosity = VISCOSITY;
int surfneg=0;
int NEG=0, POS=0, pass=0;
bool ref = Tri.finite_cells_begin()->info().isvisited;
-// Vecteur n;
Real meanK=0, STDEV=0, meanRadius=0, meanDistance=0;
Real infiniteK=1e10;
-// double volume_sub_pore = 0.f;
- for (VCell_iterator cell_it=T[currentTes].cellHandles.begin(); cell_it!=T[currentTes].cellHandles.end(); cell_it++){
- Cell_handle& cell = *cell_it;
+ for (VCellIterator cellIt=T[currentTes].cellHandles.begin(); cellIt!=T[currentTes].cellHandles.end(); cellIt++){
+ CellHandle& cell = *cellIt;
Point& p1 = cell->info();
for (int j=0; j<4; j++) {
- neighbour_cell = cell->neighbor(j);
- Point& p2 = neighbour_cell->info();
- if (!Tri.is_infinite(neighbour_cell) && (neighbour_cell->info().isvisited==ref || computeAllCells)) {
+ neighbourCell = cell->neighbor(j);
+ Point& p2 = neighbourCell->info();
+ if (!Tri.is_infinite(neighbourCell) && (neighbourCell->info().isvisited==ref || computeAllCells)) {
//Compute and store the area of sphere-facet intersections for later use
- Vertex_handle W [3];
+ VertexHandle W [3];
for (int kk=0; kk<3; kk++) {
W[kk] = cell->vertex(facetVertices[j][kk]);
}
@@ -737,24 +720,19 @@
pass+=1;
Vecteur l = p1 - p2;
distance = sqrt(l.squared_length());
-// n = l/distance;
- if (!RAVERAGE) radius = 2* Compute_HydraulicRadius(cell, j);
- else radius = (Compute_EffectiveRadius(cell, j)+Compute_EquivalentRadius(cell,j))*0.5;
+ if (!RAVERAGE) radius = 2* computeHydraulicRadius(cell, j);
+ else radius = (computeEffectiveRadius(cell, j)+computeEquivalentRadius(cell,j))*0.5;
if (radius<0) NEG++;
else POS++;
if (radius==0) {
cout << "INS-INS PROBLEM!!!!!!!" << endl;
}
-// Real h,d;
Real fluidArea=0;
-// int test=0;
if (distance!=0) {
if (minPermLength>0 && distance_correction) distance=max(minPermLength,distance);
const Vecteur& Surfk = cell->info().facetSurfaces[j];
Real area = sqrt(Surfk.squared_length());
const Vecteur& crossSections = cell->info().facetSphereCrossSections[j];
-// if (areaR2Permeability){
-// Real m1=sqrt((cross_product((v0-v1),v2-v1)).squared_length()/(v2-v1).squared_length());
Real S0=0;
S0=checkSphereFacetOverlap(v0,v1,v2);
if (S0==0) S0=checkSphereFacetOverlap(v1,v2,v0);
@@ -769,35 +747,25 @@
meanDistance += distance;
meanRadius += radius;
- meanK += k*k_factor;
+ meanK += k*kFactor;
- if (k<0 && DEBUG_OUT) {surfneg+=1;
+ if (k<0 && debugOut) {surfneg+=1;
cout<<"__ k<0 __"<<k<<" "<<" fluidArea "<<fluidArea<<" area "<<area<<" "<<crossSections[0]<<" "<<crossSections[1]<<" "<<crossSections[2] <<" "<<W[0]->info().id()<<" "<<W[1]->info().id()<<" "<<W[2]->info().id()<<" "<<p1<<" "<<p2<<" test "<<endl;}
} else {cout <<"infinite K1!"<<endl; k = infiniteK;}//Will be corrected in the next loop
- (cell->info().k_norm())[j]= k*k_factor;
-// (neighbour_cell->info().k_norm())[Tri.mirror_index(cell, j)]= k*k_factor;
- if (!neighbour_cell->info().isGhost) (neighbour_cell->info().k_norm())[Tri.mirror_index(cell, j)]= (cell->info().k_norm())[j];
-
-
-// if(permeability_map){
-// Cell_handle c = cell;
-// cell->info().s = cell->info().s + k*distance/fluidArea*this->Volume_Pore_VoronoiFraction (c,j);
-// volume_sub_pore += this->Volume_Pore_VoronoiFraction (c,j);}
-//
+ (cell->info().kNorm())[j]= k*kFactor;
+ if (!neighbourCell->info().isGhost) (neighbourCell->info().kNorm())[Tri.mirror_index(cell, j)]= (cell->info().kNorm())[j];
}
}
cell->info().isvisited = !ref;
-// if(permeability_map){cell->info().s = cell->info().s/volume_sub_pore;
-// volume_sub_pore = 0.f;}
}
- if (DEBUG_OUT) cout<<"surfneg est "<<surfneg<<endl;
+ if (debugOut) cout<<"surfneg est "<<surfneg<<endl;
meanK /= pass;
meanRadius /= pass;
meanDistance /= pass;
- Real globalK=k_factor*meanDistance*Vporale/(Ssolid_tot*8.*viscosity);//An approximate value of macroscopic permeability, for clamping local values below
- if (DEBUG_OUT) {
+ Real globalK=kFactor*meanDistance*vPoral/(sSolidTot*8.*viscosity);//An approximate value of macroscopic permeability, for clamping local values below
+ if (debugOut) {
cout << "PassCompK = " << pass << endl;
cout << "meanK = " << meanK << endl;
cout << "globalK = " << globalK << endl;
@@ -809,20 +777,20 @@
ref = Tri.finite_cells_begin()->info().isvisited;
pass=0;
- if (clampKValues) for (VCell_iterator cell_it=T[currentTes].cellHandles.begin(); cell_it!=T[currentTes].cellHandles.end(); cell_it++){
- Cell_handle& cell = *cell_it;
+ if (clampKValues) for (VCellIterator cellIt=T[currentTes].cellHandles.begin(); cellIt!=T[currentTes].cellHandles.end(); cellIt++){
+ CellHandle& cell = *cellIt;
for (int j=0; j<4; j++) {
- neighbour_cell = cell->neighbor(j);
- if (!Tri.is_infinite(neighbour_cell) && neighbour_cell->info().isvisited==ref) {
+ neighbourCell = cell->neighbor(j);
+ if (!Tri.is_infinite(neighbourCell) && neighbourCell->info().isvisited==ref) {
pass++;
- (cell->info().k_norm())[j] = max(minKdivKmean*globalK ,min((cell->info().k_norm())[j], maxKdivKmean*globalK));
- (neighbour_cell->info().k_norm())[Tri.mirror_index(cell, j)]=(cell->info().k_norm())[j];
+ (cell->info().kNorm())[j] = max(minKdivKmean*globalK ,min((cell->info().kNorm())[j], maxKdivKmean*globalK));
+ (neighbourCell->info().kNorm())[Tri.mirror_index(cell, j)]=(cell->info().kNorm())[j];
}
}
}
- if (DEBUG_OUT) cout << "PassKcorrect = " << pass << endl;
+ if (debugOut) cout << "PassKcorrect = " << pass << endl;
- if (DEBUG_OUT) cout << "POS = " << POS << " NEG = " << NEG << " pass = " << pass << endl;
+ if (debugOut) cout << "POS = " << POS << " NEG = " << NEG << " pass = " << pass << endl;
// A loop to compute the standard deviation of the local K distribution, and use it to include/exclude K values higher then (meanK +/- K_opt_factor*STDEV)
if (meanKStat)
@@ -830,50 +798,50 @@
std::ofstream k_opt_file("k_stdev.txt" ,std::ios::out);
ref = Tri.finite_cells_begin()->info().isvisited;
pass=0;
- for (Finite_cells_iterator cell = Tri.finite_cells_begin(); cell != cell_end; cell++) {
+ for (FiniteCellsIterator cell = Tri.finite_cells_begin(); cell != cellEnd; cell++) {
for (int j=0; j<4; j++) {
- neighbour_cell = cell->neighbor(j);
- if (!Tri.is_infinite(neighbour_cell) && neighbour_cell->info().isvisited==ref) {
+ neighbourCell = cell->neighbor(j);
+ if (!Tri.is_infinite(neighbourCell) && neighbourCell->info().isvisited==ref) {
pass++;
- STDEV += pow(((cell->info().k_norm())[j]-meanK),2);
+ STDEV += pow(((cell->info().kNorm())[j]-meanK),2);
}
}cell->info().isvisited = !ref;
}
STDEV = sqrt(STDEV/pass);
- if (DEBUG_OUT) cout << "PassSTDEV = " << pass << endl;
+ if (debugOut) cout << "PassSTDEV = " << pass << endl;
cout << "STATISTIC K" << endl;
- double k_min = 0, k_max = meanK + K_opt_factor*STDEV;
+ double k_min = 0, k_max = meanK + KOptFactor*STDEV;
cout << "Kmoy = " << meanK << " Standard Deviation = " << STDEV << endl;
cout << "kmin = " << k_min << " kmax = " << k_max << endl;
ref = Tri.finite_cells_begin()->info().isvisited;
pass=0;
- for (Finite_cells_iterator cell = Tri.finite_cells_begin(); cell != cell_end; cell++) {
+ for (FiniteCellsIterator cell = Tri.finite_cells_begin(); cell != cellEnd; cell++) {
for (int j=0; j<4; j++) {
- neighbour_cell = cell->neighbor(j);
- if (!Tri.is_infinite(neighbour_cell) && neighbour_cell->info().isvisited==ref) {
+ neighbourCell = cell->neighbor(j);
+ if (!Tri.is_infinite(neighbourCell) && neighbourCell->info().isvisited==ref) {
pass+=1;
- if ((cell->info().k_norm())[j]>k_max) {
- (cell->info().k_norm())[j]=k_max;
- (neighbour_cell->info().k_norm())[Tri.mirror_index(cell, j)]= (cell->info().k_norm())[j];
+ if ((cell->info().kNorm())[j]>k_max) {
+ (cell->info().kNorm())[j]=k_max;
+ (neighbourCell->info().kNorm())[Tri.mirror_index(cell, j)]= (cell->info().kNorm())[j];
}
- k_opt_file << K_opt_factor << " " << (cell->info().k_norm())[j] << endl;
+ k_opt_file << KOptFactor << " " << (cell->info().kNorm())[j] << endl;
}
}cell->info().isvisited=!ref;
}
- if (DEBUG_OUT) cout << "PassKopt = " << pass << endl;
+ if (debugOut) cout << "PassKopt = " << pass << endl;
}
- if (DEBUG_OUT) {
- Finite_vertices_iterator vertices_end = Tri.finite_vertices_end();
+ if (debugOut) {
+ FiniteVerticesIterator verticesEnd = Tri.finite_vertices_end();
Real Vgrains = 0;
int grains=0;
- for (Finite_vertices_iterator V_it = Tri.finite_vertices_begin(); V_it != vertices_end; V_it++) {
- if (!V_it->info().isFictious && !V_it->info().isGhost) {
+ for (FiniteVerticesIterator vIt = Tri.finite_vertices_begin(); vIt != verticesEnd; vIt++) {
+ if (!vIt->info().isFictious && !vIt->info().isGhost) {
grains +=1;
- Vgrains += 1.33333333 * M_PI * pow(V_it->point().weight(),1.5);}}
- cout<<grains<<"grains - " <<"Vtotale = " << Vtotale << " Vgrains = " << Vgrains << " Vporale1 = " << (Vtotale-Vgrains) << endl;
- cout << "Vtotalissimo = " << Vtotalissimo/2 << " Vsolid_tot = " << Vsolid_tot/2 << " Vporale2 = " << Vporale/2 << " Ssolid_tot = " << Ssolid_tot << endl<< endl;
+ Vgrains += 1.33333333 * M_PI * pow(vIt->point().weight(),1.5);}}
+ cout<<grains<<"grains - " <<"vTotal = " << vTotal << " Vgrains = " << Vgrains << " vPoral1 = " << (vTotal-Vgrains) << endl;
+ cout << "Vtotalissimo = " << Vtotalissimo/2 << " VSolidTot = " << VSolidTot/2 << " vPoral2 = " << vPoral/2 << " sSolidTot = " << sSolidTot << endl<< endl;
if (!RAVERAGE) cout << "------Hydraulic Radius is used for permeability computation------" << endl << endl;
else cout << "------Average Radius is used for permeability computation------" << endl << endl;
cout << "-----Computed_Permeability-----" << endl;}
@@ -884,12 +852,12 @@
{
RTriangulation& Tri = T[currentTes].Triangulation();
vector<double> constrictions;
- for (Finite_facets_iterator f_it=Tri.finite_facets_begin(); f_it != Tri.finite_facets_end();f_it++){
+ for (FiniteFacetsIterator f_it=Tri.finite_facets_begin(); f_it != Tri.finite_facets_end();f_it++){
//in the periodic case, we skip facets with lowest id out of the base period
if ( ((f_it->first->info().index < f_it->first->neighbor(f_it->second)->info().index) && f_it->first->info().isGhost)
|| ((f_it->first->info().index > f_it->first->neighbor(f_it->second)->info().index) && f_it->first->neighbor(f_it->second)->info().isGhost)
|| f_it->first->info().index == 0 || f_it->first->neighbor(f_it->second)->info().index == 0) continue;
- constrictions.push_back(Compute_EffectiveRadius(f_it->first, f_it->second));
+ constrictions.push_back(computeEffectiveRadius(f_it->first, f_it->second));
}
return constrictions;
}
@@ -899,7 +867,7 @@
{
RTriangulation& Tri = T[currentTes].Triangulation();
vector<Constriction> constrictions;
- for (Finite_facets_iterator f_it=Tri.finite_facets_begin(); f_it != Tri.finite_facets_end();f_it++){
+ for (FiniteFacetsIterator f_it=Tri.finite_facets_begin(); f_it != Tri.finite_facets_end();f_it++){
//in the periodic case, we skip facets with lowest id out of the base period
if ( ((f_it->first->info().index < f_it->first->neighbor(f_it->second)->info().index) && f_it->first->info().isGhost)
|| ((f_it->first->info().index > f_it->first->neighbor(f_it->second)->info().index) && f_it->first->neighbor(f_it->second)->info().isGhost)
@@ -907,7 +875,7 @@
vector<double> rn;
const Vecteur& normal = f_it->first->info().facetSurfaces[f_it->second];
if (!normal[0] && !normal[1] && !normal[2]) continue;
- rn.push_back(Compute_EffectiveRadius(f_it->first, f_it->second));
+ rn.push_back(computeEffectiveRadius(f_it->first, f_it->second));
rn.push_back(normal[0]);
rn.push_back(normal[1]);
rn.push_back(normal[2]);
@@ -918,7 +886,7 @@
}
template <class Tesselation>
-double FlowBoundingSphere<Tesselation>::Compute_EffectiveRadius(Cell_handle cell, int j)
+double FlowBoundingSphere<Tesselation>::computeEffectiveRadius(CellHandle cell, int j)
{
RTriangulation& Tri = T[currentTes].Triangulation();
if (Tri.is_infinite(cell->neighbor(j))) return 0;
@@ -927,7 +895,6 @@
Vecteur x = B/sqrt(B.squared_length());
Vecteur C = cell->vertex(facetVertices[j][2])->point().point()-cell->vertex(facetVertices[j][0])->point().point();
Vecteur z = CGAL::cross_product(x,C);
-// z = z/sqrt(z.squared_length());
Vecteur y = CGAL::cross_product(x,z);
y = y/sqrt(y.squared_length());
@@ -958,34 +925,34 @@
}
template <class Tesselation>
-double FlowBoundingSphere<Tesselation>::Compute_EquivalentRadius(Cell_handle cell, int j)
+double FlowBoundingSphere<Tesselation>::computeEquivalentRadius(CellHandle cell, int j)
{
Real fluidSurf = sqrt(cell->info().facetSurfaces[j].squared_length())*cell->info().facetFluidSurfacesRatio[j];
return sqrt(fluidSurf/M_PI);
}
template <class Tesselation>
-double FlowBoundingSphere<Tesselation>::Compute_HydraulicRadius(Cell_handle cell, int j)
+double FlowBoundingSphere<Tesselation>::computeHydraulicRadius(CellHandle cell, int j)
{
RTriangulation& Tri = T[currentTes].Triangulation();
if (Tri.is_infinite(cell->neighbor(j))) return 0;
- double Vpore = this->Volume_Pore_VoronoiFraction(cell, j);
- double Ssolid = this->Surface_Solid_Pore(cell, j, SLIP_ON_LATERALS, /*reuse the same facet data*/ true);
+ double Vpore = this->volumePoreVoronoiFraction(cell, j);
+ double Ssolid = this->surfaceSolidPore(cell, j, slipOnLaterals, /*reuse the same facet data*/ true);
//handle symmetry (tested ok)
- if (SLIP_ON_LATERALS && facetNFictious>0) {
+ if (slipOnLaterals && facetNFictious>0) {
//! Include a multiplier so that permeability will be K/2 or K/4 in symmetry conditions
Real mult= facetNFictious==1 ? multSym1 : multSym2;
return Vpore/Ssolid*mult;}
return Vpore/Ssolid;
}
template <class Tesselation>
-void FlowBoundingSphere<Tesselation>::Initialize_pressures( double P_zero )
+void FlowBoundingSphere<Tesselation>::initializePressures( double pZero )
{
RTriangulation& Tri = T[currentTes].Triangulation();
- Finite_cells_iterator cell_end = Tri.finite_cells_end();
+ FiniteCellsIterator cellEnd = Tri.finite_cells_end();
- for (Finite_cells_iterator cell = Tri.finite_cells_begin(); cell != cell_end; cell++){
- cell->info().p() = P_zero; cell->info().dv()=0;}
+ for (FiniteCellsIterator cell = Tri.finite_cells_begin(); cell != cellEnd; cell++){
+ cell->info().p() = pZero; cell->info().dv()=0;}
for (int bound=0; bound<6;bound++) {
int& id = *boundsIds[bound];
@@ -993,36 +960,36 @@
if (id<0) continue;
Boundary& bi = boundary(id);
if (!bi.flowCondition) {
- Vector_Cell tmp_cells;
- tmp_cells.resize(10000);
- VCell_iterator cells_it = tmp_cells.begin();
- VCell_iterator cells_end = Tri.incident_cells(T[currentTes].vertexHandles[id],cells_it);
- for (VCell_iterator it = tmp_cells.begin(); it != cells_end; it++){
+ VectorCell tmpCells;
+ tmpCells.resize(10000);
+ VCellIterator cells_it = tmpCells.begin();
+ VCellIterator cells_end = Tri.incident_cells(T[currentTes].vertexHandles[id],cells_it);
+ for (VCellIterator it = tmpCells.begin(); it != cells_end; it++){
(*it)->info().p() = bi.value;(*it)->info().Pcondition=true;
boundingCells[bound].push_back(*it);
}
}
}
- IPCells.clear();
+ ipCells.clear();
for (unsigned int n=0; n<imposedP.size();n++) {
- Cell_handle cell=Tri.locate(imposedP[n].first);
+ CellHandle cell=Tri.locate(imposedP[n].first);
//check redundancy
- for (unsigned int kk=0;kk<IPCells.size();kk++){
- if (cell==IPCells[kk]) cerr<<"Two imposed pressures fall in the same cell."<<endl;
+ for (unsigned int kk=0;kk<ipCells.size();kk++){
+ if (cell==ipCells[kk]) cerr<<"Two imposed pressures fall in the same cell."<<endl;
else if (cell->info().Pcondition) cerr<<"Imposed pressure fall in a boundary condition."<<endl;}
- IPCells.push_back(cell);
+ ipCells.push_back(cell);
cell->info().p()=imposedP[n].second;
cell->info().Pcondition=true;}
pressureChanged=false;
- IFCells.clear();
+ ifCells.clear();
for (unsigned int n=0; n<imposedF.size();n++) {
- Cell_handle cell=Tri.locate(imposedF[n].first);
+ CellHandle cell=Tri.locate(imposedF[n].first);
//check redundancy
- for (unsigned int kk=0;kk<IPCells.size();kk++){
- if (cell==IPCells[kk]) cerr<<"Both flux and pressure are imposed in the same cell."<<endl;
+ for (unsigned int kk=0;kk<ipCells.size();kk++){
+ if (cell==ipCells[kk]) cerr<<"Both flux and pressure are imposed in the same cell."<<endl;
else if (cell->info().Pcondition) cerr<<"Imposed flux fall in a pressure boundary condition."<<endl;}
- IFCells.push_back(cell);
+ ifCells.push_back(cell);
cell->info().Pcondition=false;}
}
@@ -1036,20 +1003,20 @@
if (id<0) continue;
Boundary& bi = boundary(id);
if (!bi.flowCondition) {
- for (VCell_iterator it = boundingCells[bound].begin(); it != boundingCells[bound].end(); it++){
+ for (VCellIterator it = boundingCells[bound].begin(); it != boundingCells[bound].end(); it++){
(*it)->info().p() = bi.value; (*it)->info().Pcondition=true;
}
}
}
for (unsigned int n=0; n<imposedP.size();n++) {
- IPCells[n]->info().p()=imposedP[n].second;
- IPCells[n]->info().Pcondition=true;}
+ ipCells[n]->info().p()=imposedP[n].second;
+ ipCells[n]->info().Pcondition=true;}
pressureChanged=false;
return true;
}
template <class Tesselation>
-void FlowBoundingSphere<Tesselation>::GaussSeidel(Real dt)
+void FlowBoundingSphere<Tesselation>::gaussSeidel(Real dt)
{
reApplyBoundaryConditions();
RTriangulation& Tri = T[currentTes].Triangulation();
@@ -1066,18 +1033,18 @@
omp_set_num_threads(num_threads);
#endif
- if(DEBUG_OUT){ cout << "tolerance = " << tolerance << endl;
+ if(debugOut){ cout << "tolerance = " << tolerance << endl;
cout << "relax = " << relax << endl;}
vector<Real> t_sum_p, t_dp_max, t_sum_dp, t_p_max;
t_sum_dp.resize(num_threads);
t_dp_max.resize(num_threads);
t_p_max.resize(num_threads);
t_sum_p.resize(num_threads);
- Finite_cells_iterator cell_end = Tri.finite_cells_end();
+ FiniteCellsIterator cellEnd = Tri.finite_cells_end();
#ifdef GS_OPEN_MP
- vector<Finite_cells_iterator> cells_its;
- for (Finite_cells_iterator cell = Tri.finite_cells_begin(); cell != cell_end; cell++) if ( !cell->info().Pcondition ) cells_its.push_back(cell);
- int num_cells=cells_its.size();
+ vector<FiniteCellsIterator> cells_its;
+ for (FiniteCellsIterator cell = Tri.finite_cells_begin(); cell != cellEnd; cell++) if ( !cell->info().Pcondition ) cells_its.push_back(cell);
+ int numCells=cells_its.size();
cout<<"cells_its.size() "<<cells_its.size();
#endif
// #pragma omp parallel shared(t_sum_dp, t_dp_max, sum_p, sum_dp,cells_its, j, Tri, relax)
@@ -1085,20 +1052,20 @@
do {
int cell2=0; dp_max = 0;p_max = 0;p_moy=0;sum_p=0;sum_dp=0;
#ifdef GS_OPEN_MP
- cell2=num_cells;
+ cell2=numCells;
for (int ii=0;ii<num_threads;ii++) t_p_max[ii] =0;
for (int ii=0;ii<num_threads;ii++) t_dp_max[ii] =0;
for (int ii=0;ii<num_threads;ii++) t_sum_p[ii]=0;
for (int ii=0;ii<num_threads;ii++) t_sum_dp[ii]=0;
int kk=0;
- const int num_cells2 = num_cells;
+ const int numCells2 = numCells;
#pragma omp parallel for private(dp, m, n, kk) shared(tolerance, t_sum_dp, t_dp_max, sum_p, sum_dp,cells_its, j, Tri, relax) schedule(dynamic, 1000)
- for (kk=0; kk<num_cells2; kk++) {
- const Finite_cells_iterator& cell = cells_its[kk];
+ for (kk=0; kk<numCells2; kk++) {
+ const FiniteCellsIterator& cell = cells_its[kk];
{
#else
int bb=-1;
- for (Finite_cells_iterator cell = Tri.finite_cells_begin(); cell != cell_end; cell++) {
+ for (FiniteCellsIterator cell = Tri.finite_cells_begin(); cell != cellEnd; cell++) {
bb++;
if ( !cell->info().Pcondition ) {
cell2++;
@@ -1110,29 +1077,27 @@
/// COMPRESSIBLE:
if ( compressible ) {
compFlowFactor = fluidBulkModulus*dt*cell->info().invVoidVolume();
- m += compFlowFactor*(cell->info().k_norm())[j2] * cell->neighbor(j2)->info().p();
- if (j==0) n +=compFlowFactor*(cell->info().k_norm())[j2];
+ m += compFlowFactor*(cell->info().kNorm())[j2] * cell->neighbor(j2)->info().p();
+ if (j==0) n +=compFlowFactor*(cell->info().kNorm())[j2];
} else {
/// INCOMPRESSIBLE
- m += (cell->info().k_norm())[j2] * cell->neighbor(j2)->info().p();
- if ( isinf(m) && j<10 ) cout << "(cell->info().k_norm())[j2] = " << (cell->info().k_norm())[j2] << " cell->neighbor(j2)->info().p() = " << cell->neighbor(j2)->info().p() << endl;
- if (j==0) n += (cell->info().k_norm())[j2];
+ m += (cell->info().kNorm())[j2] * cell->neighbor(j2)->info().p();
+ if ( isinf(m) && j<10 ) cout << "(cell->info().kNorm())[j2] = " << (cell->info().kNorm())[j2] << " cell->neighbor(j2)->info().p() = " << cell->neighbor(j2)->info().p() << endl;
+ if (j==0) n += (cell->info().kNorm())[j2];
}
}
}
dp = cell->info().p();
if (n!=0 || j!=0) {
- if (j==0) { if (compressible) cell->info().inv_sum_k=1/(1+n); else cell->info().inv_sum_k=1/n; }
+ if (j==0) { if (compressible) cell->info().invSumK=1/(1+n); else cell->info().invSumK=1/n; }
if ( compressible ) {
/// COMPRESSIBLE cell->info().p() = ( (previousP - compFlowFactor*cell->info().dv()) + m ) / n ;
- cell->info().p() = ( ((previousP[bb] - ((fluidBulkModulus*dt*cell->info().invVoidVolume())*(cell->info().dv()))) + m) * cell->info().inv_sum_k - cell->info().p()) * relax + cell->info().p();
+ cell->info().p() = ( ((previousP[bb] - ((fluidBulkModulus*dt*cell->info().invVoidVolume())*(cell->info().dv()))) + m) * cell->info().invSumK - cell->info().p()) * relax + cell->info().p();
} else {
/// INCOMPRESSIBLE cell->info().p() = - ( cell->info().dv() - m ) / ( n ) = ( -cell.info().dv() + m ) / n ;
- cell->info().p() = (- (cell->info().dv() - m) * cell->info().inv_sum_k - cell->info().p()) * relax + cell->info().p();
+ cell->info().p() = (- (cell->info().dv() - m) * cell->info().invSumK - cell->info().p()) * relax + cell->info().p();
}
#ifdef GS_OPEN_MP
-// double r = sqrt(sqrt(sqrt(cell->info().p())/(1+sqrt(cell->info().p()))));
-// if (j % 100 == 0) cout<<"cell->info().p() "<<cell->info().p()<<" vs. "<< (- (cell->info().dv() - m) / (n) - cell->info().p())* relax<<endl;
#endif
}
dp -= cell->info().p();
@@ -1156,7 +1121,6 @@
for (int ii=0;ii<num_threads;ii++) dp_max =max(dp_max, t_dp_max[ii]);
for (int ii=0;ii<num_threads;ii++) sum_p+=t_sum_p[ii];
for (int ii=0;ii<num_threads;ii++) sum_dp+=t_sum_dp[ii];
-// cerr<< p_max<< " "<<dp_max<<" "<<sum_p<<" "<<sum_dp<<endl;
#endif
p_moy = sum_p/cell2;
@@ -1171,9 +1135,8 @@
#endif
}
- if (DEBUG_OUT) {cout << "pmax " << p_max << "; pmoy : " << p_moy << endl;
+ if (debugOut) {cout << "pmax " << p_max << "; pmoy : " << p_moy << endl;
cout << "iteration " << j <<"; erreur : " << dp_max/p_max << endl;}
-// iter << j << " " << dp_max/p_max << endl;
computedOnce=true;
}
@@ -1183,23 +1146,23 @@
RTriangulation& Tri = T[currentTes].Triangulation();
double Q1=0;
- Vector_Cell tmp_cells;
- tmp_cells.resize(10000);
- VCell_iterator cells_it = tmp_cells.begin();
+ VectorCell tmpCells;
+ tmpCells.resize(10000);
+ VCellIterator cells_it = tmpCells.begin();
- VCell_iterator cell_up_end = Tri.incident_cells(T[currentTes].vertexHandles[boundaryId],cells_it);
- for (VCell_iterator it = tmp_cells.begin(); it != cell_up_end; it++)
+ VCellIterator cell_up_end = Tri.incident_cells(T[currentTes].vertexHandles[boundaryId],cells_it);
+ for (VCellIterator it = tmpCells.begin(); it != cell_up_end; it++)
{
- const Cell_handle& cell = *it;
+ const CellHandle& cell = *it;
if (cell->info().isGhost) continue;
for (int j2=0; j2<4; j2++)
- Q1 += (cell->neighbor(j2)->info().k_norm())[Tri.mirror_index(cell, j2)]* (cell->neighbor(j2)->info().p()-cell->info().p());
+ Q1 += (cell->neighbor(j2)->info().kNorm())[Tri.mirror_index(cell, j2)]* (cell->neighbor(j2)->info().p()-cell->info().p());
}
return Q1;
}
template <class Tesselation>
-double FlowBoundingSphere<Tesselation>::Permeameter(double P_Inf, double P_Sup, double Section, double DeltaY, const char *file)
+double FlowBoundingSphere<Tesselation>::permeameter(double PInf, double PSup, double Section, double DeltaY, const char *file)
{
RTriangulation& Tri = T[currentTes].Triangulation();
std::ofstream kFile(file, std::ios::out);
@@ -1207,34 +1170,34 @@
int cellQ1=0, cellQ2=0;
double p_out_max=-10000000, p_out_min=10000000, p_in_max=-100000000, p_in_min=10000000,p_out_moy=0, p_in_moy=0;
- Vector_Cell tmp_cells;
- tmp_cells.resize(10000);
- VCell_iterator cells_it = tmp_cells.begin();
+ VectorCell tmpCells;
+ tmpCells.resize(10000);
+ VCellIterator cells_it = tmpCells.begin();
- VCell_iterator cell_up_end = Tri.incident_cells(T[currentTes].vertexHandles[y_max_id],cells_it);
- for (VCell_iterator it = tmp_cells.begin(); it != cell_up_end; it++)
+ VCellIterator cell_up_end = Tri.incident_cells(T[currentTes].vertexHandles[yMaxId],cells_it);
+ for (VCellIterator it = tmpCells.begin(); it != cell_up_end; it++)
{
- Cell_handle& cell = *it;
+ CellHandle& cell = *it;
for (int j2=0; j2<4; j2++) {
if (!cell->neighbor(j2)->info().Pcondition){
- Q1 = Q1 + (cell->neighbor(j2)->info().k_norm())[Tri.mirror_index(cell, j2)]* (cell->neighbor(j2)->info().p()-cell->info().p());
+ Q1 = Q1 + (cell->neighbor(j2)->info().kNorm())[Tri.mirror_index(cell, j2)]* (cell->neighbor(j2)->info().p()-cell->info().p());
cellQ1+=1;
p_out_max = max(cell->neighbor(j2)->info().p(), p_out_max);
p_out_min = min(cell->neighbor(j2)->info().p(), p_out_min);
p_out_moy += cell->neighbor(j2)->info().p();}
}}
- Vector_Cell tmp_cells2;
- tmp_cells2.resize(10000);
- VCell_iterator cells_it2 = tmp_cells2.begin();
+ VectorCell tmpCells2;
+ tmpCells2.resize(10000);
+ VCellIterator cells_it2 = tmpCells2.begin();
- VCell_iterator cell_down_end = Tri.incident_cells(T[currentTes].vertexHandles[y_min_id],cells_it2);
- for (VCell_iterator it = tmp_cells2.begin(); it != cell_down_end; it++)
+ VCellIterator cell_down_end = Tri.incident_cells(T[currentTes].vertexHandles[yMinId],cells_it2);
+ for (VCellIterator it = tmpCells2.begin(); it != cell_down_end; it++)
{
- Cell_handle& cell = *it;
+ CellHandle& cell = *it;
for (int j2=0; j2<4; j2++){
if (!cell->neighbor(j2)->info().Pcondition){
- Q2 = Q2 + (cell->neighbor(j2)->info().k_norm())[Tri.mirror_index(cell, j2)]* (cell->info().p()-cell->neighbor(j2)->info().p());
+ Q2 = Q2 + (cell->neighbor(j2)->info().kNorm())[Tri.mirror_index(cell, j2)]* (cell->info().p()-cell->neighbor(j2)->info().p());
cellQ2+=1;
p_in_max = max(cell->neighbor(j2)->info().p(), p_in_max);
p_in_min = min(cell->neighbor(j2)->info().p(), p_in_min);
@@ -1245,12 +1208,12 @@
double viscosity = VISCOSITY;
double gravity = 1;
double Vdarcy = Q1/Section;
- double DeltaP = abs(P_Inf-P_Sup);
+ double DeltaP = abs(PInf-PSup);
double DeltaH = DeltaP/ (density*gravity);
double k = viscosity*Vdarcy*DeltaY / DeltaP; /**m²**/
double Ks = k*(density*gravity)/viscosity; /**m/s**/
- if (DEBUG_OUT){
+ if (debugOut){
cout << "the maximum superior pressure is = " << p_out_max << " the min is = " << p_out_min << endl;
cout << "the maximum inferior pressure is = " << p_in_max << " the min is = " << p_in_min << endl;
cout << "superior average pressure is " << p_out_moy/cellQ1 << endl;
@@ -1264,7 +1227,7 @@
cout << "The permeability of the sample is = " << k << " m^2" <<endl;
cout << endl << "The hydraulic conductivity of the sample is = " << Ks << " m/s" << endl << endl;
}
- kFile << "y_max id = "<<y_max_id<< "y_min id = "<<y_min_id<<endl;
+ kFile << "yMax id = "<<yMaxId<< "yMin id = "<<yMinId<<endl;
kFile << "the maximum superior pressure is = " << p_out_max << " the min is = " << p_out_min << endl;
kFile << "the maximum inferior pressure is = " << p_in_max << " the min is = " << p_in_min << endl;
kFile << "superior average pressure is " << p_out_moy/cellQ2 << endl;
@@ -1280,15 +1243,15 @@
return k;
}
template <class Tesselation>
-void FlowBoundingSphere<Tesselation>::DisplayStatistics()
+void FlowBoundingSphere<Tesselation>::displayStatistics()
{
RTriangulation& Tri = T[currentTes].Triangulation();
int Zero =0, Inside=0, Fictious=0;
- Finite_cells_iterator cell_end = Tri.finite_cells_end();
- for (Finite_cells_iterator cell = Tri.finite_cells_begin(); cell != cell_end; cell++) {
+ FiniteCellsIterator cellEnd = Tri.finite_cells_end();
+ for (FiniteCellsIterator cell = Tri.finite_cells_begin(); cell != cellEnd; cell++) {
int zeros =0;
for (int j=0; j!=4; j++) {
- if ((cell->info().k_norm())[j]==0) {
+ if ((cell->info().kNorm())[j]==0) {
zeros+=1;
}
}
@@ -1302,14 +1265,14 @@
}
}
int fict=0, real=0;
- for (Finite_vertices_iterator v = Tri.finite_vertices_begin(); v != Tri.finite_vertices_end(); ++v) {
+ for (FiniteVerticesIterator v = Tri.finite_vertices_begin(); v != Tri.finite_vertices_end(); ++v) {
if (v->info().isFictious) fict+=1;
else real+=1;
}
long Vertices = Tri.number_of_vertices();
long Cells = Tri.number_of_finite_cells();
long Facets = Tri.number_of_finite_facets();
- if(DEBUG_OUT) {cout << "zeros = " << Zero << endl;
+ if(debugOut) {cout << "zeros = " << Zero << endl;
cout << "There are " << Vertices << " vertices, dont " << fict << " fictious et " << real << " reeeeeel" << std::endl;
cout << "There are " << Cells << " cells " << std::endl;
cout << "There are " << Facets << " facets " << std::endl;
@@ -1329,23 +1292,23 @@
int firstReal=-1;
//count fictious vertices and cells
- vtk_infinite_vertices=vtk_infinite_cells=0;
- Finite_cells_iterator cell_end = Tri.finite_cells_end();
- for (Finite_cells_iterator cell = Tri.finite_cells_begin(); cell != cell_end; cell++) {
+ vtkInfiniteVertices=vtkInfiniteCells=0;
+ FiniteCellsIterator cellEnd = Tri.finite_cells_end();
+ for (FiniteCellsIterator cell = Tri.finite_cells_begin(); cell != cellEnd; cell++) {
bool isDrawable = cell->info().isReal() && cell->vertex(0)->info().isReal() && cell->vertex(1)->info().isReal() && cell->vertex(2)->info().isReal() && cell->vertex(3)->info().isReal();
- if (!isDrawable) vtk_infinite_cells+=1;
+ if (!isDrawable) vtkInfiniteCells+=1;
}
- for (Finite_vertices_iterator v = Tri.finite_vertices_begin(); v != Tri.finite_vertices_end(); ++v) {
- if (!v->info().isReal()) vtk_infinite_vertices+=1;
- else if (firstReal==-1) firstReal=vtk_infinite_vertices;}
+ for (FiniteVerticesIterator v = Tri.finite_vertices_begin(); v != Tri.finite_vertices_end(); ++v) {
+ if (!v->info().isReal()) vtkInfiniteVertices+=1;
+ else if (firstReal==-1) firstReal=vtkInfiniteVertices;}
- basicVTKwritter vtkfile((unsigned int) Tri.number_of_vertices()-vtk_infinite_vertices, (unsigned int) Tri.number_of_finite_cells()-vtk_infinite_cells);
+ basicVTKwritter vtkfile((unsigned int) Tri.number_of_vertices()-vtkInfiniteVertices, (unsigned int) Tri.number_of_finite_cells()-vtkInfiniteCells);
vtkfile.open(filename,"test");
vtkfile.begin_vertices();
double x,y,z;
- for (Finite_vertices_iterator v = Tri.finite_vertices_begin(); v != Tri.finite_vertices_end(); ++v) {
+ for (FiniteVerticesIterator v = Tri.finite_vertices_begin(); v != Tri.finite_vertices_end(); ++v) {
if (v->info().isReal()){
x = (double)(v->point().point()[0]);
y = (double)(v->point().point()[1]);
@@ -1355,58 +1318,58 @@
vtkfile.end_vertices();
vtkfile.begin_cells();
- for (Finite_cells_iterator cell = Tri.finite_cells_begin(); cell != Tri.finite_cells_end(); ++cell) {
+ for (FiniteCellsIterator cell = Tri.finite_cells_begin(); cell != Tri.finite_cells_end(); ++cell) {
bool isDrawable = cell->info().isReal() && cell->vertex(0)->info().isReal() && cell->vertex(1)->info().isReal() && cell->vertex(2)->info().isReal() && cell->vertex(3)->info().isReal();
if (isDrawable){vtkfile.write_cell(cell->vertex(0)->info().id()-firstReal, cell->vertex(1)->info().id()-firstReal, cell->vertex(2)->info().id()-firstReal, cell->vertex(3)->info().id()-firstReal);}
}
vtkfile.end_cells();
- if (permeability_map){
+ if (permeabilityMap){
vtkfile.begin_data("Permeability",CELL_DATA,SCALARS,FLOAT);
- for (Finite_cells_iterator cell = Tri.finite_cells_begin(); cell != Tri.finite_cells_end(); ++cell) {
+ for (FiniteCellsIterator cell = Tri.finite_cells_begin(); cell != Tri.finite_cells_end(); ++cell) {
bool isDrawable = cell->info().isReal() && cell->vertex(0)->info().isReal() && cell->vertex(1)->info().isReal() && cell->vertex(2)->info().isReal() && cell->vertex(3)->info().isReal();
if (isDrawable){vtkfile.write_data(cell->info().s);}
}
vtkfile.end_data();}
else{
vtkfile.begin_data("Pressure",CELL_DATA,SCALARS,FLOAT);
- for (Finite_cells_iterator cell = Tri.finite_cells_begin(); cell != Tri.finite_cells_end(); ++cell) {
+ for (FiniteCellsIterator cell = Tri.finite_cells_begin(); cell != Tri.finite_cells_end(); ++cell) {
bool isDrawable = cell->info().isReal() && cell->vertex(0)->info().isReal() && cell->vertex(1)->info().isReal() && cell->vertex(2)->info().isReal() && cell->vertex(3)->info().isReal();
if (isDrawable){vtkfile.write_data(cell->info().p());}
}
vtkfile.end_data();}
if (1){
- Average_Relative_Cell_Velocity();
+ averageRelativeCellVelocity();
vtkfile.begin_data("Velocity",CELL_DATA,VECTORS,FLOAT);
- for (Finite_cells_iterator cell = Tri.finite_cells_begin(); cell != Tri.finite_cells_end(); ++cell) {
+ for (FiniteCellsIterator cell = Tri.finite_cells_begin(); cell != Tri.finite_cells_end(); ++cell) {
bool isDrawable = cell->info().isReal() && cell->vertex(0)->info().isReal() && cell->vertex(1)->info().isReal() && cell->vertex(2)->info().isReal() && cell->vertex(3)->info().isReal();
- if (isDrawable){vtkfile.write_data(cell->info().av_vel()[0],cell->info().av_vel()[1],cell->info().av_vel()[2]);}
+ if (isDrawable){vtkfile.write_data(cell->info().averageVelocity()[0],cell->info().averageVelocity()[1],cell->info().averageVelocity()[2]);}
}
vtkfile.end_data();}
}
#ifdef XVIEW
template <class Tesselation>
-void FlowBoundingSphere<Tesselation>::Dessine_Triangulation(Vue3D &Vue, RTriangulation &T)
+void FlowBoundingSphere<Tesselation>::dessineTriangulation(Vue3D &Vue, RTriangulation &T)
{
double* Segments = NULL;
- long N_seg = New_liste_edges(T, &Segments);
+ long N_seg = newListeEdges(T, &Segments);
Vue.Dessine_Segment(Segments, N_seg);
- Delete_liste_edges(&Segments, N_seg);
+ deleteListeEdges(&Segments, N_seg);
}
template <class Tesselation>
-void FlowBoundingSphere<Tesselation>::Dessine_Short_Tesselation(Vue3D &Vue, Tesselation &Tes)
+void FlowBoundingSphere<Tesselation>::dessineShortTesselation(Vue3D &Vue, Tesselation &Tes)
{
if (!Tes.Computed()) Tes.Compute();
double* Segments = NULL;
- long N_seg = Tes.New_liste_short_edges(&Segments);
+ long N_seg = Tes.newListeShortEdges(&Segments);
Vue.Dessine_Segment(Segments, N_seg);
- Delete_liste_edges(&Segments, N_seg);
+ deleteListeEdges(&Segments, N_seg);
}
#endif
template <class Tesselation>
-void FlowBoundingSphere<Tesselation>::GenerateVoxelFile( )
+void FlowBoundingSphere<Tesselation>::generateVoxelFile( )
{
RTriangulation& Tri = T[currentTes].Triangulation();
double l = 1;
@@ -1421,9 +1384,9 @@
for (double x=0; x<=l; x+=eps) {
solid=false;
- for (Finite_vertices_iterator V_it = Tri.finite_vertices_begin(); V_it != Tri.finite_vertices_end(); V_it++) {
- double radius = sqrt(V_it->point().weight());
- if ((sqrt(pow((x- (V_it->point()[0])),2) +pow((y- (V_it->point()[1])),2) +pow((z- (V_it->point()[2])),2))) <= radius) solid=true;
+ for (FiniteVerticesIterator vIt = Tri.finite_vertices_begin(); vIt != Tri.finite_vertices_end(); vIt++) {
+ double radius = sqrt(vIt->point().weight());
+ if ((sqrt(pow((x- (vIt->point()[0])),2) +pow((y- (vIt->point()[1])),2) +pow((z- (vIt->point()[2])),2))) <= radius) solid=true;
}
if (solid) voxelfile << 1;
else voxelfile << 0;
@@ -1434,79 +1397,70 @@
}
template <class Tesselation>
-double FlowBoundingSphere<Tesselation>::Sample_Permeability(double& x_Min,double& x_Max ,double& y_Min,double& y_Max,double& z_Min,double& z_Max/*, string key*/)
+double FlowBoundingSphere<Tesselation>::samplePermeability(double& xMin,double& xMax ,double& yMin,double& yMax,double& zMin,double& zMax/*, string key*/)
{
- double Section = (x_Max-x_Min) * (z_Max-z_Min);
- double DeltaY = y_Max-y_Min;
- boundary(y_min_id).flowCondition=0;
- boundary(y_max_id).flowCondition=0;
- boundary(y_min_id).value=0;
- boundary(y_max_id).value=1;
- double P_zero = abs((boundary(y_min_id).value-boundary(y_max_id).value)/2);
- Initialize_pressures( P_zero );
- GaussSeidel();
+ double Section = (xMax-xMin) * (zMax-zMin);
+ double DeltaY = yMax-yMin;
+ boundary(yMinId).flowCondition=0;
+ boundary(yMaxId).flowCondition=0;
+ boundary(yMinId).value=0;
+ boundary(yMaxId).value=1;
+ double pZero = abs((boundary(yMinId).value-boundary(yMaxId).value)/2);
+ initializePressures( pZero );
+ gaussSeidel();
const char *kk = "Permeability";
- return Permeameter(boundary(y_min_id).value, boundary(y_max_id).value, Section, DeltaY, kk);
+ return permeameter(boundary(yMinId).value, boundary(yMaxId).value, Section, DeltaY, kk);
}
template <class Tesselation>
bool FlowBoundingSphere<Tesselation>::isInsideSphere(double& x, double& y, double& z)
{
RTriangulation& Tri = T[currentTes].Triangulation();
- for (Finite_vertices_iterator V_it = Tri.finite_vertices_begin(); V_it != Tri.finite_vertices_end(); V_it++) {
- double radius = V_it->point().weight();
- if (pow((x- (V_it->point()[0])),2) +pow((y- (V_it->point()[1])),2) +pow((z- (V_it->point()[2])),2) <= radius) return true;
+ for (FiniteVerticesIterator vIt = Tri.finite_vertices_begin(); vIt != Tri.finite_vertices_end(); vIt++) {
+ double radius = vIt->point().weight();
+ if (pow((x- (vIt->point()[0])),2) +pow((y- (vIt->point()[1])),2) +pow((z- (vIt->point()[2])),2) <= radius) return true;
}
return false;
}
template <class Tesselation>
-void FlowBoundingSphere<Tesselation>::SliceField(const char *filename)
+void FlowBoundingSphere<Tesselation>::sliceField(const char *filename)
{
/** Pressure field along one cutting plane **/
RTriangulation& Tri = T[noCache?(!currentTes):currentTes].Triangulation();
- Cell_handle permeameter;
+ CellHandle permeameter;
std::ofstream consFile(filename,std::ios::out);
int intervals = 400;
- double Ry = (y_max-y_min) /intervals;
- double Rz = (z_max-z_min) /intervals;
-// cout<<Rx<<" "<<Ry<<" "<<Rz<<" "<<z_max<<" "<<z_min<<" "<<y_max<<" "<<y_min<<" "<<x_max<<" "<<x_min<<endl;
-
-// for (double X=min(x_min,x_max); X<=max(x_min,x_max); X=X+abs(Rx)) {
+ double Ry = (yMax-yMin) /intervals;
+ double Rz = (zMax-zMin) /intervals;
double X=0.5;
- for (double Y=min(y_max,y_min); Y<=max(y_max,y_min); Y=Y+abs(Ry)) {
- for (double Z=min(z_min,z_max); Z<=max(z_min,z_max); Z=Z+abs(Rz)) {
+ for (double Y=min(yMax,yMin); Y<=max(yMax,yMin); Y=Y+abs(Ry)) {
+ for (double Z=min(zMin,zMax); Z<=max(zMin,zMax); Z=Z+abs(Rz)) {
permeameter = Tri.locate(Point(X, Y, Z));
consFile << permeameter->info().p() <<" ";
-// if (!isInsideSphere(X,Y,Z)) {
-// permeameter = Tri.locate(Point(X, Y, Z));
-// consFile << permeameter->info().p() <<" ";
-// //cout <<"valeur trouvée";
-// } else consFile << "Nan ";
}
consFile << endl;}
consFile << endl;
-// }
consFile.close();
}
template <class Tesselation>
-void FlowBoundingSphere<Tesselation>::ComsolField()
+void FlowBoundingSphere<Tesselation>::comsolField()
{
//Compute av. velocity first, because in the following permeabilities will be overwritten with "junk" (in fact velocities from comsol)
- Average_Relative_Cell_Velocity();
+ averageRelativeCellVelocity();
RTriangulation& Tri = T[noCache?(!currentTes):currentTes].Triangulation();
- Cell_handle c;
+ CellHandle c;
ifstream loadFile("vx_grid_03_07_ns.txt");
ifstream loadFileY("vy_grid_03_07_ns.txt");
ifstream loadFileZ("vz_grid_03_07_ns.txt");
int Nx=100; int Ny=10; int Nz=100;
std::ofstream consFile("velComp",std::ios::out);
- Finite_cells_iterator cell_end = Tri.finite_cells_end();
- for (Finite_cells_iterator cell = Tri.finite_cells_begin(); cell != cell_end; cell++){
+ FiniteCellsIterator cellEnd = Tri.finiteCellsEnd();
+ for (FiniteCellsIterator cell = Tri.finite_cells_begin(); cell != cellEnd; cell++){
cell->info().dv()=0;
- cell->info().module_permeability[0]=cell->info().module_permeability[1]=cell->info().module_permeability[2]=0;
+ cell->info().modulePermeability[0]=cell->info().modulePermeability[1]=cell->info().modulePermeability[2]=0;
}
vector<Real> X, Y, Z;
@@ -1523,24 +1477,24 @@
loadFile >> vx; loadFileY >> vy; loadFileZ >> vz;
if (!isInsideSphere(X[xi], Y[yi], Z[zi]) && vx!=0) {
c = Tri.locate(Point(X[xi], Y[yi], Z[zi]));
- c->info().module_permeability[0]+=vx;
- c->info().module_permeability[1]+=vy;
- c->info().module_permeability[2]+=vz;
+ c->info().modulePermeability[0]+=vx;
+ c->info().modulePermeability[1]+=vy;
+ c->info().modulePermeability[2]+=vz;
c->info().dv()+=1;
meanCmsVel+=vy; totCmsPoints++;}
}
int kk=0;
Vecteur diff;
- for (Finite_cells_iterator cell = Tri.finite_cells_begin(); cell != cell_end && kk<10000; cell++){
+ for (FiniteCellsIterator cell = Tri.finite_cells_begin(); cell != cellEnd && kk<10000; cell++){
if (cell->info().fictious() || cell->info().dv()<60) continue;
- for (int k=0;k<3;k++) cell->info().module_permeability[k]/=cell->info().dv();
- cerr << cell->info().module_permeability[0]<<" "<< cell->info().module_permeability[1]<<" "<< cell->info().module_permeability[2]<<" "<<cell->info().dv()<<" "<< cell->info().av_vel()<<endl;
- Real m=sqrt(pow(cell->info().module_permeability[0],2)+pow(cell->info().module_permeability[1],2)+pow(cell->info().module_permeability[2],2));
- Vecteur comFlow (cell->info().module_permeability[0],cell->info().module_permeability[1],cell->info().module_permeability[2]);
- Real angle=asin(sqrt(cross_product(comFlow,cell->info().av_vel()).squared_length())/(sqrt(comFlow.squared_length())*sqrt(cell->info().av_vel().squared_length())));
- cerr<<"norms : "<<m<<" vs. "<<sqrt(cell->info().av_vel().squared_length())<<" angle "<<180*angle/3.1415<<endl;
- consFile<<m<<" "<<sqrt(cell->info().av_vel().squared_length())<<" "<<180*angle/3.1415<<endl;
- diff = diff + (comFlow - cell->info().av_vel());
+ for (int k=0;k<3;k++) cell->info().modulePermeability[k]/=cell->info().dv();
+ cerr << cell->info().modulePermeability[0]<<" "<< cell->info().modulePermeability[1]<<" "<< cell->info().modulePermeability[2]<<" "<<cell->info().dv()<<" "<< cell->info().averageVelocity()<<endl;
+ Real m=sqrt(pow(cell->info().modulePermeability[0],2)+pow(cell->info().modulePermeability[1],2)+pow(cell->info().modulePermeability[2],2));
+ Vecteur comFlow (cell->info().modulePermeability[0],cell->info().modulePermeability[1],cell->info().modulePermeability[2]);
+ Real angle=asin(sqrt(cross_product(comFlow,cell->info().averageVelocity()).squared_length())/(sqrt(comFlow.squared_length())*sqrt(cell->info().averageVelocity().squared_length())));
+ cerr<<"norms : "<<m<<" vs. "<<sqrt(cell->info().averageVelocity().squared_length())<<" angle "<<180*angle/3.1415<<endl;
+ consFile<<m<<" "<<sqrt(cell->info().averageVelocity().squared_length())<<" "<<180*angle/3.1415<<endl;
+ diff = diff + (comFlow - cell->info().averageVelocity());
kk++;
}
cerr << "meanCmsVel "<<meanCmsVel/totCmsPoints<<" mean diff "<<diff/kk<<endl;
@@ -1554,20 +1508,20 @@
vector<vector<pair<unsigned int,Real> > > lubPairs;
lubPairs.resize(Tri.number_of_vertices()+1);
for (unsigned int k=0; k<edgeNormalLubF.size(); k++)
- lubPairs[min(Edge_ids[k].first,Edge_ids[k].second)].push_back(pair<int,Real> (max(Edge_ids[k].first,Edge_ids[k].second),edgeNormalLubF[k]));
+ lubPairs[min(edgeIds[k].first,edgeIds[k].second)].push_back(pair<int,Real> (max(edgeIds[k].first,edgeIds[k].second),edgeNormalLubF[k]));
//Now we reset the containers and initialize them
- Edge_Surfaces.clear(); Edge_ids.clear(); edgeNormalLubF.clear();
- Finite_edges_iterator ed_it;
- for ( Finite_edges_iterator ed_it = Tri.finite_edges_begin(); ed_it!=Tri.finite_edges_end();ed_it++ )
+ edgeSurfaces.clear(); edgeIds.clear(); edgeNormalLubF.clear();
+ FiniteEdgesIterator ed_it;
+ for ( FiniteEdgesIterator ed_it = Tri.finite_edges_begin(); ed_it!=Tri.finite_edges_end();ed_it++ )
{
int hasFictious= (ed_it->first)->vertex(ed_it->second)->info().isFictious + (ed_it->first)->vertex(ed_it->third)->info().isFictious;
if (hasFictious==2) continue;
double area = T[currentTes].ComputeVFacetArea(ed_it);
- Edge_Surfaces.push_back(area);
+ edgeSurfaces.push_back(area);
unsigned int id1 = (ed_it->first)->vertex(ed_it->second)->info().id();
unsigned int id2 = (ed_it->first)->vertex(ed_it->third)->info().id();
- Edge_ids.push_back(pair<int,int>(id1,id2));
+ edgeIds.push_back(pair<int,int>(id1,id2));
//For persistant edges, we must transfer the lub. force value from the older triangulation structure
if (id1>id2) swap(id1,id2);
@@ -1589,31 +1543,42 @@
Vector3r FlowBoundingSphere<Tesselation>::computeViscousShearForce(const Vector3r& deltaV, const int& edge_id, const Real& Rh)
{
Vector3r tau = deltaV*VISCOSITY/Rh;
- return tau * Edge_Surfaces[edge_id];
+ return tau * edgeSurfaces[edge_id];
}
template <class Tesselation>
Vector3r FlowBoundingSphere<Tesselation>::computeShearLubricationForce(const Vector3r& deltaShearV, const Real& dist, const int& edge_id, const Real& eps, const Real& centerDist, const Real& meanRad )
{
- Real d = max(dist,0.) + eps*meanRad;
+ Real d = max(dist,0.) + 2.*eps*meanRad;
Vector3r viscLubF = 0.5 * Mathr::PI * VISCOSITY * (-2*meanRad + centerDist*log(centerDist/d)) * deltaShearV;
return viscLubF;
}
template <class Tesselation>
+Vector3r FlowBoundingSphere<Tesselation>::computePumpTorque(const Vector3r& deltaShearAngV, const Real& dist, const int& edge_id, const Real& eps, const Real& meanRad )
+{
+ Real d = max(dist,0.) + 2.*eps*meanRad;
+ Vector3r viscPumpC = Mathr::PI * VISCOSITY * pow(meanRad,3) *(3./20. * log(meanRad/d) + 63./500. * (d/meanRad) * log(meanRad/d)) * deltaShearAngV;
+ return viscPumpC;
+}
+
+template <class Tesselation>
+Vector3r FlowBoundingSphere<Tesselation>::computeTwistTorque(const Vector3r& deltaNormAngV, const Real& dist, const int& edge_id, const Real& eps, const Real& meanRad )
+{
+ Real d = max(dist,0.) + 2.*eps*meanRad;
+ Vector3r twistC = Mathr::PI * VISCOSITY * pow(meanRad,2) * d * log(meanRad/d) * deltaNormAngV;
+ return twistC;
+}
+
+
+template <class Tesselation>
Real FlowBoundingSphere<Tesselation>::computeNormalLubricationForce(const Real& deltaNormV, const Real& dist, const int& edge_id, const Real& eps, const Real& stiffness, const Real& dt, const Real& meanRad)
{
//FIXME: here introduce elasticity
- Real d = max(dist,0.) + eps*meanRad;//account for grains roughness
+ Real d = max(dist,0.) + 2.*eps*meanRad;//account for grains roughness
if (stiffness>0) {
const Real k = stiffness*meanRad;
Real prevForce = edgeNormalLubF[edge_id];
-// Real prevForce = edgeNormalLubF[edge_id] ? edgeNormalLubF[edge_id] : (6*Mathr::PI*pow(meanRad,2)* VISCOSITY* deltaNormV)/d;
-// if (!edgeNormalLubF[edge_id]) for (int kk=0; kk<30; kk++) {
-// Real instantVisc = 6*Mathr::PI*pow(meanRad,2)*VISCOSITY/(d-prevForce/k);
-// prevForce = instantVisc*(deltaNormV + prevForce/(k*dt))/(1+instantVisc/(k*dt));
-// if ((kk==0 || kk==29) && deltaNormV!=0) cerr << "prevForce("<<kk<<") = "<< prevForce<<endl;
-// }
Real instantVisc = 1.5*Mathr::PI*pow(meanRad,2)*VISCOSITY/(d-prevForce/k);
Real normLubF = instantVisc*(deltaNormV + prevForce/(k*dt))/(1+instantVisc/(k*dt));
edgeNormalLubF[edge_id]=normLubF;
=== modified file 'lib/triangulation/FlowBoundingSphereLinSolv.hpp'
--- lib/triangulation/FlowBoundingSphereLinSolv.hpp 2013-06-27 11:29:17 +0000
+++ lib/triangulation/FlowBoundingSphereLinSolv.hpp 2014-03-21 18:45:24 +0000
@@ -44,9 +44,9 @@
using FlowType::T;
using FlowType::currentTes;
using FlowType::boundary;
- using FlowType::y_min_id;
- using FlowType::y_max_id;
- using FlowType::DEBUG_OUT;
+ using FlowType::yMinId;
+ using FlowType::yMaxId;
+ using FlowType::debugOut;
using FlowType::TOLERANCE;
using FlowType::RELAX;
using FlowType::fluidBulkModulus;
@@ -55,7 +55,7 @@
using FlowType::computedOnce;
//! TAUCS DECs
- vector<Finite_cells_iterator> orderedCells;
+ vector<FiniteCellsIterator> orderedCells;
bool isLinearSystemSet;
bool isFullLinearSystemGSSet;
bool areCellsOrdered;//true when orderedCells is filled, turn it false after retriangulation
@@ -97,7 +97,7 @@
vector<int> T_jn;//(size+1);
vector<int> T_ia;//(size*5);
vector<double> T_f;//(size); // right-hand size vector object
- vector<Cell_handle> T_cells;//(size)
+ vector<CellHandle> T_cells;//(size)
int T_index;
vector<double> T_b;
@@ -143,35 +143,35 @@
FlowBoundingSphereLinSolv();
///Linear system solve
- virtual int SetLinearSystem(Real dt);
- void VectorizedGaussSeidel(Real dt);
- virtual int SetLinearSystemFullGS(Real dt);
+ virtual int setLinearSystem(Real dt);
+ void vectorizedGaussSeidel(Real dt);
+ virtual int setLinearSystemFullGS(Real dt);
- int TaucsSolveTest();
- int TaucsSolve(Real dt);
- int PardisoSolveTest();
- int PardisoSolve(Real dt);
+ int taucsSolveTest();
+ int taucsSolve(Real dt);
+ int pardisoSolveTest();
+ int pardisoSolve(Real dt);
int eigenSolve(Real dt);
- void CopyGsToCells();
- void CopyCellsToGs(Real dt);
+ void copyGsToCells();
+ void copyCellsToGs(Real dt);
- void CopyLinToCells();
- void CopyCellsToLin(Real dt);
- void swap_fwd (double* v, int i);
- void swap_fwd (int* v, int i);
- void sort_v(int k1, int k2, int* is, double* ds);
+ void copyLinToCells();
+ void copyCellsToLin(Real dt);
+ void swapFwd (double* v, int i);
+ void swapFwd (int* v, int i);
+ void sortV(int k1, int k2, int* is, double* ds);
- virtual void GaussSeidel (Real dt) {
+ virtual void gaussSeidel (Real dt) {
switch (useSolver) {
case 0:
- VectorizedGaussSeidel(dt);
+ vectorizedGaussSeidel(dt);
break;
case 1:
- TaucsSolve(dt);
+ taucsSolve(dt);
break;
case 2:
- PardisoSolve(dt);
+ pardisoSolve(dt);
break;
case 3:
eigenSolve(dt);
@@ -179,7 +179,7 @@
}
computedOnce=true;
}
- virtual void ResetNetwork();
+ virtual void resetNetwork();
};
} //namespace CGT
=== modified file 'lib/triangulation/FlowBoundingSphereLinSolv.ipp'
--- lib/triangulation/FlowBoundingSphereLinSolv.ipp 2013-11-26 15:37:26 +0000
+++ lib/triangulation/FlowBoundingSphereLinSolv.ipp 2014-03-21 18:45:24 +0000
@@ -93,9 +93,9 @@
template<class FlowType>
-void FlowBoundingSphereLinSolv<FlowType>::swap_fwd (double* v, int i) {double temp = v[i]; v[i]=v[i+1]; v[i+1]=temp;}
+void FlowBoundingSphereLinSolv<FlowType>::swapFwd (double* v, int i) {double temp = v[i]; v[i]=v[i+1]; v[i+1]=temp;}
template<class FlowType>
-void FlowBoundingSphereLinSolv<FlowType>::swap_fwd (int* v, int i) {double temp = v[i]; v[i]=v[i+1]; v[i+1]=temp;}
+void FlowBoundingSphereLinSolv<FlowType>::swapFwd (int* v, int i) {double temp = v[i]; v[i]=v[i+1]; v[i+1]=temp;}
//spatial sort traits to use with a pair of CGAL::sphere pointers and integer.
//template<class _Triangulation>
@@ -120,8 +120,8 @@
};
template<class FlowType>
-void FlowBoundingSphereLinSolv<FlowType>::ResetNetwork() {
- FlowType::ResetNetwork();
+void FlowBoundingSphereLinSolv<FlowType>::resetNetwork() {
+ FlowType::resetNetwork();
isLinearSystemSet=false;
isFullLinearSystemGSSet=false;
areCellsOrdered=false;
@@ -143,7 +143,7 @@
#endif
}
template<class FlowType>
-int FlowBoundingSphereLinSolv<FlowType>::SetLinearSystem(Real dt)
+int FlowBoundingSphereLinSolv<FlowType>::setLinearSystem(Real dt)
{
RTriangulation& Tri = T[currentTes].Triangulation();
@@ -157,8 +157,8 @@
ncols=0;
///Ordered cells
orderedCells.clear();
- const Finite_cells_iterator cell_end = Tri.finite_cells_end();
- for (Finite_cells_iterator cell = Tri.finite_cells_begin(); cell != cell_end; cell++) {
+ const FiniteCellsIterator cellEnd = Tri.finite_cells_end();
+ for (FiniteCellsIterator cell = Tri.finite_cells_begin(); cell != cellEnd; cell++) {
orderedCells.push_back(cell);
if (!cell->info().Pcondition) ++ncols;}
// //Segfault on 14.10, and useless overall since SuiteSparse has preconditionners (including metis)
@@ -187,12 +187,12 @@
T_nnz=0;}
for (int kk=0; kk<ncols;kk++) T_b[kk]=0;
///Ordered cells
- int index=0, nIndex=0; Cell_handle neighbour_cell;
+ int index=0, nIndex=0; CellHandle neighbourCell;
for (int i=0; i<n_cells; i++)
{
- Finite_cells_iterator& cell = orderedCells[i];
+ FiniteCellsIterator& cell = orderedCells[i];
///Non-ordered cells
-// for (Finite_cells_iterator cell = Tri.finite_cells_begin(); cell != cell_end; cell++) {
+// for (FiniteCellsIterator cell = Tri.finite_cells_begin(); cell != cell_end; cell++) {
if (!cell->info().Pcondition) {
index=cell->info().index;
if (index==0) {
@@ -203,27 +203,27 @@
//Add diagonal term
is[T_nnz] = index;
js[T_nnz] = index;
- vs[T_nnz] = (cell->info().k_norm())[0]+ (cell->info().k_norm())[1]+ (cell->info().k_norm())[2]+ (cell->info().k_norm())[3];
+ vs[T_nnz] = (cell->info().kNorm())[0]+ (cell->info().kNorm())[1]+ (cell->info().kNorm())[2]+ (cell->info().kNorm())[3];
if (fluidBulkModulus>0) vs[T_nnz] += (1.f/(dt*fluidBulkModulus*cell->info().invVoidVolume()));
++T_nnz;
}
for (int j=0; j<4; j++) {
- neighbour_cell = cell->neighbor(j);
- nIndex=neighbour_cell->info().index;
- if (Tri.is_infinite(neighbour_cell)) continue;
- if (!isLinearSystemSet && !neighbour_cell->info().Pcondition) {
+ neighbourCell = cell->neighbor(j);
+ nIndex=neighbourCell->info().index;
+ if (Tri.is_infinite(neighbourCell)) continue;
+ if (!isLinearSystemSet && !neighbourCell->info().Pcondition) {
if (nIndex==0) {
- T_cells[++T_index]=neighbour_cell;
- neighbour_cell->info().index=nIndex=T_index;
+ T_cells[++T_index]=neighbourCell;
+ neighbourCell->info().index=nIndex=T_index;
} else if (index > nIndex) {
is[T_nnz] = index;
js[T_nnz] = nIndex;
- vs[T_nnz] = - (cell->info().k_norm())[j];
+ vs[T_nnz] = - (cell->info().kNorm())[j];
T_nnz++;
}
- } else if (neighbour_cell->info().Pcondition) {
+ } else if (neighbourCell->info().Pcondition) {
//ADD TO b, FIXME : use updated volume change
- T_b[index-1]+=cell->info().k_norm()[j]*neighbour_cell->info().p();
+ T_b[index-1]+=cell->info().kNorm()[j]*neighbourCell->info().p();
}
}
}
@@ -288,10 +288,10 @@
}
template<class FlowType>
-void FlowBoundingSphereLinSolv<FlowType>::CopyGsToCells() {for (int ii=1; ii<=ncols; ii++) T_cells[ii]->info().p()=gsP[ii];}
+void FlowBoundingSphereLinSolv<FlowType>::copyGsToCells() {for (int ii=1; ii<=ncols; ii++) T_cells[ii]->info().p()=gsP[ii];}
template<class FlowType>
-void FlowBoundingSphereLinSolv<FlowType>::CopyCellsToGs (Real dt)
+void FlowBoundingSphereLinSolv<FlowType>::copyCellsToGs (Real dt)
{
for (int ii=1; ii<=ncols; ii++){
gsP[ii]=T_cells[ii]->info().p();
@@ -301,10 +301,10 @@
}
template<class FlowType>
-void FlowBoundingSphereLinSolv<FlowType>::CopyLinToCells() {for (int ii=1; ii<=ncols; ii++) {T_cells[ii]->info().p()=T_x[ii-1];} }
+void FlowBoundingSphereLinSolv<FlowType>::copyLinToCells() {for (int ii=1; ii<=ncols; ii++) {T_cells[ii]->info().p()=T_x[ii-1];} }
template<class FlowType>
-void FlowBoundingSphereLinSolv<FlowType>::CopyCellsToLin (Real dt)
+void FlowBoundingSphereLinSolv<FlowType>::copyCellsToLin (Real dt)
{
for (int ii=1; ii<=ncols; ii++) {
T_bv[ii-1]=T_b[ii-1]-T_cells[ii]->info().dv();
@@ -314,7 +314,7 @@
/// For Gauss Seidel, we need the full matrix
template<class FlowType>
// int FlowBoundingSphereLinSolv<FlowType>::SetLinearSystemFullGS()
-int FlowBoundingSphereLinSolv<FlowType>::SetLinearSystemFullGS(Real dt)
+int FlowBoundingSphereLinSolv<FlowType>::setLinearSystemFullGS(Real dt)
{
//WARNING : boundary conditions (Pcondition, p values) must have been set for a correct definition
RTriangulation& Tri = T[currentTes].Triangulation();
@@ -324,18 +324,18 @@
T_index=0;
T_nnz=0;
ncols=0;
- const Finite_cells_iterator cell_end = Tri.finite_cells_end();
+ const FiniteCellsIterator cellEnd = Tri.finite_cells_end();
orderedCells.clear();
- for (Finite_cells_iterator cell = Tri.finite_cells_begin(); cell != cell_end; cell++) {
+ for (FiniteCellsIterator cell = Tri.finite_cells_begin(); cell != cellEnd; cell++) {
orderedCells.push_back(cell);
if (!cell->info().Pcondition) ++ncols;
}
//FIXME: does it really help? test by commenting this "sorting" line
spatial_sort(orderedCells.begin(),orderedCells.end(), CellTraits_for_spatial_sort<RTriangulation>());
-// double P_zero=0;
-// if (y_min_id>=0 and y_max_id>y_min_id) P_zero = abs((boundary(y_min_id).value-boundary(y_max_id).value)/2);
+// double pZero=0;
+// if (y_min_id>=0 and y_max_id>y_min_id) pZero = abs((boundary(y_min_id).value-boundary(y_max_id).value)/2);
gsP.resize(ncols+1);
// _gsP.resize(ncols+1);
gsB.resize(ncols+1);
@@ -348,7 +348,7 @@
fullAcolumns[k].resize(4);
fullAvalues[k].resize(5);
gsdV[k]=0;
-// gsP[k]=P_zero;
+// gsP[k]=pZero;
}
// _gsP[0]= &ZERO;
gsP[0]=0;
@@ -362,9 +362,9 @@
///Ordered cells
for (int i=0; i<n_cells; i++)
{
- Finite_cells_iterator& cell = orderedCells[i];
+ FiniteCellsIterator& cell = orderedCells[i];
///Non-ordered cells
-// for (Finite_cells_iterator cell = Tri.finite_cells_begin(); cell != cell_end; cell++) {
+// for (FiniteCellsIterator cell = Tri.finite_cells_begin(); cell != cell_end; cell++) {
if (!cell->info().Pcondition) {
if (cell->info().index==0) {
T_cells[++T_index]=cell;
@@ -372,29 +372,29 @@
}
gsP[cell->info().index]=cell->info().pression;
//Add diagonal term
- double num = (cell->info().k_norm())[0]+ (cell->info().k_norm())[1]+ (cell->info().k_norm())[2]+ (cell->info().k_norm())[3];
+ double num = (cell->info().kNorm())[0]+ (cell->info().kNorm())[1]+ (cell->info().kNorm())[2]+ (cell->info().kNorm())[3];
if (fluidBulkModulus>0) num += (1.f/(dt*fluidBulkModulus*cell->info().invVoidVolume()));
fullAvalues[cell->info().index][4] = 1.f/num;
++T_nnz;
for (int j=0; j<4; j++) {
- Cell_handle neighbour_cell = cell->neighbor(j);
- if (Tri.is_infinite(neighbour_cell)) {
+ CellHandle neighbourCell = cell->neighbor(j);
+ if (Tri.is_infinite(neighbourCell)) {
fullAvalues[cell->info().index][j] = 0;
fullAcolumns[cell->info().index][j] = &gsP[0];
continue;}
- if (!neighbour_cell->info().Pcondition) {
- if (neighbour_cell->info().index==0) {
- T_cells[++T_index]=neighbour_cell;
- neighbour_cell->info().index=T_index;
+ if (!neighbourCell->info().Pcondition) {
+ if (neighbourCell->info().index==0) {
+ T_cells[++T_index]=neighbourCell;
+ neighbourCell->info().index=T_index;
}
++T_nnz;
- fullAvalues[cell->info().index][j] = (cell->info().k_norm())[j];
- fullAcolumns[cell->info().index][j] = &gsP[neighbour_cell->info().index];
+ fullAvalues[cell->info().index][j] = (cell->info().kNorm())[j];
+ fullAcolumns[cell->info().index][j] = &gsP[neighbourCell->info().index];
} else {
fullAvalues[cell->info().index][j] = 0;
fullAcolumns[cell->info().index][j] = &gsP[0];
- gsB[cell->info().index]+=cell->info().k_norm()[j]*neighbour_cell->info().p();
+ gsB[cell->info().index]+=cell->info().kNorm()[j]*neighbourCell->info().p();
}
}
}
@@ -404,13 +404,13 @@
///Ordered cells
for (int i=0; i<n_cells; i++)
{
- Finite_cells_iterator& cell = orderedCells[i];
+ FiniteCellsIterator& cell = orderedCells[i];
///Non-ordered cells
-// for (Finite_cells_iterator cell = Tri.finite_cells_begin(); cell != cell_end; cell++) {
+// for (FiniteCellsIterator cell = Tri.finite_cells_begin(); cell != cell_end; cell++) {
if (!cell->info().Pcondition) for (int j=0; j<4; j++) {
- Cell_handle neighbour_cell = cell->neighbor(j);
- if (!Tri.is_infinite(neighbour_cell) && neighbour_cell->info().Pcondition)
- gsB[cell->info().index]+=cell->info().k_norm()[j]*neighbour_cell->info().p();
+ CellHandle neighbourCell = cell->neighbor(j);
+ if (!Tri.is_infinite(neighbourCell) && neighbourCell->info().Pcondition)
+ gsB[cell->info().index]+=cell->info().kNorm()[j]*neighbourCell->info().p();
}
}
isFullLinearSystemGSSet=true;
@@ -418,11 +418,11 @@
}
template<class FlowType>
-void FlowBoundingSphereLinSolv<FlowType>::VectorizedGaussSeidel(Real dt)
+void FlowBoundingSphereLinSolv<FlowType>::vectorizedGaussSeidel(Real dt)
{
// cout<<"VectorizedGaussSeidel"<<endl;
- if (!isFullLinearSystemGSSet || (isFullLinearSystemGSSet && reApplyBoundaryConditions())) SetLinearSystemFullGS(dt);
- CopyCellsToGs(dt);
+ if (!isFullLinearSystemGSSet || (isFullLinearSystemGSSet && reApplyBoundaryConditions())) setLinearSystemFullGS(dt);
+ copyCellsToGs(dt);
int j = 0;
double dp_max, p_max, sum_p, p_moy, dp_moy, sum_dp;
@@ -490,25 +490,25 @@
if (j2==0) {
p_moy = sum_p/ncols;
dp_moy = sum_dp/ncols;
- if (DEBUG_OUT) cerr <<"GS : j="<<j<<" p_moy="<<p_moy<<" dp_moy="<<dp_moy<<endl;
+ if (debugOut) cerr <<"GS : j="<<j<<" p_moy="<<p_moy<<" dp_moy="<<dp_moy<<endl;
}
#ifdef GS_OPEN_MP
#pragma omp master
#endif
j++;
} while ((dp_max/p_max) > tolerance && j<20000 /*&& ( dp_max > tolerance )*//* &&*/ /*( j<50 )*/);
- CopyGsToCells();
+ copyGsToCells();
if (j>=20000) cerr<<"GS did not converge in 20k iterations (maybe because the reference pressure is 0?)"<<endl;
- if (DEBUG_OUT) cerr <<"GS iterations : "<<j-1<<endl;
+ if (debugOut) cerr <<"GS iterations : "<<j-1<<endl;
}
template<class FlowType>
-void FlowBoundingSphereLinSolv<FlowType>::sort_v(int k1, int k2, int* is, double* ds){
+void FlowBoundingSphereLinSolv<FlowType>::sortV(int k1, int k2, int* is, double* ds){
for (int k=k1; k<k2; k++) {
int kk=k;
while (kk>=k1 && is[kk]>is[kk+1]) {
- swap_fwd(is,kk);
- swap_fwd(ds,kk);
+ swapFwd(is,kk);
+ swapFwd(ds,kk);
--kk;}
}
}
@@ -517,8 +517,8 @@
int FlowBoundingSphereLinSolv<FlowType>::eigenSolve(Real dt)
{
#ifdef EIGENSPARSE_LIB
- if (!isLinearSystemSet || (isLinearSystemSet && reApplyBoundaryConditions())) ncols = SetLinearSystem(dt);
- CopyCellsToLin(dt);
+ if (!isLinearSystemSet || (isLinearSystemSet && reApplyBoundaryConditions())) ncols = setLinearSystem(dt);
+ copyCellsToLin(dt);
//FIXME: we introduce new Eigen vectors, then we have to copy from/to c-arrays, can be optimized later
Eigen::VectorXd eb(ncols); Eigen::VectorXd ex(ncols);
for (int k=0; k<ncols; k++) eb[k]=T_bv[k];
@@ -537,7 +537,7 @@
openblas_set_num_threads(numSolveThreads);
ex = eSolver.solve(eb);
for (int k=0; k<ncols; k++) T_x[k]=ex[k];
- CopyLinToCells();
+ copyLinToCells();
#else
cerr<<"Flow engine not compiled with eigen, nothing computed if useSolver=3"<<endl;
#endif
@@ -546,18 +546,18 @@
template<class FlowType>
-int FlowBoundingSphereLinSolv<FlowType>::TaucsSolve(Real dt)
+int FlowBoundingSphereLinSolv<FlowType>::taucsSolve(Real dt)
{
#ifdef TAUCS_LIB
- if (DEBUG_OUT) cerr <<endl<<"TAUCS solve"<<endl;
+ if (debugOut) cerr <<endl<<"TAUCS solve"<<endl;
double t = taucs_ctime();//timer
double t2 = taucs_ctime();//global timer
if (!isLinearSystemSet || (isLinearSystemSet && reApplyBoundaryConditions())) {
- ncols = SetLinearSystem(dt);
- if (DEBUG_OUT) cerr << "Assembling the matrix : " << taucs_ctime()-t << endl; t = taucs_ctime();}
+ ncols = setLinearSystem(dt);
+ if (debugOut) cerr << "Assembling the matrix : " << taucs_ctime()-t << endl; t = taucs_ctime();}
- CopyCellsToLin(dt);
- if (DEBUG_OUT) cerr << "Updating dv's (Yade->LinSolver) : " << taucs_ctime()-t << endl; t = taucs_ctime();
+ copyCellsToLin(dt);
+ if (debugOut) cerr << "Updating dv's (Yade->LinSolver) : " << taucs_ctime()-t << endl; t = taucs_ctime();
//taucs_logfile("stdout");//! VERY USEFULL!!!!!!!!!!! (disable to exclude output time from taucs_ctime() measurments)
taucs_double* x = &T_x[0];// the unknown vector to solve Ax=b
@@ -565,14 +565,14 @@
taucs_double* xod = &xodv[0];
if (Fccs==NULL) {
- if (DEBUG_OUT) cerr << "_entering taucs_" << endl;
+ if (debugOut) cerr << "_entering taucs_" << endl;
// 1) Reordering
taucs_ccs_order(T_A, &perm, &invperm, (char*)"metis");
- if (DEBUG_OUT) cerr << "_entering taucs_" << endl;
+ if (debugOut) cerr << "_entering taucs_" << endl;
taucs_ccs_matrix* Aod;
- if (DEBUG_OUT) cerr << "_entering taucs_" << endl;
+ if (debugOut) cerr << "_entering taucs_" << endl;
Aod = taucs_ccs_permute_symmetrically(T_A, perm, invperm);
- if (DEBUG_OUT) cerr << "Reordering : " << taucs_ctime()-t << endl; t = taucs_ctime();
+ if (debugOut) cerr << "Reordering : " << taucs_ctime()-t << endl; t = taucs_ctime();
// 2) Factoring
F = taucs_ccs_factor_llt_mf(Aod);
@@ -582,27 +582,27 @@
Fccs = taucs_supernodal_factor_to_ccs(F);
//... then delete F
taucs_supernodal_factor_free(F); F=NULL;
- if (DEBUG_OUT) cerr << "Factoring : " << taucs_ctime()-t << endl; t = taucs_ctime();
+ if (debugOut) cerr << "Factoring : " << taucs_ctime()-t << endl; t = taucs_ctime();
}
taucs_vec_permute(ncols, TAUCS_DOUBLE, &T_bv[0], bod, perm);
// 3) Back substitution and reodering the solution back
taucs_ccs_solve_llt(Fccs, xod, bod);//the ccs format (faster)
// taucs_supernodal_solve_llt(F, xod, bod);//the blackbox format (slower)
- if (DEBUG_OUT) cerr << "Solving : " << taucs_ctime()-t << endl; t = taucs_ctime();
+ if (debugOut) cerr << "Solving : " << taucs_ctime()-t << endl; t = taucs_ctime();
t = taucs_ctime();
taucs_vec_ipermute(ncols, TAUCS_DOUBLE, xod, x, perm);
// cerr << "Deordering : " << taucs_ctime()-t << endl; t = taucs_ctime();
// 4) Copy back to the triangulation
- CopyLinToCells();
+ copyLinToCells();
// cerr << "Updating P (LinSolver->Yade) : " << taucs_ctime()-t << endl;
- if (DEBUG_OUT) cerr << "Total TAUCS time ................ : " << taucs_ctime()-t2 << endl;
+ if (debugOut) cerr << "Total TAUCS time ................ : " << taucs_ctime()-t2 << endl;
#else
cerr<<"Flow engine not compiled with taucs, nothing computed if useSolver=1"<<endl;
#endif
return 0;
}
template<class FlowType>
-int FlowBoundingSphereLinSolv<FlowType>::PardisoSolve(Real dt)
+int FlowBoundingSphereLinSolv<FlowType>::pardisoSolve(Real dt)
{
cerr <<endl<<"PardisoSolve solve"<<endl;
#ifndef PARDISO
@@ -610,29 +610,29 @@
#else
double iniT = taucs_ctime();
- if (DEBUG_OUT) cerr << "_entering pardiso_" << endl;
+ if (debugOut) cerr << "_entering pardiso_" << endl;
/* Matrix data. */
double t = taucs_ctime();//timer
bool wasLSystemSet= isLinearSystemSet;
if (!isLinearSystemSet || (isLinearSystemSet && reApplyBoundaryConditions())) {
- ncols = SetLinearSystem(dt);
- if (DEBUG_OUT) cerr << "Assembling the matrix : " << taucs_ctime()-t << endl; t = taucs_ctime();}
+ ncols = setLinearSystem(dt);
+ if (debugOut) cerr << "Assembling the matrix : " << taucs_ctime()-t << endl; t = taucs_ctime();}
- if (DEBUG_OUT) cerr<<taucs_ctime()-t<<"s : set system"<<endl;
+ if (debugOut) cerr<<taucs_ctime()-t<<"s : set system"<<endl;
t=taucs_ctime();
ia = T_A->colptr;
ja = T_A->rowind;
a = T_A->values.d;
- if (DEBUG_OUT) cerr<<taucs_ctime()-t<<"s : set system"<<endl;
- if (!wasLSystemSet) for (int k=0; k<ncols; k++) sort_v(ia[k],ia[k+1]-1,ja,a);
- if (DEBUG_OUT) cout<<taucs_ctime()-t<<"s for ordering CCS format"<<endl;
+ if (debugOut) cerr<<taucs_ctime()-t<<"s : set system"<<endl;
+ if (!wasLSystemSet) for (int k=0; k<ncols; k++) sortV(ia[k],ia[k+1]-1,ja,a);
+ if (debugOut) cout<<taucs_ctime()-t<<"s for ordering CCS format"<<endl;
t=taucs_ctime();
nnz = ia[ncols];
// int mtype = -2; /* Real symmetric matrix */
mtype = 2; /* Real symmetric positive def. matrix */
/* RHS and solution vectors. */
- CopyCellsToLin(dt);
+ copyCellsToLin(dt);
b = &T_bv[0];
// P_x.resize(n);
x = &T_x[0];// the unknown vector to solve Ax=b
@@ -652,9 +652,9 @@
num_procs=1;
cerr<<"Set environment OMP_NUM_THREADS to something. Pardiso needs it defined!"<<endl;
}
- if (DEBUG_OUT) cerr<<taucs_ctime()-t<<"pardisoinit"<<endl;
+ if (debugOut) cerr<<taucs_ctime()-t<<"pardisoinit"<<endl;
F77_FUNC(pardisoinit)(pt, &mtype, &solver, iparm, dparm, &error);
- if (DEBUG_OUT) cerr<<taucs_ctime()-t<<"pardisoinit'ed"<<endl;
+ if (debugOut) cerr<<taucs_ctime()-t<<"pardisoinit'ed"<<endl;
pardisoInitialized=true;
if (error != 0) {
if (error == -10) printf("No license file found \n");
@@ -669,7 +669,7 @@
/* .. Convert matrix from 0-based C-notation to Fortran 1-based */
/* notation. */
- if (DEBUG_OUT) cout<<taucs_ctime()-t<<"tuning"<<endl;
+ if (debugOut) cout<<taucs_ctime()-t<<"tuning"<<endl;
t=taucs_ctime();
for (i = 0; i < ncols+1; i++) {
ia[i] += 1;
@@ -677,7 +677,7 @@
for (i = 0; i < nnz; i++) {
ja[i] += 1;
}
- if (DEBUG_OUT) cout<<taucs_ctime()-t<<"s : Convert matrix from 0-based"<<endl;
+ if (debugOut) cout<<taucs_ctime()-t<<"s : Convert matrix from 0-based"<<endl;
t=taucs_ctime();
/* .. Reordering and Symbolic Factorization. This step also allocates */
/* all memory that is necessary for the factorization. */
@@ -689,7 +689,7 @@
printf("\nERROR during symbolic factorization: %d", error);
exit(1);
}
- if (DEBUG_OUT) cout<<taucs_ctime()-t<<"s : Reordering and Symbolic Factorization"<<endl;
+ if (debugOut) cout<<taucs_ctime()-t<<"s : Reordering and Symbolic Factorization"<<endl;
t=taucs_ctime();
/* .. Numerical factorization. */
@@ -702,7 +702,7 @@
printf("\nERROR during numerical factorization: %d", error);
exit(2);
}
- if (DEBUG_OUT) cerr<<taucs_ctime()-t<<"s : Numerical factorization. "<<endl;
+ if (debugOut) cerr<<taucs_ctime()-t<<"s : Numerical factorization. "<<endl;
t=taucs_ctime();
}
/* .. Back substitution and iterative refinement. */
@@ -716,10 +716,10 @@
printf("\nERROR during solution: %d", error);
exit(3);
}
- if (DEBUG_OUT) cerr<<taucs_ctime()-t<<"s : Back substitution and iterative refinement."<<endl;
+ if (debugOut) cerr<<taucs_ctime()-t<<"s : Back substitution and iterative refinement."<<endl;
t=taucs_ctime();
- CopyLinToCells();
- if (DEBUG_OUT) cerr<<taucs_ctime()-t<<"s : Copy back."<<endl;
+ copyLinToCells();
+ if (debugOut) cerr<<taucs_ctime()-t<<"s : Copy back."<<endl;
if (wasLSystemSet){
pTime1N++; pTime1+=(taucs_ctime()-iniT);
@@ -743,7 +743,7 @@
template<class FlowType>
-int FlowBoundingSphereLinSolv<FlowType>::PardisoSolveTest()
+int FlowBoundingSphereLinSolv<FlowType>::pardisoSolveTest()
{
#ifndef PARDISO
return 0;
@@ -751,7 +751,7 @@
/* Matrix data. */
double t = taucs_ctime();//timer
bool wasLSystemSet= isLinearSystemSet;
- int n = SetLinearSystem();
+ int n = setLinearSystem();
// ncols=n;//for VectorizesGS
cout<<taucs_ctime()-t<<"s : set system"<<endl;
t=taucs_ctime();
@@ -759,7 +759,7 @@
int* ja = T_A->rowind;
double* a = T_A->values.d;
- if (!wasLSystemSet) for (int k=0; k<n; k++) sort_v(ia[k],ia[k+1]-1,ja,a);
+ if (!wasLSystemSet) for (int k=0; k<n; k++) sortV(ia[k],ia[k+1]-1,ja,a);
cout<<taucs_ctime()-t<<"s for ordering CCS format"<<endl;
t=taucs_ctime();
@@ -891,13 +891,13 @@
#endif
}
template<class FlowType>
-int FlowBoundingSphereLinSolv<FlowType>::TaucsSolveTest()
+int FlowBoundingSphereLinSolv<FlowType>::taucsSolveTest()
{
#ifdef TAUCS_LIB
cout <<endl<<"TAUCS solve test"<<endl;
double t = taucs_ctime();//timer
- ncols = SetLinearSystem();
+ ncols = setLinearSystem();
//taucs_logfile("stdout");//! VERY USEFULL!!!!!!!!!!! (disable to exclude output time from taucs_ctime() measurments)
@@ -972,8 +972,8 @@
// }
-// const Finite_cells_iterator cell_end = T[currentTes].Triangulation().finite_cells_end();
-// if (DEBUG_OUT) for (Finite_cells_iterator cell = T[currentTes].Triangulation().finite_cells_begin(); cell != cell_end; cell++)
+// const FiniteCellsIterator cell_end = T[currentTes].Triangulation().finite_cells_end();
+// if (debugOut) for (FiniteCellsIterator cell = T[currentTes].Triangulation().finite_cells_begin(); cell != cell_end; cell++)
// {
//
// if (cell->info().index>0) {
=== modified file 'lib/triangulation/Network.hpp'
--- lib/triangulation/Network.hpp 2013-08-22 14:32:01 +0000
+++ lib/triangulation/Network.hpp 2014-03-21 18:45:24 +0000
@@ -46,46 +46,45 @@
Tesselation T [2];
bool currentTes;
- double x_min, x_max, y_min, y_max, z_min, z_max, Rmoy, SectionArea, Height, Vtotale;
- bool DEBUG_OUT;
+ double xMin, xMax, yMin, yMax, zMin, zMax, Rmoy, sectionArea, Height, vTotal;
+ bool debugOut;
int nOfSpheres;
- int x_min_id, x_max_id, y_min_id, y_max_id, z_min_id, z_max_id;
+ int xMinId, xMaxId, yMinId, yMaxId, zMinId, zMaxId;
int* boundsIds [6];
- vector<Cell_handle> boundingCells [6];
- Point Corner_min;
- Point Corner_max;
- Real Vsolid_tot, Vtotalissimo, Vporale, Ssolid_tot, V_porale_porosity, V_totale_porosity;
+ vector<CellHandle> boundingCells [6];
+ Point cornerMin;
+ Point cornerMax;
+ Real VSolidTot, Vtotalissimo, vPoral, sSolidTot, vPoralPorosity, vTotalePorosity;
Boundary boundaries [6];
- Boundary& boundary (int b) {return boundaries[b-id_offset];}
- short id_offset;
- int vtk_infinite_vertices, vtk_infinite_cells, num_particles;
-
- void AddBoundingPlanes();
- void AddBoundingPlane (Vecteur Normal, int id_wall);
- void AddBoundingPlane (Real center[3], double thickness, Vecteur Normal, int id_wall );
-
- void Define_fictious_cells( );
- int detectFacetFictiousVertices (Cell_handle& cell, int& j);
- double volumeSolidPore (const Cell_handle& cell);
- double volume_single_fictious_pore(const Vertex_handle& SV1, const Vertex_handle& SV2, const Vertex_handle& SV3, const Point& PV1, const Point& PV2, Vecteur& facetSurface);
- double volume_double_fictious_pore(const Vertex_handle& SV1, const Vertex_handle& SV2, const Vertex_handle& SV3, const Point& PV1, const Point& PV2, Vecteur& facetSurface);
- double spherical_triangle_volume(const Sphere& ST1, const Point& PT1, const Point& PT2, const Point& PT3);
-
- double fast_spherical_triangle_area(const Sphere& STA1, const Point& STA2, const Point& STA3, const Point& PTA1);
- Real fast_solid_angle(const Point& STA1, const Point& PTA1, const Point& PTA2, const Point& PTA3);
- double volume_double_fictious_pore(Vertex_handle SV1, Vertex_handle SV2, Vertex_handle SV3, Point PV1);
- double volume_single_fictious_pore(Vertex_handle SV1, Vertex_handle SV2, Vertex_handle SV3, Point PV1);
- double Volume_Pore_VoronoiFraction ( Cell_handle& cell, int& j, bool reuseFacetData=false);
- double Surface_Solid_Pore( Cell_handle cell, int j, bool SLIP_ON_LATERALS, bool reuseFacetData=false);
- double spherical_triangle_area ( Sphere STA1, Sphere STA2, Sphere STA3, Point PTA1 );
-
- Vecteur surface_double_fictious_facet(Vertex_handle fSV1, Vertex_handle fSV2, Vertex_handle SV3);
- Vecteur surface_single_fictious_facet(Vertex_handle fSV1, Vertex_handle SV2, Vertex_handle SV3);
- double surface_solid_double_fictious_facet(Vertex_handle SV1, Vertex_handle SV2, Vertex_handle SV3);
- double surface_solid_facet(Sphere ST1, Sphere ST2, Sphere ST3);
+ Boundary& boundary (int b) {return boundaries[b-idOffset];}
+ short idOffset;
+ int vtkInfiniteVertices, vtkInfiniteCells, num_particles;
+
+ void addBoundingPlanes();
+ void addBoundingPlane (Vecteur Normal, int id_wall);
+ void addBoundingPlane (Real center[3], double thickness, Vecteur Normal, int id_wall );
+
+ void defineFictiousCells( );
+ int detectFacetFictiousVertices (CellHandle& cell, int& j);
+ double volumeSolidPore (const CellHandle& cell);
+ double volumeSingleFictiousPore(const VertexHandle& SV1, const VertexHandle& SV2, const VertexHandle& SV3, const Point& PV1, const Point& PV2, Vecteur& facetSurface);
+ double volumeDoubleFictiousPore(const VertexHandle& SV1, const VertexHandle& SV2, const VertexHandle& SV3, const Point& PV1, const Point& PV2, Vecteur& facetSurface);
+ double sphericalTriangleVolume(const Sphere& ST1, const Point& PT1, const Point& PT2, const Point& PT3);
+
+ double fastSphericalTriangleArea(const Sphere& STA1, const Point& STA2, const Point& STA3, const Point& PTA1);
+ Real fastSolidAngle(const Point& STA1, const Point& PTA1, const Point& PTA2, const Point& PTA3);
+ double volumeDoubleFictiousPore(VertexHandle SV1, VertexHandle SV2, VertexHandle SV3, Point PV1);
+ double volumeSingleFictiousPore(VertexHandle SV1, VertexHandle SV2, VertexHandle SV3, Point PV1);
+ double volumePoreVoronoiFraction ( CellHandle& cell, int& j, bool reuseFacetData=false);
+ double surfaceSolidPore( CellHandle cell, int j, bool slipOnLaterals, bool reuseFacetData=false);
+ double sphericalTriangleArea ( Sphere STA1, Sphere STA2, Sphere STA3, Point PTA1 );
+
+ Vecteur surfaceDoubleFictiousFacet(VertexHandle fSV1, VertexHandle fSV2, VertexHandle SV3);
+ Vecteur surfaceSingleFictiousFacet(VertexHandle fSV1, VertexHandle SV2, VertexHandle SV3);
+ double surfaceSolidDoubleFictiousFacet(VertexHandle SV1, VertexHandle SV2, VertexHandle SV3);
+ double surfaceSolidFacet(Sphere ST1, Sphere ST2, Sphere ST3);
int facetF1, facetF2, facetRe1, facetRe2, facetRe3;
- int F1, F2, Re1, Re2;
int facetNFictious;
int real_vertex;
double FAR;
@@ -99,6 +98,4 @@
#include "Network.ipp"
-
-
#endif //FLOW_ENGINE
=== modified file 'lib/triangulation/Network.ipp'
--- lib/triangulation/Network.ipp 2013-07-26 13:52:11 +0000
+++ lib/triangulation/Network.ipp 2014-03-21 18:45:24 +0000
@@ -32,46 +32,39 @@
Network<Tesselation>::Network(){
FAR = 50000;
facetF1=facetF2=facetRe1=facetRe2=facetRe3=0;
- F1=F2=Re1=Re2=0;
+// F1=F2=Re1=Re2=0;
}
template<class Tesselation>
-int Network<Tesselation>::detectFacetFictiousVertices (Cell_handle& cell, int& j)
+int Network<Tesselation>::detectFacetFictiousVertices (CellHandle& cell, int& j)
{
facetNFictious = 0;
- int real_vertex=0;
- Sphere v [3];
- Vertex_handle W [3];
-
- for (int kk=0; kk<3; kk++) {
- W[kk] = cell->vertex(facetVertices[j][kk]);
- v[kk] = cell->vertex(facetVertices[j][kk])->point();
- if (W[kk]->info().isFictious) {
- if (facetNFictious==0) {F1=facetVertices[j][kk];facetF1=kk;} else
- {F2 = facetVertices[j][kk];facetF2=kk;}
+ for (int kk=0; kk<3; kk++) {
+ if (cell->vertex(facetVertices[j][kk])->info().isFictious) {
+ if (facetNFictious==0) facetF1=kk; else facetF2=kk;
facetNFictious +=1;
} else {
- if (real_vertex==0) {Re1=facetVertices[j][kk];facetRe1=kk;} else if (real_vertex==1)
- {Re2=facetVertices[j][kk];facetRe2=kk;} else if (real_vertex==2)
- {Re2=facetVertices[j][kk];facetRe3=kk;}
+ if (real_vertex==0) facetRe1=kk;
+ else if (real_vertex==1) facetRe2=kk;
+ else if (real_vertex==2) facetRe3=kk;
real_vertex+=1;}}
return facetNFictious;
}
template<class Tesselation>
-double Network<Tesselation>::Volume_Pore_VoronoiFraction (Cell_handle& cell, int& j, bool reuseFacetData)
+double Network<Tesselation>::volumePoreVoronoiFraction (CellHandle& cell, int& j, bool reuseFacetData)
{
Point& p1 = cell->info();
Point& p2 = cell->neighbor(j)->info();
if (!reuseFacetData) facetNFictious = detectFacetFictiousVertices (cell,j);
Sphere v [3];
- Vertex_handle W [3];
+ VertexHandle W [3];
for (int kk=0; kk<3; kk++) {W[kk] = cell->vertex(facetVertices[j][kk]);v[kk] = cell->vertex(facetVertices[j][kk])->point();}
switch (facetNFictious) {
case (0) : {
- Vertex_handle& SV1 = W[0];
- Vertex_handle& SV2 = W[1];
- Vertex_handle& SV3 = W[2];
+ VertexHandle& SV1 = W[0];
+ VertexHandle& SV2 = W[1];
+ VertexHandle& SV3 = W[2];
cell->info().facetSurfaces[j]=0.5*CGAL::cross_product(SV1->point()-SV3->point(),SV2->point()-SV3->point());
if (cell->info().facetSurfaces[j][0]==0 && cell->info().facetSurfaces[j][1]==0 && cell->info().facetSurfaces[j][2]==0) cerr<<"NULL FACET SURF"<<endl;
@@ -81,37 +74,37 @@
double Vsolid1=0, Vsolid2=0;
for (int i=0;i<3;i++) {
- Vsolid1 += spherical_triangle_volume(v[permut3[i][0]],v[permut3[i][1]],p1,p2);
- Vsolid2 += spherical_triangle_volume(v[permut3[i][0]],v[permut3[i][2]],p1,p2);}
+ Vsolid1 += sphericalTriangleVolume(v[permut3[i][0]],v[permut3[i][1]],p1,p2);
+ Vsolid2 += sphericalTriangleVolume(v[permut3[i][0]],v[permut3[i][2]],p1,p2);}
- Vsolid_tot += Vsolid1 + Vsolid2;
- Vporale += Vtot - (Vsolid1 + Vsolid2);
+ VSolidTot += Vsolid1 + Vsolid2;
+ vPoral += Vtot - (Vsolid1 + Vsolid2);
bool border=false;
for (int i=0;i<4;i++){
if (cell->neighbor(i)->info().fictious()!=0) border=true;}
- if (!border) {V_porale_porosity += Vtot - (Vsolid1 + Vsolid2);
- V_totale_porosity += Vtot;}
+ if (!border) {vPoralPorosity += Vtot - (Vsolid1 + Vsolid2);
+ vTotalePorosity += Vtot;}
/**Vpore**/ return Vtot - (Vsolid1 + Vsolid2);
}; break;
- case (1) : {return volume_single_fictious_pore(cell->vertex(facetVertices[j][facetF1]), cell->vertex(facetVertices[j][facetRe1]), cell->vertex(facetVertices[j][facetRe2]), p1,p2, cell->info().facetSurfaces[j]);}; break;
- case (2) : {return volume_double_fictious_pore(cell->vertex(facetVertices[j][facetF1]), cell->vertex(facetVertices[j][facetF2]), cell->vertex(facetVertices[j][facetRe1]), p1,p2, cell->info().facetSurfaces[j]);}; break;
+ case (1) : {return volumeSingleFictiousPore(cell->vertex(facetVertices[j][facetF1]), cell->vertex(facetVertices[j][facetRe1]), cell->vertex(facetVertices[j][facetRe2]), p1,p2, cell->info().facetSurfaces[j]);}; break;
+ case (2) : {return volumeDoubleFictiousPore(cell->vertex(facetVertices[j][facetF1]), cell->vertex(facetVertices[j][facetF2]), cell->vertex(facetVertices[j][facetRe1]), p1,p2, cell->info().facetSurfaces[j]);}; break;
default : return 0;}
}
template<class Tesselation>
-double Network<Tesselation>::volumeSolidPore (const Cell_handle& cell)
+double Network<Tesselation>::volumeSolidPore (const CellHandle& cell)
{
double Vsolid=0;
for (int i=0;i<4;i++) {
- if ( !cell->vertex(permut4[i][0])->info().isFictious ) Vsolid += spherical_triangle_volume( cell->vertex(permut4[i][0])->point(), cell->vertex(permut4[i][1])->point(), cell->vertex(permut4[i][2])-> point(), cell->vertex(permut4[i][3])-> point());
+ if ( !cell->vertex(permut4[i][0])->info().isFictious ) Vsolid += sphericalTriangleVolume( cell->vertex(permut4[i][0])->point(), cell->vertex(permut4[i][1])->point(), cell->vertex(permut4[i][2])-> point(), cell->vertex(permut4[i][3])-> point());
}
return Vsolid;
}
template<class Tesselation>
-double Network<Tesselation>::volume_single_fictious_pore(const Vertex_handle& SV1, const Vertex_handle& SV2, const Vertex_handle& SV3, const Point& PV1, const Point& PV2, Vecteur& facetSurface)
+double Network<Tesselation>::volumeSingleFictiousPore(const VertexHandle& SV1, const VertexHandle& SV2, const VertexHandle& SV3, const Point& PV1, const Point& PV2, Vecteur& facetSurface)
{
double A [3], B[3];
@@ -125,7 +118,7 @@
Point AA(A[0],A[1],A[2]);
Point BB(B[0],B[1],B[2]);
- facetSurface = surface_single_fictious_facet(SV1,SV2,SV3);
+ facetSurface = surfaceSingleFictiousFacet(SV1,SV2,SV3);
if (facetSurface*(PV2-PV1) > 0) facetSurface = -1.0*facetSurface;
Real Vtot=ONE_THIRD*abs(facetSurface*(PV1-PV2));
Vtotalissimo += Vtot;
@@ -135,17 +128,17 @@
Sphere& SW2 = SV2->point();
Sphere& SW3 = SV3->point();
- Real Vsolid1 = spherical_triangle_volume(SW2, AA, PV1, PV2)+spherical_triangle_volume(SW2, SW3, PV1, PV2);
- Real Vsolid2 = spherical_triangle_volume(SW3, BB, PV1, PV2)+spherical_triangle_volume(SW3, SW2, PV1, PV2);
+ Real Vsolid1 = sphericalTriangleVolume(SW2, AA, PV1, PV2)+sphericalTriangleVolume(SW2, SW3, PV1, PV2);
+ Real Vsolid2 = sphericalTriangleVolume(SW3, BB, PV1, PV2)+sphericalTriangleVolume(SW3, SW2, PV1, PV2);
- Vsolid_tot += Vsolid1 + Vsolid2;
- Vporale += Vtot - (Vsolid1 + Vsolid2);
+ VSolidTot += Vsolid1 + Vsolid2;
+ vPoral += Vtot - (Vsolid1 + Vsolid2);
return (Vtot - (Vsolid1 + Vsolid2));
}
template<class Tesselation>
-double Network<Tesselation>::volume_double_fictious_pore(const Vertex_handle& SV1, const Vertex_handle& SV2, const Vertex_handle& SV3, const Point& PV1, const Point& PV2, Vecteur& facetSurface)
+double Network<Tesselation>::volumeDoubleFictiousPore(const VertexHandle& SV1, const VertexHandle& SV2, const VertexHandle& SV3, const Point& PV1, const Point& PV2, Vecteur& facetSurface)
{
double A [3], B[3];
@@ -163,37 +156,37 @@
Real Vtot = abs(facetSurface*(PV1-PV2))*ONE_THIRD;
Vtotalissimo += Vtot;
- Real Vsolid1 = spherical_triangle_volume(SV3->point(), AA, PV1, PV2);
- Real Vsolid2 = spherical_triangle_volume(SV3->point(), BB, PV1, PV2);
+ Real Vsolid1 = sphericalTriangleVolume(SV3->point(), AA, PV1, PV2);
+ Real Vsolid2 = sphericalTriangleVolume(SV3->point(), BB, PV1, PV2);
- Vporale += (Vtot - Vsolid1 - Vsolid2);
- Vsolid_tot += Vsolid1 + Vsolid2;
+ vPoral += (Vtot - Vsolid1 - Vsolid2);
+ VSolidTot += Vsolid1 + Vsolid2;
return (Vtot - Vsolid1 - Vsolid2);
}
template<class Tesselation>
-double Network<Tesselation>::spherical_triangle_volume(const Sphere& ST1, const Point& PT1, const Point& PT2, const Point& PT3)
+double Network<Tesselation>::sphericalTriangleVolume(const Sphere& ST1, const Point& PT1, const Point& PT2, const Point& PT3)
{
double rayon = sqrt(ST1.weight());
if (rayon == 0.0) return 0.0;
- return ((ONE_THIRD * rayon) * (fast_spherical_triangle_area(ST1, PT1, PT2, PT3))) ;
+ return ((ONE_THIRD * rayon) * (fastSphericalTriangleArea(ST1, PT1, PT2, PT3))) ;
}
template<class Tesselation>
-double Network<Tesselation>::fast_spherical_triangle_area(const Sphere& STA1, const Point& STA2, const Point& STA3, const Point& PTA1)
+double Network<Tesselation>::fastSphericalTriangleArea(const Sphere& STA1, const Point& STA2, const Point& STA3, const Point& PTA1)
{
using namespace CGAL;
#ifndef FAST
- return spherical_triangle_area(STA1, STA2, STA3, PTA1);
+ return sphericalTriangleArea(STA1, STA2, STA3, PTA1);
#endif
double rayon2 = STA1.weight();
if (rayon2 == 0.0) return 0.0;
- return rayon2 * fast_solid_angle(STA1,STA2,STA3,PTA1);
+ return rayon2 * fastSolidAngle(STA1,STA2,STA3,PTA1);
}
template<class Tesselation>
-double Network<Tesselation>::spherical_triangle_area ( Sphere STA1, Sphere STA2, Sphere STA3, Point PTA1 )
+double Network<Tesselation>::sphericalTriangleArea ( Sphere STA1, Sphere STA2, Sphere STA3, Point PTA1 )
{
double rayon = STA1.weight();
if ( rayon == 0.0 ) return 0.0;
@@ -225,7 +218,7 @@
}
template<class Tesselation>
-Real Network<Tesselation>::fast_solid_angle(const Point& STA1, const Point& PTA1, const Point& PTA2, const Point& PTA3)
+Real Network<Tesselation>::fastSolidAngle(const Point& STA1, const Point& PTA1, const Point& PTA2, const Point& PTA3)
{
//! This function needs to be fast because it is used heavily. Avoid using vector operations which require constructing vectors (~50% of cpu time in the non-fast version), and compute angle using the 3x faster formula of Oosterom and StrackeeVan Oosterom, A; Strackee, J (1983). "The Solid Angle of a Plane Triangle". IEEE Trans. Biom. Eng. BME-30 (2): 125-126. (or check http://en.wikipedia.org/wiki/Solid_angle)
using namespace CGAL;
@@ -261,7 +254,7 @@
}
template<class Tesselation>
-double Network<Tesselation>::Surface_Solid_Pore(Cell_handle cell, int j, bool SLIP_ON_LATERALS, bool reuseFacetData)
+double Network<Tesselation>::surfaceSolidPore(CellHandle cell, int j, bool slipOnLaterals, bool reuseFacetData)
{
if (!reuseFacetData) facetNFictious=detectFacetFictiousVertices(cell,j);
Point& p1 = cell->info();
@@ -271,7 +264,7 @@
double Ssolid1= 0, Ssolid1n= 0, Ssolid2= 0, Ssolid2n= 0, Ssolid3= 0, Ssolid3n= 0;
Sphere v [3];
- Vertex_handle W [3];
+ VertexHandle W [3];
for (int kk=0; kk<3; kk++) {
W[kk] = cell->vertex(facetVertices[j][kk]);
@@ -279,46 +272,46 @@
switch (facetNFictious) {
case (0) : {
- Vertex_handle& SV1 = W[0];
- Vertex_handle& SV2 = W[1];
- Vertex_handle& SV3 = W[2];
+ VertexHandle& SV1 = W[0];
+ VertexHandle& SV2 = W[1];
+ VertexHandle& SV3 = W[2];
- Ssolid1 = fast_spherical_triangle_area(SV1->point(), SV2->point(), p1, p2);
- Ssolid1n = fast_spherical_triangle_area(SV1->point(), SV3->point(), p1, p2);
+ Ssolid1 = fastSphericalTriangleArea(SV1->point(), SV2->point(), p1, p2);
+ Ssolid1n = fastSphericalTriangleArea(SV1->point(), SV3->point(), p1, p2);
cell->info().solidSurfaces[j][0]=Ssolid1+Ssolid1n;
- Ssolid2 = fast_spherical_triangle_area(SV2->point(),SV1->point(),p1, p2);
- Ssolid2n = fast_spherical_triangle_area(SV2->point(),SV3->point(),p1, p2);
+ Ssolid2 = fastSphericalTriangleArea(SV2->point(),SV1->point(),p1, p2);
+ Ssolid2n = fastSphericalTriangleArea(SV2->point(),SV3->point(),p1, p2);
cell->info().solidSurfaces[j][1]=Ssolid2+Ssolid2n;
- Ssolid3 = fast_spherical_triangle_area(SV3->point(),SV2->point(),p1, p2);
- Ssolid3n = fast_spherical_triangle_area(SV3->point(),SV1->point(),p1, p2);
+ Ssolid3 = fastSphericalTriangleArea(SV3->point(),SV2->point(),p1, p2);
+ Ssolid3n = fastSphericalTriangleArea(SV3->point(),SV1->point(),p1, p2);
cell->info().solidSurfaces[j][2]=Ssolid3+Ssolid3n;
}; break;
case (1) : {
- Vertex_handle SV1 = cell->vertex(facetVertices[j][facetF1]);
- Vertex_handle SV2 = cell->vertex(facetVertices[j][facetRe1]);
- Vertex_handle SV3 = cell->vertex(facetVertices[j][facetRe2]);
+ VertexHandle SV1 = cell->vertex(facetVertices[j][facetF1]);
+ VertexHandle SV2 = cell->vertex(facetVertices[j][facetRe1]);
+ VertexHandle SV3 = cell->vertex(facetVertices[j][facetRe2]);
Boundary &bi1 = boundary(SV1->info().id());
Ssolid1 = 0;
- if (bi1.flowCondition && ! SLIP_ON_LATERALS) {
+ if (bi1.flowCondition && ! slipOnLaterals) {
Ssolid1 = abs(0.5*CGAL::cross_product(p1-p2, SV2->point()-SV3->point())[bi1.coordinate]);
cell->info().solidSurfaces[j][facetF1]=Ssolid1;
}
- Ssolid2 = fast_spherical_triangle_area(SV2->point(),SV1->point(),p1, p2);
- Ssolid2n = fast_spherical_triangle_area(SV2->point(),SV3->point(),p1, p2);
+ Ssolid2 = fastSphericalTriangleArea(SV2->point(),SV1->point(),p1, p2);
+ Ssolid2n = fastSphericalTriangleArea(SV2->point(),SV3->point(),p1, p2);
cell->info().solidSurfaces[j][facetRe1]=Ssolid2+Ssolid2n;
- Ssolid3 = fast_spherical_triangle_area(SV3->point(),SV2->point(),p1, p2);
- Ssolid3n = fast_spherical_triangle_area(SV3->point(),SV1->point(),p1, p2);
+ Ssolid3 = fastSphericalTriangleArea(SV3->point(),SV2->point(),p1, p2);
+ Ssolid3n = fastSphericalTriangleArea(SV3->point(),SV1->point(),p1, p2);
cell->info().solidSurfaces[j][facetRe2]=Ssolid3+Ssolid3n;
}; break;
case (2) : {
double A [3], B[3], C[3];
- Vertex_handle SV1 = cell->vertex(facetVertices[j][facetF1]);
- Vertex_handle SV2 = cell->vertex(facetVertices[j][facetF2]);
- Vertex_handle SV3 = cell->vertex(facetVertices[j][facetRe1]);
+ VertexHandle SV1 = cell->vertex(facetVertices[j][facetF1]);
+ VertexHandle SV2 = cell->vertex(facetVertices[j][facetF2]);
+ VertexHandle SV3 = cell->vertex(facetVertices[j][facetRe1]);
Boundary &bi1 = boundary(SV1->info().id());
Boundary &bi2 = boundary(SV2->info().id());
@@ -337,18 +330,18 @@
Sphere B1(BB, 0);
Sphere C1(CC, 0);
//FIXME : we are computing triangle area twice here, because its computed in volume_double_fictious already -> optimize
- Ssolid1 = fast_spherical_triangle_area(SV3->point(), AA, p1, p2);
- Ssolid1n = fast_spherical_triangle_area(SV3->point(), BB, p1, p2);
+ Ssolid1 = fastSphericalTriangleArea(SV3->point(), AA, p1, p2);
+ Ssolid1n = fastSphericalTriangleArea(SV3->point(), BB, p1, p2);
cell->info().solidSurfaces[j][facetRe1]=Ssolid1+Ssolid1n;
//area vector of triangle (p1,sphere,p2)
Vecteur p1p2v1Surface = 0.5*CGAL::cross_product(p1-p2,SV3->point()-p2);
- if (bi1.flowCondition && ! SLIP_ON_LATERALS) {
+ if (bi1.flowCondition && ! slipOnLaterals) {
//projection on boundary 1
Ssolid2 = abs(p1p2v1Surface[bi1.coordinate]);
cell->info().solidSurfaces[j][facetF1]=Ssolid2;
} else cell->info().solidSurfaces[j][facetF1]=0;
- if (bi2.flowCondition && ! SLIP_ON_LATERALS) {
+ if (bi2.flowCondition && ! slipOnLaterals) {
//projection on boundary 2
Ssolid3 = abs(p1p2v1Surface[bi2.coordinate]);
cell->info().solidSurfaces[j][facetF2]=Ssolid3;
@@ -361,14 +354,14 @@
if (Ssolid)
cell->info().solidSurfaces[j][3]=1.0/Ssolid;
else cell->info().solidSurfaces[j][3]=0;
- Ssolid_tot += Ssolid;
+ sSolidTot += Ssolid;
return Ssolid;
}
template<class Tesselation>
-Vecteur Network<Tesselation>::surface_double_fictious_facet(Vertex_handle fSV1, Vertex_handle fSV2, Vertex_handle SV3)
+Vecteur Network<Tesselation>::surfaceDoubleFictiousFacet(VertexHandle fSV1, VertexHandle fSV2, VertexHandle SV3)
{
//This function is correct only with axis-aligned boundaries
const Boundary &bi1 = boundary(fSV1->info().id());
@@ -381,7 +374,7 @@
}
template<class Tesselation>
-Vecteur Network<Tesselation>::surface_single_fictious_facet(Vertex_handle fSV1, Vertex_handle SV2, Vertex_handle SV3)
+Vecteur Network<Tesselation>::surfaceSingleFictiousFacet(VertexHandle fSV1, VertexHandle SV2, VertexHandle SV3)
{
//This function is correct only with axis-aligned boundaries
const Boundary &bi1 = boundary(fSV1->info().id());
@@ -392,7 +385,7 @@
}
template<class Tesselation>
-double Network<Tesselation>::surface_solid_double_fictious_facet(Vertex_handle SV1, Vertex_handle SV2, Vertex_handle SV3)
+double Network<Tesselation>::surfaceSolidDoubleFictiousFacet(VertexHandle SV1, VertexHandle SV2, VertexHandle SV3)
{
double A [3], B [3];
@@ -413,13 +406,13 @@
}
total_surface = sqrt(board1 * board2);
- double solid_surface = surface_solid_facet(SV3->point(),SV2->point(),SV1->point());
+ double solid_surface = surfaceSolidFacet(SV3->point(),SV2->point(),SV1->point());
return total_surface - solid_surface;
}
template<class Tesselation>
-double Network<Tesselation>::surface_solid_facet(Sphere ST1, Sphere ST2, Sphere ST3)
+double Network<Tesselation>::surfaceSolidFacet(Sphere ST1, Sphere ST2, Sphere ST3)
{
double Area;
@@ -439,107 +432,107 @@
}
template<class Tesselation>
-void Network<Tesselation>::AddBoundingPlanes()
+void Network<Tesselation>::addBoundingPlanes()
{
Tesselation& Tes = T[currentTes];
//FIXME: Id's order in boundsIds is done according to the enumerotation of boundaries from TXStressController.hpp, line 31. DON'T CHANGE IT!
- y_min_id = Tes.Max_id() + 2;
- boundsIds[0]=&y_min_id;
- y_max_id = Tes.Max_id() + 3;
- boundsIds[1]=&y_max_id;
- x_min_id = Tes.Max_id() + 0;
- boundsIds[2]=&x_min_id;
- x_max_id = Tes.Max_id() + 1;
- boundsIds[3]=&x_max_id;
- z_min_id = Tes.Max_id() + 5;
- boundsIds[4]=&z_max_id;
- z_max_id = Tes.Max_id() + 6;
- boundsIds[5]=&z_min_id;
-
- Corner_min = Point(x_min, y_min, z_min);
- Corner_max = Point(x_max, y_max, z_max);
-
- id_offset = Tes.Max_id() +1;//so that boundaries[vertex->id - offset] gives the ordered boundaries (also see function Boundary& boundary(int b))
-
- AddBoundingPlane (Vecteur(0,1,0) , y_min_id);
- AddBoundingPlane (Vecteur(0,-1,0) , y_max_id);
- AddBoundingPlane (Vecteur(-1,0,0) , x_max_id);
- AddBoundingPlane (Vecteur(1,0,0) , x_min_id);
- AddBoundingPlane (Vecteur(0,0,1) , z_min_id);
- AddBoundingPlane (Vecteur(0,0,-1) , z_max_id);
+ yMinId = Tes.Max_id() + 2;
+ boundsIds[0]=&yMinId;
+ yMaxId = Tes.Max_id() + 3;
+ boundsIds[1]=&yMaxId;
+ xMinId = Tes.Max_id() + 0;
+ boundsIds[2]=&xMinId;
+ xMaxId = Tes.Max_id() + 1;
+ boundsIds[3]=&xMaxId;
+ zMinId = Tes.Max_id() + 5;
+ boundsIds[4]=&zMaxId;
+ zMaxId = Tes.Max_id() + 6;
+ boundsIds[5]=&zMinId;
+
+ cornerMin = Point(xMin, yMin, zMin);
+ cornerMax = Point(xMax, yMax, zMax);
+
+ idOffset = Tes.Max_id() +1;//so that boundaries[vertex->id - offset] gives the ordered boundaries (also see function Boundary& boundary(int b))
+
+ addBoundingPlane (Vecteur(0,1,0) , yMinId);
+ addBoundingPlane (Vecteur(0,-1,0) , yMaxId);
+ addBoundingPlane (Vecteur(-1,0,0) , xMaxId);
+ addBoundingPlane (Vecteur(1,0,0) , xMinId);
+ addBoundingPlane (Vecteur(0,0,1) , zMinId);
+ addBoundingPlane (Vecteur(0,0,-1) , zMaxId);
-// AddBoundingPlanes(true);
+// addBoundingPlanes(true);
}
template<class Tesselation>
-void Network<Tesselation>::AddBoundingPlane (Vecteur Normal, int id_wall)
+void Network<Tesselation>::addBoundingPlane (Vecteur Normal, int id_wall)
{
// Tesselation& Tes = T[currentTes];
//FIXME: pre-condition: the normal is axis-aligned
int Coordinate = abs(Normal[0])*0 + abs(Normal[1])*1 + abs(Normal[2])*2;
double pivot = Normal[Coordinate]<0 ?
- Corner_max.x()*abs(Normal[0])+Corner_max.y()*abs(Normal[1])+Corner_max.z()*abs(Normal[2]) : Corner_min.x()*abs(Normal[0])+Corner_min.y()*abs(Normal[1])+Corner_min.z()*abs(Normal[2]);
+ cornerMax.x()*abs(Normal[0])+cornerMax.y()*abs(Normal[1])+cornerMax.z()*abs(Normal[2]) : cornerMin.x()*abs(Normal[0])+cornerMin.y()*abs(Normal[1])+cornerMin.z()*abs(Normal[2]);
- Real center [3] ={ 0.5*(Corner_min.x() +Corner_max.x())*(1-abs(Normal[0]))+pivot*abs(Normal[0]),
- 0.5*(Corner_max.y() +Corner_min.y())*(1-abs(Normal[1]))+pivot*abs(Normal[1]),
- 0.5*(Corner_max.z() +Corner_min.z())*(1-abs(Normal[2]))+pivot*abs(Normal[2])};
+ Real center [3] ={ 0.5*(cornerMin.x() +cornerMax.x())*(1-abs(Normal[0]))+pivot*abs(Normal[0]),
+ 0.5*(cornerMax.y() +cornerMin.y())*(1-abs(Normal[1]))+pivot*abs(Normal[1]),
+ 0.5*(cornerMax.z() +cornerMin.z())*(1-abs(Normal[2]))+pivot*abs(Normal[2])};
- AddBoundingPlane(center,0,Normal,id_wall);
+ addBoundingPlane(center,0,Normal,id_wall);
}
template<class Tesselation>
-void Network<Tesselation>::AddBoundingPlane (Real center[3], double thickness, Vecteur Normal, int id_wall )
+void Network<Tesselation>::addBoundingPlane (Real center[3], double thickness, Vecteur Normal, int id_wall )
{
Tesselation& Tes = T[currentTes];
int Coordinate = abs(Normal[0])*0 + abs(Normal[1])*1 + abs(Normal[2])*2;
- Tes.insert((center[0]+Normal[0]*thickness/2)*(1-abs(Normal[0])) + (center[0]+Normal[0]*thickness/2-Normal[0]*FAR*(Corner_max.y()-Corner_min.y()))*abs(Normal[0]),
- (center[1]+Normal[1]*thickness/2)*(1-abs(Normal[1])) + (center[1]+Normal[1]*thickness/2-Normal[1]*FAR*(Corner_max.y()-Corner_min.y()))*abs(Normal[1]),
- (center[2]+Normal[2]*thickness/2)*(1-abs(Normal[2])) + (center[2]+Normal[2]*thickness/2-Normal[2]*FAR*(Corner_max.y()-Corner_min.y()))*abs(Normal[2]),
- FAR*(Corner_max.y()-Corner_min.y()), id_wall, true);
+ Tes.insert((center[0]+Normal[0]*thickness/2)*(1-abs(Normal[0])) + (center[0]+Normal[0]*thickness/2-Normal[0]*FAR*(cornerMax.y()-cornerMin.y()))*abs(Normal[0]),
+ (center[1]+Normal[1]*thickness/2)*(1-abs(Normal[1])) + (center[1]+Normal[1]*thickness/2-Normal[1]*FAR*(cornerMax.y()-cornerMin.y()))*abs(Normal[1]),
+ (center[2]+Normal[2]*thickness/2)*(1-abs(Normal[2])) + (center[2]+Normal[2]*thickness/2-Normal[2]*FAR*(cornerMax.y()-cornerMin.y()))*abs(Normal[2]),
+ FAR*(cornerMax.y()-cornerMin.y()), id_wall, true);
Point P (center[0],center[1],center[2]);
- boundaries[id_wall-id_offset].p = P;
- boundaries[id_wall-id_offset].normal = Normal;
- boundaries[id_wall-id_offset].coordinate = Coordinate;
-
- boundaries[id_wall-id_offset].flowCondition = 1;
- boundaries[id_wall-id_offset].value = 0;
-
- if(DEBUG_OUT) cout << "A boundary -center/thick- has been created. ID = " << id_wall << " position = " << (center[0]+Normal[0]*thickness/2)*(1-abs(Normal[0])) + (center[0]+Normal[0]*thickness/2-Normal[0]*FAR*(Corner_max.y()-Corner_min.y()))*abs(Normal[0]) << " , " << (center[1]+Normal[1]*thickness/2)*(1-abs(Normal[1])) + (center[1]+Normal[1]*thickness/2-Normal[1]*FAR*(Corner_max.y()-Corner_min.y()))*abs(Normal[1]) << " , " << (center[2]+Normal[2]*thickness/2)*(1-abs(Normal[2])) + (center[2]+Normal[2]*thickness/2-Normal[2]*FAR*(Corner_max.y()-Corner_min.y()))*abs(Normal[2]) << ". Radius = " << FAR*(Corner_max.y()-Corner_min.y()) << endl;
+ boundaries[id_wall-idOffset].p = P;
+ boundaries[id_wall-idOffset].normal = Normal;
+ boundaries[id_wall-idOffset].coordinate = Coordinate;
+
+ boundaries[id_wall-idOffset].flowCondition = 1;
+ boundaries[id_wall-idOffset].value = 0;
+
+ if(debugOut) cout << "A boundary -center/thick- has been created. ID = " << id_wall << " position = " << (center[0]+Normal[0]*thickness/2)*(1-abs(Normal[0])) + (center[0]+Normal[0]*thickness/2-Normal[0]*FAR*(cornerMax.y()-cornerMin.y()))*abs(Normal[0]) << " , " << (center[1]+Normal[1]*thickness/2)*(1-abs(Normal[1])) + (center[1]+Normal[1]*thickness/2-Normal[1]*FAR*(cornerMax.y()-cornerMin.y()))*abs(Normal[1]) << " , " << (center[2]+Normal[2]*thickness/2)*(1-abs(Normal[2])) + (center[2]+Normal[2]*thickness/2-Normal[2]*FAR*(cornerMax.y()-cornerMin.y()))*abs(Normal[2]) << ". Radius = " << FAR*(cornerMax.y()-cornerMin.y()) << endl;
}
template<class Tesselation>
-void Network<Tesselation>::Define_fictious_cells()
+void Network<Tesselation>::defineFictiousCells()
{
RTriangulation& Tri = T[currentTes].Triangulation();
- Finite_cells_iterator cell_end = Tri.finite_cells_end();
- for (Finite_cells_iterator cell = Tri.finite_cells_begin(); cell != cell_end; cell++) {
+ FiniteCellsIterator cellEnd = Tri.finite_cells_end();
+ for (FiniteCellsIterator cell = Tri.finite_cells_begin(); cell != cellEnd; cell++) {
cell->info().fictious()=0;}
for (int bound=0; bound<6;bound++) {
int& id = *boundsIds[bound];
if (id<0) continue;
- Vector_Cell tmp_cells;
- tmp_cells.resize(10000);
- VCell_iterator cells_it = tmp_cells.begin();
- VCell_iterator cells_end = Tri.incident_cells(T[currentTes].vertexHandles[id],cells_it);
- for (VCell_iterator it = tmp_cells.begin(); it != cells_end; it++)
+ VectorCell tmpCells;
+ tmpCells.resize(10000);
+ VCellIterator cells_it = tmpCells.begin();
+ VCellIterator cells_end = Tri.incident_cells(T[currentTes].vertexHandles[id],cells_it);
+ for (VCellIterator it = tmpCells.begin(); it != cells_end; it++)
{
- Cell_handle& cell = *it;
+ CellHandle& cell = *it;
(cell->info().fictious())+=1;
cell->info().isFictious=true;
}
}
- if(DEBUG_OUT) cout << "Fictious cell defined" << endl;
+ if(debugOut) cout << "Fictious cell defined" << endl;
}
-// double Network::spherical_triangle_area ( Sphere STA1, Sphere STA2, Sphere STA3, Point PTA1 )
+// double Network::sphericalTriangleArea ( Sphere STA1, Sphere STA2, Sphere STA3, Point PTA1 )
// {
// double rayon = STA1.weight();
// if ( rayon == 0.0 ) return 0.0;
=== modified file 'lib/triangulation/PeriodicFlow.cpp'
--- lib/triangulation/PeriodicFlow.cpp 2013-11-21 01:28:17 +0000
+++ lib/triangulation/PeriodicFlow.cpp 2014-03-21 18:45:24 +0000
@@ -13,69 +13,59 @@
namespace CGT {
-void PeriodicFlow::Interpolate(Tesselation& Tes, Tesselation& NewTes)
+void PeriodicFlow::interpolate(Tesselation& Tes, Tesselation& NewTes)
{
- Cell_handle old_cell;
-// RTriangulation& NewTri = NewTes.Triangulation();
+ CellHandle oldCell;
RTriangulation& Tri = Tes.Triangulation();
-// Finite_cells_iterator cell_end = NewTri.finite_cells_end();
- for (Vector_Cell::iterator cell_it=NewTes.cellHandles.begin(); cell_it!=NewTes.cellHandles.end(); cell_it++){
- Cell_handle& new_cell = *cell_it;
-// for (Finite_cells_iterator new_cell = NewTri.finite_cells_begin(); new_cell != cell_end; new_cell++) {
- if (new_cell->info().Pcondition || new_cell->info().isGhost) continue;
+ for (VectorCell::iterator cellIt=NewTes.cellHandles.begin(); cellIt!=NewTes.cellHandles.end(); cellIt++){
+ CellHandle& newCell = *cellIt;
+ if (newCell->info().Pcondition || newCell->info().isGhost) continue;
Vecteur center ( 0,0,0 );
- if (new_cell->info().fictious()==0) for ( int k=0;k<4;k++ ) center= center + 0.25* (Tes.vertex(new_cell->vertex(k)->info().id())->point()-CGAL::ORIGIN);
+ if (newCell->info().fictious()==0) for ( int k=0;k<4;k++ ) center= center + 0.25* (Tes.vertex(newCell->vertex(k)->info().id())->point()-CGAL::ORIGIN);
else {
Real boundPos=0; int coord=0;
for ( int k=0;k<4;k++ ) {
- if (!new_cell->vertex (k)->info().isFictious) center= center+0.3333333333*(Tes.vertex(new_cell->vertex(k)->info().id())->point()-CGAL::ORIGIN);
+ if (!newCell->vertex (k)->info().isFictious) center= center+0.3333333333*(Tes.vertex(newCell->vertex(k)->info().id())->point()-CGAL::ORIGIN);
else {
- coord=boundary (new_cell->vertex(k)->info().id()).coordinate;
- boundPos=boundary (new_cell->vertex(k)->info().id()).p[coord];
+ coord=boundary (newCell->vertex(k)->info().id()).coordinate;
+ boundPos=boundary (newCell->vertex(k)->info().id()).p[coord];
}
}
center=Vecteur(coord==0?boundPos:center[0],coord==1?boundPos:center[1],coord==2?boundPos:center[2]);
}
- old_cell = Tri.locate(Point(center[0],center[1],center[2]));
- new_cell->info().p() = old_cell->info().shiftedP();
+ oldCell = Tri.locate(Point(center[0],center[1],center[2]));
+ newCell->info().p() = oldCell->info().shiftedP();
}
// Tes.Clear();//Don't reset to avoid segfault when getting pressure in scripts just after interpolation
}
-void PeriodicFlow::ComputeFacetForcesWithCache(bool onlyCache)
+void PeriodicFlow::computeFacetForcesWithCache(bool onlyCache)
{
RTriangulation& Tri = T[currentTes].Triangulation();
Vecteur nullVect(0,0,0);
static vector<Vecteur> oldForces;
if (oldForces.size()<=Tri.number_of_vertices()) oldForces.resize(Tri.number_of_vertices()+1);
//reset forces
- for (Finite_vertices_iterator v = Tri.finite_vertices_begin(); v != Tri.finite_vertices_end(); ++v) {
+ for (FiniteVerticesIterator v = Tri.finite_vertices_begin(); v != Tri.finite_vertices_end(); ++v) {
if (noCache) {oldForces[v->info().id()]=nullVect; v->info().forces=nullVect;}
else {oldForces[v->info().id()]=v->info().forces; v->info().forces=nullVect;}
}
-// #ifdef EIGENSPARSE_LIB
-// typedef Eigen::Triplet<double> ETriplet;
-// std::vector<ETriplet> tripletList;//The list of non-zero components in Eigen sparse matrix
-// std::vector<ETriplet> shiftsList;//The list of non-zero components in Eigen sparse matrix
-// std::vector<ETriplet> FRHSList;//The list of non-zero components in Eigen sparse matrix
-// unsigned int nPCells=0;
-// #endif
- Cell_handle neighbour_cell;
- Vertex_handle mirror_vertex;
+ CellHandle neighbourCell;
+ VertexHandle mirrorVertex;
Vecteur tempVect;
//FIXME : Ema, be carefull with this (noCache), it needs to be turned true after retriangulation
if (noCache) {
- for (Vector_Cell::iterator cell_it=T[currentTes].cellHandles.begin(); cell_it!=T[currentTes].cellHandles.end(); cell_it++){
- Cell_handle& cell = *cell_it;
+ for (VectorCell::iterator cellIt=T[currentTes].cellHandles.begin(); cellIt!=T[currentTes].cellHandles.end(); cellIt++){
+ CellHandle& cell = *cellIt;
for (int k=0;k<4;k++) cell->info().unitForceVectors[k]=nullVect;
for (int j=0; j<4; j++) if (!Tri.is_infinite(cell->neighbor(j))) {
// #ifdef EIGENSPARSE_LIB
// if (!cell->info().Pcondition) ++nPCells;
// #endif
- neighbour_cell = cell->neighbor(j);
+ neighbourCell = cell->neighbor(j);
const Vecteur& Surfk = cell->info().facetSurfaces[j];
//FIXME : later compute that fluidSurf only once in hydraulicRadius, for now keep full surface not modified in cell->info for comparison with other forces schemes
//The ratio void surface / facet surface
@@ -91,10 +81,10 @@
cell->info().unitForceVectors[j]=cell->info().unitForceVectors[j]+ tempVect;
}
/// Apply weighted forces f_k=sqRad_k/sumSqRad*f
- Vecteur Facet_Unit_Force = -fluidSurfk*cell->info().solidSurfaces[j][3];
+ Vecteur facetUnitForce = -fluidSurfk*cell->info().solidSurfaces[j][3];
for (int y=0; y<3;y++) {
//add to cached value
- cell->info().unitForceVectors[facetVertices[j][y]]=cell->info().unitForceVectors[facetVertices[j][y]]+Facet_Unit_Force*cell->info().solidSurfaces[j][y];
+ cell->info().unitForceVectors[facetVertices[j][y]]=cell->info().unitForceVectors[facetVertices[j][y]]+facetUnitForce*cell->info().solidSurfaces[j][y];
//uncomment to get total force / comment to get only viscous forces (Bruno)
if (!cell->vertex(facetVertices[j][y])->info().isFictious) {
//add to cached value
@@ -102,53 +92,8 @@
}
}
}
-// #ifdef EIGENSPARSE_LIB //Problem:
-// for (int jj=0; jj<4; jj++) if (!Tri.is_infinite(cell->neighbor(jj))) {
-// for (unsigned int dim=0; dim<3; dim++) {
-// if (!cell->info().Pcondition) {
-// tripletList.push_back(ETriplet(
-// 3*cell->vertex(jj)->info().id()+dim,
-// cell->info().index-1,
-// cell->info().unitForceVectors[jj][dim]));
-//
-// if (cell->vertex(jj)->info().period[dim])
-// shiftsList.push_back(ETriplet(
-// 3*cell->vertex(jj)->info().id()+dim,
-// 0,
-// cell->vertex(jj)->info().period[dim]));
-// } else {
-// FRHSList.push_back(ETriplet(
-// 3*cell->vertex(jj)->info().id()+dim,
-// 0,
-// cell->info().unitForceVectors[jj][dim]*cell->info().p()));
-// }
-// }
-// }
-// #endif
}
-// #ifdef EIGENSPARSE_LIB
-// cerr<<"set triplets"<<endl;
-// FIntegral.resize(Tri.number_of_vertices()*3,nPCells);
-// PshiftsInts.resize(Tri.number_of_vertices()*3,3);
-// FRHS.resize(Tri.number_of_vertices()*3,1);
-//
-// FIntegral.setFromTriplets(tripletList.begin(),tripletList.end());
-// PshiftsInts.setFromTriplets(shiftsList.begin(),shiftsList.end());
-// FRHS.setFromTriplets(FRHSList.begin(),FRHSList.end());
-//
-// Vector3r pDelts;
-// for (unsigned int k=0; k<3;k++) pDelts(k) = PeriodicCellInfo::hSize[k]*PeriodicCellInfo::gradP;
-// Eigen::MatrixXd p(nPCells,1);
-// for (Vector_Cell::iterator cell_it=T[currentTes].cellHandles.begin(); cell_it!=T[currentTes].cellHandles.end(); cell_it++)
-// {
-// if (!(*cell_it)->info().Pcondition) p[(*cell_it)->info().index-1]=(*cell_it)->info().p();
-// }
-// forces.resize(Tri.number_of_vertices()*3);
-// cerr<<"compute and display forces"<<endl;
-// forces = FIntegral * p;
-// for (int jj=0;jj<30;jj++) cerr <<"force: "<<forces(3*jj)<<" "<<forces(3*jj+1)<<" "<<forces(3*jj+2)<<endl;
-// #endif
noCache=false;//cache should always be defined after execution of this function
if (onlyCache) return;
}// end if(noCache)
@@ -158,63 +103,54 @@
Real pDeltas [3];
for (unsigned int k=0; k<3;k++) pDeltas[k]=PeriodicCellInfo::hSize[k]*PeriodicCellInfo::gradP;
//Then compute the forces
- for (Vector_Cell::iterator cell_it=T[currentTes].cellHandles.begin(); cell_it!=T[currentTes].cellHandles.end(); cell_it++){
- const Cell_handle& cell = *cell_it;
+ for (VectorCell::iterator cellIt=T[currentTes].cellHandles.begin(); cellIt!=T[currentTes].cellHandles.end(); cellIt++){
+ const CellHandle& cell = *cellIt;
for (int yy=0;yy<4;yy++) {
- Vertex_Info& vhi = cell->vertex(yy)->info();
+ VertexInfo& vhi = cell->vertex(yy)->info();
Real unshiftedP = cell->info().p();
//the pressure translated to a ghost cell adjacent to the non-ghost vertex
unshiftedP -= pDeltas[0]*vhi.period[0] + pDeltas[1]*vhi.period[1] +pDeltas[2]*vhi.period[2];
T[currentTes].vertexHandles[vhi.id()]->info().forces=T[currentTes].vertexHandles[vhi.id()]->info().forces + cell->info().unitForceVectors[yy]*unshiftedP;
}
}
- if (DEBUG_OUT) {
- Vecteur TotalForce = nullVect;
- for (Finite_vertices_iterator v = Tri.finite_vertices_begin(); v != Tri.finite_vertices_end(); v++)
+ if (debugOut) {
+ Vecteur totalForce = nullVect;
+ for (FiniteVerticesIterator v = Tri.finite_vertices_begin(); v != Tri.finite_vertices_end(); v++)
{
if (!v->info().isFictious /*&& !v->info().isGhost*/ ){
- TotalForce = TotalForce + v->info().forces;
-// cerr<< "real_id = " << v->info().id() << " force = "<< v->info().forces<< " ghost:"<< v->info().isGhost <<endl;
- }
-// cout << "real_id = " << v->info().id() << " force = " << v->info().forces << endl;
+ totalForce = totalForce + v->info().forces;}
else /*if (!v->info().isGhost)*/{
- if (boundary(v->info().id()).flowCondition==1) TotalForce = TotalForce + v->info().forces;
-// cout << "fictious_id = " << v->info().id() << " force = " << v->info().forces << " ghost:"<< v->info().isGhost<< endl;
+ if (boundary(v->info().id()).flowCondition==1) totalForce = totalForce + v->info().forces;
}
}
- cout << "TotalForce = "<< TotalForce << endl;}
+ cout << "totalForce = "<< totalForce << endl;}
}
-void PeriodicFlow::Compute_Permeability()
+void PeriodicFlow::computePermeability()
{
- if (DEBUG_OUT) cout << "----Computing_Permeability (Periodic)------" << endl;
+ if (debugOut) cout << "----Computing_Permeability (Periodic)------" << endl;
RTriangulation& Tri = T[currentTes].Triangulation();
- Vsolid_tot = 0, Vtotalissimo = 0, Vporale = 0, Ssolid_tot = 0, V_totale_porosity=0, V_porale_porosity=0;
- Cell_handle neighbour_cell;
+ VSolidTot = 0, Vtotalissimo = 0, vPoral = 0, sSolidTot = 0, vTotalePorosity=0, vPoralPorosity=0;
+ CellHandle neighbourCell;
double k=0, distance = 0, radius = 0, viscosity = VISCOSITY;
int surfneg=0;
int NEG=0, POS=0, pass=0;
-
-// Vecteur n;
-// std::ofstream oFile( "Radii",std::ios::out);
-// std::ofstream fFile( "Radii_Fictious",std::ios::out);
-// std::ofstream kFile ( "LocalPermeabilities" ,std::ios::app );
Real meanK=0, STDEV=0, meanRadius=0, meanDistance=0;
Real infiniteK=1e3;
double volume_sub_pore = 0.f;
- Vector_Cell& cellHandles= T[currentTes].cellHandles;
- for (Vector_Cell::iterator cell_it=T[currentTes].cellHandles.begin(); cell_it!=T[currentTes].cellHandles.end(); cell_it++){
- Cell_handle& cell = *cell_it;
+ VectorCell& cellHandles= T[currentTes].cellHandles;
+ for (VectorCell::iterator cellIt=T[currentTes].cellHandles.begin(); cellIt!=T[currentTes].cellHandles.end(); cellIt++){
+ CellHandle& cell = *cellIt;
Point& p1 = cell->info();
for (int j=0; j<4; j++){
- neighbour_cell = cell->neighbor(j);
- Point& p2 = neighbour_cell->info();
- if (!Tri.is_infinite(neighbour_cell) /*&& (neighbour_cell->info().isvisited==ref || computeAllCells)*/) {
+ neighbourCell = cell->neighbor(j);
+ Point& p2 = neighbourCell->info();
+ if (!Tri.is_infinite(neighbourCell) /*&& (neighbour_cell->info().isvisited==ref || computeAllCells)*/) {
//Compute and store the area of sphere-facet intersections for later use
- Vertex_handle W [3];
+ VertexHandle W [3];
for (int kk=0; kk<3; kk++) {
W[kk] = cell->vertex(facetVertices[j][kk]);
}
@@ -235,8 +171,8 @@
pass+=1;
Vecteur l = p1 - p2;
distance = sqrt(l.squared_length());
- if (!RAVERAGE) radius = 2* Compute_HydraulicRadius(cell, j);
- else radius = (Compute_EffectiveRadius(cell, j)+Compute_EquivalentRadius(cell,j))*0.5;
+ if (!RAVERAGE) radius = 2* computeHydraulicRadius(cell, j);
+ else radius = (computeEffectiveRadius(cell, j)+computeEquivalentRadius(cell,j))*0.5;
if (radius<0) NEG++;
else POS++;
if (radius==0) {
@@ -249,8 +185,6 @@
const Vecteur& Surfk = cell->info().facetSurfaces[j];
Real area = sqrt(Surfk.squared_length());
const Vecteur& crossSections = cell->info().facetSphereCrossSections[j];
-// if (areaR2Permeability){
-// Real m1=sqrt((cross_product((v0-v1),v2-v1)).squared_length()/(v2-v1).squared_length());
Real S0=0;
S0=checkSphereFacetOverlap(v0,v1,v2);
if (S0==0) S0=checkSphereFacetOverlap(v1,v2,v0);
@@ -259,53 +193,48 @@
fluidArea=abs(area-crossSections[0]-crossSections[1]-crossSections[2]+S0);
cell->info().facetFluidSurfacesRatio[j]=fluidArea/area;
k=(fluidArea * pow(radius,2)) / (8*viscosity*distance);
-// } else {
-// cout << "WARNING! if !areaR2Permeability, facetFluidSurfacesRatio will not be defined correctly. Don't use that."<<endl;
-// k = (M_PI * pow(radius,4)) / (8*viscosity*distance);
-// }
meanDistance += distance;
meanRadius += radius;
- meanK += k*k_factor;
+ meanK += k*kFactor;
- if (k<0 && DEBUG_OUT) {surfneg+=1;
+ if (k<0 && debugOut) {surfneg+=1;
cout<<"__ k<0 __"<<k<<" "<<" fluidArea "<<fluidArea<<" area "<<area<<" "<<crossSections[0]<<" "<<crossSections[1]<<" "<<crossSections[2] <<" "<<W[0]->info().id()<<" "<<W[1]->info().id()<<" "<<W[2]->info().id()<<" "<<p1<<" "<<p2<<" test "<<test<<endl;}
} else {
cout <<"infinite K2! surfaces will be missing (FIXME)"<<endl; k = infiniteK;
}//Will be corrected in the next loop
- (cell->info().k_norm())[j]= k*k_factor;
- if (!neighbour_cell->info().isGhost) (neighbour_cell->info().k_norm())[Tri.mirror_index(cell, j)]= (cell->info().k_norm())[j];
+ (cell->info().kNorm())[j]= k*kFactor;
+ if (!neighbourCell->info().isGhost) (neighbourCell->info().kNorm())[Tri.mirror_index(cell, j)]= (cell->info().kNorm())[j];
//The following block is correct but very usefull, since all values are clamped below with MIN and MAX, skip for now
// else {//find the real neighbor connected to our cell through periodicity
-// Cell_handle true_neighbour_cell = cellHandles[neighbour_cell->info().baseIndex];
+// CellHandle true_neighbour_cell = cellHandles[neighbour_cell->info().baseIndex];
// for (int ii=0;ii<4;ii++)
// if (true_neighbour_cell->neighbor(ii)->info().index == cell->info().index){
-// (true_neighbour_cell->info().k_norm())[ii]=(cell->info().k_norm())[j]; break;
+// (true_neighbour_cell->info().kNorm())[ii]=(cell->info().kNorm())[j]; break;
// }
// }
- if(permeability_map){
- Cell_handle c = cell;
- cell->info().s = cell->info().s + k*distance/fluidArea*Volume_Pore_VoronoiFraction (c,j);
- volume_sub_pore += Volume_Pore_VoronoiFraction (c,j);
+ if(permeabilityMap){
+ CellHandle c = cell;
+ cell->info().s = cell->info().s + k*distance/fluidArea*volumePoreVoronoiFraction (c,j);
+ volume_sub_pore += volumePoreVoronoiFraction (c,j);
}
}
}
// cell->info().isvisited = !ref;
- if(permeability_map){
+ if(permeabilityMap){
cell->info().s = cell->info().s/volume_sub_pore;
volume_sub_pore = 0.f;
}
// }
-// else cell->info().isvisited = !ref;
}
- if (DEBUG_OUT) cout<<"surfneg est "<<surfneg<<endl;
+ if (debugOut) cout<<"surfneg est "<<surfneg<<endl;
meanK /= pass;
meanRadius /= pass;
meanDistance /= pass;
- Real globalK=k_factor*meanDistance*Vporale/(Ssolid_tot*8.*viscosity);//An approximate value of macroscopic permeability, for clamping local values below
- if (DEBUG_OUT) {
+ Real globalK=kFactor*meanDistance*vPoral/(sSolidTot*8.*viscosity);//An approximate value of macroscopic permeability, for clamping local values below
+ if (debugOut) {
cout << "PassCompK = " << pass << endl;
cout << "meanK = " << meanK << endl;
cout << "globalK = " << globalK << endl;
@@ -315,139 +244,93 @@
cout << "meanDistance = " << meanDistance << endl;
}
pass=0;
- if (clampKValues) for (Vector_Cell::iterator cell_it=T[currentTes].cellHandles.begin(); cell_it!=T[currentTes].cellHandles.end(); cell_it++){
- Cell_handle& cell = *cell_it;
+ if (clampKValues) for (VectorCell::iterator cellIt=T[currentTes].cellHandles.begin(); cellIt!=T[currentTes].cellHandles.end(); cellIt++){
+ CellHandle& cell = *cellIt;
for (int j=0; j<4; j++) {
- neighbour_cell = cell->neighbor(j);
- if (!Tri.is_infinite(neighbour_cell) /*&& neighbour_cell->info().isvisited==ref*/) {
+ neighbourCell = cell->neighbor(j);
+ if (!Tri.is_infinite(neighbourCell) /*&& neighbour_cell->info().isvisited==ref*/) {
pass++;
- (cell->info().k_norm())[j] = max(minKdivKmean*globalK, min((cell->info().k_norm())[j], maxKdivKmean*globalK));
-// (cell->info().k_norm())[j] = max(MINK_DIV_KMEAN*meanK ,min((cell->info().k_norm())[j], maxKdivKmean*meanK));
- (neighbour_cell->info().k_norm())[Tri.mirror_index(cell, j)]=(cell->info().k_norm())[j];
- if (!neighbour_cell->info().isGhost) (neighbour_cell->info().k_norm())[Tri.mirror_index(cell, j)]= (cell->info().k_norm())[j];
+ (cell->info().kNorm())[j] = max(minKdivKmean*globalK, min((cell->info().kNorm())[j], maxKdivKmean*globalK));
+ (neighbourCell->info().kNorm())[Tri.mirror_index(cell, j)]=(cell->info().kNorm())[j];
+ if (!neighbourCell->info().isGhost) (neighbourCell->info().kNorm())[Tri.mirror_index(cell, j)]= (cell->info().kNorm())[j];
else {//find the real neighbor connected to our cell through periodicity, as we want exactly the same permeability without rounding errors
- Cell_handle& true_neighbour_cell = cellHandles[neighbour_cell->info().baseIndex];
+ CellHandle& true_neighbourCell = cellHandles[neighbourCell->info().baseIndex];
for (int ii=0;ii<4;ii++)
- if (true_neighbour_cell->neighbor(ii)->info().index == cell->info().index){
- (true_neighbour_cell->info().k_norm())[ii]=(cell->info().k_norm())[j]; break;
+ if (true_neighbourCell->neighbor(ii)->info().index == cell->info().index){
+ (true_neighbourCell->info().kNorm())[ii]=(cell->info().kNorm())[j]; break;
}
}
-
-// cout<<(cell->info().k_norm())[j]<<endl;
-// kFile << (cell->info().k_norm())[j] << endl;
}
}
-// cell->info().isvisited = !ref;
}
- if (DEBUG_OUT) cout << "PassKcorrect = " << pass << endl;
+ if (debugOut) cout << "PassKcorrect = " << pass << endl;
- if (DEBUG_OUT) cout << "POS = " << POS << " NEG = " << NEG << " pass = " << pass << endl;
+ if (debugOut) cout << "POS = " << POS << " NEG = " << NEG << " pass = " << pass << endl;
// A loop to compute the standard deviation of the local K distribution, and use it to include/exclude K values higher then (meanK +/- K_opt_factor*STDEV)
if (meanKStat)
{
std::ofstream k_opt_file("k_stdev.txt" ,std::ios::out);
-// ref = Tri.finite_cells_begin()->info().isvisited;
pass=0;
- Finite_cells_iterator cell_end = Tri.finite_cells_end();
- for (Finite_cells_iterator cell = Tri.finite_cells_begin(); cell != cell_end; cell++) {
+ FiniteCellsIterator cellEnd = Tri.finite_cells_end();
+ for (FiniteCellsIterator cell = Tri.finite_cells_begin(); cell != cellEnd; cell++) {
for (int j=0; j<4; j++) {
- neighbour_cell = cell->neighbor(j);
- if (!Tri.is_infinite(neighbour_cell) /*&& neighbour_cell->info().isvisited==ref*/) {
+ neighbourCell = cell->neighbor(j);
+ if (!Tri.is_infinite(neighbourCell) /*&& neighbour_cell->info().isvisited==ref*/) {
pass++;
- STDEV += pow(((cell->info().k_norm())[j]-meanK),2);
+ STDEV += pow(((cell->info().kNorm())[j]-meanK),2);
}
}
-// cell->info().isvisited = !ref;
}
STDEV = sqrt(STDEV/pass);
- if (DEBUG_OUT) cout << "PassSTDEV = " << pass << endl;
+ if (debugOut) cout << "PassSTDEV = " << pass << endl;
cout << "STATISTIC K" << endl;
- double k_min = 0, k_max = meanK + K_opt_factor*STDEV;
+ double k_min = 0, k_max = meanK + KOptFactor*STDEV;
cout << "Kmoy = " << meanK << " Standard Deviation = " << STDEV << endl;
cout << "kmin = " << k_min << " kmax = " << k_max << endl;
-// ref = Tri.finite_cells_begin()->info().isvisited;
pass=0;
- for (Finite_cells_iterator cell = Tri.finite_cells_begin(); cell != cell_end; cell++) {
+ for (FiniteCellsIterator cell = Tri.finite_cells_begin(); cell != cellEnd; cell++) {
for (int j=0; j<4; j++) {
- neighbour_cell = cell->neighbor(j);
- if (!Tri.is_infinite(neighbour_cell) /*&& neighbour_cell->info().isvisited==ref*/) {
+ neighbourCell = cell->neighbor(j);
+ if (!Tri.is_infinite(neighbourCell) /*&& neighbour_cell->info().isvisited==ref*/) {
pass+=1;
- if ((cell->info().k_norm())[j]>k_max) {
- (cell->info().k_norm())[j]=k_max;
- (neighbour_cell->info().k_norm())[Tri.mirror_index(cell, j)]= (cell->info().k_norm())[j];
+ if ((cell->info().kNorm())[j]>k_max) {
+ (cell->info().kNorm())[j]=k_max;
+ (neighbourCell->info().kNorm())[Tri.mirror_index(cell, j)]= (cell->info().kNorm())[j];
}
- k_opt_file << K_opt_factor << " " << (cell->info().k_norm())[j] << endl;
+ k_opt_file << KOptFactor << " " << (cell->info().kNorm())[j] << endl;
}
}
-// cell->info().isvisited=!ref;
}
- if (DEBUG_OUT) cout << "PassKopt = " << pass << endl;
+ if (debugOut) cout << "PassKopt = " << pass << endl;
}
- if (DEBUG_OUT) {
- Finite_vertices_iterator vertices_end = Tri.finite_vertices_end();
+ if (debugOut) {
+ FiniteVerticesIterator verticesEnd = Tri.finite_vertices_end();
Real Vgrains = 0;
int grains=0;
- for (Finite_vertices_iterator V_it = Tri.finite_vertices_begin(); V_it != vertices_end; V_it++) {
- if (!V_it->info().isFictious && !V_it->info().isGhost) {
+ for (FiniteVerticesIterator vIt = Tri.finite_vertices_begin(); vIt != verticesEnd; vIt++) {
+ if (!vIt->info().isFictious && !vIt->info().isGhost) {
grains +=1;
- Vgrains += 1.33333333 * M_PI * pow(V_it->point().weight(),1.5);
+ Vgrains += 1.33333333 * M_PI * pow(vIt->point().weight(),1.5);
}
}
- cout<<grains<<"grains - " <<"Vtotale = " << Vtotale << " Vgrains = " << Vgrains << " Vporale1 = " << (Vtotale-Vgrains) << endl;
- cout << "Vtotalissimo = " << Vtotalissimo/2 << " Vsolid_tot = " << Vsolid_tot/2 << " Vporale2 = " << Vporale/2 << " Ssolid_tot = " << Ssolid_tot << endl<< endl;
+ cout<<grains<<"grains - " <<"vTotal = " << vTotal << " Vgrains = " << Vgrains << " vPoral1 = " << (vTotal-Vgrains) << endl;
+ cout << "Vtotalissimo = " << Vtotalissimo/2 << " VSolidTot = " << VSolidTot/2 << " vPoral2 = " << vPoral/2 << " sSolidTot = " << sSolidTot << endl<< endl;
if (!RAVERAGE) cout << "------Hydraulic Radius is used for permeability computation------" << endl << endl;
else cout << "------Average Radius is used for permeability computation------" << endl << endl;
cout << "-----Computed_Permeability Periodic-----" << endl;
}
-// cout << "Negative Permeabilities = " << count_k_neg << endl;
}
-// void PeriodicFlow::Initialize_pressures( double P_zero )
-// {
-// RTriangulation& Tri = T[currentTes].Triangulation();
-// Finite_cells_iterator cell_end = Tri.finite_cells_end();
-//
-// for (Finite_cells_iterator cell = Tri.finite_cells_begin(); cell != cell_end; cell++){
-// cell->info().setP(P_zero); cell->info().dv()=0;}
-//
-// for (int bound=0; bound<6;bound++) {
-// int& id = *boundsIds[bound];
-// if (id<0) continue;
-// Boundary& bi = boundary(id);
-// if (!bi.flowCondition) {
-// Vector_Cell tmp_cells;
-// tmp_cells.resize(10000);
-// VCell_iterator cells_it = tmp_cells.begin();
-// VCell_iterator cells_end = Tri.incident_cells(T[currentTes].vertexHandles[id],cells_it);
-// for (VCell_iterator it = tmp_cells.begin(); it != cells_end; it++)
-// {(*it)->info().p() = bi.value;(*it)->info().Pcondition=true;
-// boundingCells[bound].push_back(*it);}
-// }
-// }
-// IPCells.clear();
-// for (unsigned int n=0; n<imposedP.size();n++) {
-// Cell_handle cell=Tri.locate(imposedP[n].first);
-//
-// //check redundancy
-// for (unsigned int kk=0;kk<IPCells.size();kk++){
-// if (cell==IPCells[kk]) cerr<<"Two imposed pressures fall in the same cell."<<endl;
-// else if (cell->info().Pcondition) cerr<<"Imposed pressure fall in a boundary condition."<<endl;}
-// // cerr<<"cell found : "<<cell->vertex(0)->point()<<" "<<cell->vertex(1)->point()<<" "<<cell->vertex(2)->point()<<" "<<cell->vertex(3)->point()<<endl;
-// // assert(cell);
-// IPCells.push_back(cell);
-// cell->info().p()=imposedP[n].second;
-// cell->info().Pcondition=true;}
-// pressureChanged=false;
-// }
-
-
-void PeriodicFlow::GaussSeidel(Real dt)
+
+
+
+void PeriodicFlow::gaussSeidel(Real dt)
{
RTriangulation& Tri = T[currentTes].Triangulation();
int j = 0;
@@ -465,7 +348,7 @@
t_dp_max.resize(num_threads);
t_p_max.resize(num_threads);
t_sum_p.resize(num_threads);
- Finite_cells_iterator cell_end = Tri.finite_cells_end();
+ FiniteCellsIterator cellEnd = Tri.finite_cells_end();
do {
int cell2=0;
dp_max = 0;
@@ -473,7 +356,7 @@
sum_p=0;
sum_dp=0;
int bb=-1;
- for (Finite_cells_iterator cell = Tri.finite_cells_begin(); cell != cell_end; cell++) {
+ for (FiniteCellsIterator cell = Tri.finite_cells_begin(); cell != cellEnd; cell++) {
bb++;
if ( !cell->info().Pcondition && !cell->info().isGhost) {
cell2++;
@@ -483,22 +366,22 @@
if (!Tri.is_infinite(cell->neighbor(j2))) {
if ( compressible ) {
compFlowFactor = fluidBulkModulus*dt*cell->info().invVoidVolume();
- m += compFlowFactor*(cell->info().k_norm())[j2]*cell->neighbor(j2)->info().shiftedP();
- if (j==0) n += compFlowFactor*(cell->info().k_norm())[j2];
+ m += compFlowFactor*(cell->info().kNorm())[j2]*cell->neighbor(j2)->info().shiftedP();
+ if (j==0) n += compFlowFactor*(cell->info().kNorm())[j2];
} else {
- m += (cell->info().k_norm())[j2]*cell->neighbor(j2)->info().shiftedP();
- if ( isinf(m) && j<10 ) cout << "(cell->info().k_norm())[j2] = " << (cell->info().k_norm())[j2] << " cell->neighbor(j2)->info().shiftedP() = " << cell->neighbor(j2)->info().shiftedP() << endl;
- if (j==0) n += (cell->info().k_norm())[j2];
+ m += (cell->info().kNorm())[j2]*cell->neighbor(j2)->info().shiftedP();
+ if ( isinf(m) && j<10 ) cout << "(cell->info().kNorm())[j2] = " << (cell->info().kNorm())[j2] << " cell->neighbor(j2)->info().shiftedP() = " << cell->neighbor(j2)->info().shiftedP() << endl;
+ if (j==0) n += (cell->info().kNorm())[j2];
}
}
}
dp = cell->info().p();
if (n!=0 || j!=0) {
- if (j==0) { if (compressible) cell->info().inv_sum_k=1/(1+n); else cell->info().inv_sum_k=1/n; }
+ if (j==0) { if (compressible) cell->info().invSumK=1/(1+n); else cell->info().invSumK=1/n; }
if ( compressible ) {
- cell->info().setP( ( ((previousP[bb] - ((fluidBulkModulus*dt*cell->info().invVoidVolume())*(cell->info().dv()))) + m) * cell->info().inv_sum_k - cell->info().shiftedP()) * relax + cell->info().shiftedP());
+ cell->info().setP( ( ((previousP[bb] - ((fluidBulkModulus*dt*cell->info().invVoidVolume())*(cell->info().dv()))) + m) * cell->info().invSumK - cell->info().shiftedP()) * relax + cell->info().shiftedP());
} else {
- cell->info().setP((-(cell->info().dv()-m)*cell->info().inv_sum_k-cell->info().p())*relax+cell->info().shiftedP());
+ cell->info().setP((-(cell->info().dv()-m)*cell->info().invSumK-cell->info().p())*relax+cell->info().shiftedP());
}
}
dp -= cell->info().p();
@@ -510,15 +393,14 @@
}
j++;
-// if (j%100==0) cerr <<"j="<<j<<" p_moy="<<p_moy<<" dp="<< dp_moy<<" p_max="<<p_max<<" dp_max="<<dp_max<<endl;
if (j>=40000) cerr<<"\r GS not converged after 40k iterations, break";
} while ((dp_max/p_max) > tolerance && j<40000 /*&& ( dp_max > tolerance )*//* &&*/ /*( j<50 )*/);
int cel=0;
double Pav=0;
- for (Finite_cells_iterator cell = Tri.finite_cells_begin();
- cell != cell_end;
+ for (FiniteCellsIterator cell = Tri.finite_cells_begin();
+ cell != cellEnd;
cell++) {
cel++;
Pav+=cell->info().shiftedP();
@@ -526,15 +408,15 @@
Pav/=cel;
}
-void PeriodicFlow::DisplayStatistics()
+void PeriodicFlow::displayStatistics()
{
RTriangulation& Tri = T[currentTes].Triangulation();
int Zero =0, Inside=0, Fictious=0, ghostC=0,realC=0, ghostV=0, realV=0;
- Finite_cells_iterator cell_end = Tri.finite_cells_end();
- for (Finite_cells_iterator cell = Tri.finite_cells_begin(); cell != cell_end; cell++) {
+ FiniteCellsIterator cellEnd = Tri.finite_cells_end();
+ for (FiniteCellsIterator cell = Tri.finite_cells_begin(); cell != cellEnd; cell++) {
int zeros =0;
for (int j=0; j!=4; j++) {
- if ((cell->info().k_norm())[j]==0) {
+ if ((cell->info().kNorm())[j]==0) {
zeros+=1;
}
}
@@ -550,15 +432,14 @@
if (cell->info().isGhost) ghostC+=1; else realC+=1;
}
int fict=0, real=0;
- for (Finite_vertices_iterator v = Tri.finite_vertices_begin(); v != Tri.finite_vertices_end(); ++v) {
+ for (FiniteVerticesIterator v = Tri.finite_vertices_begin(); v != Tri.finite_vertices_end(); ++v) {
if (v->info().isFictious) fict+=1;
else real+=1;
- if (v->info().isGhost) {ghostV+=1; /*cerr<<"ghost v "<< v->info().id() <<": period=("<<v->info().period[0]<<","<<v->info().period[1]<<","<<v->info().period[2]<<")"<<endl;*/} else realV+=1;
}
long Vertices = Tri.number_of_vertices();
long Cells = Tri.number_of_finite_cells();
long Facets = Tri.number_of_finite_facets();
- if(DEBUG_OUT) {
+ if(debugOut) {
cout << "zeros = " << Zero << endl;
cout << "There are " << Vertices << " vertices, dont " << fict << " fictious et " << real << " reeeeeel" << std::endl;
cout << "There are " << ghostV+realV << " vertices, dont " << ghostV << " ghost et " << realV << " reeeeeel" << std::endl;
@@ -569,8 +450,8 @@
cout << "There are " << Fictious << " cells FICTIOUS." << endl;
}
- vtk_infinite_vertices = fict;
- vtk_infinite_cells = Fictious;
+ vtkInfiniteVertices = fict;
+ vtkInfiniteCells = Fictious;
num_particles = real;
}
@@ -579,18 +460,18 @@
RTriangulation& Tri = T[currentTes].Triangulation();
double Q1=0;
- Vector_Cell tmp_cells;
- tmp_cells.resize(10000);
- VCell_iterator cells_it = tmp_cells.begin();
+ VectorCell tmpCells;
+ tmpCells.resize(10000);
+ VCellIterator cells_it = tmpCells.begin();
- VCell_iterator cell_up_end = Tri.incident_cells(T[currentTes].vertexHandles[boundaryId],cells_it);
- for (VCell_iterator it = tmp_cells.begin(); it != cell_up_end; it++)
+ VCellIterator cell_up_end = Tri.incident_cells(T[currentTes].vertexHandles[boundaryId],cells_it);
+ for (VCellIterator it = tmpCells.begin(); it != cell_up_end; it++)
{
- const Cell_handle& cell = *it;
+ const CellHandle& cell = *it;
if (cell->info().isGhost) continue;
Q1 -= cell->info().dv();
for (int j2=0; j2<4; j2++)
- Q1 += (cell->info().k_norm())[j2]* (cell->neighbor(j2)->info().shiftedP()-cell->info().shiftedP());
+ Q1 += (cell->info().kNorm())[j2]* (cell->neighbor(j2)->info().shiftedP()-cell->info().shiftedP());
}
return Q1;
}
@@ -602,13 +483,13 @@
vector<vector<pair<unsigned int,Real> > > lubPairs;
lubPairs.resize(Tri.number_of_vertices()+1);
for (unsigned int k=0; k<edgeNormalLubF.size(); k++)
- lubPairs[min(Edge_ids[k].first,Edge_ids[k].second)].push_back(pair<int,Real> (max(Edge_ids[k].first,Edge_ids[k].second),edgeNormalLubF[k]));
+ lubPairs[min(edgeIds[k].first,edgeIds[k].second)].push_back(pair<int,Real> (max(edgeIds[k].first,edgeIds[k].second),edgeNormalLubF[k]));
//Now we reset the containers and initialize them
- Edge_Surfaces.clear(); Edge_ids.clear(); edgeNormalLubF.clear();
- Finite_edges_iterator ed_it;
- for ( Finite_edges_iterator ed_it = Tri.finite_edges_begin(); ed_it!=Tri.finite_edges_end();ed_it++ )
+ edgeSurfaces.clear(); edgeIds.clear(); edgeNormalLubF.clear();
+ FiniteEdgesIterator ed_it;
+ for ( FiniteEdgesIterator ed_it = Tri.finite_edges_begin(); ed_it!=Tri.finite_edges_end();ed_it++ )
{
int hasFictious= (ed_it->first)->vertex(ed_it->second)->info().isFictious + (ed_it->first)->vertex(ed_it->third)->info().isFictious;
if (hasFictious==2) continue;
@@ -619,8 +500,8 @@
unsigned int id1 = (ed_it->first)->vertex(ed_it->second)->info().id();
unsigned int id2 = (ed_it->first)->vertex(ed_it->third)->info().id();
double area = T[currentTes].ComputeVFacetArea(ed_it);
- Edge_Surfaces.push_back(area);
- Edge_ids.push_back(pair<int,int>(id1,id2));
+ edgeSurfaces.push_back(area);
+ edgeIds.push_back(pair<int,int>(id1,id2));
//For persistant edges, we must transfer the lub. force value from the older triangulation structure
if (id1>id2) swap(id1,id2);
@@ -635,7 +516,6 @@
}
// not found, we initialize with zero lub force
if (i==lubPairs[id1].size()) edgeNormalLubF.push_back(0);
-// edgeNormalLubF.push_back(0);
}
}
=== modified file 'lib/triangulation/PeriodicFlow.hpp'
--- lib/triangulation/PeriodicFlow.hpp 2013-08-22 14:32:01 +0000
+++ lib/triangulation/PeriodicFlow.hpp 2014-03-21 18:45:24 +0000
@@ -20,11 +20,11 @@
class PeriodicFlow : public PeriodicFlowBoundingSphere
{
public:
- void Interpolate(Tesselation& Tes, Tesselation& NewTes);
- void ComputeFacetForcesWithCache(bool onlyCache=false);
- void Compute_Permeability();
- void GaussSeidel(Real dt=0);
- void DisplayStatistics();
+ void interpolate(Tesselation& Tes, Tesselation& NewTes);
+ void computeFacetForcesWithCache(bool onlyCache=false);
+ void computePermeability();
+ void gaussSeidel(Real dt=0);
+ void displayStatistics();
void computeEdgesSurfaces();
double boundaryFlux(unsigned int boundaryId);
#ifdef EIGENSPARSE_LIB
=== modified file 'lib/triangulation/PeriodicFlowLinSolv.hpp'
--- lib/triangulation/PeriodicFlowLinSolv.hpp 2013-08-22 14:32:01 +0000
+++ lib/triangulation/PeriodicFlowLinSolv.hpp 2014-03-21 18:45:24 +0000
@@ -27,8 +27,8 @@
PeriodicFlowLinSolv();
///Linear system solve
- virtual int SetLinearSystem(Real dt=0);
- virtual int SetLinearSystemFullGS(Real dt=0);
+ virtual int setLinearSystem(Real dt=0);
+ virtual int setLinearSystemFullGS(Real dt=0);
};
} //namespace CGTF
=== modified file 'lib/triangulation/PeriodicFlowLinSolv.ipp'
--- lib/triangulation/PeriodicFlowLinSolv.ipp 2013-06-27 11:29:17 +0000
+++ lib/triangulation/PeriodicFlowLinSolv.ipp 2014-03-21 18:45:24 +0000
@@ -48,7 +48,7 @@
PeriodicFlowLinSolv::PeriodicFlowLinSolv(): LinSolver() {}
-int PeriodicFlowLinSolv::SetLinearSystem(Real dt)
+int PeriodicFlowLinSolv::setLinearSystem(Real dt)
{
//WARNING : boundary conditions (Pcondition, p values) must have been set for a correct definition of
RTriangulation& Tri = T[currentTes].Triangulation();
@@ -64,11 +64,10 @@
unsigned int maxindex = 0;
//FIXME: this is way too large since many cells will be ghosts
T_cells.resize(Tri.number_of_finite_cells()+1);
-// indices.resize(Tri.number_of_finite_cells()+1);
///Ordered cells
orderedCells.clear();
- const Finite_cells_iterator cell_end = Tri.finite_cells_end();
- for (Finite_cells_iterator cell = Tri.finite_cells_begin(); cell != cell_end; cell++) {
+ const FiniteCellsIterator cellEnd = Tri.finite_cells_end();
+ for (FiniteCellsIterator cell = Tri.finite_cells_begin(); cell != cellEnd; cell++) {
if (cell->info().Pcondition || cell->info().isGhost) continue;
orderedCells.push_back(cell);
// T_cells[++ncols]=cell;
@@ -79,7 +78,6 @@
}
// spatial_sort(orderedCells.begin(),orderedCells.end(), CellTraits_for_spatial_sort());//FIXME: ordering will not work with the new "indices", which needs reordering to
T_cells.resize(ncols+1);
-// indices.resize(maxindex+1);
isLinearSystemSet=false;
areCellsOrdered=true;
}
@@ -93,48 +91,45 @@
T_bv.resize(ncols);
bodv.resize(ncols);
xodv.resize(ncols);
-// gsB.resize(ncols+1);
T_cells.resize(ncols+1);
T_nnz=0;}
for (int kk=0; kk<ncols;kk++) T_b[kk]=0;
///Ordered cells
- int nIndex=0; Cell_handle neighbour_cell;
+ int nIndex=0; CellHandle neighbourCell;
for (int i=0; i<ncols; i++)
{
- Finite_cells_iterator& cell = orderedCells[i];
+ FiniteCellsIterator& cell = orderedCells[i];
///Non-ordered cells
-// for (Finite_cells_iterator cell = Tri.finite_cells_begin(); cell != cell_end; cell++) {
-// if (!cell->info().Pcondition && !cell->info().isGhost)
{
const int& index=cell->info().index;
- const Cell_Info& cInfo = cell->info();
+ const CellInfo& cInfo = cell->info();
if (!isLinearSystemSet) {
//Add diagonal term
is[T_nnz] = index;
js[T_nnz] = index;
- vs[T_nnz] = (cInfo.k_norm())[0]+ (cInfo.k_norm())[1]+ (cInfo.k_norm())[2]+ (cInfo.k_norm())[3];
+ vs[T_nnz] = (cInfo.kNorm())[0]+ (cInfo.kNorm())[1]+ (cInfo.kNorm())[2]+ (cInfo.kNorm())[3];
if (vs[T_nnz]<0) cerr<<"!!!! WTF !!!"<<endl;
if (fluidBulkModulus>0) vs[T_nnz] += (1.f/(dt*fluidBulkModulus*cInfo.invVoidVolume()));
T_nnz++;
}
for (int j=0; j<4; j++) {
- neighbour_cell = cell->neighbor(j);
- if (Tri.is_infinite(neighbour_cell)) continue;
- Cell_Info& nInfo = neighbour_cell->info();
+ neighbourCell = cell->neighbor(j);
+ if (Tri.is_infinite(neighbourCell)) continue;
+ CellInfo& nInfo = neighbourCell->info();
nIndex=nInfo.index;
if (nIndex==index) {
cerr<<"ERROR: nIndex==index, the cell is neighbour to itself"<< index<<endl;
errorCode=3;}
- if (nInfo.Pcondition) T_b[index-1]+=cInfo.k_norm()[j]*nInfo.shiftedP();
+ if (nInfo.Pcondition) T_b[index-1]+=cInfo.kNorm()[j]*nInfo.shiftedP();
else {
if (!isLinearSystemSet && index>nIndex) {
is[T_nnz] = index;
js[T_nnz] = nIndex;
- vs[T_nnz] = - (cInfo.k_norm())[j];
+ vs[T_nnz] = - (cInfo.kNorm())[j];
if (vs[T_nnz]>0) cerr<<"!!!! WTF2 !!!"<<endl;
T_nnz++;}
- if (nInfo.isGhost) T_b[index-1]+=cInfo.k_norm()[j]*nInfo.pShift();
+ if (nInfo.isGhost) T_b[index-1]+=cInfo.kNorm()[j]*nInfo.pShift();
}
}
}
@@ -203,16 +198,9 @@
tripletList.clear(); tripletList.resize(T_nnz);
for(int k=0;k<T_nnz;k++) {
tripletList[k]=ETriplet(is[k]-1,js[k]-1,vs[k]);
-// file<<is[k]-1<<" "<<js[k]-1<<" "<<vs[k]<<endl;
-// if (is[k]==js[k]) file2<<is[k]-1<<" "<<js[k]-1<<" "<<1.0001*vs[k]<<endl;
-// else file2<<is[k]-1<<" "<<js[k]-1<<" "<<vs[k]<<endl;
-// if (is[k]==js[k]) file3<<is[k]-1<<" "<<js[k]-1<<" "<<1.00000001*vs[k]<<endl;
-// else file3<<is[k]-1<<" "<<js[k]-1<<" "<<vs[k]<<endl;
}
A.resize(ncols,ncols);
A.setFromTriplets(tripletList.begin(), tripletList.end());
-// file << A;
-// file.close();
#else
cerr<<"yade compiled without CHOLMOD, FlowEngine.useSolver="<< useSolver <<" not supported"<<endl;
#endif
@@ -226,7 +214,7 @@
/// For Gauss Seidel, we need the full matrix
-int PeriodicFlowLinSolv::SetLinearSystemFullGS(Real dt)
+int PeriodicFlowLinSolv::setLinearSystemFullGS(Real dt)
{
//WARNING : boundary conditions (Pcondition, p values) must have been set for a correct definition
RTriangulation& Tri = T[currentTes].Triangulation();
@@ -237,10 +225,10 @@
T_index=0;//FIXME : no need to clear if we don't re-triangulate
T_nnz=0;
ncols=0;
- const Finite_cells_iterator cell_end = Tri.finite_cells_end();
+ const FiniteCellsIterator cellEnd = Tri.finite_cells_end();
orderedCells.clear();
T_cells.resize(n_cells+1);
- for (Finite_cells_iterator cell = Tri.finite_cells_begin(); cell != cell_end; cell++) {
+ for (FiniteCellsIterator cell = Tri.finite_cells_begin(); cell != cellEnd; cell++) {
if (cell->info().Pcondition || cell->info().isGhost) continue;
++ncols;
T_cells[cell->info().index]=cell;
@@ -266,53 +254,51 @@
///Ordered cells
for (int i=1; i<=ncols; i++)
{
- Cell_handle& cell = T_cells[i];
+ CellHandle& cell = T_cells[i];
///Non-ordered cells
if (!cell->info().Pcondition && !cell->info().isGhost) {
//Add diagonal term
- fullAvalues[cell->info().index][4] = 1.f/((cell->info().k_norm())[0]+ (cell->info().k_norm())[1]+ (cell->info().k_norm())[2]+ (cell->info().k_norm())[3] + (fluidBulkModulus>0? 1.f/(dt*fluidBulkModulus*cell->info().invVoidVolume()):0));
+ fullAvalues[cell->info().index][4] = 1.f/((cell->info().kNorm())[0]+ (cell->info().kNorm())[1]+ (cell->info().kNorm())[2]+ (cell->info().kNorm())[3] + (fluidBulkModulus>0? 1.f/(dt*fluidBulkModulus*cell->info().invVoidVolume()):0));
//DUMP
-// cout<< cell->info().index<<" "<< cell->info().index<<" "<<fullAvalues[cell->info().index][4] <<endl;
T_nnz++;
for (int j=0; j<4; j++) {
- Cell_handle neighbour_cell = cell->neighbor(j);
- const Cell_Info& nInfo = neighbour_cell->info();
- Cell_Info& cInfo = cell->info();
- if (Tri.is_infinite(neighbour_cell)) {
+ CellHandle neighbourCell = cell->neighbor(j);
+ const CellInfo& nInfo = neighbourCell->info();
+ CellInfo& cInfo = cell->info();
+ if (Tri.is_infinite(neighbourCell)) {
fullAvalues[cInfo.index][j] = 0;
//We point to the pressure of the adjacent cell. If the cell is ghost, then it has the index of the real one, and then the pointer is correct
fullAcolumns[cInfo.index][j] = &gsP[0];
continue;}
if (!nInfo.Pcondition) {
++T_nnz;
- fullAvalues[cInfo.index][j] = (cInfo.k_norm())[j];
+ fullAvalues[cInfo.index][j] = (cInfo.kNorm())[j];
fullAcolumns[cInfo.index][j] = &gsP[nInfo.index];
//DUMP
-// cout<< cInfo.index<<" "<< nInfo.index<<" "<<fullAvalues[cInfo.index][j] <<endl;
//if the adjacent cell is ghost, we account for the pressure shift in the RHS
if (nInfo.isGhost){
- gsB[cInfo.index]+=cInfo.k_norm()[j]*nInfo.pShift();
+ gsB[cInfo.index]+=cInfo.kNorm()[j]*nInfo.pShift();
}
} else {
fullAvalues[cInfo.index][j] = 0;
fullAcolumns[cInfo.index][j] = &gsP[0];
- gsB[cInfo.index]+=cInfo.k_norm()[j]*nInfo.shiftedP();
+ gsB[cInfo.index]+=cInfo.kNorm()[j]*nInfo.shiftedP();
}
}
}
}
} else for (int i=1; i<=ncols; i++)
{
- Cell_handle& cell = T_cells[i];
+ CellHandle& cell = T_cells[i];
///Non-ordered cells
if (!cell->info().Pcondition && !cell->info().isGhost) {
for (int j=0; j<4; j++) {
- Cell_handle neighbour_cell = cell->neighbor(j);
- const Cell_Info& nInfo = neighbour_cell->info();
- Cell_Info& cInfo = cell->info();
+ CellHandle neighbourCell = cell->neighbor(j);
+ const CellInfo& nInfo = neighbourCell->info();
+ CellInfo& cInfo = cell->info();
if (!nInfo.Pcondition) {
- if (nInfo.isGhost) gsB[cInfo.index]+=cInfo.k_norm()[j]*nInfo.pShift();
- } else gsB[cInfo.index]+=cInfo.k_norm()[j]*nInfo.shiftedP();
+ if (nInfo.isGhost) gsB[cInfo.index]+=cInfo.kNorm()[j]*nInfo.pShift();
+ } else gsB[cInfo.index]+=cInfo.kNorm()[j]*nInfo.shiftedP();
}
}
}
=== modified file 'lib/triangulation/RegularTriangulation.h'
--- lib/triangulation/RegularTriangulation.h 2013-08-22 14:32:01 +0000
+++ lib/triangulation/RegularTriangulation.h 2014-03-21 18:45:24 +0000
@@ -26,22 +26,22 @@
typedef CGAL::Triangulation_3<K> Triangulation;
typedef CGAL::Regular_triangulation_3<Traits, Tds> RTriangulation;
-typedef typename RTriangulation::Vertex_iterator Vertex_iterator;
-typedef typename RTriangulation::Vertex_handle Vertex_handle;
-typedef typename RTriangulation::Finite_vertices_iterator Finite_vertices_iterator;
-typedef typename RTriangulation::Cell_iterator Cell_iterator;
-typedef typename RTriangulation::Finite_cells_iterator Finite_cells_iterator;
-typedef typename RTriangulation::Cell_circulator Cell_circulator;
-typedef typename RTriangulation::Cell_handle Cell_handle;
+typedef typename RTriangulation::Vertex_iterator VertexIterator;
+typedef typename RTriangulation::Vertex_handle VertexHandle;
+typedef typename RTriangulation::Finite_vertices_iterator FiniteVerticesIterator;
+typedef typename RTriangulation::Cell_iterator CellIterator;
+typedef typename RTriangulation::Finite_cells_iterator FiniteCellsIterator;
+typedef typename RTriangulation::Cell_circulator CellCirculator;
+typedef typename RTriangulation::Cell_handle CellHandle;
typedef typename RTriangulation::Facet Facet;
-typedef typename RTriangulation::Facet_iterator Facet_iterator;
-typedef typename RTriangulation::Facet_circulator Facet_circulator;
-typedef typename RTriangulation::Finite_facets_iterator Finite_facets_iterator;
-typedef typename RTriangulation::Locate_type Locate_type;
+typedef typename RTriangulation::Facet_iterator FacetIterator;
+typedef typename RTriangulation::Facet_circulator FacetCirculator;
+typedef typename RTriangulation::Finite_facets_iterator FiniteFacetsIterator;
+typedef typename RTriangulation::Locate_type LocateType;
-typedef typename RTriangulation::Edge_iterator Edge_iterator;
-typedef typename RTriangulation::Finite_edges_iterator Finite_edges_iterator;
+typedef typename RTriangulation::Edge_iterator EdgeIterator;
+typedef typename RTriangulation::Finite_edges_iterator FiniteEdgesIterator;
};
typedef CGAL::To_double<double> W_TO_DOUBLE; // foncteur Weight to Real
=== modified file 'lib/triangulation/Tenseur3.cpp'
--- lib/triangulation/Tenseur3.cpp 2012-01-20 17:31:56 +0000
+++ lib/triangulation/Tenseur3.cpp 2014-03-21 18:45:24 +0000
@@ -1,6 +1,6 @@
#include "Tenseur3.h"
-#include "def_types.h" //pour d�finition de la classe "Vecteur"
+#include "def_types.h"
using namespace std;
namespace CGT {
=== modified file 'lib/triangulation/Tesselation.h'
--- lib/triangulation/Tesselation.h 2012-07-09 12:19:23 +0000
+++ lib/triangulation/Tesselation.h 2014-03-21 18:45:24 +0000
@@ -12,27 +12,27 @@
//Since template inheritance does not automatically give access to the members of the base class, this macro can be used to declare all members at once.
#define DECLARE_TESSELATION_TYPES(baseType)\
- typedef typename baseType::RTriangulation RTriangulation;\
- typedef typename baseType::Vertex_Info Vertex_Info;\
- typedef typename baseType::Cell_Info Cell_Info;\
- typedef typename baseType::Vertex_iterator Vertex_iterator;\
- typedef typename baseType::Vertex_handle Vertex_handle;\
- typedef typename baseType::Finite_vertices_iterator Finite_vertices_iterator;\
- typedef typename baseType::Cell_iterator Cell_iterator;\
- typedef typename baseType::Finite_cells_iterator Finite_cells_iterator;\
- typedef typename baseType::Cell_circulator Cell_circulator;\
- typedef typename baseType::Cell_handle Cell_handle;\
- typedef typename baseType::Facet Facet;\
- typedef typename baseType::Facet_iterator Facet_iterator;\
- typedef typename baseType::Facet_circulator Facet_circulator;\
- typedef typename baseType::Finite_facets_iterator Finite_facets_iterator;\
- typedef typename baseType::Locate_type Locate_type;\
- typedef typename baseType::Edge_iterator Edge_iterator;\
- typedef typename baseType::Finite_edges_iterator Finite_edges_iterator;\
- typedef typename baseType::Vector_Vertex Vector_Vertex;\
- typedef typename baseType::Vector_Cell Vector_Cell;\
- typedef typename baseType::List_Point List_Point;\
- typedef typename baseType::VCell_iterator VCell_iterator;
+ typedef typename baseType::RTriangulation RTriangulation;\
+ typedef typename baseType::VertexInfo VertexInfo;\
+ typedef typename baseType::CellInfo CellInfo;\
+ typedef typename baseType::VertexIterator VertexIterator;\
+ typedef typename baseType::VertexHandle VertexHandle;\
+ typedef typename baseType::FiniteVerticesIterator FiniteVerticesIterator;\
+ typedef typename baseType::CellIterator CellIterator;\
+ typedef typename baseType::FiniteCellsIterator FiniteCellsIterator;\
+ typedef typename baseType::CellCirculator CellCirculator;\
+ typedef typename baseType::CellHandle CellHandle;\
+ typedef typename baseType::Facet Facet;\
+ typedef typename baseType::FacetIterator FacetIterator;\
+ typedef typename baseType::FacetCirculator FacetCirculator;\
+ typedef typename baseType::FiniteFacetsIterator FiniteFacetsIterator;\
+ typedef typename baseType::LocateType LocateType;\
+ typedef typename baseType::EdgeIterator EdgeIterator;\
+ typedef typename baseType::FiniteEdgesIterator FiniteEdgesIterator;\
+ typedef typename baseType::VectorVertex VectorVertex;\
+ typedef typename baseType::VectorCell VectorCell;\
+ typedef typename baseType::ListPoint ListPoint;\
+ typedef typename baseType::VCellIterator VCellIterator;
// Classe Tesselation, contient les fonctions permettant de calculer la Tessalisation
// d'une RTriangulation et de stocker les centres dans chacune de ses cellules
@@ -43,28 +43,28 @@
{
public:
typedef typename TT::RTriangulation RTriangulation;
- typedef typename TT::Vertex_Info Vertex_Info;
- typedef typename TT::Cell_Info Cell_Info;
- typedef typename RTriangulation::Vertex_iterator Vertex_iterator;
- typedef typename RTriangulation::Vertex_handle Vertex_handle;
- typedef typename RTriangulation::Finite_vertices_iterator Finite_vertices_iterator;
- typedef typename RTriangulation::Cell_iterator Cell_iterator;
- typedef typename RTriangulation::Finite_cells_iterator Finite_cells_iterator;
- typedef typename RTriangulation::Cell_circulator Cell_circulator;
- typedef typename RTriangulation::Cell_handle Cell_handle;
+ typedef typename TT::Vertex_Info VertexInfo;
+ typedef typename TT::Cell_Info CellInfo;
+ typedef typename RTriangulation::Vertex_iterator VertexIterator;
+ typedef typename RTriangulation::Vertex_handle VertexHandle;
+ typedef typename RTriangulation::Finite_vertices_iterator FiniteVerticesIterator;
+ typedef typename RTriangulation::Cell_iterator CellIterator;
+ typedef typename RTriangulation::Finite_cells_iterator FiniteCellsIterator;
+ typedef typename RTriangulation::Cell_circulator CellCirculator;
+ typedef typename RTriangulation::Cell_handle CellHandle;
typedef typename RTriangulation::Facet Facet;
- typedef typename RTriangulation::Facet_iterator Facet_iterator;
- typedef typename RTriangulation::Facet_circulator Facet_circulator;
- typedef typename RTriangulation::Finite_facets_iterator Finite_facets_iterator;
- typedef typename RTriangulation::Locate_type Locate_type;
- typedef typename RTriangulation::Edge_iterator Edge_iterator;
- typedef typename RTriangulation::Finite_edges_iterator Finite_edges_iterator;
+ typedef typename RTriangulation::Facet_iterator FacetIterator;
+ typedef typename RTriangulation::Facet_circulator FacetCirculator;
+ typedef typename RTriangulation::Finite_facets_iterator FiniteFacetsIterator;
+ typedef typename RTriangulation::Locate_type LocateType;
+ typedef typename RTriangulation::Edge_iterator EdgeIterator;
+ typedef typename RTriangulation::Finite_edges_iterator FiniteEdgesIterator;
- typedef std::vector<Vertex_handle> Vector_Vertex;
- typedef std::vector<Cell_handle> Vector_Cell;
- typedef std::list<Point> List_Point;
- typedef typename Vector_Cell::iterator VCell_iterator;
- int max_id;
+ typedef std::vector<VertexHandle> VectorVertex;
+ typedef std::vector<CellHandle> VectorCell;
+ typedef std::list<Point> ListPoint;
+ typedef typename VectorCell::iterator VCellIterator;
+ int maxId;
protected:
RTriangulation* Tri;
@@ -75,8 +75,8 @@
Real area;
Real TotalInternalVoronoiVolume;
Real TotalInternalVoronoiPorosity;
- Vector_Vertex vertexHandles;//This is a redirection vector to get vertex pointers by spheres id
- Vector_Cell cellHandles;//for speedup of global loops, iterating on this vector is faster than cellIterator++
+ VectorVertex vertexHandles;//This is a redirection vector to get vertex pointers by spheres id
+ VectorCell cellHandles;//for speedup of global loops, iterating on this vector is faster than cellIterator++
bool redirected;//is vertexHandles filled with current vertex pointers?
public:
@@ -85,48 +85,47 @@
~_Tesselation(void);
///Insert a sphere
- Vertex_handle insert(Real x, Real y, Real z, Real rad, unsigned int id, bool isFictious = false);
+ VertexHandle insert(Real x, Real y, Real z, Real rad, unsigned int id, bool isFictious = false);
/// move a spheres
- Vertex_handle move (Real x, Real y, Real z, Real rad, unsigned int id);
+ VertexHandle move (Real x, Real y, Real z, Real rad, unsigned int id);
///Fill a vector with vertexHandles[i] = handle of vertex with id=i for fast access
bool redirect (void);
///Remove a sphere
bool remove (unsigned int id);
- int Max_id (void) {return max_id;}
+ int Max_id (void) {return maxId;}
void Compute (); //Calcule le centres de Voronoi pour chaque cellule
void Invalidate () {computed=false;} //Set the tesselation as "not computed" (computed=false), this will launch //tesselation internaly when using functions like computeVolumes())
// N.B : Compute() must be executed before the functions below are used
void Clear(void);
- static Point Dual (const Cell_handle &cell);
- static Plan Dual (Vertex_handle S1, Vertex_handle S2);
- static Segment Dual (Finite_facets_iterator &facet); //G�n�re le segment dual d'une facette finie
- static Real Volume (Finite_cells_iterator cell);
- inline void AssignPartialVolume (Finite_edges_iterator& ed_it);
-// inline void ComputeVFacetArea (Finite_edges_iterator& ed_it);
- double ComputeVFacetArea (Finite_edges_iterator ed_it);
+ static Point Dual (const CellHandle &cell);
+ static Plane Dual (VertexHandle S1, VertexHandle S2);
+ static Segment Dual (FiniteFacetsIterator &facet); //G�n�re le segment dual d'une facette finie
+ static Real Volume (FiniteCellsIterator cell);
+ inline void AssignPartialVolume (FiniteEdgesIterator& ed_it);
+ double ComputeVFacetArea (FiniteEdgesIterator ed_it);
void ResetVCellVolumes (void);
void ComputeVolumes (void);//Compute volume each voronoi cell
void ComputePorosity (void);//Compute volume and porosity of each voronoi cell
inline Real& Volume (unsigned int id) { return vertexHandles[id]->info().v(); }
- inline const Vertex_handle& vertex (unsigned int id) const { return vertexHandles[id]; }
+ inline const VertexHandle& vertex (unsigned int id) const { return vertexHandles[id]; }
- Finite_cells_iterator finite_cells_begin(void);// {return Tri->finite_cells_begin();}
- Finite_cells_iterator finite_cells_end(void);// {return Tri->finite_cells_end();}
- void Voisins (Vertex_handle v, Vector_Vertex& Output_vector);// {Tri->incident_vertices(v, back_inserter(Output_vector));}
+// FiniteCellsIterator finite_cells_begin(void);// {return Tri->finite_cells_begin();}
+// FiniteCellsIterator finiteCellsEnd(void);// {return Tri->finite_cells_end();}
+ void voisins (VertexHandle v, VectorVertex& Output_vector);// {Tri->incident_vertices(v, back_inserter(Output_vector));}
RTriangulation& Triangulation (void);// {return *Tri;}
bool Computed (void) {return computed;}
- bool is_short ( Finite_facets_iterator f_it );
- inline bool is_internal ( Finite_facets_iterator &facet );//
+ bool is_short ( FiniteFacetsIterator f_it );
+ inline bool is_internal ( FiniteFacetsIterator &facet );//
- long New_liste_edges ( Real** Coordonnes ); //Genere la liste des segments de Voronoi
- long New_liste_short_edges ( Real** Coordonnes ); //Genere la version tronquee (partie interieure) du graph de Voronoi
- long New_liste_short_edges2 ( Real** Coordonnes );
- long New_liste_adjacent_edges ( Vertex_handle vertex0, Real** Coordonnes );
+ long newListeEdges ( Real** Coordonnes ); //Genere la liste des segments de Voronoi
+ long newListeShortEdges ( Real** Coordonnes ); //Genere la version tronquee (partie interieure) du graph de Voronoi
+ long newListeShortEdges2 ( Real** Coordonnes );
+ long New_liste_adjacent_edges ( VertexHandle vertex0, Real** Coordonnes );
};
@@ -138,11 +137,11 @@
DECLARE_TESSELATION_TYPES(Tesselation)
using Tesselation::Tri;
using Tesselation::vertexHandles;
- using Tesselation::max_id;
+ using Tesselation::maxId;
using Tesselation::redirected;
///Insert a sphere, which can be a duplicate one from the base period if duplicateOfId>=0
- Vertex_handle insert(Real x, Real y, Real z, Real rad, unsigned int id, bool isFictious = false, int duplicateOfId=-1);
+ VertexHandle insert(Real x, Real y, Real z, Real rad, unsigned int id, bool isFictious = false, int duplicateOfId=-1);
///Fill a vector with vertexHandles[i] = handle of vertex with id=i for fast access, contains only spheres from the base period
bool redirect (void);
};
=== modified file 'lib/triangulation/Tesselation.ipp'
--- lib/triangulation/Tesselation.ipp 2012-07-09 12:19:23 +0000
+++ lib/triangulation/Tesselation.ipp 2014-03-21 18:45:24 +0000
@@ -16,11 +16,10 @@
template<class TT>
_Tesselation<TT>::_Tesselation ( void )
{
-// std::cout << "Tesselation(void)" << std::endl;
Tri = new RTriangulation;
Tes = Tri;
computed=false;
- max_id = -1;
+ maxId = -1;
TotalFiniteVoronoiVolume=0;
area=0;
TotalInternalVoronoiPorosity=0;
@@ -48,12 +47,12 @@
redirected = false;
vertexHandles.clear();
vertexHandles.resize(MAX_ID+1,NULL);
- max_id=0;
+ maxId=0;
}
template<class TT>
-typename _Tesselation<TT>::Vertex_handle _Tesselation<TT>::insert ( Real x, Real y, Real z, Real rad, unsigned int id, bool isFictious )
+typename _Tesselation<TT>::VertexHandle _Tesselation<TT>::insert ( Real x, Real y, Real z, Real rad, unsigned int id, bool isFictious )
{
- Vertex_handle Vh;
+ VertexHandle Vh;
Vh = Tri->insert(Sphere(Point(x,y,z),pow(rad,2)));
if ( Vh!=NULL )
{
@@ -61,16 +60,16 @@
Vh->info().isFictious = isFictious;
assert (vertexHandles.size()>id);
vertexHandles[id] = Vh;
- /*if ( !isFictious ) */max_id = std::max ( max_id, (int) id );
+ /*if ( !isFictious ) */maxId = std::max ( maxId, (int) id );
}
else cout << id << " : Vh==NULL!!"<< " id=" << id << " Point=" << Point ( x,y,z ) << " rad=" << rad << endl;
return Vh;
}
template<class TT>
-typename _Tesselation<TT>::Vertex_handle _Tesselation<TT>::move ( Real x, Real y, Real z, Real rad, unsigned int id )
+typename _Tesselation<TT>::VertexHandle _Tesselation<TT>::move ( Real x, Real y, Real z, Real rad, unsigned int id )
{
bool fictious = vertexHandles[id]->info().isFictious;
- Vertex_handle Vh;
+ VertexHandle Vh;
Vh = Tri->move_point ( vertexHandles[id], Sphere ( Point ( x,y,z ),pow ( rad,2 ) ) );
if ( Vh!=NULL )
{
@@ -89,18 +88,15 @@
if ( !redirected )
{
//Set size of the redirection vector
- if ( (unsigned int)max_id+1 != vertexHandles.size() ) vertexHandles.resize ( max_id+1,NULL );
- //cout << "!redirected" << endl;
- max_id = 0;
- Finite_vertices_iterator vertices_end = Tri->finite_vertices_end ();
- for ( Finite_vertices_iterator V_it = Tri->finite_vertices_begin (); V_it != vertices_end; V_it++ )
+ if ( (unsigned int)maxId+1 != vertexHandles.size() ) vertexHandles.resize ( maxId+1,NULL );
+ maxId = 0;
+ FiniteVerticesIterator verticesEnd = Tri->finite_vertices_end ();
+ for ( FiniteVerticesIterator vIt = Tri->finite_vertices_begin (); vIt != verticesEnd; vIt++ )
{
- vertexHandles[V_it->info().id()]= V_it;
- max_id = max(max_id, (int) V_it->info().id());
- //if ( ! ( V_it->info().isFictious ) ) vertexHandles[V_it->info().id() ]= V_it;
- //std::cout<< "Cell " << V_it->info().id() << ": v=" << V_it->info().v() << std::endl;
+ vertexHandles[vIt->info().id()]= vIt;
+ maxId = max(maxId, (int) vIt->info().id());
}
- if ( (unsigned int)max_id+1 != vertexHandles.size() ) vertexHandles.resize ( max_id+1 );
+ if ( (unsigned int)maxId+1 != vertexHandles.size() ) vertexHandles.resize ( maxId+1 );
redirected = true;
} else return false;
return true;
@@ -115,15 +111,7 @@
}
template<class TT>
-typename _Tesselation<TT>::Finite_cells_iterator _Tesselation<TT>::finite_cells_begin ( void )
-{ return Tri->finite_cells_begin(); }
-
-template<class TT>
-typename _Tesselation<TT>::Finite_cells_iterator _Tesselation<TT>::finite_cells_end ( void )
-{ return Tri->finite_cells_end(); }
-
-template<class TT>
-void _Tesselation<TT>::Voisins ( Vertex_handle v, Vector_Vertex& Output_vector )
+void _Tesselation<TT>::voisins ( VertexHandle v, VectorVertex& Output_vector )
{ Tri->incident_vertices ( v, back_inserter ( Output_vector ) ); }
template<class TT>
@@ -131,14 +119,14 @@
{ return *Tri; }
template<class TT>
-Real _Tesselation<TT>::Volume ( Finite_cells_iterator cell )
+Real _Tesselation<TT>::Volume ( FiniteCellsIterator cell )
{
- return ( Tetraedre ( cell->vertex ( 0 )->point(), cell->vertex ( 1 )->point(),
+ return ( Tetrahedron ( cell->vertex ( 0 )->point(), cell->vertex ( 1 )->point(),
cell->vertex ( 2 )->point(), cell->vertex ( 3 )->point() ) ).volume();
}
template<class TT>
-Plan _Tesselation<TT>::Dual ( Vertex_handle S1, Vertex_handle S2 )
+Plane _Tesselation<TT>::Dual ( VertexHandle S1, VertexHandle S2 )
{
Segment seg ( S1->point(), S2->point() );
Real r = 0.5* ( 1.0 + ( ( S1->point() ).weight() * ( S1->point() ).weight() - ( S2->point() ).weight() * ( S2->point() ).weight() ) /seg.squared_length() );
@@ -146,7 +134,7 @@
}
template<class TT>
-Point _Tesselation<TT>::Dual ( const Cell_handle &cell )
+Point _Tesselation<TT>::Dual ( const CellHandle &cell )
{
return cell->info();
}
@@ -155,8 +143,8 @@
void _Tesselation<TT>::Compute ()
{
if (!redirected) redirect();
- Finite_cells_iterator cell_end = Tri->finite_cells_end();
- for ( Finite_cells_iterator cell = Tri->finite_cells_begin(); cell != cell_end; cell++ )
+ FiniteCellsIterator cellEnd = Tri->finite_cells_end();
+ for ( FiniteCellsIterator cell = Tri->finite_cells_begin(); cell != cellEnd; cell++ )
{
const Sphere& S0 = cell->vertex ( 0 )->point();
@@ -175,230 +163,41 @@
computed = true;
}
-// long Tesselation::New_liste_adjacent_edges ( Vertex_handle vertex0, Real** Coordonnes )
-// {
-// Delete_liste_edges ( Coordonnes );
-// *Coordonnes = new Real [600];
-// long k = 0;
-// Finite_edges_iterator ed_it;
-//
-// for ( ed_it = Tri->finite_edges_begin(); ed_it != Tri->finite_edges_end(); ed_it++ )
-// {
-// if ( ed_it->first->vertex ( ed_it->second ) == vertex0 || ed_it->first->vertex ( ed_it->third ) == vertex0 )
-// {
-// Point p;
-// Facet_circulator facet0, facet;
-// facet0 = Tri->incident_facets ( *ed_it );
-// bool pass = false;
-// for ( facet = facet0; ! ( facet == facet0 && pass ) ; facet++ )
-// {
-// pass = true;
-// if ( !Tri->is_infinite ( ( *facet ).first ) && !Tri->is_infinite ( ( *facet ).first->neighbor ( ( *facet ).second ) ) )
-// {
-// // cout << "p.x() = " << p.x() << "p.y() = " << p.y() << "p.z() = " << p.z() << endl;
-// p = ( *facet ).first->info();
-// ( *Coordonnes ) [k++] = p.x(); ( *Coordonnes ) [k++] = p.y(); ( *Coordonnes ) [k++] = p.z();
-// p = ( *facet ).first->neighbor ( ( *facet ).second )->info();
-// ( *Coordonnes ) [k++] = p.x(); ( *Coordonnes ) [k++] = p.y(); ( *Coordonnes ) [k++] = p.z();
-// }
-// }
-// }
-// }
-//
-//
-// return k/6;
-// }
-
-/*
-long Tesselation::New_liste_short_edges2 ( Real** Coordonnes )
-{
- Delete_liste_edges ( Coordonnes );
- //long j = 6 * T.number_of_finite_edges();
-
- long Nff = Tri->number_of_finite_facets();
- *Coordonnes = new Real [6 * Nff];
-
- long k = 0;
- Point p, p2;
- Finite_facets_iterator f_it; //une facette = { cell, long }
- Cell_handle cell;
-// long id_facet ;
-// Locate_type lt;
-// int n, m;
- CGAL::Object result; //utilis� pour le retour du pr�dicat CGAL::intersection
-
- // const Edge & e : (e.first, e.second, e.third) == const Cell_handle& c, int i, int j
- //H2.top("initialisation de la liste de segments");
- for ( f_it = Tri->finite_facets_begin(); f_it != Tri->finite_facets_end(); f_it++ )
- {
- if ( is_short ( f_it ) )
- {
- p = f_it->first->info();
- ( *Coordonnes ) [k++] = p.x(); ( *Coordonnes ) [k++] = p.y(); ( *Coordonnes ) [k++] = p.z();
- Cell_handle cell = f_it->first->neighbor ( f_it->second );
-
- p = cell->info();
- ( *Coordonnes ) [k++] = p.x(); ( *Coordonnes ) [k++] = p.y(); ( *Coordonnes ) [k++] = p.z();
- }
- }
- return k/6;
-}*/
-/*
-bool Tesselation::is_short ( Finite_facets_iterator f_it )
-{
- Cell_handle cell1 = f_it->first;
- Cell_handle cell2 = cell1->neighbor ( f_it->second );
-// return ( !Tri->is_infinite(cell1->neighbor(1)) && !Tri->is_infinite(cell1->neighbor(2))
-// && !Tri->is_infinite(cell1->neighbor(3)) && !Tri->is_infinite(cell1->neighbor(0))
-// && !Tri->is_infinite(cell2->neighbor(1)) && !Tri->is_infinite(cell2->neighbor(2))
-// && !Tri->is_infinite(cell2->neighbor(3)) && !Tri->is_infinite(cell2->neighbor(0)) );
- return ( !Tri->is_infinite ( cell1 ) && !Tri->is_infinite ( cell2 ) );
-
-}*/
-/*
-long Tesselation::New_liste_short_edges ( Real** Coordonnes )
-{
- Delete_liste_edges ( Coordonnes );
- //long j = 6 * T.number_of_finite_edges();
-
- long Nff = Tri->number_of_finite_facets();
- *Coordonnes = new Real [6 * Nff];
-
- long k = 0;
- int n = 0;
- Point p, p2;
- Point v1, v2, v3;
- Finite_facets_iterator f_it; //une facette = { cell, long }
- Cell_handle cell, location;
- long id_facet ;
- CGAL::Object result; //utilis� pour le retour du pr�dicat CGAL::intersection
-
- // const Edge & e : (e.first, e.second, e.third) == const Cell_handle& c, int i, int j
- //H2.top("initialisation de la liste de segments");
- for ( f_it = Tri->finite_facets_begin(); f_it != Tri->finite_facets_end(); f_it++ )
- {
- id_facet = f_it->second; //indice de la facette dans la cellule
- cell = f_it->first->neighbor ( id_facet ); //Deuxi�me cellule adjacente
- if ( !Tri->is_infinite ( f_it->first ) && !Tri->is_infinite ( cell ) )
- {
- p = f_it->first->info();
- p2 = cell->info();
-
- location = Tri->locate ( p );
- if ( !Tri->is_infinite ( location ) )
- {
- ( *Coordonnes ) [k++] = p.x(); ( *Coordonnes ) [k++] = p.y(); ( *Coordonnes ) [k++] = p.z();
-
- location = Tri->locate ( p2 );
- if ( !Tri->is_infinite ( location ) ) { p = p2; }
- else
- {
- n = 0;
- v1 = f_it->first->vertex ( n == id_facet ? ++n : n )->point(); n++;
- v2 = f_it->first->vertex ( n == id_facet ? ++n : n )->point(); n++;
- v3 = f_it->first->vertex ( n == id_facet ? ++n : n )->point(); n++;
- Plan P1 ( v1, v2, v3 );
-
- result = CGAL::intersection ( P1, Droite ( p, p2 ) );
- if ( !CGAL::assign ( p, result ) ) std::cout << "pas de point d'intersection!!!!!!!!!" << std::endl;
- }
- ( *Coordonnes ) [k++] = p.x(); ( *Coordonnes ) [k++] = p.y(); ( *Coordonnes ) [k++] = p.z();
- }
- else
- {
- location = Tri->locate ( p2 );
- if ( !Tri->is_infinite ( location ) )
- {
- ( *Coordonnes ) [k++] = p2.x(); ( *Coordonnes ) [k++] = p2.y(); ( *Coordonnes ) [k++] = p2.z();
- n = 0;
- n = 0;
- v1 = f_it->first->vertex ( n == id_facet ? ++n : n )->point(); n++;
- v2 = f_it->first->vertex ( n == id_facet ? ++n : n )->point(); n++;
- v3 = f_it->first->vertex ( n == id_facet ? ++n : n )->point(); n++;
- Plan P1 ( v1, v2, v3 );
-
- result = CGAL::intersection ( P1, Droite ( p, p2 ) );
- if ( !CGAL::assign ( p, result ) ) std::cout << "pas de point d'intersection!!!!!!!!!" << std::endl;
- ( *Coordonnes ) [k++] = p.x(); ( *Coordonnes ) [k++] = p.y(); ( *Coordonnes ) [k++] = p.z();
- }
- }
- }
- }
- return k/6;
-}
-
-
-
-long Tesselation::New_liste_edges ( Real** Coordonnes )
-{
- Delete_liste_edges ( Coordonnes );
- //long j = 6 * T.number_of_finite_edges();
-
- long Nff = Tri->number_of_finite_facets();
- *Coordonnes = new Real [6 * Nff];
-
- long k = 0;
- Point p;
-
- // const Edge & e : (e.first, e.second, e.third) == const Cell_handle& c, int i, int j
- //H2.top("initialisation de la liste de segments");
- for ( Finite_facets_iterator f_it = Tri->finite_facets_begin(); f_it != Tri->finite_facets_end(); f_it++ )
- {
- if ( !Tri->is_infinite ( f_it->first ) )
- {
- p = f_it->first->info();
- //}
- ( *Coordonnes ) [k++] = p.x(); ( *Coordonnes ) [k++] = p.y(); ( *Coordonnes ) [k++] = p.z();
-
- Cell_handle cell = f_it->first->neighbor ( f_it->second );
- if ( !Tri->is_infinite ( cell ) )
- {
- p = cell->info();
- }
- ( *Coordonnes ) [k++] = p.x(); ( *Coordonnes ) [k++] = p.y(); ( *Coordonnes ) [k++] = p.z();
- }
- }
- return Nff;
-}*/
-
template<class TT>
-Segment _Tesselation<TT>::Dual ( Finite_facets_iterator &f_it )
+Segment _Tesselation<TT>::Dual ( FiniteFacetsIterator &f_it )
{
return Segment ( f_it->first->info(), ( f_it->first->neighbor ( f_it->second ) )->info() );
}
template<class TT>
-double _Tesselation<TT>::ComputeVFacetArea ( Finite_edges_iterator ed_it )
+double _Tesselation<TT>::ComputeVFacetArea ( FiniteEdgesIterator ed_it )
{
- Cell_circulator cell0 = Tri->incident_cells ( *ed_it );
- Cell_circulator cell2 = cell0;
+ CellCirculator cell0 = Tri->incident_cells ( *ed_it );
+ CellCirculator cell2 = cell0;
- if ( Tri->is_infinite ( cell2 ) )
- {
+ if ( Tri->is_infinite ( cell2 ) ){
++cell2;
while ( Tri->is_infinite ( cell2 ) && cell2!=cell0 ) ++cell2;
if ( cell2==cell0 ) return 0;
}
cell0=cell2++;
- Cell_circulator cell1=cell2++;
+ CellCirculator cell1=cell2++;
Real area = 0;
- while ( cell2!=cell0 )
- {
+ while ( cell2!=cell0 ){
area+= sqrt(std::abs (( Triangle ( cell0->info(), cell1->info(), cell2->info() ) ).squared_area())) ;
++cell1;
++cell2;
}
-
return area;
}
template<class TT>
-void _Tesselation<TT>::AssignPartialVolume ( Finite_edges_iterator& ed_it )
+void _Tesselation<TT>::AssignPartialVolume ( FiniteEdgesIterator& ed_it )
{
- //Edge_iterator ed_it
- Cell_circulator cell0=Tri->incident_cells ( *ed_it );
- Cell_circulator cell2=cell0;
+ //EdgeIterator ed_it
+ CellCirculator cell0=Tri->incident_cells ( *ed_it );
+ CellCirculator cell2=cell0;
if ( Tri->is_infinite ( cell2 ) )
{
++cell2;
@@ -406,60 +205,35 @@
if ( cell2==cell0 ) return;
}
cell0=cell2++;
- Cell_circulator cell1=cell2++;
-// std::cout << "edge : " << ed_it->first->vertex ( ed_it->second )->info().id() << "-" << ed_it->first->vertex ( ed_it->third )->info().id() << std::endl;
+ CellCirculator cell1=cell2++;
bool isFictious1 = ( ed_it->first )->vertex ( ed_it->second )->info().isFictious;
bool isFictious2 = ( ed_it->first )->vertex ( ed_it->third )->info().isFictious;
-// cout<<"fictious "<<isFictious1<<" "<<isFictious2<<endl;
Real r;
-
-// cout << "cell0 : " << cell0->vertex(0)->info().id() << " "
-// << cell0->vertex(1)->info().id() << " "
-// << cell0->vertex(2)->info().id() << " "
-// << cell0->vertex(3)->info().id() << "(center : " << (Point) cell0->info() << ")" << endl;
-
while ( cell2!=cell0 )
{
if ( !Tri->is_infinite ( cell1 ) && !Tri->is_infinite ( cell2 ) )
{
-// cout << "cell1 : " << cell1->vertex(0)->info().id() << " "
-// << cell1->vertex(1)->info().id() << " "
-// << cell1->vertex(2)->info().id() << " "
-// << cell1->vertex(3)->info().id() << "(center : " << (Point) cell1->info() << ")" << endl;
-// cout << "cell2 : " << cell2->vertex(0)->info().id() << " "
-// << cell2->vertex(1)->info().id() << " "
-// << cell2->vertex(2)->info().id() << " "
-// << cell2->vertex(3)->info().id() << "(center : " << (Point) cell2->info() << ")" << endl;
-
-// std::cout << "assign tetra : (" << ed_it->first->vertex ( ed_it->second )->point() << "),(" << cell0->info() << "),(" << cell1->info() << "),(" <<cell2->info() << ")" << std::endl;
if ( !isFictious1 )
{
- r = std::abs ( ( Tetraedre ( ed_it->first->vertex ( ed_it->second )->point(), cell0->info(), cell1->info(), cell2->info() ) ).volume() );
-// std::cout << "assigned1=" << r << " on " << ed_it->first->vertex ( ed_it->second )->info().id() << std::endl;
+ r = std::abs ( ( Tetrahedron ( ed_it->first->vertex ( ed_it->second )->point(), cell0->info(), cell1->info(), cell2->info() ) ).volume() );
( ed_it->first )->vertex ( ed_it->second )->info().v() += r;
TotalFiniteVoronoiVolume+=r;
}
-// std::cout << "assign tetra : (" << ed_it->first->vertex ( ed_it->third )->point() << "),(" << cell0->info() << "),(" << cell1->info() << "),(" <<cell2->info() << ")" << std::endl;
if ( !isFictious2 )
{
- r = std::abs ( ( Tetraedre ( ed_it->first->vertex ( ed_it->third )->point(), cell0->info(), cell1->info(), cell2->info() ) ).volume() );
-// std::cout << "assigned2=" << r << " on " << ed_it->first->vertex ( ed_it->third )->info().id() << std::endl;
+ r = std::abs ( ( Tetrahedron ( ed_it->first->vertex ( ed_it->third )->point(), cell0->info(), cell1->info(), cell2->info() ) ).volume() );
ed_it->first->vertex ( ed_it->third )->info().v() +=r;
TotalFiniteVoronoiVolume+=r;
}
}
++cell1; ++cell2;
}
-// std::cout << "fin AssignPartialVolume,total " << TotalFiniteVoronoiVolume<< std::endl;
}
template<class TT>
void _Tesselation<TT>::ResetVCellVolumes ( void )
{
- for ( Vertex_iterator V_it = Tri->vertices_begin (); V_it != Tri->vertices_end (); V_it++ )
- {
- V_it->info().v() =0;
- }
+ for ( VertexIterator vIt = Tri->vertices_begin (); vIt != Tri->vertices_end (); vIt++ ) vIt->info().v() =0;
TotalFiniteVoronoiVolume=0;
TotalInternalVoronoiPorosity=0;
}
@@ -469,53 +243,36 @@
{
if ( !computed ) Compute();
ResetVCellVolumes();
- for ( Finite_edges_iterator ed_it=Tri->finite_edges_begin(); ed_it!=Tri->finite_edges_end();ed_it++ )
+ for ( FiniteEdgesIterator ed_it=Tri->finite_edges_begin(); ed_it!=Tri->finite_edges_end();ed_it++ )
{
AssignPartialVolume ( ed_it );
}
- //Delete volume for spheres on the boarders of the packing
//FIXME: find a way to compute a volume correctly for spheres of the boarders.
-
-// Vector_Vertex boarder_vertices;
-// Voisins(Tri->infinite_vertex (), boarder_vertices);
-// unsigned int l = boarder_vertices.size();
-// for (unsigned int i=0; i<l; ++i) boarder_vertices[i]->info().v()=0;
-// cout << "TotalVolume : " << TotalFiniteVoronoiVolume << endl;
}
template<class TT>
void _Tesselation<TT>::ComputePorosity ( void ) //WARNING : This function will erase real volumes of cells
{
- // and replace it with porosity
ComputeVolumes();
- //Real rr=0;
- Finite_vertices_iterator vertices_end = Tri->finite_vertices_end ();
- for ( Finite_vertices_iterator V_it = Tri->finite_vertices_begin (); V_it != vertices_end; V_it++ )
+ FiniteVerticesIterator verticesEnd = Tri->finite_vertices_end ();
+ for ( FiniteVerticesIterator vIt = Tri->finite_vertices_begin (); vIt != verticesEnd; vIt++ )
{
- if ( V_it->info().v() && !V_it->info().isFictious )
+ if ( vIt->info().v() && !vIt->info().isFictious )
{
- Real r = 4.188790 * std::pow ( ( V_it->point().weight() ),1.5 );// 4/3*PI*R³ = 4.188...*R³
+ Real r = 4.188790 * std::pow ( ( vIt->point().weight() ),1.5 );// 4/3*PI*R³ = 4.188...*R³
TotalInternalVoronoiPorosity+=r;
- //rr+=V_it->info().v();
- TotalInternalVoronoiVolume += V_it->info().v();
- V_it->info().v() =
- ( V_it->info().v() - r )
- / V_it->info().v();
- //std::cout << "Cell " << V_it->info().id() << ": V_it->point().weight()=" << V_it->point().weight() << std::endl;
- std::cout << "Cell " << V_it->info().id() << ": v=" << V_it->info().v() << " radius=" << sqrt ( V_it->point().weight() ) << " volume sphere ="<< r << std::endl;
+ TotalInternalVoronoiVolume += vIt->info().v();
+ vIt->info().v() =
+ ( vIt->info().v() - r )
+ / vIt->info().v();
}
}
- std::cout << "total internal solid = " << TotalInternalVoronoiPorosity << std::endl;
- std::cout << "TotalFiniteVoronoiVolume = " << TotalFiniteVoronoiVolume << std::endl;
- std::cout << "TotalInternalVoronoiVolume = " << TotalInternalVoronoiVolume << std::endl;
-
TotalInternalVoronoiPorosity= ( TotalInternalVoronoiVolume-TotalInternalVoronoiPorosity ) /TotalInternalVoronoiVolume;
- std::cout << "TotalInternalVoronoiPorosity = " << TotalInternalVoronoiPorosity << std::endl;
}
template<class TT>
-bool _Tesselation<TT>::is_internal ( Finite_facets_iterator &facet )
+bool _Tesselation<TT>::is_internal ( FiniteFacetsIterator &facet )
{
return ( !Tri->is_infinite ( facet->first ) && !Tri->is_infinite ( facet->first->neighbor ( facet->second ) ) );
}
@@ -523,9 +280,9 @@
template<class Tesselation>
-typename Tesselation::Vertex_handle PeriodicTesselation<Tesselation>::insert(Real x, Real y, Real z, Real rad, unsigned int id, bool isFictious, int duplicateOfId)
+typename Tesselation::VertexHandle PeriodicTesselation<Tesselation>::insert(Real x, Real y, Real z, Real rad, unsigned int id, bool isFictious, int duplicateOfId)
{
- Vertex_handle Vh;
+ VertexHandle Vh;
if (!Tri) cerr<<"!Tri!"<<endl;
Vh = Tri->insert(Sphere(Point(x,y,z),pow(rad,2)));
if ( Vh!=NULL )
@@ -535,7 +292,7 @@
if (duplicateOfId<0) {
assert (vertexHandles.size()>id);
vertexHandles[id] = Vh;
- max_id = std::max ( max_id, (int) id );
+ maxId = std::max ( maxId, (int) id );
Vh->info().isGhost=0;
} else Vh->info().isGhost=1;
}
@@ -549,19 +306,17 @@
if ( !redirected )
{
//Set size of the redirection vector
- if ( (unsigned int)max_id+1 != vertexHandles.size() ) vertexHandles.resize ( max_id+1,NULL );
+ if ( (unsigned int)maxId+1 != vertexHandles.size() ) vertexHandles.resize ( maxId+1,NULL );
cout << "!redirected" << endl;
- max_id = 0;
- Finite_vertices_iterator vertices_end = Tri->finite_vertices_end ();
- for ( Finite_vertices_iterator V_it = Tri->finite_vertices_begin (); V_it != vertices_end; V_it++ )
+ maxId = 0;
+ FiniteVerticesIterator verticesEnd = Tri->finite_vertices_end ();
+ for ( FiniteVerticesIterator vIt = Tri->finite_vertices_begin (); vIt != verticesEnd; vIt++ )
{
- if (V_it->info().isGhost) continue;
- vertexHandles[V_it->info().id()]= V_it;
- max_id = max(max_id, (int) V_it->info().id());
- //if ( ! ( V_it->info().isFictious ) ) vertexHandles[V_it->info().id() ]= V_it;
- //std::cout<< "Cell " << V_it->info().id() << ": v=" << V_it->info().v() << std::endl;
+ if (vIt->info().isGhost) continue;
+ vertexHandles[vIt->info().id()]= vIt;
+ maxId = max(maxId, (int) vIt->info().id());
}
- if ( (unsigned int)max_id+1 != vertexHandles.size() ) vertexHandles.resize ( max_id+1 );
+ if ( (unsigned int)maxId+1 != vertexHandles.size() ) vertexHandles.resize ( maxId+1 );
bool redirected = true;
} else return false;
return true;
=== modified file 'lib/triangulation/def_types.h'
--- lib/triangulation/def_types.h 2013-11-21 01:28:17 +0000
+++ lib/triangulation/def_types.h 2014-03-21 18:45:24 +0000
@@ -21,6 +21,9 @@
#include <CGAL/number_utils.h>
#include <boost/static_assert.hpp>
+//This include from yade let us use Eigen types
+#include <yade/lib/base/Math.hpp>
+
namespace CGT {
//Robust kernel
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
@@ -37,15 +40,14 @@
#endif
typedef Traits::RT Real; //Dans cartesian, RT = FT
typedef Traits::Weighted_point Sphere;
-typedef Traits::Line_3 Droite;
-typedef Traits::Plane_3 Plan;
+typedef Traits::Plane_3 Plane;
typedef Traits::Triangle_3 Triangle;
-typedef Traits::Tetrahedron_3 Tetraedre;
+typedef Traits::Tetrahedron_3 Tetrahedron;
class SimpleCellInfo : public Point {
public:
//"id": unique identifier of each cell, independant of other numberings used in the fluid types.
- // Care to initialize it, there is no magic numbering to rely on
+ // Care to initialize it if you need it, there is no magic numbering to rely on
unsigned int id;
Real s;
bool isFictious;
@@ -91,10 +93,10 @@
Real invVoidV;
Real t;
int fict;
- Real VolumeVariation;
+ Real volumeVariation;
double pression;
//average relative (fluid - facet translation) velocity defined for a single cell as 1/Volume * SUM_ON_FACETS(x_average_facet*average_facet_flow_rate)
- Vecteur Average_Cell_Velocity;
+ Vecteur averageCellVelocity;
// Surface vectors of facets, pointing from outside toward inside the cell
std::vector<Vecteur> facetSurfaces;
//Ratio between fluid surface and facet surface
@@ -103,70 +105,63 @@
std::vector<Vecteur> unitForceVectors;
// Store the area of triangle-sphere intersections for each facet (used in forces definition)
std::vector<Vecteur> facetSphereCrossSections;
- std::vector<Vecteur> cell_force;
- std::vector<double> RayHydr;
-// std::vector<double> flow_rate;
- std::vector<double> module_permeability;
+ std::vector<Vecteur> cellForce;
+ std::vector<double> rayHydr;
+ std::vector<double> modulePermeability;
// Partial surfaces of spheres in the double-tetrahedron linking two voronoi centers. [i][j] is for sphere facet "i" and sphere facetVertices[i][j]. Last component for 1/sum_surfaces in the facet.
double solidSurfaces [4][4];
FlowCellInfo (void)
{
- module_permeability.resize(4, 0);
- cell_force.resize(4);
+ modulePermeability.resize(4, 0);
+ cellForce.resize(4);
facetSurfaces.resize(4);
facetFluidSurfacesRatio.resize(4);
facetSphereCrossSections.resize(4);
unitForceVectors.resize(4);
for (int k=0; k<4;k++) for (int l=0; l<3;l++) solidSurfaces[k][l]=0;
- RayHydr.resize(4, 0);
+ rayHydr.resize(4, 0);
// isInside = false;
- inv_sum_k=0;
+ invSumK=0;
isFictious=false; Pcondition = false; isGhost = false;
// isInferior = false; isSuperior = false; isLateral = false; isExternal=false;
isvisited = false;
index=0;
volumeSign=0;
s=0;
- VolumeVariation=0;
+ volumeVariation=0;
pression=0;
invVoidV=0;
fict=0;
isGhost=false;
}
bool isGhost;
- double inv_sum_k;
-// bool isInside;
-// bool isInferior;
-// bool isSuperior;
-// bool isLateral;
+ double invSumK;
bool isvisited;
-// bool isExternal;
- FlowCellInfo& operator= (const std::vector<double> &v) { for (int i=0; i<4;i++) module_permeability[i]= v[i]; return *this; }
+ FlowCellInfo& operator= (const std::vector<double> &v) { for (int i=0; i<4;i++) modulePermeability[i]= v[i]; return *this; }
FlowCellInfo& operator= (const Point &p) { Point::operator= (p); return *this; }
FlowCellInfo& operator= (const float &scalar) { s=scalar; return *this; }
inline Real& volume (void) {return t;}
inline const Real& invVoidVolume (void) const {return invVoidV;}
inline Real& invVoidVolume (void) {return invVoidV;}
- inline Real& dv (void) {return VolumeVariation;}
+ inline Real& dv (void) {return volumeVariation;}
inline int& fictious (void) {return fict;}
inline double& p (void) {return pression;}
//For compatibility with the periodic case
inline const double shiftedP (void) const {return pression;}
- inline const std::vector<double>& k_norm (void) const {return module_permeability;}
- inline std::vector<double>& k_norm (void) {return module_permeability;}
+ inline const std::vector<double>& kNorm (void) const {return modulePermeability;}
+ inline std::vector<double>& kNorm (void) {return modulePermeability;}
inline std::vector< Vecteur >& facetSurf (void) {return facetSurfaces;}
- inline std::vector<Vecteur>& force (void) {return cell_force;}
- inline std::vector<double>& Rh (void) {return RayHydr;}
-
- inline Vecteur& av_vel (void) {return Average_Cell_Velocity;}
+ inline std::vector<Vecteur>& force (void) {return cellForce;}
+ inline std::vector<double>& Rh (void) {return rayHydr;}
+ inline Vecteur& averageVelocity (void) {return averageCellVelocity;}
};
class FlowVertexInfo : public SimpleVertexInfo {
- Vecteur Grain_Velocity;
- Real volume_incident_cells;
+ Vecteur grainVelocity;
+ Real volumeIncidentCells;
public:
FlowVertexInfo& operator= (const Vecteur &u) { Vecteur::operator= (u); return *this; }
FlowVertexInfo& operator= (const float &scalar) { s=scalar; return *this; }
@@ -175,8 +170,8 @@
bool isGhost;
FlowVertexInfo (void) {isGhost=false;}
inline Vecteur& force (void) {return forces;}
- inline Vecteur& vel (void) {return Grain_Velocity;}
- inline Real& vol_cells (void) {return volume_incident_cells;}
+ inline Vecteur& vel (void) {return grainVelocity;}
+ inline Real& volCells (void) {return volumeIncidentCells;}
inline const Vecteur ghostShift (void) {return CGAL::NULL_VECTOR;}
};
=== modified file 'pkg/common/PersistentTriangulationCollider.cpp'
--- pkg/common/PersistentTriangulationCollider.cpp 2010-11-19 21:29:56 +0000
+++ pkg/common/PersistentTriangulationCollider.cpp 2014-03-21 18:45:24 +0000
@@ -60,7 +60,7 @@
const Sphere* s = YADE_CAST<Sphere*>(b->shape.get());
Tes->insert ( b->state->pos[0],b->state->pos[1],b->state->pos[2], s->radius, b->getId() );
}
- Tes->AddBoundingPlanes();
+ Tes->addBoundingPlanes();
isTriangulated = true;
triangulationIteration = true;
//}
=== modified file 'pkg/dem/FlowEngine.cpp'
--- pkg/dem/FlowEngine.cpp 2013-11-25 02:04:22 +0000
+++ pkg/dem/FlowEngine.cpp 2014-03-21 18:45:24 +0000
@@ -50,44 +50,51 @@
timingDeltas->checkpoint ( "Position buffer" );
if (first) {
if (multithread) setPositionsBuffer(false);
- Build_Triangulation(P_zero,solver);
- Initialize_volumes(solver);
+ buildTriangulation(pZero,solver);
+ initializeVolumes(solver);
backgroundSolver=solver;
backgroundCompleted=true;
}
solver->ompThreads = ompThreads>0? ompThreads : omp_get_max_threads();
timingDeltas->checkpoint ( "Triangulating" );
- UpdateVolumes ( solver );
+ updateVolumes ( solver );
timingDeltas->checkpoint ( "Update_Volumes" );
- Eps_Vol_Cumulative += eps_vol_max;
+ epsVolCumulative += epsVolMax;
retriangulationLastIter++;
if (!updateTriangulation) updateTriangulation = // If not already set true by another function of by the user, check conditions
- (defTolerance>0 && Eps_Vol_Cumulative > defTolerance) || retriangulationLastIter>meshUpdateInterval;
+ (defTolerance>0 && epsVolCumulative > defTolerance) || retriangulationLastIter>meshUpdateInterval;
///Compute flow and and forces here
if (pressureForce){
- solver->GaussSeidel(scene->dt);
+ solver->gaussSeidel(scene->dt);
timingDeltas->checkpoint ( "Gauss-Seidel (includes matrix construct and factorization in single-thread mode)" );
- solver->ComputeFacetForcesWithCache();}
+ solver->computeFacetForcesWithCache();}
timingDeltas->checkpoint ( "Compute_Forces" );
///Application of vicscous forces
scene->forces.sync();
timingDeltas->checkpoint ( "forces.sync()" );
- ComputeViscousForces ( *solver );
+ computeLubricationContributions ( *solver );
timingDeltas->checkpoint ( "viscous forces" );
Vector3r force;
- Finite_vertices_iterator vertices_end = solver->T[solver->currentTes].Triangulation().finite_vertices_end();
- for ( Finite_vertices_iterator V_it = solver->T[solver->currentTes].Triangulation().finite_vertices_begin(); V_it != vertices_end; V_it++ ) {
- force = pressureForce ? Vector3r ( V_it->info().forces[0],V_it->info().forces[1],V_it->info().forces[2] ): Vector3r(0,0,0);
+ Vector3r torque;
+ FiniteVerticesIterator verticesEnd = solver->T[solver->currentTes].Triangulation().finite_vertices_end();
+ for ( FiniteVerticesIterator vIt = solver->T[solver->currentTes].Triangulation().finite_vertices_begin(); vIt != verticesEnd; vIt++ ) {
+ force = pressureForce ? Vector3r ( vIt->info().forces[0],vIt->info().forces[1],vIt->info().forces[2] ): Vector3r(0,0,0);
+ torque = Vector3r(0,0,0);
if (shearLubrication || viscousShear){
- force = force + solver->viscousShearForces[V_it->info().id()];
- scene->forces.addTorque ( V_it->info().id(), solver->viscousShearTorques[V_it->info().id()]);
+ force = force + solver->shearLubricationForces[vIt->info().id()];
+ torque = torque + solver->shearLubricationTorques[vIt->info().id()];
+ if (pumpTorque)
+ torque = torque + solver->pumpLubricationTorques[vIt->info().id()];
}
+ if (twistTorque)
+ torque = torque + solver->twistLubricationTorques[vIt->info().id()];
if (normalLubrication)
- force = force + solver-> normLubForce[V_it->info().id()];
- scene->forces.addForce ( V_it->info().id(), force);
+ force = force + solver-> normalLubricationForce[vIt->info().id()];
+ scene->forces.addForce ( vIt->info().id(), force);
+ scene->forces.addTorque ( vIt->info().id(), torque);
}
///End Compute flow and forces
timingDeltas->checkpoint ( "Applying Forces" );
@@ -96,63 +103,63 @@
while (updateTriangulation && !backgroundCompleted) { /*cout<<"sleeping..."<<sleeping++<<endl;*/
sleeping++;
boost::this_thread::sleep(boost::posix_time::microseconds(1000));}
- if (Debug && sleeping) cerr<<"sleeping..."<<sleeping<<endl;
+ if (debug && sleeping) cerr<<"sleeping..."<<sleeping<<endl;
if (updateTriangulation || (ellapsedIter>(0.5*meshUpdateInterval) && backgroundCompleted)) {
- if (Debug) cerr<<"switch flow solver"<<endl;
+ if (debug) cerr<<"switch flow solver"<<endl;
if (useSolver==0) LOG_ERROR("background calculations not available for Gauss-Seidel");
- if (fluidBulkModulus>0) solver->Interpolate (solver->T[solver->currentTes], backgroundSolver->T[backgroundSolver->currentTes]);
+ if (fluidBulkModulus>0) solver->interpolate (solver->T[solver->currentTes], backgroundSolver->T[backgroundSolver->currentTes]);
solver=backgroundSolver;
backgroundSolver = shared_ptr<FlowSolver> (new FlowSolver);
//Copy imposed pressures/flow from the old solver
backgroundSolver->imposedP = vector<pair<CGT::Point,Real> >(solver->imposedP);
backgroundSolver->imposedF = vector<pair<CGT::Point,Real> >(solver->imposedF);
- if (Debug) cerr<<"switched"<<endl;
+ if (debug) cerr<<"switched"<<endl;
setPositionsBuffer(false);//set "parallel" buffer for background calculation
backgroundCompleted=false;
retriangulationLastIter=ellapsedIter;
updateTriangulation=false;
- Eps_Vol_Cumulative=0;
+ epsVolCumulative=0;
ellapsedIter=0;
boost::thread workerThread(&FlowEngine::backgroundAction,this);
workerThread.detach();
- if (Debug) cerr<<"backgrounded"<<endl;
- Initialize_volumes(solver);
- ComputeViscousForces(*solver);
- if (Debug) cerr<<"volumes initialized"<<endl;
+ if (debug) cerr<<"backgrounded"<<endl;
+ initializeVolumes(solver);
+ computeLubricationContributions(*solver);
+ if (debug) cerr<<"volumes initialized"<<endl;
}
else {
- if (Debug && !backgroundCompleted) cerr<<"still computing solver in the background, ellapsedIter="<<ellapsedIter<<endl;
+ if (debug && !backgroundCompleted) cerr<<"still computing solver in the background, ellapsedIter="<<ellapsedIter<<endl;
ellapsedIter++;
}
} else {
if (updateTriangulation && !first) {
- Build_Triangulation (P_zero, solver);
- Initialize_volumes(solver);
- ComputeViscousForces(*solver);
+ buildTriangulation (pZero, solver);
+ initializeVolumes(solver);
+ computeLubricationContributions(*solver);
updateTriangulation = false;
- Eps_Vol_Cumulative=0;
+ epsVolCumulative=0;
retriangulationLastIter=0;
ReTrg++;}
}
first=false;
- timingDeltas->checkpoint ( "Triangulate + init volumes" );
+ timingDeltas->checkpoint ( "triangulate + init volumes" );
}
void FlowEngine::backgroundAction()
{
if (useSolver<1) {LOG_ERROR("background calculations not available for Gauss-Seidel"); return;}
- Build_Triangulation ( P_zero,backgroundSolver );
+ buildTriangulation ( pZero,backgroundSolver );
//FIXME: GS is computing too much, we need only matrix factorization in fact
- backgroundSolver->GaussSeidel(scene->dt);
+ backgroundSolver->gaussSeidel(scene->dt);
//FIXME(2): and here we need only cached variables, not forces
- backgroundSolver->ComputeFacetForcesWithCache(/*onlyCache?*/ true);
+ backgroundSolver->computeFacetForcesWithCache(/*onlyCache?*/ true);
// boost::this_thread::sleep(boost::posix_time::seconds(5));
backgroundCompleted = true;
}
template<class Solver>
-void FlowEngine::BoundaryConditions ( Solver& flow )
+void FlowEngine::boundaryConditions ( Solver& flow )
{
for (int k=0;k<6;k++) {
@@ -177,19 +184,18 @@
}
template<class Solver>
-void FlowEngine::clearImposedPressure ( Solver& flow ) { flow->imposedP.clear(); flow->IPCells.clear();}
+void FlowEngine::clearImposedPressure ( Solver& flow ) { flow->imposedP.clear(); flow->ipCells.clear();}
template<class Solver>
-void FlowEngine::clearImposedFlux ( Solver& flow ) { flow->imposedF.clear(); flow->IFCells.clear();}
+void FlowEngine::clearImposedFlux ( Solver& flow ) { flow->imposedF.clear(); flow->ifCells.clear();}
template<class Solver>
Real FlowEngine::getCellFlux ( unsigned int cond, const shared_ptr<Solver>& flow )
{
if ( cond>=flow->imposedP.size() ) {LOG_ERROR ( "Getting flux with cond higher than imposedP size." ); return 0;}
double flux=0;
- typename Solver::Cell_handle& cell= flow->IPCells[cond];
+ typename Solver::CellHandle& cell= flow->ipCells[cond];
for ( int ngb=0;ngb<4;ngb++ ) {
- /*if (!cell->neighbor(ngb)->info().Pcondition)*/
- flux+= cell->info().k_norm() [ngb]* ( cell->info().p()-cell->neighbor ( ngb )->info().p() );
+ flux+= cell->info().kNorm() [ngb]* ( cell->info().p()-cell->neighbor ( ngb )->info().p() );
}
return flux+cell->info().dv();
}
@@ -197,10 +203,10 @@
template<class Solver>
void FlowEngine::initSolver ( Solver& flow )
{
- flow->Vtotalissimo=0; flow->Vsolid_tot=0; flow->Vporale=0; flow->Ssolid_tot=0;
- flow->SLIP_ON_LATERALS=slip_boundary;
- flow->k_factor = permeabilityFactor;
- flow->DEBUG_OUT = Debug;
+ flow->Vtotalissimo=0; flow->VSolidTot=0; flow->vPoral=0; flow->sSolidTot=0;
+ flow->slipOnLaterals = slipBoundary;
+ flow->kFactor = permeabilityFactor;
+ flow->debugOut = debug;
flow->useSolver = useSolver;
#ifdef EIGENSPARSE_LIB
flow->numSolveThreads = numSolveThreads;
@@ -208,17 +214,17 @@
#endif
flow->meanKStat = meanKStat;
flow->VISCOSITY = viscosity;
- flow->TOLERANCE=Tolerance;
- flow->RELAX=Relax;
+ flow->TOLERANCE=tolerance;
+ flow->RELAX=relax;
flow->clampKValues = clampKValues;
flow->maxKdivKmean = maxKdivKmean;
flow->minKdivKmean = minKdivKmean;
flow->meanKStat = meanKStat;
- flow->permeability_map = permeability_map;
+ flow->permeabilityMap = permeabilityMap;
flow->fluidBulkModulus = fluidBulkModulus;
flow->T[flow->currentTes].Clear();
- flow->T[flow->currentTes].max_id=-1;
- flow->x_min = 1000.0, flow->x_max = -10000.0, flow->y_min = 1000.0, flow->y_max = -10000.0, flow->z_min = 1000.0, flow->z_max = -10000.0;
+ flow->T[flow->currentTes].maxId=-1;
+ flow->xMin = 1000.0, flow->xMax = -10000.0, flow->yMin = 1000.0, flow->yMax = -10000.0, flow->zMin = 1000.0, flow->zMax = -10000.0;
}
#ifdef LINSOLV
@@ -236,46 +242,46 @@
#endif
template<class Solver>
-void FlowEngine::Build_Triangulation ( Solver& flow )
+void FlowEngine::buildTriangulation ( Solver& flow )
{
- Build_Triangulation ( 0.f,flow );
+ buildTriangulation ( 0.f,flow );
}
template<class Solver>
-void FlowEngine::Build_Triangulation ( double P_zero, Solver& flow )
+void FlowEngine::buildTriangulation ( double pZero, Solver& flow )
{
- flow->ResetNetwork();
+ flow->resetNetwork();
if (first) flow->currentTes=0;
else {
flow->currentTes=!flow->currentTes;
- if (Debug) cout << "--------RETRIANGULATION-----------" << endl;
+ if (debug) cout << "--------RETRIANGULATION-----------" << endl;
}
initSolver(flow);
- AddBoundary ( flow );
- Triangulate ( flow );
- if ( Debug ) cout << endl << "Tesselating------" << endl << endl;
+ addBoundary ( flow );
+ triangulate ( flow );
+ if ( debug ) cout << endl << "Tesselating------" << endl << endl;
flow->T[flow->currentTes].Compute();
- flow->Define_fictious_cells();
+ flow->defineFictiousCells();
// For faster loops on cells define this vector
flow->T[flow->currentTes].cellHandles.clear();
flow->T[flow->currentTes].cellHandles.reserve(flow->T[flow->currentTes].Triangulation().number_of_finite_cells());
- Finite_cells_iterator cell_end = flow->T[flow->currentTes].Triangulation().finite_cells_end();
+ FiniteCellsIterator cellEnd = flow->T[flow->currentTes].Triangulation().finite_cells_end();
int k=0;
- for ( Finite_cells_iterator cell = flow->T[flow->currentTes].Triangulation().finite_cells_begin(); cell != cell_end; cell++ ){
+ for ( FiniteCellsIterator cell = flow->T[flow->currentTes].Triangulation().finite_cells_begin(); cell != cellEnd; cell++ ){
flow->T[flow->currentTes].cellHandles.push_back(cell);
cell->info().id=k++;}//define unique numbering now, corresponds to position in cellHandles
- flow->DisplayStatistics ();
- flow->Compute_Permeability();
- porosity = flow->V_porale_porosity/flow->V_totale_porosity;
+ flow->displayStatistics ();
+ flow->computePermeability();
+ porosity = flow->vPoralPorosity/flow->vTotalePorosity;
- BoundaryConditions ( flow );
- flow->Initialize_pressures ( P_zero );
+ boundaryConditions ( flow );
+ flow->initializePressures ( pZero );
- if ( !first && !multithread && (useSolver==0 || fluidBulkModulus>0)) flow->Interpolate ( flow->T[!flow->currentTes], flow->T[flow->currentTes] );
- if ( WaveAction ) flow->ApplySinusoidalPressure ( flow->T[flow->currentTes].Triangulation(), sineMagnitude, sineAverage, 30 );
+ if ( !first && !multithread && (useSolver==0 || fluidBulkModulus>0)) flow->interpolate ( flow->T[!flow->currentTes], flow->T[flow->currentTes] );
+ if ( waveAction ) flow->applySinusoidalPressure ( flow->T[flow->currentTes].Triangulation(), sineMagnitude, sineAverage, 30 );
if (normalLubrication || shearLubrication || viscousShear) flow->computeEdgesSurfaces();
}
@@ -298,10 +304,10 @@
}
template<class Solver>
-void FlowEngine::AddBoundary ( Solver& flow )
+void FlowEngine::addBoundary ( Solver& flow )
{
vector<posData>& buffer = multithread ? positionBufferParallel : positionBufferCurrent;
- solver->x_min = Mathr::MAX_REAL, solver->x_max = -Mathr::MAX_REAL, solver->y_min = Mathr::MAX_REAL, solver->y_max = -Mathr::MAX_REAL, solver->z_min = Mathr::MAX_REAL, solver->z_max = -Mathr::MAX_REAL;
+ solver->xMin = Mathr::MAX_REAL, solver->xMax = -Mathr::MAX_REAL, solver->yMin = Mathr::MAX_REAL, solver->yMax = -Mathr::MAX_REAL, solver->zMin = Mathr::MAX_REAL, solver->zMax = -Mathr::MAX_REAL;
FOREACH ( const posData& b, buffer ) {
if ( !b.exists ) continue;
if ( b.isSphere ) {
@@ -309,64 +315,56 @@
const Real& x = b.pos[0];
const Real& y = b.pos[1];
const Real& z = b.pos[2];
- flow->x_min = min ( flow->x_min, x-rad );
- flow->x_max = max ( flow->x_max, x+rad );
- flow->y_min = min ( flow->y_min, y-rad );
- flow->y_max = max ( flow->y_max, y+rad );
- flow->z_min = min ( flow->z_min, z-rad );
- flow->z_max = max ( flow->z_max, z+rad );
+ flow->xMin = min ( flow->xMin, x-rad );
+ flow->xMax = max ( flow->xMax, x+rad );
+ flow->yMin = min ( flow->yMin, y-rad );
+ flow->yMax = max ( flow->yMax, y+rad );
+ flow->zMin = min ( flow->zMin, z-rad );
+ flow->zMax = max ( flow->zMax, z+rad );
}
}
//FIXME id_offset must be set correctly, not the case here (always 0), then we need walls first or it will fail
- id_offset = flow->T[flow->currentTes].max_id+1;
- flow->id_offset = id_offset;
- flow->SectionArea = ( flow->x_max - flow->x_min ) * ( flow->z_max-flow->z_min );
- flow->Vtotale = ( flow->x_max-flow->x_min ) * ( flow->y_max-flow->y_min ) * ( flow->z_max-flow->z_min );
- flow->y_min_id=wallIds[ymin];
- flow->y_max_id=wallIds[ymax];
- flow->x_max_id=wallIds[xmax];
- flow->x_min_id=wallIds[xmin];
- flow->z_min_id=wallIds[zmin];
- flow->z_max_id=wallIds[zmax];
+ idOffset = flow->T[flow->currentTes].maxId+1;
+ flow->idOffset = idOffset;
+ flow->sectionArea = ( flow->xMax - flow->xMin ) * ( flow->zMax-flow->zMin );
+ flow->vTotal = ( flow->xMax-flow->xMin ) * ( flow->yMax-flow->yMin ) * ( flow->zMax-flow->zMin );
+ flow->yMinId=wallIds[ymin];
+ flow->yMaxId=wallIds[ymax];
+ flow->xMaxId=wallIds[xmax];
+ flow->xMinId=wallIds[xmin];
+ flow->zMinId=wallIds[zmin];
+ flow->zMaxId=wallIds[zmax];
//FIXME: Id's order in boundsIds is done according to the enumeration of boundaries from TXStressController.hpp, line 31. DON'T CHANGE IT!
- flow->boundsIds[0]= &flow->x_min_id;
- flow->boundsIds[1]= &flow->x_max_id;
- flow->boundsIds[2]= &flow->y_min_id;
- flow->boundsIds[3]= &flow->y_max_id;
- flow->boundsIds[4]= &flow->z_min_id;
- flow->boundsIds[5]= &flow->z_max_id;
+ flow->boundsIds[0]= &flow->xMinId;
+ flow->boundsIds[1]= &flow->xMaxId;
+ flow->boundsIds[2]= &flow->yMinId;
+ flow->boundsIds[3]= &flow->yMaxId;
+ flow->boundsIds[4]= &flow->zMinId;
+ flow->boundsIds[5]= &flow->zMaxId;
for (int k=0;k<6;k++) flow->boundary ( *flow->boundsIds[k] ).useMaxMin = boundaryUseMaxMin[k];
-
-// if ( flow->y_min_id>=0 ) flow->boundary ( flow->y_min_id ).useMaxMin = boundaryUseMaxMin[ymin];
-// if ( flow->y_max_id>=0 ) flow->boundary ( flow->y_max_id ).useMaxMin = boundaryUseMaxMin[ymax];
-// if ( flow->x_max_id>=0 ) flow->boundary ( flow->x_max_id ).useMaxMin = boundaryUseMaxMin[xmax];
-// if ( flow->x_min_id>=0 ) flow->boundary ( flow->x_min_id ).useMaxMin = boundaryUseMaxMin[xmin];
-// if ( flow->z_max_id>=0 ) flow->boundary ( flow->z_max_id ).useMaxMin = boundaryUseMaxMin[zmax];
-// if ( flow->z_min_id>=0 ) flow->boundary ( flow->z_min_id ).useMaxMin = boundaryUseMaxMin[zmin];
-
- flow->Corner_min = CGT::Point ( flow->x_min, flow->y_min, flow->z_min );
- flow->Corner_max = CGT::Point ( flow->x_max, flow->y_max, flow->z_max );
+ flow->cornerMin = CGT::Point ( flow->xMin, flow->yMin, flow->zMin );
+ flow->cornerMax = CGT::Point ( flow->xMax, flow->yMax, flow->zMax );
//assign BCs types and values
- BoundaryConditions ( flow );
+ boundaryConditions ( flow );
double center[3];
for ( int i=0; i<6; i++ ) {
if ( *flow->boundsIds[i]<0 ) continue;
CGT::Vecteur Normal ( normal[i].x(), normal[i].y(), normal[i].z() );
- if ( flow->boundary ( *flow->boundsIds[i] ).useMaxMin ) flow->AddBoundingPlane(Normal, *flow->boundsIds[i] );
+ if ( flow->boundary ( *flow->boundsIds[i] ).useMaxMin ) flow->addBoundingPlane(Normal, *flow->boundsIds[i] );
else {
for ( int h=0;h<3;h++ ) center[h] = buffer[*flow->boundsIds[i]].pos[h];
// cerr << "id="<<*flow->boundsIds[i] <<" center="<<center[0]<<","<<center[1]<<","<<center[2]<<endl;
- flow->AddBoundingPlane ( center, wall_thickness, Normal,*flow->boundsIds[i] );
+ flow->addBoundingPlane ( center, wallThickness, Normal,*flow->boundsIds[i] );
}
}
}
template<class Solver>
-void FlowEngine::Triangulate ( Solver& flow )
+void FlowEngine::triangulate ( Solver& flow )
{
///Using Tesselation wrapper (faster)
// TesselationWrapper TW;
@@ -383,45 +381,47 @@
flow->T[flow->currentTes].insert ( b.pos[0], b.pos[1], b.pos[2], b.radius, b.id );}
}
flow->T[flow->currentTes].redirected=true;//By inserting one-by-one, we already redirected
- flow->viscousShearForces.resize ( flow->T[flow->currentTes].max_id+1 );
- flow->viscousShearTorques.resize ( flow->T[flow->currentTes].max_id+1 );
- flow->viscousBodyStress.resize ( flow->T[flow->currentTes].max_id+1 );
- flow->normLubForce.resize ( flow->T[flow->currentTes].max_id+1 );
- flow->lubBodyStress.resize ( flow->T[flow->currentTes].max_id+1 );
+ flow->shearLubricationForces.resize ( flow->T[flow->currentTes].maxId+1 );
+ flow->shearLubricationTorques.resize ( flow->T[flow->currentTes].maxId+1 );
+ flow->pumpLubricationTorques.resize ( flow->T[flow->currentTes].maxId+1 );
+ flow->twistLubricationTorques.resize ( flow->T[flow->currentTes].maxId+1 );
+ flow->shearLubricationBodyStress.resize ( flow->T[flow->currentTes].maxId+1 );
+ flow->normalLubricationForce.resize ( flow->T[flow->currentTes].maxId+1 );
+ flow->normalLubricationBodyStress.resize ( flow->T[flow->currentTes].maxId+1 );
}
template<class Solver>
-void FlowEngine::Initialize_volumes ( Solver& flow )
+void FlowEngine::initializeVolumes ( Solver& flow )
{
typedef typename Solver::element_type Flow;
- typedef typename Flow::Finite_vertices_iterator Finite_vertices_iterator;
+ typedef typename Flow::FiniteVerticesIterator FiniteVerticesIterator;
typedef typename Solver::element_type Flow;
- Finite_vertices_iterator vertices_end = flow->T[flow->currentTes].Triangulation().finite_vertices_end();
+ FiniteVerticesIterator verticesEnd = flow->T[flow->currentTes].Triangulation().finite_vertices_end();
CGT::Vecteur Zero(0,0,0);
- for (Finite_vertices_iterator V_it = flow->T[flow->currentTes].Triangulation().finite_vertices_begin(); V_it!= vertices_end; V_it++) V_it->info().forces=Zero;
+ for (FiniteVerticesIterator vIt = flow->T[flow->currentTes].Triangulation().finite_vertices_begin(); vIt!= verticesEnd; vIt++) vIt->info().forces=Zero;
- FOREACH(Cell_handle& cell, flow->T[flow->currentTes].cellHandles)
+ FOREACH(CellHandle& cell, flow->T[flow->currentTes].cellHandles)
{
switch ( cell->info().fictious() )
{
- case ( 0 ) : cell->info().volume() = Volume_cell ( cell ); break;
- case ( 1 ) : cell->info().volume() = Volume_cell_single_fictious ( cell ); break;
- case ( 2 ) : cell->info().volume() = Volume_cell_double_fictious ( cell ); break;
- case ( 3 ) : cell->info().volume() = Volume_cell_triple_fictious ( cell ); break;
+ case ( 0 ) : cell->info().volume() = volumeCell ( cell ); break;
+ case ( 1 ) : cell->info().volume() = volumeCellSingleFictious ( cell ); break;
+ case ( 2 ) : cell->info().volume() = volumeCellDoubleFictious ( cell ); break;
+ case ( 3 ) : cell->info().volume() = volumeCellTripleFictious ( cell ); break;
default: break;
}
if (flow->fluidBulkModulus>0) { cell->info().invVoidVolume() = 1 / ( abs(cell->info().volume()) - flow->volumeSolidPore(cell) ); }
}
- if (Debug) cout << "Volumes initialised." << endl;
+ if (debug) cout << "Volumes initialised." << endl;
}
-void FlowEngine::Average_real_cell_velocity()
+void FlowEngine::averageRealCellVelocity()
{
- solver->Average_Relative_Cell_Velocity();
+ solver->averageRelativeCellVelocity();
Vector3r Vel ( 0,0,0 );
//AVERAGE CELL VELOCITY
- Finite_cells_iterator cell_end = solver->T[solver->currentTes].Triangulation().finite_cells_end();
- for ( Finite_cells_iterator cell = solver->T[solver->currentTes].Triangulation().finite_cells_begin(); cell != cell_end; cell++ ) {
+ FiniteCellsIterator cellEnd = solver->T[solver->currentTes].Triangulation().finite_cells_end();
+ for ( FiniteCellsIterator cell = solver->T[solver->currentTes].Triangulation().finite_cells_begin(); cell != cellEnd; cell++ ) {
for ( int g=0;g<4;g++ ) {
if ( !cell->vertex ( g )->info().isFictious ) {
const shared_ptr<Body>& sph = Body::byId ( cell->vertex ( g )->info().id(), scene );
@@ -429,44 +429,44 @@
}
}
RTriangulation& Tri = solver->T[solver->currentTes].Triangulation();
- CGT::Point pos_av_facet;
- double volume_facet_translation = 0;
- CGT::Vecteur Vel_av ( Vel[0], Vel[1], Vel[2] );
+ CGT::Point posAvFacet;
+ double volumeFacetTranslation = 0;
+ CGT::Vecteur velAv ( Vel[0], Vel[1], Vel[2] );
for ( int i=0; i<4; i++ ) {
- volume_facet_translation = 0;
+ volumeFacetTranslation = 0;
if ( !Tri.is_infinite ( cell->neighbor ( i ) ) ) {
CGT::Vecteur Surfk = cell->info()-cell->neighbor ( i )->info();
Real area = sqrt ( Surfk.squared_length() );
Surfk = Surfk/area;
CGT::Vecteur branch = cell->vertex ( facetVertices[i][0] )->point() - cell->info();
- pos_av_facet = ( CGT::Point ) cell->info() + ( branch*Surfk ) *Surfk;
- volume_facet_translation += Vel_av*cell->info().facetSurfaces[i];
- cell->info().av_vel() = cell->info().av_vel() - volume_facet_translation/cell->info().volume() * ( pos_av_facet-CGAL::ORIGIN );
+ posAvFacet = ( CGT::Point ) cell->info() + ( branch*Surfk ) *Surfk;
+ volumeFacetTranslation += velAv*cell->info().facetSurfaces[i];
+ cell->info().averageVelocity() = cell->info().averageVelocity() - volumeFacetTranslation/cell->info().volume() * ( posAvFacet-CGAL::ORIGIN );
}
}
}
}
template<class Solver>
-void FlowEngine::UpdateVolumes ( Solver& flow )
+void FlowEngine::updateVolumes ( Solver& flow )
{
- if ( Debug ) cout << "Updating volumes.............." << endl;
+ if ( debug ) cout << "Updating volumes.............." << endl;
Real invDeltaT = 1/scene->dt;
- eps_vol_max=0;
+ epsVolMax=0;
Real totVol=0; Real totDVol=0;
#ifdef YADE_OPENMP
const long size=flow->T[flow->currentTes].cellHandles.size();
#pragma omp parallel for num_threads(ompThreads>0 ? ompThreads : 1)
for(long i=0; i<size; i++){
- Cell_handle& cell = flow->T[flow->currentTes].cellHandles[i];
+ CellHandle& cell = flow->T[flow->currentTes].cellHandles[i];
#else
- FOREACH(Cell_handle& cell, flow->T[flow->currentTes].cellHandles){
+ FOREACH(CellHandle& cell, flow->T[flow->currentTes].cellHandles){
#endif
double newVol, dVol;
switch ( cell->info().fictious() ) {
- case ( 3 ) : newVol = Volume_cell_triple_fictious ( cell ); break;
- case ( 2 ) : newVol = Volume_cell_double_fictious ( cell ); break;
- case ( 1 ) : newVol = Volume_cell_single_fictious ( cell ); break;
- case ( 0 ) : newVol = Volume_cell (cell ); break;
+ case ( 3 ) : newVol = volumeCellTripleFictious ( cell ); break;
+ case ( 2 ) : newVol = volumeCellDoubleFictious ( cell ); break;
+ case ( 1 ) : newVol = volumeCellSingleFictious ( cell ); break;
+ case ( 0 ) : newVol = volumeCell (cell ); break;
default: newVol = 0; break;}
dVol=cell->info().volumeSign* ( newVol - cell->info().volume() );
cell->info().dv() = dVol*invDeltaT;
@@ -477,20 +477,20 @@
#pragma omp atomic
totDVol+=abs(dVol);}
}
- if (defTolerance>0) eps_vol_max = totDVol/totVol;
+ if (defTolerance>0) epsVolMax = totDVol/totVol;
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<<endl;
+ flow->ifCells[n]->info().dv()+=flow->imposedF[n].second;
+ flow->ifCells[n]->info().Pcondition=false;}
+ if ( debug ) cout << "Updated volumes, total =" <<totVol<<", dVol="<<totDVol<<endl;
}
template<class Cellhandle>
-Real FlowEngine::Volume_cell_single_fictious ( Cellhandle cell )
+Real FlowEngine::volumeCellSingleFictious ( Cellhandle cell )
{
Vector3r V[3];
int b=0;
int w=0;
cell->info().volumeSign=1;
- Real Wall_coordinate=0;
+ Real wallCoordinate=0;
for ( int y=0;y<4;y++ ) {
if ( ! ( cell->vertex ( y )->info().isFictious ) ) {
@@ -499,55 +499,55 @@
} else {
b = cell->vertex ( y )->info().id();
const shared_ptr<Body>& wll = Body::byId ( b , scene );
- if ( !solver->boundary ( b ).useMaxMin ) Wall_coordinate = wll->state->pos[solver->boundary ( b ).coordinate]+ ( solver->boundary ( b ).normal[solver->boundary ( b ).coordinate] ) *wall_thickness/2;
- else Wall_coordinate = solver->boundary ( b ).p[solver->boundary ( b ).coordinate];
+ if ( !solver->boundary ( b ).useMaxMin ) wallCoordinate = wll->state->pos[solver->boundary ( b ).coordinate]+ ( solver->boundary ( b ).normal[solver->boundary ( b ).coordinate] ) *wallThickness/2;
+ else wallCoordinate = solver->boundary ( b ).p[solver->boundary ( b ).coordinate];
}
}
- Real Volume = 0.5* ( ( V[0]-V[1] ).cross ( V[0]-V[2] ) ) [solver->boundary ( b ).coordinate] * ( 0.33333333333* ( V[0][solver->boundary ( b ).coordinate]+ V[1][solver->boundary ( b ).coordinate]+ V[2][solver->boundary ( b ).coordinate] ) - Wall_coordinate );
- return abs ( Volume );
+ Real volume = 0.5* ( ( V[0]-V[1] ).cross ( V[0]-V[2] ) ) [solver->boundary ( b ).coordinate] * ( 0.33333333333* ( V[0][solver->boundary ( b ).coordinate]+ V[1][solver->boundary ( b ).coordinate]+ V[2][solver->boundary ( b ).coordinate] ) - wallCoordinate );
+ return abs ( volume );
}
template<class Cellhandle>
-Real FlowEngine::Volume_cell_double_fictious ( Cellhandle cell )
+Real FlowEngine::volumeCellDoubleFictious ( Cellhandle cell )
{
Vector3r A=Vector3r::Zero(), AS=Vector3r::Zero(),B=Vector3r::Zero(), BS=Vector3r::Zero();
cell->info().volumeSign=1;
int b[2];
int coord[2];
- Real Wall_coordinate[2];
+ Real wallCoordinate[2];
int j=0;
- bool first_sph=true;
+ bool firstSph=true;
for ( int g=0;g<4;g++ ) {
if ( cell->vertex ( g )->info().isFictious ) {
b[j] = cell->vertex ( g )->info().id();
coord[j]=solver->boundary ( b[j] ).coordinate;
- if ( !solver->boundary ( b[j] ).useMaxMin ) Wall_coordinate[j] = positionBufferCurrent[b[j]].pos[coord[j]] + ( solver->boundary ( b[j] ).normal[coord[j]] ) *wall_thickness/2;
- else Wall_coordinate[j] = solver->boundary ( b[j] ).p[coord[j]];
+ if ( !solver->boundary ( b[j] ).useMaxMin ) wallCoordinate[j] = positionBufferCurrent[b[j]].pos[coord[j]] + ( solver->boundary ( b[j] ).normal[coord[j]] ) *wallThickness/2;
+ else wallCoordinate[j] = solver->boundary ( b[j] ).p[coord[j]];
j++;
- } else if ( first_sph ) {
+ } else if ( firstSph ) {
A=AS=/*AT=*/ positionBufferCurrent[cell->vertex(g)->info().id()].pos;
- first_sph=false;
+ firstSph=false;
} else {
B=BS=/*BT=*/ positionBufferCurrent[cell->vertex(g)->info().id()].pos;;
}
}
- AS[coord[0]]=BS[coord[0]] = Wall_coordinate[0];
+ AS[coord[0]]=BS[coord[0]] = wallCoordinate[0];
//first pyramid with triangular base (A,B,BS)
- Real Vol1=0.5* ( ( A-BS ).cross ( B-BS ) ) [coord[1]]* ( 0.333333333* ( 2*B[coord[1]]+A[coord[1]] )-Wall_coordinate[1] );
+ Real Vol1=0.5* ( ( A-BS ).cross ( B-BS ) ) [coord[1]]* ( 0.333333333* ( 2*B[coord[1]]+A[coord[1]] )-wallCoordinate[1] );
//second pyramid with triangular base (A,AS,BS)
- Real Vol2=0.5* ( ( AS-BS ).cross ( A-BS ) ) [coord[1]]* ( 0.333333333* ( B[coord[1]]+2*A[coord[1]] )-Wall_coordinate[1] );
+ Real Vol2=0.5* ( ( AS-BS ).cross ( A-BS ) ) [coord[1]]* ( 0.333333333* ( B[coord[1]]+2*A[coord[1]] )-wallCoordinate[1] );
return abs ( Vol1+Vol2 );
}
template<class Cellhandle>
-Real FlowEngine::Volume_cell_triple_fictious ( Cellhandle cell )
+Real FlowEngine::volumeCellTripleFictious ( Cellhandle cell )
{
Vector3r A;
int b[3];
int coord[3];
- Real Wall_coordinate[3];
+ Real wallCoordinate[3];
int j=0;
cell->info().volumeSign=1;
@@ -556,19 +556,19 @@
b[j] = cell->vertex ( g )->info().id();
coord[j]=solver->boundary ( b[j] ).coordinate;
const shared_ptr<Body>& wll = Body::byId ( b[j] , scene );
- if ( !solver->boundary ( b[j] ).useMaxMin ) Wall_coordinate[j] = wll->state->pos[coord[j]] + ( solver->boundary ( b[j] ).normal[coord[j]] ) *wall_thickness/2;
- else Wall_coordinate[j] = solver->boundary ( b[j] ).p[coord[j]];
+ if ( !solver->boundary ( b[j] ).useMaxMin ) wallCoordinate[j] = wll->state->pos[coord[j]] + ( solver->boundary ( b[j] ).normal[coord[j]] ) *wallThickness/2;
+ else wallCoordinate[j] = solver->boundary ( b[j] ).p[coord[j]];
j++;
} else {
const shared_ptr<Body>& sph = Body::byId ( cell->vertex ( g )->info().id(), scene );
A= ( sph->state->pos );
}
}
- Real Volume = ( A[coord[0]]-Wall_coordinate[0] ) * ( A[coord[1]]-Wall_coordinate[1] ) * ( A[coord[2]]-Wall_coordinate[2] );
- return abs ( Volume );
+ Real volume = ( A[coord[0]]-wallCoordinate[0] ) * ( A[coord[1]]-wallCoordinate[1] ) * ( A[coord[2]]-wallCoordinate[2] );
+ return abs ( volume );
}
template<class Cellhandle>
-Real FlowEngine::Volume_cell ( Cellhandle cell )
+Real FlowEngine::volumeCell ( Cellhandle cell )
{
static const Real inv6 = 1/6.;
const Vector3r& p0 = positionBufferCurrent[cell->vertex ( 0 )->info().id()].pos;
@@ -580,25 +580,27 @@
return volume;
}
template<class Solver>
-void FlowEngine::ComputeViscousForces ( Solver& flow )
+void FlowEngine::computeLubricationContributions ( Solver& flow )
{
if (normalLubrication || shearLubrication || viscousShear){
- if ( Debug ) cout << "Application of viscous forces" << endl;
- if ( Debug ) cout << "Number of edges = " << flow.Edge_ids.size() << endl;
- for ( unsigned int k=0; k<flow.viscousShearForces.size(); k++ ) flow.viscousShearForces[k]=Vector3r::Zero();
- for ( unsigned int k=0; k<flow.viscousShearTorques.size(); k++ ) flow.viscousShearTorques[k]=Vector3r::Zero();
- for ( unsigned int k=0; k<flow.viscousBodyStress.size(); k++) flow.viscousBodyStress[k]=Matrix3r::Zero();
- for ( unsigned int k=0; k<flow.normLubForce.size(); k++ ) flow.normLubForce[k]=Vector3r::Zero();
- for ( unsigned int k=0; k<flow.lubBodyStress.size(); k++) flow.lubBodyStress[k]=Matrix3r::Zero();
+ if ( debug ) cout << "Application of viscous forces" << endl;
+ if ( debug ) cout << "Number of edges = " << flow.edgeIds.size() << endl;
+ for ( unsigned int k=0; k<flow.shearLubricationForces.size(); k++ ) flow.shearLubricationForces[k]=Vector3r::Zero();
+ for ( unsigned int k=0; k<flow.shearLubricationTorques.size(); k++ ) flow.shearLubricationTorques[k]=Vector3r::Zero();
+ for ( unsigned int k=0; k<flow.pumpLubricationTorques.size(); k++ ) flow.pumpLubricationTorques[k]=Vector3r::Zero();
+ for ( unsigned int k=0; k<flow.twistLubricationTorques.size(); k++ ) flow.twistLubricationTorques[k]=Vector3r::Zero();
+ for ( unsigned int k=0; k<flow.shearLubricationBodyStress.size(); k++) flow.shearLubricationBodyStress[k]=Matrix3r::Zero();
+ for ( unsigned int k=0; k<flow.normalLubricationForce.size(); k++ ) flow.normalLubricationForce[k]=Vector3r::Zero();
+ for ( unsigned int k=0; k<flow.normalLubricationBodyStress.size(); k++) flow.normalLubricationBodyStress[k]=Matrix3r::Zero();
typedef typename Solver::Tesselation Tesselation;
const Tesselation& Tes = flow.T[flow.currentTes];
flow.deltaShearVel.clear(); flow.normalV.clear(); flow.deltaNormVel.clear(); flow.surfaceDistance.clear(); flow.onlySpheresInteractions.clear(); flow.normalStressInteraction.clear(); flow.shearStressInteraction.clear();
- for ( int i=0; i< ( int ) flow.Edge_ids.size(); i++ ) {
- const int& id1 = flow.Edge_ids[i].first;
- const int& id2 = flow.Edge_ids[i].second;
+ for ( int i=0; i< ( int ) flow.edgeIds.size(); i++ ) {
+ const int& id1 = flow.edgeIds[i].first;
+ const int& id2 = flow.edgeIds[i].second;
int hasFictious= Tes.vertex ( id1 )->info().isFictious + Tes.vertex ( id2 )->info().isFictious;
if (hasFictious>0 or id1==id2) continue;
@@ -609,19 +611,22 @@
const Real& r1 = s1->radius;
const Real& r2 = s2->radius;
Vector3r deltaV; Real deltaNormV; Vector3r deltaShearV;
- Vector3r O1O2_vect; Real O1O2; Vector3r normal; Real surfaceDist; Vector3r O1C_vect; Vector3r O2C_vect;Real meanRad ;Real Rh;
- Vector3r visc_f; Vector3r lub_f;
+ Vector3r O1O2Vector; Real O1O2; Vector3r normal; Real surfaceDist; Vector3r O1CVector; Vector3r O2CVector;Real meanRad ;Real Rh; Vector3r deltaAngVel; Vector3r deltaShearAngVel;
+ Vector3r shearLubF; Vector3r normaLubF; Vector3r pumpT; Vector3r deltaAngNormVel; Vector3r twistT; Vector3r angVel1; Vector3r angVel2;
//FIXME: if periodic and velGrad!=0, then deltaV should account for velGrad, not the case currently
if ( !hasFictious ){
- O1O2_vect = sph2->state->pos + makeVector3r(Tes.vertex(id2)->info().ghostShift()) - sph1->state->pos - makeVector3r(Tes.vertex(id1)->info().ghostShift());
- O1O2 = O1O2_vect.norm();
- normal= (O1O2_vect/O1O2);
+ O1O2Vector = sph2->state->pos + makeVector3r(Tes.vertex(id2)->info().ghostShift()) - sph1->state->pos - makeVector3r(Tes.vertex(id1)->info().ghostShift());
+ O1O2 = O1O2Vector.norm();
+ normal= (O1O2Vector/O1O2);
surfaceDist = O1O2 - r2 - r1;
- O1C_vect = (O1O2/2. + (pow(r1,2) - pow(r2,2)) / (2.*O1O2))*normal;
- O2C_vect = -(O1O2_vect-O1C_vect);
+ O1CVector = (O1O2/2. + (pow(r1,2) - pow(r2,2)) / (2.*O1O2))*normal;
+ O2CVector = -(O1O2Vector - O1CVector);
meanRad = (r2 + r1)/2.;
Rh = (r1 < r2)? surfaceDist + 0.45 * r1 : surfaceDist + 0.45 * r2;
deltaV = (sph2->state->vel + sph2->state->angVel.cross(-r2 * normal)) - (sph1->state->vel+ sph1->state->angVel.cross(r1 * normal));
+ angVel1 = sph1->state->angVel;
+ angVel2 = sph2->state->angVel;
+ deltaAngVel = sph2->state->angVel - sph1->state->angVel;
} else {
if ( hasFictious==1 ) {//for the fictious sphere, use velocity of the boundary, not of the body
@@ -633,73 +638,89 @@
normal = makeVector3r(flow.boundary(id1).normal);
else
normal = -makeVector3r(flow.boundary(id2).normal);
- O1O2_vect = O1O2 * normal;
+ O1O2Vector = O1O2 * normal;
meanRad = v1fictious ? r2:r1;
- surfaceDist = O1O2- meanRad;
+ surfaceDist = O1O2 - meanRad;
if (v1fictious){
- O1C_vect = Vector3r::Zero();
- O2C_vect = -O1O2_vect;}
+ O1CVector = Vector3r::Zero();
+ O2CVector = - O1O2Vector;}
else{
- O1C_vect = O1O2_vect;
- O2C_vect = Vector3r::Zero();}
+ O1CVector = O1O2Vector;
+ O2CVector = Vector3r::Zero();}
Rh = surfaceDist + 0.45 * meanRad;
Vector3r v1 = ( Tes.vertex ( id1 )->info().isFictious ) ? flow.boundary ( id1 ).velocity:sph1->state->vel + sph1->state->angVel.cross(r1 * normal);
Vector3r v2 = ( Tes.vertex ( id2 )->info().isFictious ) ? flow.boundary ( id2 ).velocity:sph2->state->vel + sph2->state->angVel.cross(-r2 * (normal));
deltaV = v2-v1;
+ angVel1 = ( Tes.vertex ( id1 )->info().isFictious ) ? Vector3r::Zero() : sph1->state->angVel;
+ angVel2 = ( Tes.vertex ( id2 )->info().isFictious ) ? Vector3r::Zero() : sph2->state->angVel;
+ deltaAngVel = angVel2 - angVel1;
}
}
deltaShearV = deltaV - ( normal.dot ( deltaV ) ) *normal;
+ deltaShearAngVel = deltaAngVel - ( normal.dot ( deltaAngVel ) ) *normal;
flow.deltaShearVel.push_back(deltaShearV);
flow.normalV.push_back(normal);
flow.surfaceDistance.push_back(max(surfaceDist, 0.) + eps*meanRad);
+ /// Compute the shear Lubrication force and torque on each particle
+
if (shearLubrication)
- visc_f = flow.computeShearLubricationForce(deltaShearV,surfaceDist,i,eps,O1O2,meanRad);
+ shearLubF = flow.computeShearLubricationForce(deltaShearV,surfaceDist,i,eps,O1O2,meanRad);
else if (viscousShear)
- visc_f = flow.computeViscousShearForce ( deltaShearV, i , Rh);
+ shearLubF = flow.computeViscousShearForce ( deltaShearV, i , Rh);
if (viscousShear || shearLubrication){
- flow.viscousShearForces[id1]+=visc_f;
- flow.viscousShearForces[id2]+=(-visc_f);
- flow.viscousShearTorques[id1]+=O1C_vect.cross(visc_f);
- flow.viscousShearTorques[id2]+=O2C_vect.cross(-visc_f);
+ flow.shearLubricationForces[id1]+=shearLubF;
+ flow.shearLubricationForces[id2]+=(-shearLubF);
+ flow.shearLubricationTorques[id1]+=O1CVector.cross(shearLubF);
+ flow.shearLubricationTorques[id2]+=O2CVector.cross(-shearLubF);
+
+ /// Compute the pump Lubrication torque on each particle
+
+ if (pumpTorque){
+ pumpT = flow.computePumpTorque(deltaShearAngVel, surfaceDist, i, eps, meanRad );
+ flow.pumpLubricationTorques[id1]+=(-pumpT);
+ flow.pumpLubricationTorques[id2]+=pumpT;}
+
+ /// Compute the twist Lubrication torque on each particle
+
+ if (twistTorque){
+ deltaAngNormVel = (normal.dot(deltaAngVel))*normal ;
+ twistT = flow.computeTwistTorque(deltaAngNormVel, surfaceDist, i, eps, meanRad );
+ flow.twistLubricationTorques[id1]+=(-twistT);
+ flow.twistLubricationTorques[id2]+=twistT;
+ }
+ }
+ /// Compute the viscous shear stress on each particle
-
- /// Compute the viscous shear stress on each particle
- if (viscousShearBodyStress){
- flow.viscousBodyStress[id1] += visc_f * O1C_vect.transpose()/ (4.0/3.0 *3.14* pow(r1,3));
- flow.viscousBodyStress[id2] += (-visc_f) * O2C_vect.transpose()/ (4.0/3.0 *3.14* pow(r2,3));
- flow.shearStressInteraction.push_back(visc_f * O1O2_vect.transpose()/(4.0/3.0 *3.14* pow(r1,3)));
+ if (viscousShearBodyStress){
+ flow.shearLubricationBodyStress[id1] += shearLubF * O1CVector.transpose()/ (4.0/3.0 *3.14* pow(r1,3));
+ flow.shearLubricationBodyStress[id2] += (-shearLubF) * O2CVector.transpose()/ (4.0/3.0 *3.14* pow(r2,3));
+ flow.shearStressInteraction.push_back(shearLubF * O1O2Vector.transpose()/(4.0/3.0 *3.14* pow(r1,3)));
}
- }
/// Compute the normal lubrication force applied on each particle
+
if (normalLubrication){
deltaNormV = normal.dot(deltaV);
flow.deltaNormVel.push_back(deltaNormV * normal);
- lub_f = flow.computeNormalLubricationForce (deltaNormV, surfaceDist, i,eps,stiffness,scene->dt,meanRad)*normal;
- flow.normLubForce[id1]+=lub_f;
- flow.normLubForce[id2]+=(-lub_f);
+ normaLubF = flow.computeNormalLubricationForce (deltaNormV, surfaceDist, i,eps,stiffness,scene->dt,meanRad)*normal;
+ flow.normalLubricationForce[id1]+=normaLubF;
+ flow.normalLubricationForce[id2]+=(-normaLubF);
- /// Compute the normal lubrication stress on each particle
+ /// Compute the normal lubrication stress on each particle
+
if (viscousNormalBodyStress){
- flow.lubBodyStress[id1] += lub_f * O1C_vect.transpose()/ (4.0/3.0 *3.14* pow(r1,3));
- flow.lubBodyStress[id2] += (-lub_f) *O2C_vect.transpose() / (4.0/3.0 *3.14* pow(r2,3));
- flow.normalStressInteraction.push_back(lub_f * O1O2_vect.transpose()/(4.0/3.0 *3.14* pow(r1,3)));
+ flow.normalLubricationBodyStress[id1] += normaLubF * O1CVector.transpose()/ (4.0/3.0 *3.14* pow(r1,3));
+ flow.normalLubricationBodyStress[id2] += (-normaLubF) *O2CVector.transpose() / (4.0/3.0 *3.14* pow(r2,3));
+ flow.normalStressInteraction.push_back(normaLubF * O1O2Vector.transpose()/(4.0/3.0 *3.14* pow(r1,3)));
}
}
-
- if (create_file){
- std::ofstream velocity_file("result_velocity.txt",ios::app);
- velocity_file << i << "\t" << deltaNormV * normal[0] << "\t" << deltaNormV * normal[1] << "\t" << deltaNormV * normal[2] << "\t" << deltaShearV[0] << "\t" << deltaShearV[1] << "\t" << deltaShearV[2] << "\t" << normal[0] << "\t" << normal[1] << "\t" << normal[2] << "\t" << max(surfaceDist, 0.) + eps*meanRad << endl;
- velocity_file.close(); }
-
- if (display_force) cout<<"force tangentielle "<<visc_f<< " force normale "<< lub_f<<endl;
+
if (!hasFictious)
flow.onlySpheresInteractions.push_back(i);
-
}
}
}
@@ -722,44 +743,52 @@
if (first) {
if (multithread) setPositionsBuffer(false);
cachedCell= Cell(*(scene->cell));
- Build_Triangulation(P_zero,solver);
+ buildTriangulation(pZero,solver);
if (solver->errorCode>0) {LOG_INFO("triangulation error, pausing"); Omega::instance().pause(); return;}
- Initialize_volumes(solver); backgroundSolver=solver; backgroundCompleted=true;}
-// if ( first ) {Build_Triangulation ( P_zero ); updateTriangulation = false; Initialize_volumes();}
+ initializeVolumes(solver); backgroundSolver=solver; backgroundCompleted=true;}
+// if ( first ) {Build_Triangulation ( pZero ); updateTriangulation = false; initializeVolumes();}
timingDeltas->checkpoint("Triangulating");
- UpdateVolumes (solver);
- Eps_Vol_Cumulative += eps_vol_max;
+ updateVolumes (solver);
+ epsVolCumulative += epsVolMax;
retriangulationLastIter++;
if (!updateTriangulation) updateTriangulation = // If not already set true by another function of by the user, check conditions
- (defTolerance>0 && Eps_Vol_Cumulative > defTolerance) || retriangulationLastIter>meshUpdateInterval;
+ (defTolerance>0 && epsVolCumulative > defTolerance) || retriangulationLastIter>meshUpdateInterval;
timingDeltas->checkpoint("Update_Volumes");
///Compute flow and and forces here
if (pressureForce){
- solver->GaussSeidel(scene->dt);
+ solver->gaussSeidel(scene->dt);
timingDeltas->checkpoint("Gauss-Seidel");
- solver->ComputeFacetForcesWithCache();}
+ solver->computeFacetForcesWithCache();}
timingDeltas->checkpoint("Compute_Pressure_Forces");
///Compute vicscous forces
scene->forces.sync();
- ComputeViscousForces(*solver);
+ computeLubricationContributions(*solver);
timingDeltas->checkpoint("Compute_Viscous_Forces");
Vector3r force;
+ Vector3r torque;
const Tesselation& Tes = solver->T[solver->currentTes];
- for (int id=0; id<=Tes.max_id; id++){
+ for (int id=0; id<=Tes.maxId; id++){
assert (Tes.vertexHandles[id] != NULL);
- const Tesselation::Vertex_Info& v_info = Tes.vertexHandles[id]->info();
+ const Tesselation::VertexInfo& v_info = Tes.vertexHandles[id]->info();
force =(pressureForce) ? Vector3r ( ( v_info.forces ) [0],v_info.forces[1],v_info.forces[2] ) : Vector3r(0,0,0);
+ torque = Vector3r(0,0,0);
if (shearLubrication || viscousShear){
- force = force +solver->viscousShearForces[v_info.id()];
- scene->forces.addTorque ( v_info.id(), solver->viscousShearTorques[v_info.id()]);
+ force = force +solver->shearLubricationForces[v_info.id()];
+ torque = torque +solver->shearLubricationTorques[v_info.id()];
+ if (pumpTorque)
+ torque = torque +solver->pumpLubricationTorques[v_info.id()];
+ if (twistTorque)
+ torque = torque +solver->twistLubricationTorques[v_info.id()];
}
+
if (normalLubrication)
- force = force + solver->normLubForce[v_info.id()];
+ force = force + solver->normalLubricationForce[v_info.id()];
scene->forces.addForce ( v_info.id(), force);
+ scene->forces.addTorque ( v_info.id(), torque);
}
///End Compute flow and forces
timingDeltas->checkpoint("Applying Forces");
@@ -767,7 +796,7 @@
while (updateTriangulation && !backgroundCompleted) { /*cout<<"sleeping..."<<sleeping++<<endl;*/ boost::this_thread::sleep(boost::posix_time::microseconds(1000));}
if (updateTriangulation || ellapsedIter>(0.5*meshUpdateInterval)) {
if (useSolver==0) LOG_ERROR("background calculations not available for Gauss-Seidel");
- if (fluidBulkModulus>0) solver->Interpolate (solver->T[solver->currentTes], backgroundSolver->T[backgroundSolver->currentTes]);
+ if (fluidBulkModulus>0) solver->interpolate (solver->T[solver->currentTes], backgroundSolver->T[backgroundSolver->currentTes]);
solver=backgroundSolver;
backgroundSolver = shared_ptr<FlowSolver> (new FlowSolver);
//Copy imposed pressures/flow from the old solver
@@ -778,23 +807,23 @@
backgroundCompleted=false;
retriangulationLastIter=ellapsedIter;
ellapsedIter=0;
- Eps_Vol_Cumulative=0;
+ epsVolCumulative=0;
boost::thread workerThread(&PeriodicFlowEngine::backgroundAction,this);
workerThread.detach();
- Initialize_volumes(solver);
- ComputeViscousForces(*solver);
+ initializeVolumes(solver);
+ computeLubricationContributions(*solver);
}
- else if (Debug && !first) {
- if (Debug && !backgroundCompleted) cerr<<"still computing solver in the background"<<endl;
+ else if (debug && !first) {
+ if (debug && !backgroundCompleted) cerr<<"still computing solver in the background"<<endl;
ellapsedIter++;}
} else {
if (updateTriangulation && !first) {
cachedCell= Cell(*(scene->cell));
- Build_Triangulation (P_zero, solver);
- Initialize_volumes(solver);
- ComputeViscousForces(*solver);
+ buildTriangulation (pZero, solver);
+ initializeVolumes(solver);
+ computeLubricationContributions(*solver);
updateTriangulation = false;
- Eps_Vol_Cumulative=0;
+ epsVolCumulative=0;
retriangulationLastIter=0;
ReTrg++;}
}
@@ -806,15 +835,15 @@
void PeriodicFlowEngine::backgroundAction()
{
if (useSolver<1) {LOG_ERROR("background calculations not available for Gauss-Seidel"); return;}
- Build_Triangulation (P_zero,backgroundSolver);
+ buildTriangulation (pZero,backgroundSolver);
//FIXME: GS is computing too much, we need only matrix factorization in fact
- backgroundSolver->GaussSeidel(scene->dt);
- backgroundSolver->ComputeFacetForcesWithCache(/*onlyCache?*/ true);
+ backgroundSolver->gaussSeidel(scene->dt);
+ backgroundSolver->computeFacetForcesWithCache(/*onlyCache?*/ true);
// boost::this_thread::sleep(boost::posix_time::seconds(10));
backgroundCompleted = true;
}
-void PeriodicFlowEngine::Triangulate( shared_ptr<FlowSolver>& flow )
+void PeriodicFlowEngine::triangulate( shared_ptr<FlowSolver>& flow )
{
Tesselation& Tes = flow->T[flow->currentTes];
vector<posData>& buffer = multithread ? positionBufferParallel : positionBufferCurrent;
@@ -828,11 +857,11 @@
const Real& x = wpos[0];
const Real& y = wpos[1];
const Real& z = wpos[2];
- Vertex_handle vh0=Tes.insert ( x, y, z, rad, id );
-// Vertex_handle vh0=Tes.insert ( b.pos[0], b.pos[1], b.pos[2], b.radius, b.id );
+ VertexHandle vh0=Tes.insert ( x, y, z, rad, id );
+// VertexHandle vh0=Tes.insert ( b.pos[0], b.pos[1], b.pos[2], b.radius, b.id );
if (vh0==NULL) {
flow->errorCode = 2;
- LOG_ERROR("Vh NULL in PeriodicFlowEngine::Triangulate(), check input data"); continue;}
+ LOG_ERROR("Vh NULL in PeriodicFlowEngine::triangulate(), check input data"); continue;}
for ( int k=0;k<3;k++ ) vh0->info().period[k]=-period[k];
const Vector3r cellSize ( cachedCell.getSize() );
//FIXME: if hasShear, comment in
@@ -853,22 +882,24 @@
//Vector3r pt=scene->cell->shearPt ( pos2 );
//without shear:
const Vector3r& pt= pos2;
- Vertex_handle vh=Tes.insert ( pt[0],pt[1],pt[2],rad,id,false,id );
+ VertexHandle vh=Tes.insert ( pt[0],pt[1],pt[2],rad,id,false,id );
for ( int k=0;k<3;k++ ) vh->info().period[k]=i[k]-period[k];}}
}
//re-assign the original vertex pointer since duplicates may have overwrite it
Tes.vertexHandles[id]=vh0;
}
Tes.redirected=true;//By inserting one-by-one, we already redirected
- flow -> viscousShearForces.resize ( Tes.max_id+1 );
- flow -> viscousShearTorques.resize ( Tes.max_id+1 );
- flow -> viscousBodyStress.resize ( Tes.max_id+1 );
- flow -> normLubForce.resize ( Tes.max_id+1 );
- flow -> lubBodyStress.resize ( Tes.max_id+1 );
+ flow -> shearLubricationForces.resize ( Tes.maxId+1 );
+ flow -> shearLubricationTorques.resize ( Tes.maxId+1 );
+ flow -> pumpLubricationTorques.resize ( Tes.maxId+1 );
+ flow -> twistLubricationTorques.resize ( Tes.maxId+1 );
+ flow -> shearLubricationBodyStress.resize ( Tes.maxId+1 );
+ flow -> normalLubricationForce.resize ( Tes.maxId+1 );
+ flow -> normalLubricationBodyStress.resize ( Tes.maxId+1 );
}
-Real PeriodicFlowEngine::Volume_cell ( Cell_handle cell )
+Real PeriodicFlowEngine::volumeCell ( CellHandle cell )
{
static const Real inv6 = 1/6.;
const Vector3r p0 = positionBufferCurrent[cell->vertex(0)->info().id()].pos + makeVector3r(cell->vertex(0)->info().ghostShift());
@@ -880,13 +911,13 @@
return volume;
}
-Real PeriodicFlowEngine::Volume_cell_single_fictious ( Cell_handle cell )
+Real PeriodicFlowEngine::volumeCellSingleFictious ( CellHandle cell )
{
Vector3r V[3];
int b=0;
int w=0;
cell->info().volumeSign=1;
- Real Wall_coordinate=0;
+ Real wallCoordinate=0;
for ( int y=0;y<4;y++ ) {
if ( ! ( cell->vertex ( y )->info().isFictious ) ) {
@@ -896,24 +927,24 @@
} else {
b = cell->vertex ( y )->info().id();
const shared_ptr<Body>& wll = Body::byId ( b,scene );
- if ( !solver->boundary ( b ).useMaxMin ) Wall_coordinate = wll->state->pos[solver->boundary ( b ).coordinate]+ ( solver->boundary ( b ).normal[solver->boundary ( b ).coordinate] ) *wall_thickness/2;
- else Wall_coordinate = solver->boundary ( b ).p[solver->boundary ( b ).coordinate];
+ if ( !solver->boundary ( b ).useMaxMin ) wallCoordinate = wll->state->pos[solver->boundary ( b ).coordinate]+ ( solver->boundary ( b ).normal[solver->boundary ( b ).coordinate] ) *wallThickness/2;
+ else wallCoordinate = solver->boundary ( b ).p[solver->boundary ( b ).coordinate];
}
}
- Real Volume = 0.5* ( ( V[0]-V[1] ).cross ( V[0]-V[2] ) ) [solver->boundary ( b ).coordinate] * ( 0.33333333333* ( V[0][solver->boundary ( b ).coordinate]+ V[1][solver->boundary ( b ).coordinate]+ V[2][solver->boundary ( b ).coordinate] ) - Wall_coordinate );
+ Real Volume = 0.5* ( ( V[0]-V[1] ).cross ( V[0]-V[2] ) ) [solver->boundary ( b ).coordinate] * ( 0.33333333333* ( V[0][solver->boundary ( b ).coordinate]+ V[1][solver->boundary ( b ).coordinate]+ V[2][solver->boundary ( b ).coordinate] ) - wallCoordinate );
return abs ( Volume );
}
-void PeriodicFlowEngine::locateCell ( Cell_handle baseCell, unsigned int& index, int& baseIndex, shared_ptr<FlowSolver>& flow, unsigned int count)
+void PeriodicFlowEngine::locateCell ( CellHandle baseCell, unsigned int& index, int& baseIndex, shared_ptr<FlowSolver>& flow, unsigned int count)
{
if (count>10) {
LOG_ERROR("More than 10 attempts to locate a cell, duplicateThreshold may be too small, resulting in periodicity inconsistencies.");
flow->errorCode=1; return;
}
- PeriFlowTesselation::Cell_Info& base_info = baseCell->info();
+ PeriFlowTesselation::CellInfo& baseInfo = baseCell->info();
//already located, return FIXME: is inline working correctly? else move this test outside the function, just before the calls
- if ( base_info.index>0 || base_info.isGhost ) return;
+ if ( baseInfo.index>0 || baseInfo.isGhost ) return;
RTriangulation& Tri = flow->T[flow->currentTes].Triangulation();
Vector3r center ( 0,0,0 );
Vector3i period;
@@ -934,16 +965,16 @@
Vector3r wdCenter= cachedCell.wrapPt ( center,period );
if ( period[0]!=0 || period[1]!=0 || period[2]!=0 ) {
if ( baseCell->info().index>0 ) {
- cout<<"indexed cell is found ghost!"<<base_info.index <<endl;
- base_info.isGhost=false;
+ cout<<"indexed cell is found ghost!"<<baseInfo.index <<endl;
+ baseInfo.isGhost=false;
return;
}
- Cell_handle ch= Tri.locate ( CGT::Point ( wdCenter[0],wdCenter[1],wdCenter[2] )
+ CellHandle ch= Tri.locate ( CGT::Point ( wdCenter[0],wdCenter[1],wdCenter[2] )
// ,/*hint*/ v0
);
- base_info.period[0]=period[0];
- base_info.period[1]=period[1];
- base_info.period[2]=period[2];
+ baseInfo.period[0]=period[0];
+ baseInfo.period[1]=period[1];
+ baseInfo.period[2]=period[2];
//call recursively, since the returned cell could be also a ghost (especially if baseCell is a non-periodic type from the external contour
locateCell ( ch,index,baseIndex,flow,++count );
if ( ch==baseCell ) cerr<<"WTF!!"<<endl;
@@ -976,56 +1007,56 @@
// }
}
- base_info.isGhost=true;
- base_info._pression=& ( ch->info().p() );
- base_info.index=ch->info().index;
- base_info.baseIndex=ch->info().baseIndex;
- base_info.Pcondition=ch->info().Pcondition;
+ baseInfo.isGhost=true;
+ baseInfo._pression=& ( ch->info().p() );
+ baseInfo.index=ch->info().index;
+ baseInfo.baseIndex=ch->info().baseIndex;
+ baseInfo.Pcondition=ch->info().Pcondition;
} else {
- base_info.isGhost=false;
+ baseInfo.isGhost=false;
//index is 1-based, if it is zero it is not initialized, we define it here
- if ( base_info.baseIndex<0 ){
- base_info.baseIndex=++baseIndex;
- if (!base_info.Pcondition) base_info.index=++index;}
+ if ( baseInfo.baseIndex<0 ){
+ baseInfo.baseIndex=++baseIndex;
+ if (!baseInfo.Pcondition) baseInfo.index=++index;}
}
}
Vector3r PeriodicFlowEngine::meanVelocity()
{
- solver->Average_Relative_Cell_Velocity();
+ solver->averageRelativeCellVelocity();
Vector3r meanVel ( 0,0,0 );
Real volume=0;
- Finite_cells_iterator cell_end = solver->T[solver->currentTes].Triangulation().finite_cells_end();
- for ( Finite_cells_iterator cell = solver->T[solver->currentTes].Triangulation().finite_cells_begin(); cell != cell_end; cell++ ) {
+ FiniteCellsIterator cellEnd = solver->T[solver->currentTes].Triangulation().finite_cells_end();
+ for ( FiniteCellsIterator cell = solver->T[solver->currentTes].Triangulation().finite_cells_begin(); cell != cellEnd; cell++ ) {
//We could also define velocity using cell's center
// if ( !cell->info().isReal() ) continue;
if ( cell->info().isGhost ) continue;
for ( int i=0;i<3;i++ )
- meanVel[i]=meanVel[i]+ ( ( cell->info().av_vel() ) [i] * abs ( cell->info().volume() ) );
+ meanVel[i]=meanVel[i]+ ( ( cell->info().averageVelocity() ) [i] * abs ( cell->info().volume() ) );
volume+=abs ( cell->info().volume() );
}
return ( meanVel/volume );
}
-void PeriodicFlowEngine::UpdateVolumes (shared_ptr<FlowSolver>& flow)
+void PeriodicFlowEngine::updateVolumes (shared_ptr<FlowSolver>& flow)
{
- if ( Debug ) cout << "Updating volumes.............." << endl;
+ if ( debug ) cout << "Updating volumes.............." << endl;
Real invDeltaT = 1/scene->dt;
double newVol, dVol;
- eps_vol_max=0;
+ epsVolMax=0;
Real totVol=0;
Real totDVol=0;
Real totVol0=0;
Real totVol1=0;
- FOREACH(Cell_handle& cell, flow->T[flow->currentTes].cellHandles){
+ FOREACH(CellHandle& cell, flow->T[flow->currentTes].cellHandles){
switch ( cell->info().fictious() ) {
case ( 1 ) :
- newVol = Volume_cell_single_fictious ( cell );
+ newVol = volumeCellSingleFictious ( cell );
totVol1+=newVol;
break;
case ( 0 ) :
- newVol = Volume_cell ( cell );
+ newVol = volumeCell ( cell );
totVol0+=newVol;
break;
default:
@@ -1035,64 +1066,61 @@
totVol+=newVol;
dVol=cell->info().volumeSign * ( newVol - cell->info().volume() );
totDVol+=dVol;
- eps_vol_max = max ( eps_vol_max, abs ( dVol/newVol ) );
+ epsVolMax = max ( epsVolMax, abs ( dVol/newVol ) );
cell->info().dv() = dVol * invDeltaT;
cell->info().volume() = newVol;
}
- if ( Debug ) cout << "Updated volumes, total =" <<totVol<<", dVol="<<totDVol<<" "<< totVol0<<" "<< totVol1<<endl;
+ if ( debug ) cout << "Updated volumes, total =" <<totVol<<", dVol="<<totDVol<<" "<< totVol0<<" "<< totVol1<<endl;
}
-void PeriodicFlowEngine::Initialize_volumes (shared_ptr<FlowSolver>& flow)
+void PeriodicFlowEngine::initializeVolumes (shared_ptr<FlowSolver>& flow)
{
- Finite_vertices_iterator vertices_end = flow->T[flow->currentTes].Triangulation().finite_vertices_end();
+ FiniteVerticesIterator verticesEnd = flow->T[flow->currentTes].Triangulation().finite_vertices_end();
CGT::Vecteur Zero ( 0,0,0 );
- for ( Finite_vertices_iterator V_it = flow->T[flow->currentTes].Triangulation().finite_vertices_begin(); V_it!= vertices_end; V_it++ ) V_it->info().forces=Zero;
+ for ( FiniteVerticesIterator vIt = flow->T[flow->currentTes].Triangulation().finite_vertices_begin(); vIt!= verticesEnd; vIt++ ) vIt->info().forces=Zero;
- FOREACH(Cell_handle& cell, flow->T[flow->currentTes].cellHandles){
+ FOREACH(CellHandle& cell, flow->T[flow->currentTes].cellHandles){
switch ( cell->info().fictious() )
{
- case ( 0 ) : cell->info().volume() = Volume_cell ( cell ); break;
- case ( 1 ) : cell->info().volume() = Volume_cell_single_fictious ( cell ); break;
-// case ( 2 ) : cell->info().volume() = Volume_cell_double_fictious ( cell ); break;
-// case ( 3 ) : cell->info().volume() = Volume_cell_triple_fictious ( cell ); break;
+ case ( 0 ) : cell->info().volume() = volumeCell ( cell ); break;
+ case ( 1 ) : cell->info().volume() = volumeCellSingleFictious ( cell ); break;
default: cell->info().volume() = 0; break;
}
//FIXME: the void volume is negative sometimes, hence crashing...
if (flow->fluidBulkModulus>0) { cell->info().invVoidVolume() = 1. / (max(0.1*cell->info().volume(),abs(cell->info().volume()) - flow->volumeSolidPore(cell)) ); }
}
- if ( Debug ) cout << "Volumes initialised." << endl;
+ if ( debug ) cout << "Volumes initialised." << endl;
}
-void PeriodicFlowEngine::Build_Triangulation ( double P_zero, shared_ptr<FlowSolver>& flow)
+void PeriodicFlowEngine::buildTriangulation ( double pZero, shared_ptr<FlowSolver>& flow)
{
- flow->ResetNetwork();
+ flow->resetNetwork();
if (first) flow->currentTes=0;
else {
flow->currentTes=!flow->currentTes;
- if ( Debug ) cout << "--------RETRIANGULATION-----------" << endl;}
+ if ( debug ) cout << "--------RETRIANGULATION-----------" << endl;}
initSolver(flow);
- AddBoundary ( flow );
- if ( Debug ) cout << endl << "Added boundaries------" << endl << endl;
- Triangulate (flow);
- if ( Debug ) cout << endl << "Tesselating------" << endl << endl;
+ addBoundary ( flow );
+ if ( debug ) cout << endl << "Added boundaries------" << endl << endl;
+ triangulate (flow);
+ if ( debug ) cout << endl << "Tesselating------" << endl << endl;
flow->T[flow->currentTes].Compute();
- flow->Define_fictious_cells();
+ flow->defineFictiousCells();
//FIXME: this is already done in addBoundary(?)
- BoundaryConditions ( flow );
- if ( Debug ) cout << endl << "BoundaryConditions------" << endl << endl;
- flow->Initialize_pressures ( P_zero );
- if ( Debug ) cout << endl << "Initialize_pressures------" << endl << endl;
+ boundaryConditions ( flow );
+ if ( debug ) cout << endl << "boundaryConditions------" << endl << endl;
+ flow->initializePressures ( pZero );
+ if ( debug ) cout << endl << "initializePressures------" << endl << endl;
// Define the ghost cells and add indexes to the cells inside the period (the ones that will contain the pressure unknowns)
//This must be done after boundary conditions and initialize pressure, else the indexes are not good (not accounting imposedP): FIXME
unsigned int index=0;
int baseIndex=-1;
FlowSolver::Tesselation& Tes = flow->T[flow->currentTes];
Tes.cellHandles.resize(Tes.Triangulation().number_of_finite_cells());
- const Finite_cells_iterator cellend=Tes.Triangulation().finite_cells_end();
- for ( Finite_cells_iterator cell=Tes.Triangulation().finite_cells_begin(); cell!=cellend; cell++ ){
-// if (cell->vertex(0)->info().isGhost && cell->vertex(1)->info().isGhost && cell->vertex(2)->info().isGhost && cell->vertex(3)->info().isGhost) { cell->info().isGhost=true; continue;} //crash, why?
+ const FiniteCellsIterator cellend=Tes.Triangulation().finite_cells_end();
+ for ( FiniteCellsIterator cell=Tes.Triangulation().finite_cells_begin(); cell!=cellend; cell++ ){
locateCell ( cell,index,baseIndex,flow );
if (flow->errorCode>0) return;
//Fill this vector than can be later used to speedup loops
@@ -1100,20 +1128,20 @@
}
Tes.cellHandles.resize(baseIndex+1);
- if ( Debug ) cout << endl << "locateCell------" << endl << endl;
- flow->Compute_Permeability ( );
- porosity = flow->V_porale_porosity/flow->V_totale_porosity;
- flow->TOLERANCE=Tolerance;flow->RELAX=Relax;
+ if ( debug ) cout << endl << "locateCell------" << endl << endl;
+ flow->computePermeability ( );
+ porosity = flow->vPoralPorosity/flow->vTotalePorosity;
+ flow->TOLERANCE=tolerance;flow->RELAX=relax;
- flow->DisplayStatistics ();
+ flow->displayStatistics ();
//FIXME: check interpolate() for the periodic case, at least use the mean pressure from previous step.
- if ( !first && !multithread && (useSolver==0 || fluidBulkModulus>0)) flow->Interpolate ( flow->T[!flow->currentTes], Tes );
-// if ( !first && (useSolver==0 || fluidBulkModulus>0)) flow->Interpolate ( flow->T[!flow->currentTes], flow->T[flow->currentTes] );
+ if ( !first && !multithread && (useSolver==0 || fluidBulkModulus>0)) flow->interpolate ( flow->T[!flow->currentTes], Tes );
+// if ( !first && (useSolver==0 || fluidBulkModulus>0)) flow->interpolate ( flow->T[!flow->currentTes], flow->T[flow->currentTes] );
- if ( WaveAction ) flow->ApplySinusoidalPressure ( Tes.Triangulation(), sineMagnitude, sineAverage, 30 );
+ if ( waveAction ) flow->applySinusoidalPressure ( Tes.Triangulation(), sineMagnitude, sineAverage, 30 );
if (normalLubrication || shearLubrication || viscousShear) flow->computeEdgesSurfaces();
- if ( Debug ) cout << endl << "end buildTri------" << endl << endl;
+ if ( debug ) cout << endl << "end buildTri------" << endl << endl;
}
void PeriodicFlowEngine::preparePShifts()
=== modified file 'pkg/dem/FlowEngine.hpp'
--- pkg/dem/FlowEngine.hpp 2014-02-03 16:10:48 +0000
+++ pkg/dem/FlowEngine.hpp 2014-03-21 18:45:24 +0000
@@ -30,11 +30,11 @@
typedef _FlowSolver FlowSolver;
typedef FlowTesselation Tesselation;
typedef FlowSolver::RTriangulation RTriangulation;
- typedef FlowSolver::Finite_vertices_iterator Finite_vertices_iterator;
- typedef FlowSolver::Finite_cells_iterator Finite_cells_iterator;
- typedef FlowSolver::Cell_handle Cell_handle;
- typedef RTriangulation::Finite_edges_iterator Finite_edges_iterator;
- typedef FlowSolver::Vertex_handle Vertex_handle;
+ typedef FlowSolver::FiniteVerticesIterator FiniteVerticesIterator;
+ typedef FlowSolver::FiniteCellsIterator FiniteCellsIterator;
+ typedef FlowSolver::CellHandle CellHandle;
+ typedef RTriangulation::Finite_edges_iterator FiniteEdgesIterator;
+ typedef FlowSolver::VertexHandle VertexHandle;
@@ -51,11 +51,11 @@
public :
int retriangulationLastIter;
- enum {wall_xmin, wall_xmax, wall_ymin, wall_ymax, wall_zmin, wall_zmax};
+ enum {wallxMin, wallxMax, wallyMin, wallyMax, wallzMin, wallzMax};
Vector3r normal [6];
bool currentTes;
- int id_offset;
- double Eps_Vol_Cumulative;
+ int idOffset;
+ double epsVolCumulative;
int ReTrg;
int ellapsedIter;
TPL void initSolver (Solver& flow);
@@ -63,15 +63,15 @@
TPL void setForceMetis (Solver& flow, bool force);
TPL bool getForceMetis (Solver& flow);
#endif
- TPL void Triangulate (Solver& flow);
- TPL void AddBoundary (Solver& flow);
- TPL void Build_Triangulation (double P_zero, Solver& flow);
- TPL void Build_Triangulation (Solver& flow);
- TPL void UpdateVolumes (Solver& flow);
- TPL void Initialize_volumes (Solver& flow);
- TPL void BoundaryConditions(Solver& flow);
+ TPL void triangulate (Solver& flow);
+ TPL void addBoundary (Solver& flow);
+ TPL void buildTriangulation (double pZero, Solver& flow);
+ TPL void buildTriangulation (Solver& flow);
+ TPL void updateVolumes (Solver& flow);
+ TPL void initializeVolumes (Solver& flow);
+ TPL void boundaryConditions(Solver& flow);
TPL void updateBCs ( Solver& flow ) {
- if (flow->T[flow->currentTes].max_id>0) BoundaryConditions(flow);//avoids crash at iteration 0, when the packing is not bounded yet
+ if (flow->T[flow->currentTes].maxId>0) boundaryConditions(flow);//avoids crash at iteration 0, when the packing is not bounded yet
else LOG_ERROR("updateBCs not applied");
flow->pressureChanged=true;}
@@ -80,21 +80,25 @@
TPL void setImposedPressure(unsigned int cond, Real p,Solver& flow);
TPL void clearImposedPressure(Solver& flow);
TPL void clearImposedFlux(Solver& flow);
- TPL void ComputeViscousForces(Solver& flow);
+ TPL void computeLubricationContributions(Solver& flow);
TPL Real getCellFlux(unsigned int cond, const shared_ptr<Solver>& flow);
TPL Real getBoundaryFlux(unsigned int boundary,Solver& flow) {return flow->boundaryFlux(boundary);}
TPL Vector3r fluidForce(unsigned int id_sph, Solver& flow) {
const CGT::Vecteur& f=flow->T[flow->currentTes].vertex(id_sph)->info().forces; return Vector3r(f[0],f[1],f[2]);}
TPL Vector3r shearLubForce(unsigned int id_sph, Solver& flow) {
- return (flow->viscousShearForces.size()>id_sph)?flow->viscousShearForces[id_sph]:Vector3r::Zero();}
+ return (flow->shearLubricationForces.size()>id_sph)?flow->shearLubricationForces[id_sph]:Vector3r::Zero();}
TPL Vector3r shearLubTorque(unsigned int id_sph, Solver& flow) {
- return (flow->viscousShearTorques.size()>id_sph)?flow->viscousShearTorques[id_sph]:Vector3r::Zero();}
+ return (flow->shearLubricationTorques.size()>id_sph)?flow->shearLubricationTorques[id_sph]:Vector3r::Zero();}
+ TPL Vector3r pumpLubTorque(unsigned int id_sph, Solver& flow) {
+ return (flow->pumpLubricationTorques.size()>id_sph)?flow->pumpLubricationTorques[id_sph]:Vector3r::Zero();}
+ TPL Vector3r twistLubTorque(unsigned int id_sph, Solver& flow) {
+ return (flow->twistLubricationTorques.size()>id_sph)?flow->twistLubricationTorques[id_sph]:Vector3r::Zero();}
TPL Vector3r normalLubForce(unsigned int id_sph, Solver& flow) {
- return (flow->normLubForce.size()>id_sph)?flow->normLubForce[id_sph]:Vector3r::Zero();}
+ return (flow->normalLubricationForce.size()>id_sph)?flow->normalLubricationForce[id_sph]:Vector3r::Zero();}
TPL Matrix3r bodyShearLubStress(unsigned int id_sph, Solver& flow) {
- return (flow->viscousBodyStress.size()>id_sph)?flow->viscousBodyStress[id_sph]:Matrix3r::Zero();}
+ return (flow->shearLubricationBodyStress.size()>id_sph)?flow->shearLubricationBodyStress[id_sph]:Matrix3r::Zero();}
TPL Matrix3r bodyNormalLubStress(unsigned int id_sph, Solver& flow) {
- return (flow->lubBodyStress.size()>id_sph)?flow->lubBodyStress[id_sph]:Matrix3r::Zero();}
+ return (flow->normalLubricationBodyStress.size()>id_sph)?flow->normalLubricationBodyStress[id_sph]:Matrix3r::Zero();}
TPL Vector3r shearVelocity(unsigned int interaction, Solver& flow) {
return (flow->deltaShearVel[interaction]);}
TPL Vector3r normalVelocity(unsigned int interaction, Solver& flow) {
@@ -108,7 +112,7 @@
TPL Real surfaceDistanceParticle(unsigned int interaction, Solver& flow) {
return (flow->surfaceDistance[interaction]);}
TPL Real edgeSize(Solver& flow) {
- return (flow->Edge_ids.size());}
+ return (flow->edgeIds.size());}
TPL Real OSI(Solver& flow) {
return (flow->onlySpheresInteractions.size());}
TPL int onlySpheresInteractions(unsigned int interaction, Solver& flow) {
@@ -130,19 +134,16 @@
return pycsd;}
template<class Cellhandle>
- Real Volume_cell_single_fictious (Cellhandle cell);
- template<class Cellhandle>
- Real Volume_cell_double_fictious (Cellhandle cell);
- template<class Cellhandle>
- Real Volume_cell_triple_fictious (Cellhandle cell);
- template<class Cellhandle>
- Real Volume_cell (Cellhandle cell);
- void Oedometer_Boundary_Conditions();
- void Average_real_cell_velocity();
- void saveVtk(const char* folder) {solver->saveVtk(folder);}
- vector<Real> avFlVelOnSph(unsigned int id_sph) {return solver->Average_Fluid_Velocity_On_Sphere(id_sph);}
-
-// void setBoundaryVel(Vector3r vel) {topBoundaryVelocity=vel; updateTriangulation=true;}
+ Real volumeCellSingleFictious (Cellhandle cell);
+ template<class Cellhandle>
+ Real volumeCellDoubleFictious (Cellhandle cell);
+ template<class Cellhandle>
+ Real volumeCellTripleFictious (Cellhandle cell);
+ template<class Cellhandle>
+ Real volumeCell (Cellhandle cell);
+ void averageRealCellVelocity();
+ void saveVtk() {solver->saveVtk();}
+ vector<Real> avFlVelOnSph(unsigned int id_sph) {return solver->averageFluidVelocityOnSphere(id_sph);}
void pressureProfile(double wallUpY, double wallDownY) {return solver->measurePressureProfile(wallUpY,wallDownY);}
double getPorePressure(Vector3r pos){return solver->getPorePressure(pos[0], pos[1], pos[2]);}
TPL int getCell(double posX, double posY, double posZ, Solver& flow){return flow->getCell(posX, posY, posZ);}
@@ -168,6 +169,8 @@
//Instanciation of templates for python binding
Vector3r _shearLubForce(unsigned int id_sph) {return shearLubForce(id_sph,solver);}
Vector3r _shearLubTorque(unsigned int id_sph) {return shearLubTorque(id_sph,solver);}
+ Vector3r _pumpLubTorque(unsigned int id_sph) {return pumpLubTorque(id_sph,solver);}
+ Vector3r _twistLubTorque(unsigned int id_sph) {return twistLubTorque(id_sph,solver);}
Vector3r _normalLubForce(unsigned int id_sph) {return normalLubForce(id_sph,solver);}
Matrix3r _bodyShearLubStress(unsigned int id_sph) {return bodyShearLubStress(id_sph,solver);}
Matrix3r _bodyNormalLubStress(unsigned int id_sph) {return bodyNormalLubStress(id_sph,solver);}
@@ -214,19 +217,19 @@
((bool,first,true,,"Controls the initialization/update phases"))
((double, fluidBulkModulus, 0.,,"Bulk modulus of fluid (inverse of compressibility) K=-dP*V/dV [Pa]. Flow is compressible if fluidBulkModulus > 0, else incompressible."))
((Real, dt, 0,,"timestep [s]"))
- ((bool,permeability_map,false,,"Enable/disable stocking of average permeability scalar in cell infos."))
- ((bool, slip_boundary, true,, "Controls friction condition on lateral walls"))
- ((bool,WaveAction, false,, "Allow sinusoidal pressure condition to simulate ocean waves"))
+ ((bool,permeabilityMap,false,,"Enable/disable stocking of average permeability scalar in cell infos."))
+ ((bool, slipBoundary, true,, "Controls friction condition on lateral walls"))
+ ((bool,waveAction, false,, "Allow sinusoidal pressure condition to simulate ocean waves"))
((double, sineMagnitude, 0,, "Pressure value (amplitude) when sinusoidal pressure is applied (p )"))
((double, sineAverage, 0,,"Pressure value (average) when sinusoidal pressure is applied"))
- ((bool, Debug, false,,"Activate debug messages"))
- ((double, wall_thickness,0.001,,"Walls thickness"))
- ((double,P_zero,0,,"The value used for initializing pore pressure. It is useless for incompressible fluid, but important for compressible model."))
- ((double,Tolerance,1e-06,,"Gauss-Seidel Tolerance"))
- ((double,Relax,1.9,,"Gauss-Seidel relaxation"))
+ ((bool, debug, false,,"Activate debug messages"))
+ ((double, wallThickness,0.001,,"Walls thickness"))
+ ((double,pZero,0,,"The value used for initializing pore pressure. It is useless for incompressible fluid, but important for compressible model."))
+ ((double,tolerance,1e-06,,"Gauss-Seidel Tolerance"))
+ ((double,relax,1.9,,"Gauss-Seidel relaxation"))
((bool, updateTriangulation, 0,,"If true the medium is retriangulated. Can be switched on to force retriangulation after some events (else it will be true periodicaly based on :yref:`FlowEngine::defTolerance` and :yref:`FlowEngine::meshUpdateInterval`. Of course, it costs CPU time."))
((int,meshUpdateInterval,1000,,"Maximum number of timesteps between re-triangulation events. See also :yref:`FlowEngine::defTolerance`."))
- ((double, eps_vol_max, 0,(Attr::readonly),"Maximal absolute volumetric strain computed at each iteration. |yupdate|"))
+ ((double, epsVolMax, 0,(Attr::readonly),"Maximal absolute volumetric strain computed at each iteration. |yupdate|"))
((double, defTolerance,0.05,,"Cumulated deformation threshold for which retriangulation of pore space is performed. If negative, the triangulation update will occure with a fixed frequency on the basis of :yref:`FlowEngine::meshUpdateInterval`"))
((double, porosity, 0,(Attr::readonly),"Porosity computed at each retriangulation |yupdate|"))
((bool,meanKStat,false,,"report the local permeabilities' correction"))
@@ -251,10 +254,10 @@
((int, ignoredBody,-1,,"Id of a sphere to exclude from the triangulation.)"))
((vector<int>, wallIds,vector<int>(6),,"body ids of the boundaries (default values are ok only if aabbWalls are appended before spheres, i.e. numbered 0,...,5)"))
((vector<bool>, boundaryUseMaxMin, vector<bool>(6,true),,"If true (default value) bounding sphere is added as function of max/min sphere coord, if false as function of yade wall position"))
- ((bool, display_force, false,,"display the lubrication force applied on particles"))
- ((bool, create_file, false,,"create file of velocities"))
((bool, viscousShear, false,,"Compute viscous shear terms as developped by Donia Marzougui (FIXME: ref.)"))
((bool, shearLubrication, false,,"Compute shear lubrication force as developped by Brule (FIXME: ref.) "))
+ ((bool, pumpTorque, false,,"Compute pump torque applied on particles "))
+ ((bool, twistTorque, false,,"Compute twist torque applied on particles "))
((double, eps, 0.00001,,"roughness defined as a fraction of particles size, giving the minimum distance between particles in the lubrication model."))
((bool, pressureForce, true,,"Compute the pressure field and associated fluid forces. WARNING: turning off means fluid flow is not computed at all."))
((bool, normalLubrication, false,,"Compute normal lubrication force as developped by Brule"))
@@ -264,7 +267,6 @@
#ifdef EIGENSPARSE_LIB
((int, numSolveThreads, 1,,"number of openblas threads in the solve phase."))
((int, numFactorizeThreads, 1,,"number of openblas threads in the factorization phase"))
-// ((bool, forceMetis, 0,,"If true, METIS is used for matrix preconditioning, else Cholmod is free to choose the best method (which may be METIS to, depending on the matrix). See ``nmethods`` in Cholmod documentation"))
#endif
,
/*deprec*/
@@ -272,11 +274,11 @@
,,
timingDeltas=shared_ptr<TimingDeltas>(new TimingDeltas);
for (int i=0; i<6; ++i){normal[i]=Vector3r::Zero(); wallIds[i]=i;}
- normal[wall_ymin].y()=normal[wall_xmin].x()=normal[wall_zmin].z()=1;
- normal[wall_ymax].y()=normal[wall_xmax].x()=normal[wall_zmax].z()=-1;
+ normal[wallyMin].y()=normal[wallxMin].x()=normal[wallzMin].z()=1;
+ normal[wallyMax].y()=normal[wallxMax].x()=normal[wallzMax].z()=-1;
solver = shared_ptr<FlowSolver> (new FlowSolver);
first=true;
- eps_vol_max=Eps_Vol_Cumulative=retriangulationLastIter=0;
+ epsVolMax=epsVolCumulative=retriangulationLastIter=0;
ReTrg=1;
backgroundCompleted=true;
ellapsedIter=0;
@@ -295,6 +297,8 @@
.def("fluidForce",&FlowEngine::_fluidForce,(python::arg("Id_sph")),"Return the fluid force on sphere Id_sph.")
.def("shearLubForce",&FlowEngine::_shearLubForce,(python::arg("Id_sph")),"Return the shear lubrication force on sphere Id_sph.")
.def("shearLubTorque",&FlowEngine::_shearLubTorque,(python::arg("Id_sph")),"Return the shear lubrication torque on sphere Id_sph.")
+ .def("pumpLubTorque",&FlowEngine::_pumpLubTorque,(python::arg("Id_sph")),"Return the pump torque on sphere Id_sph.")
+ .def("twistLubTorque",&FlowEngine::_twistLubTorque,(python::arg("Id_sph")),"Return the twist torque on sphere Id_sph.")
.def("normalLubForce",&FlowEngine::_normalLubForce,(python::arg("Id_sph")),"Return the normal lubrication force on sphere Id_sph.")
.def("bodyShearLubStress",&FlowEngine::_bodyShearLubStress,(python::arg("Id_sph")),"Return the shear lubrication stress on sphere Id_sph.")
.def("bodyNormalLubStress",&FlowEngine::_bodyNormalLubStress,(python::arg("Id_sph")),"Return the normal lubrication stress on sphere Id_sph.")
@@ -353,24 +357,23 @@
typedef _PeriFlowSolver FlowSolver;
typedef PeriFlowTesselation Tesselation;
typedef FlowSolver::RTriangulation RTriangulation;
- typedef FlowSolver::Finite_vertices_iterator Finite_vertices_iterator;
- typedef FlowSolver::Finite_cells_iterator Finite_cells_iterator;
- typedef FlowSolver::Cell_handle Cell_handle;
- typedef RTriangulation::Finite_edges_iterator Finite_edges_iterator;
- typedef RTriangulation::Vertex_handle Vertex_handle;
+ typedef FlowSolver::FiniteVerticesIterator FiniteVerticesIterator;
+ typedef FlowSolver::FiniteCellsIterator FiniteCellsIterator;
+ typedef FlowSolver::CellHandle CellHandle;
+ typedef RTriangulation::Finite_edges_iterator FiniteEdgesIterator;
+ typedef RTriangulation::Vertex_handle VertexHandle;
shared_ptr<FlowSolver> solver;
shared_ptr<FlowSolver> backgroundSolver;
- void Triangulate (shared_ptr<FlowSolver>& flow);
-// void AddBoundary ();
- void Build_Triangulation (Real pzero, shared_ptr<FlowSolver>& flow);
- void Initialize_volumes (shared_ptr<FlowSolver>& flow);
- void UpdateVolumes (shared_ptr<FlowSolver>& flow);
- Real Volume_cell (Cell_handle cell);
+ void triangulate (shared_ptr<FlowSolver>& flow);
+ void buildTriangulation (Real pzero, shared_ptr<FlowSolver>& flow);
+ void initializeVolumes (shared_ptr<FlowSolver>& flow);
+ void updateVolumes (shared_ptr<FlowSolver>& flow);
+ Real volumeCell (CellHandle cell);
- Real Volume_cell_single_fictious (Cell_handle cell);
- inline void locateCell(Cell_handle baseCell, unsigned int& index, int& baseIndex, shared_ptr<FlowSolver>& flow, unsigned int count=0);
+ Real volumeCellSingleFictious (CellHandle cell);
+ inline void locateCell(CellHandle baseCell, unsigned int& index, int& baseIndex, shared_ptr<FlowSolver>& flow, unsigned int count=0);
Vector3r meanVelocity();
virtual ~PeriodicFlowEngine();
@@ -384,6 +387,8 @@
void saveVtk(const char* folder) {solver->saveVtk(folder);}
Vector3r _shearLubForce(unsigned int id_sph) {return shearLubForce(id_sph,solver);}
Vector3r _shearLubTorque(unsigned int id_sph) {return shearLubTorque(id_sph,solver);}
+ Vector3r _pumpLubTorque(unsigned int id_sph) {return pumpLubTorque(id_sph,solver);}
+ Vector3r _twistLubTorque(unsigned int id_sph) {return twistLubTorque(id_sph,solver);}
Vector3r _normalLubForce(unsigned int id_sph) {return normalLubForce(id_sph,solver);}
Matrix3r _bodyShearLubStress(unsigned int id_sph) {return bodyShearLubStress(id_sph,solver);}
Matrix3r _bodyNormalLubStress(unsigned int id_sph) {return bodyNormalLubStress(id_sph,solver);}
@@ -412,9 +417,6 @@
void _exportMatrix(string filename) {exportMatrix(filename,solver);}
void _exportTriplets(string filename) {exportTriplets(filename,solver);}
#endif
-
-// void _setImposedPressure(unsigned int cond, Real p) {setImposedPressure(cond,p,solver);}
-// void _clearImposedPressure() {clearImposedPressure(solver);}
Real _getCellFlux(unsigned int cond) {return getCellFlux(cond,solver);}
python::list _getConstrictions(bool all) {return getConstrictions(all,solver);}
python::list _getConstrictionsFull(bool all) {return getConstrictionsFull(all,solver);}
@@ -434,9 +436,8 @@
((Vector3r, gradP, Vector3r::Zero(),,"Macroscopic pressure gradient"))
,,
wallIds=vector<int>(6,-1);
-// wallTopId=wallBottomId=wallFrontId=wallBackId=wallLeftId=wallRightId=-1;
solver = shared_ptr<FlowSolver> (new FlowSolver);
- eps_vol_max=Eps_Vol_Cumulative=retriangulationLastIter=0;
+ epsVolMax=epsVolCumulative=retriangulationLastIter=0;
ReTrg=1;
first=true;
,
@@ -444,6 +445,8 @@
.def("fluidForce",&PeriodicFlowEngine::_fluidForce,(python::arg("Id_sph")),"Return the fluid force on sphere Id_sph.")
.def("shearLubForce",&PeriodicFlowEngine::_shearLubForce,(python::arg("Id_sph")),"Return the shear lubrication force on sphere Id_sph.")
.def("shearLubTorque",&PeriodicFlowEngine::_shearLubTorque,(python::arg("Id_sph")),"Return the shear lubrication torque on sphere Id_sph.")
+ .def("pumpLubTorque",&PeriodicFlowEngine::_pumpLubTorque,(python::arg("Id_sph")),"Return the pump torque on sphere Id_sph.")
+ .def("twistLubTorque",&PeriodicFlowEngine::_twistLubTorque,(python::arg("Id_sph")),"Return the twist torque on sphere Id_sph.")
.def("normalLubForce",&PeriodicFlowEngine::_normalLubForce,(python::arg("Id_sph")),"Return the normal lubrication force on sphere Id_sph.")
.def("bodyShearLubStress",&PeriodicFlowEngine::_bodyShearLubStress,(python::arg("Id_sph")),"Return the shear lubrication stress on sphere Id_sph.")
.def("bodyNormalLubStress",&PeriodicFlowEngine::_bodyNormalLubStress,(python::arg("Id_sph")),"Return the normal lubrication stress on sphere Id_sph.")
=== modified file 'pkg/dem/Law2_ScGeom_CapillaryPhys_Capillarity.cpp'
--- pkg/dem/Law2_ScGeom_CapillaryPhys_Capillarity.cpp 2013-05-30 20:17:45 +0000
+++ pkg/dem/Law2_ScGeom_CapillaryPhys_Capillarity.cpp 2014-03-21 18:45:24 +0000
@@ -143,7 +143,7 @@
int* currentIndexes = hertzOn? mindlinContactPhysics->currentIndexes : cundallContactPhysics->currentIndexes;
//If P=0, we use null solution
MeniscusParameters
- solution(Pinterpol? capillary->Interpolate(R1,R2,Dinterpol, Pinterpol, currentIndexes) : MeniscusParameters());
+ solution(Pinterpol? capillary->interpolate(R1,R2,Dinterpol, Pinterpol, currentIndexes) : MeniscusParameters());
/// capillary adhesion force
Real Finterpol = solution.F;
Vector3r fCap = Finterpol*(2*Mathr::PI*(R2/alpha)*liquidTension)*currentContactGeometry->normal;
@@ -284,7 +284,7 @@
}
}
-MeniscusParameters capillarylaw::Interpolate(Real R1, Real R2, Real D, Real P, int* index)
+MeniscusParameters capillarylaw::interpolate(Real R1, Real R2, Real D, Real P, int* index)
{ //cerr << "interpolate" << endl;
if (R1 > R2) {
Real R3 = R1;
=== modified file 'pkg/dem/Law2_ScGeom_CapillaryPhys_Capillarity.hpp'
--- pkg/dem/Law2_ScGeom_CapillaryPhys_Capillarity.hpp 2013-05-30 20:17:45 +0000
+++ pkg/dem/Law2_ScGeom_CapillaryPhys_Capillarity.hpp 2014-03-21 18:45:24 +0000
@@ -137,7 +137,7 @@
public:
capillarylaw();
std::vector<Tableau> data_complete;
- MeniscusParameters Interpolate(Real R1, Real R2, Real D, Real P, int* index);
+ MeniscusParameters interpolate(Real R1, Real R2, Real D, Real P, int* index);
void fill (const char* filename);
};
=== modified file 'pkg/dem/TesselationWrapper.cpp'
--- pkg/dem/TesselationWrapper.cpp 2013-03-05 19:00:17 +0000
+++ pkg/dem/TesselationWrapper.cpp 2014-03-21 18:45:24 +0000
@@ -68,7 +68,7 @@
BodyContainer::iterator bi = biBegin;
Body::id_t Ng = 0;
- Body::id_t& MaxId=Tes.max_id;
+ Body::id_t& MaxId=Tes.maxId;
TW.mean_radius = 0;
shared_ptr<Sphere> sph (new Sphere);
@@ -111,7 +111,7 @@
else {
v->info() = (const unsigned int) p->second;
//Vh->info().isFictious = false;//false is the default
- Tes.max_id = std::max(Tes.max_id,(int) p->second);
+ Tes.maxId = std::max(Tes.maxId,(int) p->second);
Tes.vertexHandles[p->second]=v;
hint=v->cell();
++TW.n_spheres;
@@ -200,13 +200,13 @@
void TesselationWrapper::ComputeTesselation(double pminx, double pmaxx, double pminy, double pmaxy, double pminz, double pmaxz, double dt)
{
- AddBoundingPlanes(pminx, pmaxx, pminy, pmaxy, pminz, pmaxz, dt);
+ addBoundingPlanes(pminx, pmaxx, pminy, pmaxy, pminz, pmaxz, dt);
ComputeTesselation();
}
void TesselationWrapper::ComputeVolumes(void)
{
- if (!bounded) AddBoundingPlanes();
+ if (!bounded) addBoundingPlanes();
ComputeTesselation();
Tes->ComputeVolumes();
}
@@ -232,7 +232,7 @@
return true;
}
-void TesselationWrapper::AddBoundingPlanes(double pminx, double pmaxx, double pminy, double pmaxy, double pminz, double pmaxz,double dt)
+void TesselationWrapper::addBoundingPlanes(double pminx, double pmaxx, double pminy, double pmaxy, double pminz, double pmaxz,double dt)
{
//Not sure this hack form JFJ works in all cases (?)
if (dt == 0) {
@@ -254,7 +254,7 @@
}
}
-void TesselationWrapper::AddBoundingPlanes(void)
+void TesselationWrapper::addBoundingPlanes(void)
{
if (!bounded) {
if (!rad_divided) {
@@ -357,7 +357,7 @@
ts = mma.analyser->TS0;}
RTriangulation& Tri = Tes->Triangulation();
Pmin=ts->box.base; Pmax=ts->box.sommet;
- //if (!scene->isPeriodic) AddBoundingPlanes();
+ //if (!scene->isPeriodic) addBoundingPlanes();
ComputeVolumes();
int bodiesDim = Tes->Max_id() + 1; //=scene->bodies->size();
cerr<<"bodiesDim="<<bodiesDim<<endl;
=== modified file 'pkg/dem/TesselationWrapper.hpp'
--- pkg/dem/TesselationWrapper.hpp 2013-10-31 00:03:24 +0000
+++ pkg/dem/TesselationWrapper.hpp 2014-03-21 18:45:24 +0000
@@ -37,11 +37,11 @@
class TesselationWrapper : public GlobalEngine{
public:
- typedef CGT::_Tesselation<CGT::SimpleTriangulationTypes> Tesselation;
+ typedef CGT::_Tesselation<CGT::SimpleTriangulationTypes> Tesselation;
typedef Tesselation::RTriangulation RTriangulation;
- typedef Tesselation::Vertex_Info Vertex_Info;
- typedef Tesselation::Cell_Info Cell_Info;
- typedef RTriangulation::Finite_edges_iterator Finite_edges_iterator;
+ typedef Tesselation::VertexInfo VertexInfo;
+ typedef Tesselation::CellInfo CellInfo;
+ typedef RTriangulation::Finite_edges_iterator FiniteEdgesIterator;
@@ -67,9 +67,9 @@
void clear2(void);
/// Add axis aligned bounding planes (modelised as spheres with (almost) infinite radius)
- void AddBoundingPlanes (void);
+ void addBoundingPlanes (void);
/// Force boudaries at positions not equal to precomputed ones
- void AddBoundingPlanes(double pminx, double pmaxx, double pminy, double pmaxy, double pminz, double pmaxz, double dt);
+ void addBoundingPlanes(double pminx, double pmaxx, double pminy, double pmaxy, double pminz, double pmaxz, double dt);
void RemoveBoundingPlanes (void);
///Compute voronoi centers then stop (don't compute anything else)
void ComputeTesselation (void);
@@ -108,9 +108,9 @@
public:
/// edge iterators are used for returning tesselation "facets", i.e. spheres with a common branch in the triangulation, convert CGAL::edge to int pair (b1->id, b2->id)
- Finite_edges_iterator facet_begin;
- Finite_edges_iterator facet_end;
- Finite_edges_iterator facet_it;
+ FiniteEdgesIterator facet_begin;
+ FiniteEdgesIterator facet_end;
+ FiniteEdgesIterator facet_it;
MicroMacroAnalyser mma;
YADE_CLASS_BASE_DOC_ATTRS_CTOR_PY(TesselationWrapper,GlobalEngine,"Handle the triangulation of spheres in a scene, build tesselation on request, and give access to computed quantities (see also the `dedicated section in user manual <https://yade-dem.org/doc/user.html#micro-stress-and-micro-strain>`_). The calculation of microstrain is explained in [Catalano2013a]_ \n\nSee example usage in script example/tesselationWrapper/tesselationWrapper.py.\n\nBelow is an output of the :yref:`defToVtk<TesselationWrapper::defToVtk>` function visualized with paraview (in this case Yade's TesselationWrapper was used to process experimental data obtained on sand by Edward Ando at Grenoble University, 3SR lab.)\n\n.. figure:: fig/localstrain.*",