|
[Sponsors] |
December 17, 2013, 15:31 |
Problems writing temperature depentant variable
|
#1 |
Member
Join Date: Aug 2013
Posts: 60
Rep Power: 13 |
I am trying to view a variable within para view. I am working with solidDisplacementFoam, in this solver constants (E, nu) are specified within the constant file of the test case, these are read inside one of the solver header files and constant scalar fields are generated from these constants, one of the scalar field is defined as shown:
Code:
volScalarField mu(E/(2.0*(1.0 + nu))); Code:
forAll(mu.internalField(), cellI) { mu.internalField()[cellI] = 100*T.internalField()[cellI]; } mu.correctBoundaryConditions(); Also, I now need to view this variable inside of para view, how would I alter the code to show this? Last edited by sur4j; December 18, 2013 at 15:24. Reason: Making question more understandable |
|
December 18, 2013, 15:32 |
|
#2 |
Member
Join Date: Aug 2013
Posts: 60
Rep Power: 13 |
I have been experimenting with the code and realised that if I add the following I get files for mu written every required time step:
Code:
if(runTime.outputTime()) { mu.write(); } Code:
--> FOAM FATAL IO ERROR: wrong token type - expected word, found on line 14 the punctuation token '(' file: /home/sk/OpenFOAM/sk-2.2.2/run/plateHole/20/((E|rho)|(2*(1+nu))).object at line 14. From function operator>>(Istream&, word&) in file primitives/strings/word/wordIO.C at line 74. FOAM exiting |
|
December 19, 2013, 16:38 |
|
#3 |
Member
Join Date: Aug 2013
Posts: 60
Rep Power: 13 |
I think that the error may have something to do with the file name printing as the formula ((E|rho)|(2*(1+nu))) in every time file, is there a way of changing this. I mean printing the file with a name such as "mu" for example?
Also, I have not told OpenFOAM to read this in the createFields.H file, when I tried this I got errors when compiling the solver. Is defining this in the header file required? I have been spending hours changing so many things with this solver trying to make it work, I initially thought that this would be very simple all I want to do is make the constant mu a variable which changes as 100*Temperature, could someone please help me with this. |
|
December 20, 2013, 08:14 |
|
#4 |
Member
Artem Shaklein
Join Date: Feb 2010
Location: Russia, Izhevsk
Posts: 43
Rep Power: 16 |
hello, sur4j.
You're moving in the right direction. Yes, it's possible for errors to occur in paraview while reading unsuitable characters. You can use different constructors for your field: Code:
volScalarField mu("mu", E/(2.0*(1.0 + nu))); Code:
volScalarField mu ( IOobject ( "mu", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::AUTO_WRITE ), E/(2.0*(1.0 + nu)) ) |
|
December 20, 2013, 14:56 |
|
#5 |
Member
Join Date: Aug 2013
Posts: 60
Rep Power: 13 |
Thank you so much for helping me.
I have tried the code but it still doesnt work. Inside the createFields.H file there is a if statement saying if(thermalStress){calculate T}, since I am solving a thermal problem I added the IOobject inside this if statement and the solver compiled fine, I then ran it on a test case and mu did not write out in any of the time step folders. I then went back into the header file and moved the IOobject mu from inside the IF statement to the start of the code and got an error saying redecleartion of the volScalarField mu which has already been defined inside of the readMechanicalProperties file. So after having these problems I started changing things again, one of the changes was adding the mu.write with the force defined mu constructor code you had written, this compiled. I then set up a test case, this was to apply a temperature BC at the right wall of the plate hole tutorial, I ran the solver on this case and found that mu was written every time step. I then viewed the results inside of para view and got strange results: Temperature: https://imageshack.com/i/ndscesp mu: https://imageshack.com/i/162oysp When I looked at mu inside of the time step folder uniform 9.79413e+06 BC's were set to the hole top and right, the list of values shown above that all look correct (100*T as set in the solver) so I think that it is just that 9.794....BC causing the values to change. Again, I have spent a long time changing things and I am really stuck therefore I would appreciate any help at all with this. Thank you. |
|
December 21, 2013, 06:42 |
|
#6 |
Member
Join Date: Aug 2013
Posts: 60
Rep Power: 13 |
Code:
volScalarField mu ( IOobject ( "mu", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::AUTO_WRITE ),E/(2.0*(1.0 + nu)) ) I have been trying this on different test cases and the results look much better so I think that the symmetry BC set on the plate tutorial was causing some of the problems. I now however have a new problem when I run the solver on the test case I get mu written in each time step folder, this is fine and all the values in the list look fine however, it shows the BC's at the bottom of the list and as explained above a uniform uniform 9.79413e+06 BC is set at the walls automatically (this is the value of mu which is calculated from the formula), how do I remove this BC so that I don't have to manually go and change this to zeroGradient every time? Last edited by sur4j; December 22, 2013 at 08:41. |
|
December 24, 2013, 01:55 |
|
#7 |
Member
Artem Shaklein
Join Date: Feb 2010
Location: Russia, Izhevsk
Posts: 43
Rep Power: 16 |
Okay, it seems that we're done with postprocessing mu in paraview)
Next, you asked me about "E/(2.0*(1.0 + nu))", I just took it from your first message. And to tell the truth I don't know mathematical model of structure analysis model in OpenFOAM. Can you explain what exactly do you want? Just add E=E(T), nu=nu(T) (I guess it's Young's modulus and Poisson's ratio) or add extra stress from material thermal expantion? If latter, you should look for mathematical models describing a process. If former, you can modify original code by changing E and nu from dimensionedScalar type to volScalarField type. After that at each iteration you should update your E=E(T), nu=nu(T) variables and mu(T) = E(T)/(2.0*(1.0 + nu(T))). |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Problem with viewing graphic view when running in UNIX | pitisrisuk | Main CFD Forum | 1 | April 15, 2016 12:39 |
Visible Gemometry to view the inside flow countour | keby9 | FLUENT | 2 | December 22, 2012 13:08 |
para view problem | m.maneshi | OpenFOAM | 0 | December 1, 2009 20:08 |
OpenFOAM on MinGW crosscompiler hosted on Linux | allenzhao | OpenFOAM Installation | 127 | January 30, 2009 20:08 |
meshing F1 front wing | Steve | FLUENT | 0 | April 17, 2003 13:37 |