|
[Sponsors] |
Again on fixing the value of a variable in e certain volume of the domain |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
March 2, 2012, 10:11 |
Again on fixing the value of a variable in e certain volume of the domain
|
#1 |
Senior Member
Samuele Z
Join Date: Oct 2009
Location: Mozzate - Co - Italy
Posts: 520
Rep Power: 18 |
Dear All,
what I am trying to do has been discussed, yet. Anyway, I am finding it a bit difficult to find a solution, since there are many threads about this question and I can not cope with them all. So, I would like to ask you, for help. What I wanna do is to edit the buoyantSimpleFoam solver, in order to fix the value of the temperature in a sub-volume of my domain. I have a mesh whit a volume patch which contains the cell I want to fix the T (or h) value. The problem I have to face first, are the following: a. in the solver we do not have T, but h. This is not a problem, since for a PIG it stands h = C_p*T, with C_p = const. Now, the question is: what are the next step? Following this tutorial I created my own solver buoyantSimpleFoam_Mod. I edited the file `files' in the Make directory and then I started editing the hEqn.H and the createFields files. Following this thread, I figured out that my hEqn.H file should looks like this: Code:
{ fvScalarMatrix hEqn ( fvm::div(phi, h) - fvm::Sp(fvc::div(phi), h) - fvm::laplacian(turbulence->alphaEff(), h) == fvc::div(phi/fvc::interpolate(rho)*fvc::interpolate(p)) - p*fvc::div(phi/fvc::interpolate(rho)) ); hEqn.relax(); hEqn.setValues(hCells, hVals); hEqn.solve(); thermo.correct(); } One question that comes to my mind is: where should I define these 2 vectors? And how? Also, is it possible to insert the label of the volume patch, instead of the label of each cell? Fuerthermore, I guess that I have to change the file fvSolution in the case/system directory and I think that it is enough to add the following line: Code:
hCells 0; sVals 1000; Could anyone help, please? Thanks a lot, Samuele Last edited by samiam1000; March 2, 2012 at 10:40. |
|
March 2, 2012, 11:55 |
|
#2 |
Senior Member
mauricio
Join Date: Jun 2011
Posts: 172
Rep Power: 17 |
Hi there
one quick thought! u say ou wanna fix the temperature over a range of cells forming a continuous volume right? if so wouldn’t it be easier to make a hole in you geometry and work with boundary conditions? sry but i'm not that much into c++ syntax yet Last edited by calim_cfd; March 2, 2012 at 11:56. Reason: spelling |
|
March 5, 2012, 06:43 |
|
#3 |
Senior Member
Samuele Z
Join Date: Oct 2009
Location: Mozzate - Co - Italy
Posts: 520
Rep Power: 18 |
Actually,
I want to impose the value in a volume in order to have a stronger condition. I have a flux of air inside that volume. And the faces of this volume could be either inlet or outlet . And I don't know how other variables behave on that face. That's why I can not create the cavity. Any other idea? |
|
March 5, 2012, 07:00 |
|
#4 | |
Senior Member
mauricio
Join Date: Jun 2011
Posts: 172
Rep Power: 17 |
Quote:
Code:
inletOutlet Switches U and p between fixedValue and zeroGradient depending on direction of U outletInlet Switches U and p between fixedValue and zeroGradient depending on direction of U inletValue, value outletValue, sry if i'm missing sth theoretically basic here goodluck
__________________
Best Regards /calim "Elune will grant us the strength" |
||
March 5, 2012, 08:40 |
|
#5 |
Senior Member
Samuele Z
Join Date: Oct 2009
Location: Mozzate - Co - Italy
Posts: 520
Rep Power: 18 |
Dear Claim,
I think that what you mean is not what I would like to get. I know about the inletOutlet BC in order to take in account the reverse flow, but what I mean is that I have a volume through which the air flows. So, what I wanna do is to fix the temperature, but I want to make the other variables being evaluated in the whole volume. |
|
March 5, 2012, 09:09 |
|
#6 |
Senior Member
Aurelien Thinat
Join Date: Jul 2010
Posts: 165
Rep Power: 15 |
Hi samiam1000,
I have never done something like that. But my first shot would like : - add a volScalarField I to the solver ; - I = 0 in the volume you want a fixed temperature and 1 everywhere else ; - modify the temperature equation by adding the factor I ; - use setField to impose I and T at the begining. I guess it would do the job no ? |
|
March 5, 2012, 09:25 |
|
#7 |
Senior Member
Samuele Z
Join Date: Oct 2009
Location: Mozzate - Co - Italy
Posts: 520
Rep Power: 18 |
Dear Aurelien,
first of all, thanks for answering. Well, I think that your idea may work, but I need your help.. I mean: 1. how can I add a volScalarField I to the solver? I mean, which is the file to edit and how? 2. how can I set the value of the field I? Thanks for any help you will provide, Samuele |
|
March 5, 2012, 09:46 |
|
#8 |
Senior Member
Aurelien Thinat
Join Date: Jul 2010
Posts: 165
Rep Power: 15 |
1) Have a look at :
http://cfd.iut.ac.ir/files/Tutorial,...20Diego%20.pdf At slide 18, you have an example, just follow these instructions on how to add a volscalarfield. You will just have to change the name T (they add the temperature equation to a basic solver) by any name of your choice. The temperature equation is usually in the file "TEqn.H". 2) To set a value in a domain, have a look at the command "setField" and the "setFieldDict" (look at this in the tutorials). You can easily use this for a cube for example. For more complex geometries, you will have to find a way to define a cellSet. You will have to define a new file "I" in the folder 0 with all your BCs and set fixedValue = 1 everywhere. Then run the command setField. Launch your solver. |
|
March 5, 2012, 10:04 |
|
#9 |
Senior Member
Samuele Z
Join Date: Oct 2009
Location: Mozzate - Co - Italy
Posts: 520
Rep Power: 18 |
Hi Aurelien,
sorry for the silly question, but there is something that I am missing. If you look at buoyantSimpleFoam you can see that you don't have the TEqn.H file, but you have a hEqn.H file. And, since for a PIG it stands h = C_p*T, hence you can modify the hEqn.H, fixing the enthalpy and not the temperature. The point is that I can not und why I have to add a new scalar field. What I would like to do is to modify the existing one. Also, what I can not understand is that if you look at the createField.H file inside the solver you will read: Code:
volScalarField& p = thermo.p(); volScalarField& h = thermo.h(); const volScalarField& psi = thermo.psi(); Thanks again, Samuele |
|
March 5, 2012, 11:01 |
|
#10 |
Senior Member
Aurelien Thinat
Join Date: Jul 2010
Posts: 165
Rep Power: 15 |
Well, my idea was basically to disable the equation of T or h somewhere in the domain by using a scalar 1 or 0 to detect the cellzone.
I saw in other posts that it's possible to fix a value directly (in OF 2.1) in the equations. Maybe you can try this. |
|
March 5, 2012, 11:05 |
|
#11 |
Senior Member
Samuele Z
Join Date: Oct 2009
Location: Mozzate - Co - Italy
Posts: 520
Rep Power: 18 |
I am looking forward to having OF 2.1 installed.. Right now I am running OF 2.0 and I have to edit the source.
I'll try with your solution, though I am not very good with C++ and I will meet some difficulties .. The point is `never give up'.. Thanks again, Samuele |
|
March 8, 2012, 03:53 |
|
#12 |
Senior Member
Samuele Z
Join Date: Oct 2009
Location: Mozzate - Co - Italy
Posts: 520
Rep Power: 18 |
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Error message: Insufficient Catalogue Size | Paresh Jain | CFX | 32 | February 3, 2021 03:37 |
[blockMesh] BlockMesh FOAM warning | gaottino | OpenFOAM Meshing & Mesh Conversion | 7 | July 19, 2010 14:11 |
[blockMesh] Solid volume inside computational domain | francois | OpenFOAM Meshing & Mesh Conversion | 7 | November 19, 2008 16:11 |
How to compute total liquid volume of the whole domain | hsieh | OpenFOAM Post-Processing | 2 | July 13, 2007 18:18 |
Multi_component Vs Additional Variable | Anurag | CFX | 2 | February 4, 2005 16:45 |