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

How to output specific parameters during the simulation

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By alexeym

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 29, 2017, 15:50
Default How to output specific parameters during the simulation
  #1
New Member
 
Lieh
Join Date: Mar 2017
Posts: 26
Rep Power: 9
akesm is on a distinguished road
Hello
I am new to openFOAM, I have a question might seem trivial.

I want to output the maximum of a certain parameter (say magnitude of velocity in the whole domain) during my simulation for a couple of time steps, I do not know where should I write this couple of code lines? Should it be in a script and run together with the run case? and if so how?


Any suggestion codes for doing so is highly appreciated.
akesm is offline   Reply With Quote

Old   March 29, 2017, 16:07
Default
  #2
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,930
Rep Power: 38
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
Hi,

Is there a reason you do not want to use fieldMinMax function object? You can find example in header file $FOAM_SRC/functionObjects/field/fieldMinMax/fieldMinMax.H
alexeym is offline   Reply With Quote

Old   March 29, 2017, 16:15
Default
  #3
New Member
 
Lieh
Join Date: Mar 2017
Posts: 26
Rep Power: 9
akesm is on a distinguished road
Thanks so much for your reply. Actually, I looked at this, it's for scalar quantities, not for instance velocity. But also I do not know how to use that function object, shall use it in my control dict, or any other way of using it?
akesm is offline   Reply With Quote

Old   March 29, 2017, 16:22
Default
  #4
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,930
Rep Power: 38
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
Why you have decided it is for scalar quantities?

Code:
For variables with a rank greater than zero, either the min/max of
a component value or the magnitude is reported.
Yes, you add description of the function object to controlDict. Or you create description as a separate file and use #include entry in controlDict.

And there is even an example of controlDict in $FOAM_SRC/functionObjects/field/fieldMinMax.
alexeym is offline   Reply With Quote

Old   March 30, 2017, 05:38
Default
  #5
Member
 
Ben Jankauskas
Join Date: Jun 2013
Location: Exeter
Posts: 34
Rep Power: 12
rhythm is on a distinguished road
Hi,

For cases like that I usually just introduce an info statement somewhere in the time loop, such as is done in multiphase solvers.
Don't know if you wanted to have the values output into a separate file, if you do, then there must be some sort of function object that would do this sort of thing.

If you only wanted to probe the min/max values of the field/parameter, then info statement is good enough and of course if you wanted to see how it evolves over time, then you can always extract them (sed/grep/awk etc.) from the log file to do some post processing.

Here's an example from driftFluxFoam alphaEqn.H:

Code:
    Info<< "Phase-1 volume fraction = "
        << alpha1.weightedAverage(mesh.Vsc()).value()
        << "  Min(" << alpha1.name() << ") = " << min(alpha1).value()
        << "  Max(" << alpha1.name() << ") = " << max(alpha1).value()
        << endl;
Cheers,
Ben
rhythm is offline   Reply With Quote

Old   March 30, 2017, 15:07
Default
  #6
New Member
 
Lieh
Join Date: Mar 2017
Posts: 26
Rep Power: 9
akesm is on a distinguished road
Thanks for your reply,
I put the below code in the controlDict but I get the error "keyword field is not defined"

Code:
functions 
{ 
    fieldMinMax1
    { 
        type        fieldMinMax;
        libs ("libfieldFunctionObjects.so");
        ...
        write       yes;
        log         yes;
        location    yes;
        mode        magnitude;
        fields
        (
            U
        );
    }  
}
akesm is offline   Reply With Quote

Old   March 30, 2017, 15:30
Default
  #7
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,930
Rep Power: 38
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
Code:
...
in header file example means skipped content and should not be copied to controlDict. Currently due to this dots your controlDict is not read till the end, as a result keyword fields is missing.
akesm likes this.
alexeym is offline   Reply With Quote

Old   March 30, 2017, 15:38
Default
  #8
New Member
 
Lieh
Join Date: Mar 2017
Posts: 26
Rep Power: 9
akesm is on a distinguished road
oops, my mistake, thanks now it is working and printing the maximum and all its relevant info in a separate folder named as "postprocessing".
akesm is offline   Reply With Quote

Reply

Tags
output data


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
Pro/E to ANSYS Parameterization Guide Trues ANSYS 4 April 18, 2018 05:52
Simulation of a single bubble with a VOF-method Suzzn CFX 21 January 29, 2018 00:58
Problem with an old Simulation FrankW CFX 3 February 8, 2016 04:28
Unsteady simulation solution files in parallel gunnersnroses SU2 1 December 15, 2015 13:28
Output Excel File in Transient Simulation Soon CFX 5 July 11, 2005 06:11


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