yade-dev team mailing list archive
-
yade-dev team
-
Mailing list archive
-
Message #11564
[Branch ~yade-pkg/yade/git-trunk] Rev 3503: Move SPH-body parameters into body->state.
------------------------------------------------------------
revno: 3503
committer: Anton Gladky <gladky.anton@xxxxxxxxx>
timestamp: Thu 2014-10-23 15:46:20 +0200
message:
Move SPH-body parameters into body->state.
Recommended by Bruno:
http://www.mail-archive.com/yade-dev@xxxxxxxxxxxxxxxxxxx/msg10628.html
modified:
core/Body.hpp
core/State.hpp
pkg/common/SPHEngine.cpp
pkg/dem/VTKRecorder.cpp
--
lp:yade
https://code.launchpad.net/~yade-pkg/yade/git-trunk
Your team Yade developers is subscribed to branch lp:yade.
To unsubscribe from this branch go to https://code.launchpad.net/~yade-pkg/yade/git-trunk/+edit-subscription
=== modified file 'core/Body.hpp'
--- core/Body.hpp 2014-10-15 06:44:01 +0000
+++ core/Body.hpp 2014-10-23 13:46:20 +0000
@@ -95,12 +95,6 @@
((long,chain,-1,,"Id of chain to which the body belongs."))
((long,iterBorn,-1,,"Step number at which the body was added to simulation."))
((Real,timeBorn,-1,,"Time at which the body was added to simulation."))
-#ifdef YADE_SPH
- ((Real,rho, -1.0,, "Current density (only for SPH-model)")) // [Mueller2003], (12)
- ((Real,rho0,-1.0,, "Rest density (only for SPH-model)")) // [Mueller2003], (12)
- ((Real,press,0.0,, "Pressure (only for SPH-model)")) // [Mueller2003], (12)
- ((Real,Cs,0.0,, "Color field (only for SPH-model)")) // [Mueller2003], (15)
-#endif
#ifdef YADE_LIQMIGRATION
((Real,Vf, 0.0,, "Individual amount of liquid"))
((Real,Vmin, 0.0,, "Minimal amount of liquid"))
@@ -121,11 +115,6 @@
.add_property("timeBorn",&Body::timeBorn,"Returns time at which the body was added to simulation.")
.def_readwrite("chain",&Body::chain,"Returns Id of chain to which the body belongs.")
.def("intrs",&Body::py_intrs,"Return all interactions in which this body participates.")
-#ifdef YADE_SPH
- .add_property("rho", &Body::rho, "Returns the current density (only for SPH-model).")
- .add_property("rho0", &Body::rho0,"Returns the rest density (only for SPH-model).")
- .add_property("press",&Body::press,"Returns the pressure (only for SPH-model).")
-#endif
);
};
REGISTER_SERIALIZABLE(Body);
=== modified file 'core/State.hpp'
--- core/State.hpp 2014-10-15 06:44:01 +0000
+++ core/State.hpp 2014-10-23 13:46:20 +0000
@@ -61,7 +61,13 @@
((Quaternionr,refOri,Quaternionr::Identity(),,"Reference orientation"))
((unsigned,blockedDOFs,,,"[Will be overridden]"))
((bool,isDamped,true,,"Damping in :yref:`Newtonintegrator` can be deactivated for individual particles by setting this variable to FALSE. E.g. damping is inappropriate for particles in free flight under gravity but it might still be applicable to other particles in the same simulation."))
- ((Real,densityScaling,1,,"|yupdate| see :yref:`GlobalStiffnessTimeStepper::targetDt`.")),
+ ((Real,densityScaling,1,,"|yupdate| see :yref:`GlobalStiffnessTimeStepper::targetDt`."))
+#ifdef YADE_SPH
+ ((Real,rho, -1.0,, "Current density (only for SPH-model)")) // [Mueller2003], (12)
+ ((Real,rho0,-1.0,, "Rest density (only for SPH-model)")) // [Mueller2003], (12)
+ ((Real,press,0.0,, "Pressure (only for SPH-model)")) // [Mueller2003], (12)
+#endif
+ ,
/* additional initializers */
((pos,se3.position))
((ori,se3.orientation)),
@@ -74,6 +80,11 @@
.add_property("ori",&State::ori_get,&State::ori_set,"Current orientation.")
.def("displ",&State::displ,"Displacement from :yref:`reference position<State.refPos>` (:yref:`pos<State.pos>` - :yref:`refPos<State.refPos>`)")
.def("rot",&State::rot,"Rotation from :yref:`reference orientation<State.refOri>` (as rotation vector)")
+#ifdef YADE_SPH
+ .add_property("rho", &State::rho, "Returns the current density (only for SPH-model).")
+ .add_property("rho0", &State::rho0,"Returns the rest density (only for SPH-model).")
+ .add_property("press",&State::press,"Returns the pressure (only for SPH-model).")
+#endif
);
REGISTER_INDEX_COUNTER(State);
DECLARE_LOGGER;
=== modified file 'pkg/common/SPHEngine.cpp'
--- pkg/common/SPHEngine.cpp 2014-10-21 07:58:55 +0000
+++ pkg/common/SPHEngine.cpp 2014-10-23 13:46:20 +0000
@@ -12,14 +12,14 @@
YADE_PARALLEL_FOREACH_BODY_BEGIN(const shared_ptr<Body>& b, scene->bodies){
if(mask>0 && (b->groupMask & mask)==0) continue;
this->calculateSPHRho(b);
- b->press=std::max(0.0, k*(b->rho - b->rho0));
+ b->state->press=std::max(0.0, k*(b->state->rho - b->state->rho0));
} YADE_PARALLEL_FOREACH_BODY_END();
}
}
void SPHEngine::calculateSPHRho(const shared_ptr<Body>& b) {
- if (b->rho0<0) {
- b->rho0 = rho0;
+ if (b->state->rho0<0) {
+ b->state->rho0 = rho0;
}
Real rho = 0;
@@ -49,7 +49,7 @@
}
// Self mass contribution
rho += b->state->mass*kernelFunctionCurDensity(0.0, h);
- b->rho = rho;
+ b->state->rho = rho;
}
Real smoothkernelLucy(const double & r, const double & h) {
@@ -134,8 +134,8 @@
const Real Mass1 = bodies[id1]->state->mass;
const Real Mass2 = bodies[id2]->state->mass;
- const Real Rho1 = bodies[id1]->rho;
- const Real Rho2 = bodies[id2]->rho;
+ const Real Rho1 = bodies[id1]->state->rho;
+ const Real Rho2 = bodies[id2]->state->rho;
const Vector3r xixj = de2.pos - de1.pos;
@@ -144,8 +144,8 @@
if (Rho1!=0.0 and Rho2!=0.0) {
// from [Monaghan1992], (3.3), multiply by Mass2, because we need a force, not du/dt
fpressure = - Mass1 * Mass2 * (
- bodies[id1]->press/(Rho1*Rho1) +
- bodies[id2]->press/(Rho2*Rho2)
+ bodies[id1]->state->press/(Rho1*Rho1) +
+ bodies[id2]->state->press/(Rho2*Rho2)
)
* phys.kernelFunctionCurrentPressure(xixj.norm(), phys.h);
}
=== modified file 'pkg/dem/VTKRecorder.cpp'
--- pkg/dem/VTKRecorder.cpp 2014-10-15 06:44:01 +0000
+++ pkg/dem/VTKRecorder.cpp 2014-10-23 13:46:20 +0000
@@ -598,9 +598,8 @@
damageRel->InsertNextValue(YADE_PTR_CAST<JCFpmState>(b->state)->tensBreakRel + YADE_PTR_CAST<JCFpmState>(b->state)->shearBreakRel);
}
#ifdef YADE_SPH
- spheresCsSPH->InsertNextValue(b->Cs);
- spheresRhoSPH->InsertNextValue(b->rho);
- spheresPressSPH->InsertNextValue(b->press);
+ spheresRhoSPH->InsertNextValue(b->state->rho);
+ spheresPressSPH->InsertNextValue(b->state->press);
spheresCoordNumbSPH->InsertNextValue(b->coordNumber());
#endif
#ifdef YADE_LIQMIGRATION