|
[Sponsors] |
![]() |
![]() |
#21 | |
Senior Member
Samuele Z
Join Date: Oct 2009
Location: Mozzate - Co - Italy
Posts: 520
Rep Power: 18 ![]() |
Quote:
I am trying to do something similar.. I'd like to know in which file I should add this code. Also, how can I use it, once compiled? I mean: what should I change in the case directory? Just a Q file in the my_case/0 folder? Thanks a lot, Samuele |
||
![]() |
![]() |
![]() |
![]() |
#22 |
Member
|
||
![]() |
![]() |
![]() |
![]() |
#23 |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 ![]() ![]() |
This depends on how you generate your mesh/your workflow: certain mesh converters support them, you can use utilities like topoSet ...
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request |
|
![]() |
![]() |
![]() |
![]() |
#24 | |
Member
|
Quote:
Regards, Hossein |
||
![]() |
![]() |
![]() |
![]() |
#25 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 ![]() ![]() |
Quote:
Code:
"time()>timeOff ? 0 : heatSource"
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request |
||
![]() |
![]() |
![]() |
![]() |
#26 |
Member
|
Thanks. It is very powerful.
|
|
![]() |
![]() |
![]() |
![]() |
#27 | |
Member
|
Quote:
Is that condition (time()>timeOff) suitable for a steady state solver? in other word, does time() represent flow time or time name of the results? Thank you in advance, Hossein |
||
![]() |
![]() |
![]() |
![]() |
#28 |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 ![]() ![]() |
time() wold be the iteration number. But isn't switching a sorce term and steady simulation a contradiction?
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request |
|
![]() |
![]() |
![]() |
![]() |
#29 | |
Member
|
Quote:
My intention in the previous post was "How can add a source term to a field for some primary iterations in a steady state solver and then turn off it! Thanks again, Hossein |
||
![]() |
![]() |
![]() |
![]() |
#30 |
Member
Kumudu
Join Date: Oct 2013
Posts: 63
Rep Power: 12 ![]() |
Hi kathrin kissling,
I am almost new to OpenFoam and I want to add a transient heat source to specified points on the Mesh. Actually, I am working on Ground Source heat pump simulation problem. I want to add a source term representing the U-tube in the ground. In this U-tube water is circulating and this loop extract heat from the soil where the U-tube is buried. So, I want to add a volumetric source term such that, q=UA(Ts-Tf), where, Ts is the temperature at the soil and Tf is fluid temperature. U is the overall heat transfer coefficient. This source term should coincide with the ground loop configurations. That is in the three dimensional computational domain, I have to find a points that is in a U-curve and add the above source term to the points in the U-curve. How could I do that. I saw that Kathrin has gave Robin a somewhat related answer. Could you please help me in this. |
|
![]() |
![]() |
![]() |
![]() |
#31 |
Member
Kumudu
Join Date: Oct 2013
Posts: 63
Rep Power: 12 ![]() |
Hi Robin,
I am new to OpenFoam and I want to add a source term into some specified points in the computational domain. I saw, that you have got some help from kathrin_kissling for same type of problem. Can you please tell me how you define this defineQPositionDict other than create.H file. Also how to add this topoSetSource in LaplacianFoam. I think you also used LaplacianFoam for your problem.Please tell me each step to do this. I am really greatfull if you could help me on this. I have copied the answer gave by Kathrin, so that you can remember the steps Best, Kumudu IOdictionary defineQPositionDict ( IOobject ( "defineQPositionDict", runTime.constant(), mesh, IOobject::MUST_READ, IOobject::NO_WRITE ) ); PtrList<entry> regions(defineQPositionDict.lookup("regions")); Info << regions << endl; forAll(regions, regionI) { const entry& region = regions[regionI]; autoPtr<topoSetSource> source = topoSetSource::New(region.keyword(), mesh, region.dict()); cellSet selectedCellsSet ( mesh, "cellSet", mesh.nCells()/10+1 //size estimate ); source->applyToSet ( topoSetSource::NEW, selectedCellsSet ); labelList selection = selectedCellsSet.toc(); forAll(selection, cellI) { alpha1[selection[cellI]] = 1.; //Replace this with your source term calculation } } |
|
![]() |
![]() |
![]() |
![]() |
#32 |
Member
Kumudu
Join Date: Oct 2013
Posts: 63
Rep Power: 12 ![]() |
Hi Bernhar,
I want to add a heat source into specified position in Mesh. I want to add this heat source for time dependent three dimensional diffusion equation. You have defined most of the things as a reply to transient heat source problem of Robin. Can you explain me how to use swak4Foam to define expression source, where I should define. I think heatSourceDict should be defined in system directory. Also I cannot understand how to define CellZones. Please tell me how to add this source term into Diffusion equation. Actually, I want to add this heat source to points in Mesh coinciding ground loop configurations. I am working on ground heat exchanger simulations. This heat exchanger is consist with ground loops buried in ground. I want to simulate ground temperature after installing this loops which extract heat from ground. The heat source should show the loop configuration. Could you please help me in this regard. Kumudu ![]() |
|
![]() |
![]() |
![]() |
![]() |
#33 | |||
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 ![]() ![]() |
Quote:
http://www.cfd-online.com/Forums/ope...tml#post329700 Quote:
Quote:
So you want to have heat sources which are only on some locations. Specification depends on how the locations are specified. Either by cellZones (which is preferable for a number of reasons) or as coordinates where you'll have to write expressions. I'm sorry, but I don't have the time to answer questions were I have almost no information, especially as I suspect that what you need is already covered in some of the existing information/documentation
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request |
||||
![]() |
![]() |
![]() |
![]() |
#34 |
Member
Kumudu
Join Date: Oct 2013
Posts: 63
Rep Power: 12 ![]() |
[QUOTE=gschaider;460353]You've got to add it to the solver otherwise it can't be used. But that is already explained in this thread:
http://www.cfd-online.com/Forums/ope...tml#post329700 Hi gschaider, Thank you very much for replying me. I start learning OpenFoam around three four days ago. And I am still reading the basic. However, I was able to define expressionSource using swaks and I did the same as you explained in the transient source term blog. But, I got an error, kumudu21688@kumudu21688-Inspiron-N5040:~/OpenFOAM/kumudu21688-2.1.1/run/myheatsource$ mylaplacianFoam /*---------------------------------------------------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 2.1.1 | | \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ Build : 2.1.1-221db2718bbb Exec : mylaplacianFoam Date : Nov 03 2013 Time : 11:01:29 Host : "kumudu21688-Inspiron-N5040" PID : 4536 Case : /home/kumudu21688/OpenFOAM/kumudu21688-2.1.1/run/myheatsource nProcs : 1 sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE). fileModificationChecking : Monitoring run-time modified files using timeStampMaster allowSystemOperations : Disallowing user-supplied system call operations // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Create time Create mesh for time = 0 Reading field T Reading transportProperties Reading diffusivity DT SIMPLE: no convergence criteria found. Calculations will run for 15 steps. Calculating temperature distribution swak4Foam: Allocating new repository for sampledSets --> FOAM FATAL IO ERROR: Attempt to return dictionary entry as a primitive file: /home/kumudu21688/OpenFOAM/kumudu21688-2.1.1/run/myheatsource/system/controlDict::functions::theSensor::setName from line 59 to line 63. From function ITstream& primitiveEntry::stream() const in file db/dictionary/dictionaryEntry/dictionaryEntry.C at line 82. FOAM aborting #0 Foam::error: ![]() #1 Foam::IOerror::abort() in "/opt/openfoam211/platforms/linux64GccDPOpt/lib/libOpenFOAM.so" #2 Foam::dictionaryEntry::stream() const in "/opt/openfoam211/platforms/linux64GccDPOpt/lib/libOpenFOAM.so" #3 Foam::SetsRepository::getSet(Foam::dictionary const&, Foam: ![]() #4 Foam::createSampledSet::createSampledSet(Foam::wor d const&, Foam: ![]() #5 Foam::OutputFilterFunctionObject<Foam::createSampl edSet>::allocateFilter() in "/home/kumudu21688/OpenFOAM/kumudu21688-2.1.1/platforms/linux64GccDPOpt/lib/libswakFunctionObjects.so" #6 Foam::OutputFilterFunctionObject<Foam::createSampl edSet>::start() in "/home/kumudu21688/OpenFOAM/kumudu21688-2.1.1/platforms/linux64GccDPOpt/lib/libswakFunctionObjects.so" #7 Foam::functionObjectList::read() in "/opt/openfoam211/platforms/linux64GccDPOpt/lib/libOpenFOAM.so" #8 Foam::Time::run() const in "/opt/openfoam211/platforms/linux64GccDPOpt/lib/libOpenFOAM.so" #9 Foam::Time::loop() in "/opt/openfoam211/platforms/linux64GccDPOpt/lib/libOpenFOAM.so" #10 Foam::simpleControl::loop() in "/opt/openfoam211/platforms/linux64GccDPOpt/lib/libfiniteVolume.so" #11 in "/opt/openfoam211/platforms/linux64GccDPOpt/bin/mylaplacianFoam" #12 __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6" #13 in "/opt/openfoam211/platforms/linux64GccDPOpt/bin/mylaplacianFoam" Aborted (core dumped) I can't understand how to relate the heaterZone with ControlDict. This is where I defined the posted comment that you explained. /*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 2.1.1 | | \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class dictionary; location "system"; object controlDict; } libs ( "libswakFunctionObjects.so" ); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // application mylaplacianFoam; startFrom latestTime; startTime 0; stopAt endTime; endTime 15; deltaT 0.05; writeControl runTime; writeInterval 1; purgeWrite 0; writeFormat ascii; writePrecision 6; writeCompression off; timeFormat general; timePrecision 6; runTimeModifiable true // ************************************************** *********************** // functions { theSensor { type createSampledSet; outputControl timeStep; outputInterval 1; setName TSensor; setName { type cloud; axis x; points ( (0 0 0) // core center ); } } } libs ( "libswakFunctionObjects.so" ); This is probably wrong. But, my problem is actually not this. I am still trying to undersatnd the addition of heat source into the LaplacianFoam. |
|
![]() |
![]() |
![]() |
![]() |
#35 |
Member
Kumudu
Join Date: Oct 2013
Posts: 63
Rep Power: 12 ![]() |
[QUOTE=gschaider;460353]For instance I don't know what a "ground loop" is.
I am sorry for not mentioning my problem beforehand. Here is my problem definition............. General idea about ground source heat pump..... Ground source heat pumps are used to heat up and cool down a building in summer and winter. They used the utilization of temperature difference between air and ground to transfer heat from ground to buildings or reject heat from buildings to ground. However, ground temperature is usually lower than the building setpoint temperature, therefore, a heat pump is used to transfer heat from low temperature medium ground to building. This heat pumps actually act as a refrigerators. So first heat is extracted from ground through ground heat exchangers and them it is transfered to heat pump. I have attached a schematic of Ground source heat pump. My main target is to simulate the ground temperature after installing this ground heat exchanger and also outlet fluid temperature of the ground heat exchanger. Ground heat exchanger definition roughly.... Ground heat exchanger is consisted with U-pipes, where the water is circulating through it. This U-pipes are installed in a borehole (a hole in ground about 45-150m deep). This borefole is filled with grout (This grout is filled to prevent water draining into borehole and also to enhance heat transfer through U-pipes to soil). Grout has higher thermal conductivity than soil. I have attached the schematic of a borehole with this message. These ground heat exchangers are used to extract or reject the heat into the ground. Simulation targets 1. Simulate ground temperature using 3D diffusion equation. ρc ∂ T/∂t =( ∇ .λ ∇ T)+S ---->(1) So this S is the source term that I want add to the Mesh coinciding with U-pipes location and the configuration. S is the volumetric heat source like this, S=qn dV The source term would be like this, qn=- λ∂ Ts/∂n=U( Ts - Tf) Tf is the fluid temperature Ts is the soil temperature U overall heat transfer coefficient 2. Simulate fluid temperature circulating through ground heat exchanger ρc ∂ Tf/∂t+ hP (Tf- Ts ) = m ( Tf,out- Tf,in) ---->(2) Tf,out is the outlet temperature of the U-pipes Tf,in is the inlet fluid temperature h is the force convection heat transfer coefficient P is the perimeter of pipe m is the mass flow rate of the pipe c is the heat capacity *** Equation (1) and (2) should be solved conjugately. My supervisor told me that, I shouldn't mesh the U-pipes. But represent this U-pipe heat transfer with the term S(heat source) by adding it to the same location as the U-pipes. This S is dependent on location and fluid temperature as well. It is also a transient term. So, could you please tell me how would I do this with OpenFoam. Is this possible to do in OpenFoam?. Thanks. I am sorry for writing long explanation. Kumudu Last edited by Kumudu; November 3, 2013 at 17:30. |
|
![]() |
![]() |
![]() |
![]() |
#36 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 ![]() ![]() |
[QUOTE=Kumudu;460370]
Quote:
Anyway: if you use this approximation for the average of T_fluid then it is possible with relatively little effort. Otherwise it is not that easy
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request |
||
![]() |
![]() |
![]() |
![]() |
#37 | |
Member
Kumudu
Join Date: Oct 2013
Posts: 63
Rep Power: 12 ![]() |
[QUOTE=gschaider;460553]
Quote:
------------------------------------------------------ Hi gschaider, Thanks for the reply. This is the way I have to simulate. 1. Guess minimum outlet fluid temperature(T_f,out,init) that would required to run the heat pump. Then, I can calculate heat extraction rate( There is a second order equation that relate the required heat load, outlet temperature of the ground U-pipe and heat extraction rate (Q_ext). 2. Calculate initial inlet temperature(T_f,in,init) from the following equation, Q_ext=m_dot*cf(T_f,out,init-T_f,in,init) 3. Find initial fluid temperature of circulating fluid =(T_f,out,init +T_f,in,init)/2 4. Solve 3D diffusion equation first taking S=qn* δ(x-x_sf)*dV qn=U*A*(Ts-Tf), Ts is the soil temperature , Tf :fluid temperature δ is a dirac delta function(radial basis function) which use to smear this heat flux through some grid points (actually, will smear the heat flux into some radial distance from the points which coincide with the ground U-loop). Using this delta function, I will be able to make this heat source 3 dimentional and shows the ground loop in the domain, without generating mesh for pipes. x_sf= a point on the pipe ( r distance from points that we place the heat source initially) //.......................................... Do you think this can be done?. If so, what is the solver I should use?. How to modify the existing solvers and .H files? ![]() //................................................. 5. Soil temperature can be calculated from solving diffusion equation first 6. Solve the convection equation assuming 1D domain with having the same length as U-pipe. ρc (∂T_f)/∂t+ h*P(T_f- T_s@pipe_surface )=m_dot*c_f (T_f,out-T_f,in) Inlet temperature is specified. Initial fluid temperature is given T_s@pipe_surface is known h and P are known T_f,out is the fluid temperature at end point of 1 dimensional domain. 7. So, new fluid temperature is known, solve diffusion equation again. So, this is a conjugate process. //////////////////////////////////// Please suggest me a method or some commands to find specified points which will be coinciding with U-loop Then, how to add this heat source into the transient diffusion equation which will only applicable for specified points. If OpenFoam has some commands to define a radial basis function, to smear this heat source within a r distance from this specified points which will make 3D heat source. Then, how to solve, 1 Dimensional equation for fluid , without generating mesh for pipe. Is it possible?????? Thanks you very much for even replying me. I don't have someone to get some suggestion about this. Please tell me how to do this if you have some idea, about this. ![]() ////////////////////////////////////////////////////////////////////// based on the required heat extraction rate. Give inlet temperature value to fluid. |
||
![]() |
![]() |
![]() |
![]() |
#38 | |||
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 ![]() ![]() |
[QUOTE=Kumudu;460572]
Quote:
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request |
||||
![]() |
![]() |
![]() |
![]() |
#39 |
Member
Kumudu
Join Date: Oct 2013
Posts: 63
Rep Power: 12 ![]() |
[QUOTE=gschaider;462458]
Thanks for reply. I give up that idea. These days, I am trying to combine, transient diffusion equation for solid and scalar transport equation for fluid. I have more than one solid regions (pipe, grout and soil). I am hoping to define different cell zones for water, pipe, and grout using topoSet dict. I am following the chtMultiRegionFoam for this. I hope I can do this. The regoins are coupled through boundary conditions. Not through the source terms. It is a difficult task. I saw a tutorial for blockCoupledTransientFoam posted by OpenFoam. This only deal with one fluid and solid region. But it handles the source term via defining alpha value. (0 for fluid , 1 for soild ). So, changing the given code that is applicable for multiple region is somewhat difficult for me. If it is also has been done by the openFoam group, please let me know. But, the regions should be defined by Toposet Dictionary not by patches. Dealing with topoSet is easy. Thanks again ![]() |
|
![]() |
![]() |
![]() |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Problem of SOURCE term gradient in UDS | wind | Fluent UDF and Scheme Programming | 6 | December 1, 2022 14:21 |
UDF source term | Rajani Kanth.B | Fluent UDF and Scheme Programming | 4 | May 1, 2013 09:31 |
[Gmsh] Compiling gmshFoam with OpenFOAM-1.5 | BlGene | OpenFOAM Meshing & Mesh Conversion | 10 | August 6, 2009 04:26 |
Adding a momentum source term | segersson | OpenFOAM Running, Solving & CFD | 5 | March 2, 2006 23:06 |
UDF Source Term Units? | Brian | FLUENT | 1 | October 24, 2005 09:15 |