How can a field defined in the
How can a field defined in the solver code be accessed from within the code of a boundary condition?
As explained here http://www.cfd-online.com/OpenFOAM_D...tml?1133622442, I'm trying to add Johnson and Jackson's BCs to the twoPhaseEulerFoam solver, but I can't have access to the solver fields. I get the error: /*---------------------------------------------------------------------------*\ | ========= | | | \ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \ / O peration | Version: 1.2 | | \ / A nd | Web: http://www.openfoam.org | | \/ M anipulation | | \*---------------------------------------------------------------------------*/ Exec : twoPhaseEulerFoam . Rhodes2D Date : Dec 05 2005 Time : 21:06:15 Host : dimension4400 PID : 13204 Root : /home/alberto/OpenFOAM/alberto-1.2/run/FluidBeds Case : Rhodes2D Nprocs : 1 Create time Create mesh for time = 0 Reading environmentalProperties Reading transportProperties --> FOAM FATAL ERROR : request for volScalarField alpha from objectRegistry region0 failed available objects of type volScalarField are 0 ( ) From function objectRegistry::lookupObject<type>(const word&) const in file /home/dm2/henry/OpenFOAM/OpenFOAM-1.2/src/OpenFOAM/lnInclude/objectRegistryTempl ates.C at line 122. FOAM aborting I try to read the alpha field as follows: const fvPatchField<scalar>& alpha = lookupPatchField<volScalarField, scalar > ( "alpha" ); Also, how can I have access to the kineticTheoryProperties dictionary from the BC code? I get an error message which tells me the dictionary can't be found if I try to read from it. Thanks in advance, Alberto |
Hi Alberto,
I had a similar problem: if you want to access the kineticTheoryProperties from the constant folder you can get it by Quote:
Quote:
Quote:
otherwise, the whole mesh vol<Type>Field can be read by eg. Quote:
Quote:
|
Goodness, no! Do NOT create a mesh every time you want to access something related to it..
You can access the objectRegistry using the fvPatch db() function: Code:
template<class Type> |
Hey Sandeep,
Thanks for your advice... I already realized it but did it like: Quote:
Quote:
Tobi |
eaxmple
Hi,
this should be an example: Code:
const dimensionedScalar& readNu = db().lookupObject<IOdictionary>("transportProperties").lookup("nu"); Abdrea |
Hi Andrea.
thanks for the quick reply, but there are two things... 1. your code does not work on my BC : Quote:
2. I don't want to read a dictionary IO but call a member function called Cp().... thx altough... my version works anyway... :rolleyes: |
Reading alpha and alphaEff
Hello everyone. I have a similar question to what has being asked. I think mine is easier to answer :). Well, I am writing a post-processor to an LES simulation I performed and I am trying to read the thermal diffusivity and effective-thermal diffusivity, alpha and alphaEff. Is what I am doing correct:
IOdictionary LESProperties ( IOobject ( "LESProperties", runTime.constant(), mesh, IOobject::MUST_READ, IOobject::NO_WRITE ) ); dimensionScalar alphaEff ( LESProperties.lookup("alphaEff") ); dimensionScalar alpha ( LESProperties.lookup("alpha") ); |
Hello everyone. I have a similar question. I am trying to write a post-processor and I need the values from the LESProperties and thermophysicalProperties, and I am not sure if the code I have here is correct. I am just working my way around OpenFOAM and trying to get comfortable with the code. Thanks.
// Read LESProperties & thermophysicalProperties IOdictionary LESProperties ( IOobject ( "LESProperties", runTime.constant(), mesh, IOobject::MUST_READ, IOobject::NO_WRITE ) ); dimensionScalar alphaEff ( LESProperties.lookup("alphaEff") ); dimensionScalar alpha ( LESProperties.lookup("alpha") ); |
Hello,
I have got a question about the "use of IOdictionary for this purpose".. Does this mean that at every time step when the boundary condition is updated (or called), a disk I/O operation is performed for the value of "nu" ?? Does the name "IOdictionary" stand for that?? It is very important for me. Thank you, Ozgur Quote:
|
Access Data from same bc but different parameter
Hi All!
New Year, new problems, i am trying to figure out how to access a variable from a different parameter for the same patch at each timestep e.g., read the amplitude and frequency values from the velocity oscillatingFixedValue BC at the current time step and use them as input parameters for the pressure boundary condition. So far I manage to get: Code:
//load the internal velocity field Looking forward for quick reply... Tobias |
Quote:
Sorry I can't handle your code ... can you give a more detailed example? |
I have a similar problem.
In every loop I write out a constant scalar to "scalarDict" which is inside of the constant directory. The entry for the scalar is: fluxIn 0.21; Now I want to import this value and assign it to a boundary condition, e.g. flowRateInletvelocity. However, this does not work with any of the above posted hints. scalarDict is of type "IOdictionary" and is located in "createFields.H". The scalarDict.set(name, value) is inside the "solver.C" file. Compiling the solver via "wmake" works well without any error message. So, what kind of "lines" do I have to put inside my "U" file to successfully import the flowRate I need for my BC? Any kind of help would be appreciated. |
Alright, I fixed it myself.
Since the scalarDict is updated on every timestep ( the value is just overwritten ). How can I manage to reload the value in my BC? For now the BC flowRate value is 3.8E-05 (the starting value) all the time. So it is not updated... |
All times are GMT -4. The time now is 17:39. |