Replacing Uniform BC with zeroGradient
Hello,
I have a problem when writing a scalar field into the time folders. The field is initially specified as: volScalarField mu("mu", E/(2.0*(1.0 + nu))); Where E and nu are obtained from the test case mechanical properties file. I have used the following code to write the scalar field mu inside each time folder so that I can view the results in para view: Code:
if(runTime.outputTime()) Code:
...LIST OF VALUES FOR EACH CELL ABOVE HERE If not, would it be possible for me to create a bash script (such as Allrun) in which a for loop and sed command is used to go through each time directory inside of the case and replace the BC with the required zeroGradient? Thanks. |
Hallo,
If you create your field in the following manner, you should obtain the effect that you are looking for: Code:
volScalarField mu Code:
mu.correctBoundaryConditions(); Kind regards Niels |
Thank you so much for your help Niel, I was getting a volScalarField re-deceleration error but when I deleted the equation from the other header file where it was initialy defined the solver compiled fine.
Could you please help me with one more problem? Inside of my main .C file I have made the variable "mu" temperature dependant and made it change in the time loop in the following way: Code:
if(mu.internalField()[cellI]<(1.27941e+07+(deltaLame*3))){ if(mu.internalField()[cellI]<(mu+(deltaLame*3))) I get errors, I also tried to replace mu with: E.internalField()/(2.0*(1.0 + nu.internalField())) But again I got a long list of errors. Could you please suggest a method for defining mu here so that I do not have to manually replace and recompile the solver when I change the variable it is dependant on? Your help is greatly appreciated. Thank you. |
Good morning,
You could merely create another volScalarField called muLimit, and then make the comparison in the if-statement on a cell per cell basis. This would also allow you to have a spatially varying limit. Kind regards, Niels |
I am now adding a time and temperature dependant thermal conductivity, I have modified the code in the main .C file and it works as expected however, I now have the same problem with DT in the readThermalProperties file as I did for mu and lambda, I mean in the output file in the time step folder the boundary field value is set as uniform at the wall as shown in the first post above.
I have the following code in the readThermalProperties file: Code:
volScalarField DT Code:
..................... Code:
sk@sk-VirtualBox:~/OpenFOAM/sk-2.2.2/applications/solvers/cureFoam$ wmake Thank you. |
Hallo,
You get an error, because you lack a ",", before the "zeroGradient" part. Kind regards, Niels |
All times are GMT -4. The time now is 14:57. |