← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-dev/yade/trunk] Rev 2863: - add setImposedPressure that let the p value be modified

 

------------------------------------------------------------
revno: 2863
committer: Bruno Chareyre <bruno.chareyre@xxxxxxxxxxx>
branch nick: trunk
timestamp: Tue 2011-05-17 19:48:28 +0200
message:
  - add setImposedPressure that let the p value be modified
modified:
  pkg/dem/FlowEngine.cpp
  pkg/dem/FlowEngine.hpp


--
lp:yade
https://code.launchpad.net/~yade-dev/yade/trunk

Your team Yade developers is subscribed to branch lp:yade.
To unsubscribe from this branch go to https://code.launchpad.net/~yade-dev/yade/trunk/+edit-subscription
=== modified file 'pkg/dem/FlowEngine.cpp'
--- pkg/dem/FlowEngine.cpp	2011-05-03 20:03:21 +0000
+++ pkg/dem/FlowEngine.cpp	2011-05-17 17:48:28 +0000
@@ -173,17 +173,26 @@
 }
 
 
-void FlowEngine::imposePressure(Vector3r pos, Real p)
+unsigned int FlowEngine::imposePressure(Vector3r pos, Real p)
 {
 	flow->imposedP.push_back( pair<CGT::Point,Real>(CGT::Point(pos[0],pos[1],pos[2]),p) );
 	//force immediate update of boundary conditions
 	Update_Triangulation=true;
+	return flow->imposedP.size();
+}
+
+void FlowEngine::setImposedPressure(unsigned int cond, Real p)
+{
+	if (cond>=flow->imposedP.size()) LOG_ERROR("Setting p with cond higher than imposedP size.");
+	flow->imposedP[cond].second=p;
+	//force immediate update of boundary conditions
+	Update_Triangulation=true;
 }
 
 void FlowEngine::clearImposedPressure() { flow->imposedP.clear();}
 
-Real FlowEngine::getFlux(int cond) {
-	if (cond>=(int)flow->imposedP.size()) LOG_ERROR("Getting flux with cond higher than imposedP size.");
+Real FlowEngine::getFlux(unsigned int cond) {
+	if (cond>=flow->imposedP.size()) LOG_ERROR("Getting flux with cond higher than imposedP size.");
 	CGT::RTriangulation& Tri = flow->T[flow->currentTes].Triangulation();
 	double flux=0;
 	CGT::Cell_handle cell= Tri.locate(flow->imposedP[cond].first);

=== modified file 'pkg/dem/FlowEngine.hpp'
--- pkg/dem/FlowEngine.hpp	2011-05-03 20:03:21 +0000
+++ pkg/dem/FlowEngine.hpp	2011-05-17 17:48:28 +0000
@@ -51,11 +51,12 @@
 		Real Volume_cell (CGT::Cell_handle cell);
 		void Oedometer_Boundary_Conditions();
 		void BoundaryConditions();
-		void imposePressure(Vector3r pos, Real p);
+		unsigned int imposePressure(Vector3r pos, Real p);
+		void setImposedPressure(unsigned int cond, Real p);
 		void clearImposedPressure();
 		void Average_real_cell_velocity();
 		void ApplyViscousForces();
-		Real getFlux(int cond);
+		Real getFlux(unsigned int cond);
 		void saveVtk() {flow->saveVtk();}
 		vector<Real> AvFlVelOnSph(unsigned int id_sph) {return flow->Average_Fluid_Velocity_On_Sphere(id_sph);}
 		python::list getConstrictions() {
@@ -141,7 +142,8 @@
 					,,
 					timingDeltas=shared_ptr<TimingDeltas>(new TimingDeltas);
 					,
-					.def("imposePressure",&FlowEngine::imposePressure,(python::arg("pos"),python::arg("p")),"Impose pressure in cell of location 'pos'.")
+					.def("imposePressure",&FlowEngine::imposePressure,(python::arg("pos"),python::arg("p")),"Impose pressure in cell of location 'pos'. The index of the condition is returned (for multiple imposed pressures at different points).")
+					.def("setImposedPressure",&FlowEngine::setImposedPressure,(python::arg("cond"),python::arg("p")),"Set pressure value at the point of index cond.")
 					.def("clearImposedPressure",&FlowEngine::clearImposedPressure,"Clear the list of points with pressure imposed.")
 					.def("getFlux",&FlowEngine::getFlux,(python::arg("cond")),"Get influx in cell associated to an imposed P (indexed using 'cond').")
 					.def("getConstrictions",&FlowEngine::getConstrictions,"Get the list of constrictions (inscribed circle) for all finite facets.")