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

Visualize scalarCodedSource in paraFoam

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree2Likes
  • 1 Post By NiklasW
  • 1 Post By NiklasW

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 12, 2021, 16:23
Default Visualize scalarCodedSource in paraFoam
  #1
Member
 
Jonathan Wells
Join Date: Oct 2020
Location: Indiana
Posts: 44
Rep Power: 2
jdw135 is on a distinguished road
I'm coding a scalarCodedSource to use with my case, and I'm trying to visualize the results in paraFoam. Is there a way to make it write the result of the calculation at each time step?

Essentially, I am making the field

Code:
scalarField& qq = eqn.source();
qq += ...;
and I would like to visualize qq at each time step. Is there something I add to the fvOptions file?
jdw135 is offline   Reply With Quote

Old   April 13, 2021, 10:13
Default
  #2
Member
 
Jonathan Wells
Join Date: Oct 2020
Location: Indiana
Posts: 44
Rep Power: 2
jdw135 is on a distinguished road
Anyone? I know there has to be a way to do this.
jdw135 is offline   Reply With Quote

Old   April 13, 2021, 11:58
Default
  #3
New Member
 
Join Date: May 2019
Posts: 9
Rep Power: 4
NiklasW is on a distinguished road
Hi Jonathan,

I'm not sure, if it's the best solution, but this might work:
Code:
qq += ...;

volScalarField volqq = volScalarField::New("qq",mesh_, 0.0);
volqq.primitiveFieldRef() = qq;
volqq.write();
jdw135 likes this.
NiklasW is offline   Reply With Quote

Old   April 14, 2021, 11:18
Default
  #4
Member
 
Jonathan Wells
Join Date: Oct 2020
Location: Indiana
Posts: 44
Rep Power: 2
jdw135 is on a distinguished road
Quote:
Originally Posted by NiklasW View Post
Hi Jonathan,

I'm not sure, if it's the best solution, but this might work:
Code:
qq += ...;

volScalarField volqq = volScalarField::New("qq",mesh_, 0.0);
volqq.primitiveFieldRef() = qq;
volqq.write();
For whatever reason, that causes the solution to take much longer and won't load anything at all in paraFoam.
jdw135 is offline   Reply With Quote

Old   April 14, 2021, 11:28
Default
  #5
New Member
 
Join Date: May 2019
Posts: 9
Rep Power: 4
NiklasW is on a distinguished road
So it also doesn't create qq files in your time folders?
NiklasW is offline   Reply With Quote

Old   April 14, 2021, 14:47
Default
  #6
Member
 
Jonathan Wells
Join Date: Oct 2020
Location: Indiana
Posts: 44
Rep Power: 2
jdw135 is on a distinguished road
Quote:
Originally Posted by NiklasW View Post
So it also doesn't create qq files in your time folders?
It does, but now nothing else gets written to the time folders and when I try to open the case in paraFoam, it just hangs forever when I click apply.
jdw135 is offline   Reply With Quote

Old   April 14, 2021, 18:52
Default
  #7
Member
 
Jonathan Wells
Join Date: Oct 2020
Location: Indiana
Posts: 44
Rep Power: 2
jdw135 is on a distinguished road
Correction*

I realized that your code was printing the qq field every time step, rather than every 500 like my controlDict file specifies. That's almost certainly the cause of the slowdown, as my time step is 1e-5 and I'm running for several seconds.

I guess I need to figure out how to make it write only at the same intervals as the rest of my data.
jdw135 is offline   Reply With Quote

Old   April 15, 2021, 03:32
Default
  #8
New Member
 
Join Date: May 2019
Posts: 9
Rep Power: 4
NiklasW is on a distinguished road
Ah, ok, I thought you wanted to write it at each time step

This should do it:
Code:
if (mesh_.time().writeTime())
{
        volScalarField volqq = volScalarField::New("qq",mesh_, 0.0);
        volqq.primitiveFieldRef() = qq;
        volqq.write();
}
jdw135 likes this.
NiklasW is offline   Reply With Quote

Old   April 15, 2021, 15:09
Default
  #9
Member
 
Jonathan Wells
Join Date: Oct 2020
Location: Indiana
Posts: 44
Rep Power: 2
jdw135 is on a distinguished road
Quote:
Originally Posted by NiklasW View Post
Ah, ok, I thought you wanted to write it at each time step

This should do it:
Code:
if (mesh_.time().writeTime())
{
        volScalarField volqq = volScalarField::New("qq",mesh_, 0.0);
        volqq.primitiveFieldRef() = qq;
        volqq.write();
}
This worked perfectly! Thank you so much for the help!
jdw135 is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
[OpenFOAM] Unable to launch parafoam & boonhow ParaView 3 December 3, 2020 06:21
[OpenFOAM.org] paraFoam Fatal Error upon run Gallienus OpenFOAM Installation 2 April 14, 2020 19:23
How to visualize cellSets in paraFoam with streamlines anon_q OpenFOAM Post-Processing 0 October 17, 2018 10:25
[OpenFOAM.com] paraFoam cannot open due to Qt issues - [Solved/Information] u2berggeist OpenFOAM Installation 2 July 2, 2018 17:03
[OpenFOAM] OpenFoam (Ubuntu): paraFoam via Xming+PuTTY raketenmaid ParaView 4 February 5, 2013 05:20


All times are GMT -4. The time now is 10:39.