CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

Collect record of time when particle becomes stuckToWall

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 30, 2018, 10:44
Default Collect record of time when particle becomes stuckToWall
  #1
New Member
 
James C
Join Date: Jan 2017
Posts: 5
Rep Power: 9
jpaolo is on a distinguished road
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)
jpaolo is offline   Reply With Quote

Old   August 30, 2018, 10:59
Default
  #2
Senior Member
 
anonymous
Join Date: Jan 2016
Posts: 416
Rep Power: 14
simrego is on a distinguished road
Hi!


Like this?
const Time& time = mesh().time();
Then you could use scalar t = time.value();
simrego is offline   Reply With Quote

Old   August 30, 2018, 12:41
Default
  #3
New Member
 
James C
Join Date: Jan 2017
Posts: 5
Rep Power: 9
jpaolo is on a distinguished road
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
jpaolo is offline   Reply With Quote

Old   August 30, 2018, 12:52
Default
  #4
Senior Member
 
anonymous
Join Date: Jan 2016
Posts: 416
Rep Power: 14
simrego is on a distinguished road
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.
simrego is offline   Reply With Quote

Old   August 30, 2018, 14:06
Default
  #5
New Member
 
James C
Join Date: Jan 2017
Posts: 5
Rep Power: 9
jpaolo is on a distinguished road
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?
jpaolo is offline   Reply With Quote

Old   August 30, 2018, 14:11
Default
  #6
Senior Member
 
anonymous
Join Date: Jan 2016
Posts: 416
Rep Power: 14
simrego is on a distinguished road
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.
simrego is offline   Reply With Quote

Old   August 31, 2018, 08:04
Default
  #7
New Member
 
James C
Join Date: Jan 2017
Posts: 5
Rep Power: 9
jpaolo is on a distinguished road
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.
Attached Files
File Type: txt dsmcStickingDiffuseWallPatch2_C.txt (13.9 KB, 3 views)
File Type: txt dsmcStickingDiffuseWallPatch2_H.txt (3.7 KB, 1 views)
jpaolo is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


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


All times are GMT -4. The time now is 04:51.