call of overloaded ‘exp(double)’ is ambiguous
Dear Fellows
I am trying to add a variable called rhoE into my createFields.H file and assign a value to it based on location in the grid. I have added the following lines into my createFields.H file: Code:
volScalarField yPos = mesh.C().component(vector::Y); Code:
createFields.H: In function ‘int main(int, char**)’: |
Have you tried ?
Code:
rhoE.internalField()[patchi]=Foam::exp(-yPos[patchi]); Code:
rhoE.internalField()[patchi]=std::exp(-yPos[patchi]); |
Thanks Daniel. It worked.:)
I am trying to do sth similar with a volVectorField in my createFields.H file. Code:
volVectorField E OF gives me the following error during the compilation of the code: Code:
createFields.H:248:34: error: expected ‘)’ before numeric constant |
Dear All
I coded my second problem as follows: By defining the volVectorField and its volScalarFields components separately and using four loops. Code:
volVectorField E I am not interested in lengthy codes.:D |
try
Code:
volVectorField E Code:
dimensionedVector("E", dimensionSet(0, 1, 0, 0, 0, 0, 0), vector(2.e06, 0, 0)) |
Thanks Daniel.:)
I prefer shortened versions every time. Just another short question: Since these two volVectorField "E" and volScalarField "rhoE" are initialized from createFields.H and act on internal field (they are not present in Boundary conditions); I don't want to put them in 0 Folder. So they should be Code:
runTime.timeName(), |
try it out and see. But with those settings it will not read anything form the zero directory.
|
Thanks Daniel for your fast and correct responses.
|
Dear Daniel
These fields I introduced in my createFields.H file are internally active fields, so I don't want to define a Boundary condition file in my $Foam_case/0 folder. I had these lines in my createFields.H file: Code:
volScalarField rhoE rhoE file cannot be found in 0 folder. So what I did was initializing the rhoE as follows: Code:
volScalarField rhoE since after Initializing I have introduced a for loop for setting internal values for rhoE? Right now, this part in my createFields.H file is as follows. Code:
volScalarField rhoE |
Why not take your field you created and output the result and look at the values in ParaView? This will tell you if you are correct or not.
|
1 Attachment(s)
Daniel
Many thanks for your hints. Actually, right now I am capable of defining the internalField of two variables "rhoE" and "E" correctly. However, since the rhoE distribution very close to the one of my boundaries are important, I want to extrapolate from internalField to that boundary location and give a value for rhoE on that boundary. Because If I don't do that, my distribution of rhoE starts form 0 (at the boundary) and then reaches to the internalField value. In the appended picture, it is evident that the distribution starts from zero and reaches to the internal value. I have thought sth like this: Code:
Is there any way to extrapolate the internal field and put it on related boundary inside createFields.H file? Even , I tried sth like this: Code:
|
PS: Here I have specified the location of boundary by xPos and yPos as:
Code:
if (xPos [i] > 9.3e-06 && xPos [i] < 18.6e-06 && yPos [i] == 0.0) Code:
forAll(rhoE.boundaryField(),boundaryI) Code:
xPos [i] > 9.3e-06 && xPos [i] < 18.6e-06 && yPos [i] == 0.0 Please somebody tell me why this happens?:confused::confused::confused::confused: |
All times are GMT -4. The time now is 20:39. |