|
[Sponsors] |
Collect record of time when particle becomes stuckToWall |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
August 30, 2018, 10:44 |
Collect record of time when particle becomes stuckToWall
|
#1 |
New Member
James C
Join Date: Jan 2017
Posts: 5
Rep Power: 9 |
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) |
|
August 30, 2018, 10:59 |
|
#2 |
Senior Member
anonymous
Join Date: Jan 2016
Posts: 416
Rep Power: 14 |
Hi!
Like this? const Time& time = mesh().time(); Then you could use scalar t = time.value(); |
|
August 30, 2018, 12:41 |
|
#3 |
New Member
James C
Join Date: Jan 2017
Posts: 5
Rep Power: 9 |
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 |
|
August 30, 2018, 12:52 |
|
#4 |
Senior Member
anonymous
Join Date: Jan 2016
Posts: 416
Rep Power: 14 |
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. |
|
August 30, 2018, 14:06 |
|
#5 |
New Member
James C
Join Date: Jan 2017
Posts: 5
Rep Power: 9 |
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? |
|
August 30, 2018, 14:11 |
|
#6 |
Senior Member
anonymous
Join Date: Jan 2016
Posts: 416
Rep Power: 14 |
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. |
|
August 31, 2018, 08:04 |
|
#7 |
New Member
James C
Join Date: Jan 2017
Posts: 5
Rep Power: 9 |
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. |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Particle tracking error | alchem | OpenFOAM Bugs | 5 | May 6, 2017 17:30 |
Stuck in a Rut- interDyMFoam! | xoitx | OpenFOAM Running, Solving & CFD | 14 | March 25, 2016 08:09 |
Micro Scale Pore, icoFoam | gooya_kabir | OpenFOAM Running, Solving & CFD | 2 | November 2, 2013 14:58 |
injection problem | Mark New | FLUENT | 0 | August 4, 2013 02:30 |
same geometry,structured and unstructured mesh,different behaviour. | sharonyue | OpenFOAM Running, Solving & CFD | 13 | January 2, 2013 23:40 |