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

Global parameters for customized boundary conditions

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 28, 2020, 12:18
Default Global parameters for customized boundary conditions
  #1
New Member
 
Jan Behrendt
Join Date: Nov 2016
Location: Germany
Posts: 3
Rep Power: 10
JanBeh is on a distinguished road
Hello Foamers!
recently i've had to deal with - guess the well known and much discussed- compiling errors if one would like to upgrade to a newer version of openFoam.
actually i have to upgrade my solver and boundaryConditions (programmed in oF 2.3) due to the fact that of Version 2.3 won't be no longer supported.

i really benefited from the threads and discussions about the openFoam updates but i simply can't find a solution to my kind of problem.

long story short…
i'd like to add global parameters in a customized boundaryCondition. thoose parameters should be non-const (runtime dependent).
basically what i would like to have is a status parameter which is updated in the main (solver) code depending on the actual runtime.
back in version 2.3 it was pretty easy to deal with that kind of problem. One just had to work with the "external int.." definition/declaration but it seems that something -at least for me- essential had changed.

I will try to clarify the problem using a simple example (that's how it actually worked in version 2.3.x)


back in version 2.3.x it was possible to define a -let's name it- Status.H file like this
Status.H
#ifndef Status_H
#define Status_H

extern int status = 1;

#endif

Now lets make a my_zeroGradient boundaryCondition like this:
my_zeroGradient.H
#ifndef my_zeroGradient_h

#include Status.H

#endif

To keep that kind of problem simple i'll do a simple Info output in the my_zeroGradient.C

my_zeroGradient.C
#include "my_zeroGradient.H"

void Foam::my_zeroGradientFvPatchField<Type>::evaluate…
{
Info << "Hello World, your Status is " << status << endl;
….
}


To make the point clear ill now copy paste the compressilbeInterFoam solver and compile it to my_compressibleInterFoam solver. Before compiling just some changes:

my_compressibleInterFoam.C
#include....
#include "Status.H"
….
int main(…
….
if (this is true)
status = 2; (and not 1 any longer)


no compiling errors but if i run a simple case (f.e. the depthCharge2D tutorial) the Info Output from the my_zeroGradient bc still remains 1.
So the question is : how am i able to update or how to change this non-const parameter (i thought global parameter) in the my_zeroGradient bc?

to keep in mind: the way i tried to show or to explain here still workes for version 2.3.x.

Guess this kind of problem is not such a big deal but i really dont know how to handle it right now. maybe it's an easy, or even a silly, question but i didn't get that part. Hence, i need some help


Thanks in advance

btw: im using OF 18.12 rn
JanBeh 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
Out File does not show Imbalance in % Mmaragann CFX 5 January 20, 2017 11:20
Multiphase flow - incorrect velocity on inlet Mike_Tom CFX 6 September 29, 2016 02:27
Basic Nozzle-Expander Design karmavatar CFX 20 March 20, 2016 09:44
Error finding variable "THERMX" sunilpatil CFX 8 April 26, 2013 08:00
IcoFoam parallel woes msrinath80 OpenFOAM Running, Solving & CFD 9 July 22, 2007 03:58


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