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

Using Min and Max operators OpenFOAM

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 28, 2016, 09:24
Default Using Min and Max operators OpenFOAM
  #1
Member
 
Upuli
Join Date: Feb 2016
Posts: 68
Rep Power: 10
upuli is on a distinguished road
Dear All

I have two functions, f and g . I want to get the minimum and maximum of two . How can I write it in OpenFOam


Thanks
upuli is offline   Reply With Quote

Old   March 28, 2016, 10:16
Default
  #2
Member
 
Bijan Darbari
Join Date: Nov 2015
Posts: 48
Rep Power: 10
bijan darbari is on a distinguished road
hello

I think:


Code:
Info<< "min/max value   = " << min(f).value() << ", "
        <<  max(f).value() << endl;
bijan darbari is offline   Reply With Quote

Old   March 28, 2016, 23:13
Default Using Min and Max operators OpenFOAM
  #3
Member
 
Upuli
Join Date: Feb 2016
Posts: 68
Rep Power: 10
upuli is on a distinguished road
Dear bijan
Thank you.I'll try with it.
upuli is offline   Reply With Quote

Old   June 7, 2021, 11:51
Default
  #4
New Member
 
Join Date: Aug 2020
Posts: 7
Rep Power: 5
Kannan86 is on a distinguished road
Hi



I want compare two equations and the maximum should go into the function. How to write code for this in OF.


example : G = max (a/b , c/d)




Thanks in advance.
Kannan86 is offline   Reply With Quote

Old   July 28, 2022, 04:46
Default
  #5
New Member
 
Feng
Join Date: Apr 2017
Posts: 9
Rep Power: 9
wind_ is on a distinguished road
hi Kannan86

Have you solved this problem?

when i get the max of two fields, e.g. :
volScalarField fun = max(fun1,fun2);

compiling is OK, but when i run the code, the screan show the following error:
Arguments of max have different dimensions
dimensions : [0 0 1 0 0 0 0] and [0 0 1 0 0 0 0]


Thanks
wind_ 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
y+ and u+ values with low-Re RANS turbulence models: utility + testcase florian_krause OpenFOAM 114 August 23, 2023 05:37
Near wall treatment in k-omega SST Arnoldinho OpenFOAM Running, Solving & CFD 38 March 8, 2017 13:48
multiphaseEulerFoam (OF2.3.0) : Courant number explodes when running in parallel Mehrez OpenFOAM Running, Solving & CFD 10 May 18, 2016 11:44
Problem of simulating of small droplet with radius of 2mm liguifan OpenFOAM Running, Solving & CFD 5 June 3, 2014 02:53
On the damBreak4phaseFine cases paean OpenFOAM Running, Solving & CFD 0 November 14, 2008 21:14


All times are GMT -4. The time now is 03:43.