← Back to team overview

yade-users team mailing list archive

Re: How to communicate between two independent Engines

 

Hello. It is indeed possible. The simplest is maybe to declare and
define in your Engine DampingAdjustement a pointer towards an Engine
ConvergenceEstimator, with something like that :
/shared_ptr<ConvergenceEstimator> convergenceEstimator =
shared_ptr<ConvergenceEstimator> (new ConvergenceEstimator);/

(don't forget to include the good files and to modify the Sconscript !)
and then you can use your method of this Engine in your
DampingAdjustement, with the line you wrote :
/
convergenceEstimator->getCCValue()
/
But you will surely have to modify a bit your definition of "getCCValue"
function of the ConvergenceEstimator : she will need to have as a
parameter the Metabody of the simulation : so you would have to declare
this function with something like
/Real ConvergenceEstimator::getCCValue//(Body * body)
/
and then call it from the DampingAdjustement in fact with :
/convergenceEstimator->getCCValue(body)
/(this body here is the one which was passed to the applyCondition of
DampingAdjustement)/
/

If you have it in your version of Yade you could give a look to
"TriaxialStateRecorder" (in pkg/dem/Engine/DeusExMachina/) : this Engine
uses like you (and records) the value of the UnbalancedForce computed by
the other Engine "TriaxialStressController". In this case it is a bit
more complicated than what I said to you, because the
TriaxialStateRecorder cares to find in the list of Engines present in
the simulation the one which is a TriaxialStressController instead of
creating a new one, like I adviced.

Hoping having been enough clear...

Jerome

Chen, Feng a écrit:
> Hi, all:
> I am recently having such kind of problem, I have two costomized
> engines, one is called "ConvergenceEstimator", which is used to
> evaluate some maximumUnBalanceForce over the contactForce ratio (this
> will return a CCValue to evaluate whether the whole particle system is
> close to equilibrium), then Ihave another engine
> "DampingAdjustment"designed to change the initialsimulation parameter,
> in my case, the damping coefficient, for example, from 0.3 to 0.4.
> I have one piece of code in the preprocessor (similar to
> SDECSpheresPlane)which looks like this:
> ///--------------------
> ...
> rootBody->engines.push_back(ConvergenceEstimator);
> rootBody->engines.push_back(DampingAdjustment);
> ///--------------------
> This means my DampingAdjustment Engine needs the return values of the
> previous engine, I need to have something in DampingAdjustment like(I
> think should be in DampingAdjustment::applyCondition(Body* body)):
> if (convergenceEstimator->getCCVaue() <=eps)
> dampingCoefficient = 0.3;
> else
> dampingCoefficient =0.5;
> I think this is purely a programming problem, how to access the
> ConvergenceEstimator which is the other engine?
> I hope I have made my problem clear. Thank you very much!
> Feng Chen
> ------------------------------------------------------------------------
>
> _______________________________________________
> Yade-users mailing list
> Yade-users@xxxxxxxxxxxxxxxx
> https://lists.berlios.de/mailman/listinfo/yade-users
>   
_______________________________________________
Yade-users mailing list
Yade-users@xxxxxxxxxxxxxxxx
https://lists.berlios.de/mailman/listinfo/yade-users

References