Using swak4foam to implement a BC for heat convection with h(Tamb,Twall)
Dear foamers,
Lately I have been working on the implementation of a BC for heat convection using swak4foam. You can check this thread (problems creating volscalarfield expressionfield function object) I started before Christmas regarding this matter. The BC I would like to use is externalWallHeatFluxTemperature, but this one uses a constant value for the h coefficient and what I want is that this coeff. is calculated each time step depending on the ambient and wall temperatures. As I'm not an experinced user of swak4foam (not even of OF) I have been facing several problems since I started with this. However, now I think I'm starting to do things right. I will list in the following lines the steps I have in mind to develop de desired BC (some of them have been already taken with a little success): 1. As a first step I created a BC with groovyBC that solves the convection heat transfer for T. Here comes the code: Code:
convection_wall 2. Creation of the required fields needed to calculate h coefficient. These field are: Pr (Prandtl) nš, Ra (Raileigh) nš, Nu (Nuselt) nš and h_Ext (convection coeff. itself). These fields are created by means of the expressionField function object. Here comes the Pr creation as an example: Code:
Pr_Expression Code:
Pr_convection_wall I have some questions about my procedure. First of all, I don't know if it's a proper method and I'm sure it's not the best one for sure, but I think it could work in my case. Any suggestion on how to improve it? One thing I would like to know is how can I access the kappa field of my solid region in the thermophysicalProperties file in the step 1 of my procedure? (marked in red) My intention is that the BC retrieves the value of k automatically from the thermophysicalProperties file like externalWallHeatFluxTemperature BC does when the field kappa is set to solidThermo. Is there a way to do that? I know how to retrieve the values of rho and alpha by means of the use of aliases but I have no clue on how to do that with kappa... On the other side, I would like to know if its possible to use the #include directive within the variables field. My intention is to create a file with the formulas marked in blue in the step 3 and call them with a simple line instead of writing all of them in every function object (I have to write them all in every field created. Besides that, in the example above I only talk about one patch but I have to set up more than one patch with the same BC in the same case!!) This is all for now. So far I have only implemented the calculation of the Pr and Ra fields and I have to take a look at it because I think the results I got are not correct. That's why I ask above if my procedure is correct or not, because I checked the formulas and they look correct... I will really apprecaite any hint you can share with me in regards of the matters I mention above. Many thanks in advance. Alex |
Just for the information of the ones that may be interested, finally I managed to implement my BC. I hope that everything does what its meant to do, I still have some doubts about it that I would like to be resolved by someone with deeper knowledge in swak4foam than me.
First of all, I found out that the #include directive can be used normally, the problem I had was that I enclosed the #include statement within quotation marks as if it was a variable itself within the variables field. This is the correct way to use it: Code:
Pr_convection_wall NON-RESOLVED POINTS 1. Quote:
2. Quote:
3. Another problem I have to face is that, according to my procedure, the fields created are of type surfaceScalarField. Originally I wanted them to be volScalarField although I only worked with the patch fields. The fact that I only manipulate values at patches gave me a lot of troubles when I tried to create the fields as volScalarFields, that was why I finally ended up working with surfaceScalarFields instead. The main problem of the surfaceScalarFields is that they cannot be displayed in paraview, at least I haven't found the way to do it... How can I display surfaceScalarFields in paraview? If it's not possible, How could I proceed to create the fields as volScalarFields but only work with the values at patches? ------------------------------------------------------ I hope someone can give me some tips or hints so that I can finally finish the developement of my BC. Any word you can send me will be very welcome. Many thanks in advance, Alex |
1) You can modify the solver to create a volScalarField from the kappa value in constant/solidRegion/thermophysicalProperties and then you should be able to access it from groovyBC
2) I'll have to a dig about it a bit more, I have no clue right now 3) Have a look at this tool made by wyldkat (thanks to him) https://github.com/wyldckat/reconstr...ctSurfaceField If not you could make a tool that reads the surfaceScalarFields and then calls Code:
fvc::reconstruct(scalarField) |
Thanks for your quick response Mr. ssss.
Quote:
Quote:
Quote:
Thank you very much for your advices, it's been of much help (maybe not as much as I needed, though) Regards, Alex |
Do you know how to compile a new solver? In this case I can help you to implement the new things I've told you.
|
I think I have some documentation regarding the compilation of new solvers. I never tried it because I never had the need to do it, but I think if I dig a little into my files I can find info regarding the compilation of solvers and utilities.
I will really appreciate if you help me with the implementation! :) |
All times are GMT -4. The time now is 13:18. |