yade-users team mailing list archive
-
yade-users team
-
Mailing list archive
-
Message #23189
Re: [Question #690872]: Adding a method in the yade class files associated to a new contact law
Question #690872 on Yade changed:
https://answers.launchpad.net/yade/+question/690872
Status: Open => Answered
Jan Stránský proposed the following answer:
> concerning the class computeNewAlfa
it is a method/function, not class :-)
> How do i precise ...
however you want / your model needs..
> phys->alfa = alfa + om->dt *( ... )
> How do i precise ... that OldAlfa is equal to NewAlfa for the previous time step
depnding on the formulation, e.g. you can do it like in the original
post, just the "phys->alfa = alfa + om->dt *( ... )" is defined in
computeNewAlfa function (which can be composed of several other
functions, like computeTerm1(...) etc.)
bool Law2_ScGeom_VsmPhys_Vsm::go(...)
{
VsmPhys::computeAnything(phys->alfa); // phys->alfa is "oldAlfa"
...
phys->alfa = computeNewAlfa(phys->alfa,...); // phys->alfa argument is "oldAlfa", phys->alfa result is "newAlfa"
}
or if you want the code being more "self-explanatory", the same can be
rewritten as:
bool Law2_ScGeom_VsmPhys_Vsm::go(...)
{
Real oldAlfa = phys->alfa;
computeAnything(oldAlfa);
...
Real newAlfa = VsmPhys::computeNewAlfa(oldAlfa,...);
// now you can do computations with both oldAlfa and newAlfa if needed
phys->alfa = newAlfa;
}
/////
> corresponding to a specific interaction
being member of IPhys = corresponding to a specific interaction
> how is the value of NewAlfa stored between two time steps... ?)
as phys->alfa (??)
if you need values in two time steps (current and previous), you can store two values in IPhys
cheers
Jan
--
You received this question notification because your team yade-users is
an answer contact for Yade.