![]() |
Collect record of time when particle becomes stuckToWall
Hi all, does anyone know how to get the time in OpenFOAM to be collected?
What I mean is that, in dsmcFOAM+ there is a wall boundary condition (https://github.com/MicroNanoFlows/Op...useWallPatch.C) that particles can stick to, but I also want to record the time when the particle sticks to that wall. I have tried adding this; //Particle becomes stuck to wall stuckToWall = 1; measurePropertiesBeforeControl(p); //get time from runTime scalar t = runTime().value(); but I get error stating; dsmcSelectiveDiffuseSpecularStickingWallPatch2.C: In member function ‘virtual void Foam::dsmcSelectiveDiffuseSpecularStickingWallPatc h2::controlParticle(Foam::dsmcParcel&, Foam::dsmcParcel::trackingData&)’: dsmcSelectiveDiffuseSpecularStickingWallPatch2.C:1 99:32: error: ‘runTime’ was not declared in this scope scalar t = runTime().value(); ^ dsmcSelectiveDiffuseSpecularStickingWallPatch2.C:1 99:20: warning: unused variable ‘t’ [-Wunused-variable] scalar t = runTime().value(); ^ Any help on how I can edit the boundary condition to record the time when the particle becomes stuck to the wall would be much appreciated. Thank you! (Link to BC - https://github.com/MicroNanoFlows/Op...useWallPatch.C) |
Hi!
Like this? const Time& time = mesh().time(); Then you could use scalar t = time.value(); |
Thank you for the help,
I tried what you said; //Particle becomes stuck to wall stuckToWall = 1; measurePropertiesBeforeControl(p); //************************************ const Time& time = mesh().time(); scalar t = time.value(); //************************************ But I still get error saying; dsmcSelectiveDiffuseSpecularStickingWallPatch2.C: In member function ‘virtual void Foam::dsmcSelectiveDiffuseSpecularStickingWallPatc h2::controlParticle(Foam::dsmcParcel&, Foam::dsmcParcel::trackingData&)’: dsmcSelectiveDiffuseSpecularStickingWallPatch2.C:2 01:37: error: ‘mesh’ was not declared in this scope const Time& time = mesh().time(); ^ dsmcSelectiveDiffuseSpecularStickingWallPatch2.C:2 02:20: warning: unused variable ‘t’ [-Wunused-variable] scalar t = time.value(); ^ make: * [Make/linux64GccDPOpt/dsmcSelectiveDiffuseSpecularStickingWallPatch2.o] Error 1 Am I putting it at the wrong place in the .C file? Or should I put the 'const Time& time = mesh().time()' in the header file? Thanks again :) |
Sorry, you are in a boundary condition.
As I know there are many methods to do this. For example: scalar t = patch().boundaryMesh().mesh().time().value(); or maybe: scalar t = this->db().time().value(); Maybe both good for you. |
Thank you for sticking around helping, I really appreciate this.
the error code when I plug in; scalar t = this->db().time().value(); is dsmcSelectiveDiffuseSpecularStickingWallPatch2.C: In member function ‘virtual void Foam::dsmcSelectiveDiffuseSpecularStickingWallPatc h2::controlParticle(Foam::dsmcParcel&, Foam::dsmcParcel::trackingData&)’: dsmcSelectiveDiffuseSpecularStickingWallPatch2.C:1 97:37: error: ‘mesh’ was not declared in this scope const Time& time = mesh().time(); ^ dsmcSelectiveDiffuseSpecularStickingWallPatch2.C:2 03:30: error: ‘class Foam::dsmcSelectiveDiffuseSpecularStickingWallPatc h2’ has no member named ‘db’ scalar t = this->db().time().value(); ^ dsmcSelectiveDiffuseSpecularStickingWallPatch2.C:1 97:25: warning: unused variable ‘time’ [-Wunused-variable] const Time& time = mesh().time(); ^ dsmcSelectiveDiffuseSpecularStickingWallPatch2.C:2 03:20: warning: unused variable ‘t’ [-Wunused-variable] scalar t = this->db().time().value(); ^ make: * [Make/linux64GccDPOpt/dsmcSelectiveDiffuseSpecularStickingWallPatch2.o] Error 1 paolo@paolo-VirtualBox:~/OpenFOAM/paolo-2.4.0-MNF/run/programming/dsmcSelectiveDiffuseSpecularStickingWallPatch2$ I get a similar error code on the other option. Is there something I am doing wrong? I just want time to recorded when each particle becomes 'stuckToWall' in the boundary condition. When I export the results it comes out with the positions and other properties, having the time when it becomes stuck should be manageable to do right? Am I inputting it in the right section? |
edit: sorry I missed one error from your post.
Can you share your code? It's a bit difficult to help without knowing the other parts of the code. If the base was the linked BC in your 1st post then try: const Time& time = mesh_.time(); scalar t = time.value(); If it's not working, please share your code if it's possible or it'll be a guess-try-guess-try... so a long road. Sorry for that lot of guesses but I can't do else without knowing your code. |
2 Attachment(s)
No need to apologise, it is my bad.
I have uploaded the .C and .H file in a .txt format (I wouldn't open them in notepad). I have added your suggestion on line 94; // For recording time when particle sticks const Time& time = mesh_.time(); and on line 155; // For recording time when particle sticks scalar t = time.value(); Thanks for the help again. I hope I have uploaded the files okay. |
All times are GMT -4. The time now is 22:47. |