|
[Sponsors] |
April 29, 2019, 10:27 |
|
#21 |
Member
Priyanka P
Join Date: Apr 2019
Location: Germany
Posts: 40
Rep Power: 7 |
Thank you so much for your reply.
I am not using blockMeshDict to generate mesh, instead I am using Salome for that. then how can I define a face now? Thank you Last edited by priyankap; April 29, 2019 at 11:38. |
|
April 29, 2019, 11:37 |
|
#22 |
Member
Priyanka P
Join Date: Apr 2019
Location: Germany
Posts: 40
Rep Power: 7 |
Hi,
How can define my cellSet if I am using ideasUnvToFoam utility to import my mesh from salome to openfoam? because in this case, I can't use topoSetDict to define my regions. Instead, I am using following command for this: Code:
splitMeshRegions -cellZones -overwrite | tee log.splitMeshRegions |
|
April 29, 2019, 12:12 |
Internal Energy
|
#23 |
Member
Shailesh BG
Join Date: Aug 2017
Location: Bangalore
Posts: 39
Rep Power: 9 |
Hi,
'h' here is the internal energy/enthalpy [J/Kg] of the system. To get a better understanding of 'h' and other constants used in the fvOptions framework, I would suggest going through this thread: Help with the units of enthalpy (h) in chtMultiRegionFoam In that thread, it is confirmed that the 'h' given in fvOptions does represent power (Watts), so your understanding of putting the power value there is correct. But, there is one more important option to consider, i.e.: What is the volume mode of your heat source? Here as you can see there are two options: i) Absolute: It assigns a single emission rate to the whole source, no matter if the source consists of 2 cells or 100 cells. So here the value is given directly as quantity [W]. ii) Specific: Here the value is given as <quantity>/m^3 [W/m^3] Note: If it is 1000W directly then it is an absolute source. This and the definitions for every field entry in fvOptions is defined in this blog, https://caefn.com/openfoam/page/3 Now, for the relationship between enthalpy and the temperature difference, basically (H2 -H1) = rho*Cp* (T2 -T1) .................................................. ............(i) where: rho is density Cp is specific heat at constant pressure The way it is implemented in the solver is by using thermal diffusivity coefficient; alpha = kappa/(rho*Cp) When equation (i) is applied to the case of a simple slab it reduces to the equation which you have given. So to understand how the temperature is calculated, I would suggest first finding out the value of alpha for your system and then substituting the respective values into equation (i). To get a perfect understanding of how energy balance and resulting temperature distribution is calculated for each cell, go through your solver's source code, it does take time but it is worth it (and most of the terms are explained in that thread.) I do not know Salome, so sorry I won't be able to help you with that.
__________________
Regards, Shailesh |
|
April 29, 2019, 17:57 |
|
#24 |
Member
Priyanka P
Join Date: Apr 2019
Location: Germany
Posts: 40
Rep Power: 7 |
thank you so much for your help. It was really useful.
|
|
May 2, 2019, 12:17 |
|
#25 | |
Member
Priyanka P
Join Date: Apr 2019
Location: Germany
Posts: 40
Rep Power: 7 |
Quote:
Hi Shailesh, I am using ideasUnvToFoam utility instead of blockMeshDict because I made my geometry in Salome. So I created the patch also in Salome. After that, I tried using topoSet as per your suggestion. My toposetDict is given below: Code:
FoamFile { version 2.0; format ascii; class dictionary; object topoSetDict; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // actions ( // wall { name hot; type faceSet; action new; source patchToFace; sourceInfo { name "hotFace"; } } // Select based on faceSet { name hotFaceCellSet; type cellSet; action new; source faceToCell; sourceInfo { set hot; // Name of faceSet //option neighbour; // cell with neighbour in faceSet //option owner; // ,, owner option any; // cell with any face in faceSet //option all; // cell with all faces in faceSet } } ) Code:
Create time Create polyMesh for time = 0 Reading topoSetDict Time = 0 mesh not changed. Created faceSet hot Applying source patchToFace Adding all faces of patch hotFace ... Found matching patch hotFace with 1092 faces. faceSet hot now size 1092 Created cellSet hotFaceCellSet Applying source faceToCell Adding cells according to faceSet hot ... cellSet hotFaceCellSet now size 1092 End Code:
Creating finite volume options from "constant/fvOptions" Selecting finite volume options model type scalarSemiImplicitSource Source: heatSource - selecting cells using cellSet hotFaceCellSet --> FOAM FATAL ERROR: Illegal content 4105 of set:hotFaceCellSet of type cellSet Value should be between 0 and 3956 From function void Foam::topoSet::check(Foam::label) in file sets/topoSets/topoSet.C at line 189. FOAM aborting #0 Foam::error::printStack(Foam::Ostream&) at ??:? #1 Foam::error::abort() at ??:? #2 Foam::topoSet::check(int) at ??:? #3 Foam::cellSet::cellSet(Foam::polyMesh const&, Foam::word const&, Foam::IOobject::readOption, Foam::IOobject::writeOption) at ??:? #4 Foam::fv::cellSetOption::setCellSet() at ??:? #5 Foam::fv::cellSetOption::cellSetOption(Foam::word const&, Foam::word const&, Foam::dictionary const&, Foam::fvMesh const&) at ??:? #6 Foam::fv::option::adddictionaryConstructorToTable<Foam::fv::SemiImplicitSource<double> >::New(Foam::word const&, Foam::word const&, Foam::dictionary const&, Foam::fvMesh const&) at ??:? #7 Foam::fv::option::New(Foam::word const&, Foam::dictionary const&, Foam::fvMesh const&) at ??:? #8 Foam::fv::optionList::reset(Foam::dictionary const&) at ??:? #9 Foam::fv::optionList::optionList(Foam::fvMesh const&, Foam::dictionary const&) at ??:? #10 Foam::fv::options::options(Foam::fvMesh const&) at ??:? #11 ? at ??:? #12 __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6" #13 ? at ??:? Aborted (core dumped) I don't understand what I did wrong. Can you please guide me if possible? Thank you |
||
May 3, 2019, 06:51 |
|
#26 |
Member
Priyanka P
Join Date: Apr 2019
Location: Germany
Posts: 40
Rep Power: 7 |
Hi Shailesh,
I tried making cellSet as you suggested, bu it is giving me errors, and when I tried to view it in paraFoam. It shows the following: When I create faceSet, it seems to be working, as you can see in the figure below that the red area is the faceSet. But when I try to make cellSet on the same faceSet, it comes our like some rough shapes on the faceSet. My topoSetDict file is given below for your reference. Code:
actions ( { name hot1; type faceSet; action new; source patchToFace; sourceInfo { name "hotFace"; } } //cellSet { name hotcell; type cellSet; action new; source faceToCell; sourceInfo { set hot1; // Name of faceZone, regular expressions allowed option any; // master/slave } } My requirement is to make a cellSet exactly same as faceSet, which means just one suface/face of the box, as you can see in the figure of faceSet below. I shall be highly thankful if you can help me out in this. |
|
May 3, 2019, 10:35 |
Change source info option
|
#27 |
Member
Shailesh BG
Join Date: Aug 2017
Location: Bangalore
Posts: 39
Rep Power: 9 |
Hi,
This is my guess. It may be because the option 'any' is selected in the source info while defining the cellSet. Code:
option any; // cell with any face in faceSet Could you try changing this option to i) owner and ii) all (this might be more accurate as it asks to select only those cells which have all its faces in the faceSet), and see if it correctly selects the cellSet. If paraFoam shows the correct cell distribution then you can add heat sources to it.
__________________
Regards, Shailesh |
|
May 3, 2019, 12:24 |
|
#28 |
Member
Priyanka P
Join Date: Apr 2019
Location: Germany
Posts: 40
Rep Power: 7 |
Hi,
Thank you for your reply. I already tried these options and even then it is not selecting just the faceSet. When I use i) owner, it remains same as "any" and when I use ii) All, it selects nothing. I am attaching the dropbox link to my case, I would be grateful if you can please have a look on it. https://www.dropbox.com/sh/3fy3k575f...MLiNQ-WOa?dl=0 Thank you. |
|
May 7, 2019, 09:56 |
Working with Structured Mesh
|
#29 |
Member
Shailesh BG
Join Date: Aug 2017
Location: Bangalore
Posts: 39
Rep Power: 9 |
Hi,
Very sorry for such a late reply, I was not in town. Apart from the mesh creation in Salome, the topoSet creation of cellSet and fvOptions definition of the source to that cellSet should be the same. I do not know Salome, so just to check if the process works I created a simple cube mesh using blockMesh and used the same topoSet to define the cellSet and gave that cellSet scalarSemiImplicitSource. And it works, the option I used in topoSet selection was "any". I have attached the paraFoam screenshot showing the cube with the lower face acting as the heat source, on the RHS of the screenshot I have shown just the cellSet. The only difference might be that Salome has created an unstructured mesh, so when you use the option "any", it is selecting interior cells also. You can visualize the cellSet generated in paraFoam, on the left-hand side properties column select the option "Include Sets" under Selection. This should give you the 'cellSet' and the 'faceSet' option under Mesh Parts. See if the cellSets are selected properly. If the cellSets selected are unruly because of the unstructured mesh, then creating a structured mesh just around your heat source face in Salome would solve your problem.
__________________
Regards, Shailesh |
|
February 17, 2022, 03:03 |
|
#30 | |
New Member
ZhuangLi
Join Date: Jan 2022
Posts: 13
Rep Power: 4 |
Quote:
Hi Lasse, I am also working on adding heat source to every cell in chtMultiRegionSimpleFoam, could you please share the dropbox link again, it doesn't work now. It would be very helpful to me. __________ Best regards, zhuangli |
||
February 17, 2022, 03:11 |
|
#31 | |
New Member
ZhuangLi
Join Date: Jan 2022
Posts: 13
Rep Power: 4 |
Quote:
Hi Shailesh, I am also working on adding heat source to every cell in chtMultiRegionSimpleFoam, could you please share the dropbox link from Lasse, it does not work now. __________ Best regards, zhuangli |
||
February 17, 2022, 03:52 |
|
#32 |
Senior Member
Lasse Brams Vinther
Join Date: Oct 2015
Posts: 118
Rep Power: 11 |
Hello Zhuangli,
That link no longer works, however, there is a new link 3 posts below the original which works. It's here as well: https://www.dropbox.com/s/4dxbyvk5a2...on.tar.gz?dl=0 Let me know if there are any questions in this regard. |
|
February 17, 2022, 04:10 |
|
#33 | |
New Member
ZhuangLi
Join Date: Jan 2022
Posts: 13
Rep Power: 4 |
Quote:
Oh Lasse, thank you so much. I can receive your reply so soon. you save me online! Zhuangli |
||
February 17, 2022, 05:11 |
|
#34 | |
New Member
ZhuangLi
Join Date: Jan 2022
Posts: 13
Rep Power: 4 |
Quote:
The version of OpenFOAM I use is v2012. I am a new Foamer, and what modifications you have done with chtMultiRegionSimpleFoam and make it to meet adding heat source by cells? ______ Regard! Zhuangli |
||
February 17, 2022, 05:29 |
|
#35 |
Senior Member
Lasse Brams Vinther
Join Date: Oct 2015
Posts: 118
Rep Power: 11 |
The code is for OpenFOAM V4.0 I believe and it's quite some time ago since I made it, however, just looked briefly at it and the main changes are the following:
Add volPowerField to createFluidFields Code:
PtrList<volScalarField> volPowerFluid(fluidRegions.size()); Info<< " Adding to volPowerFluid\n" << endl; volPowerFluid.set ( i, new volScalarField ( IOobject ( "volPower", runTime.constant(), fluidRegions[i], IOobject::MUST_READ, IOobject::AUTO_WRITE ), fluidRegions[i] ) ); Code:
volScalarField& volPower = volPowerFluid[i]; Code:
energySource { type scalarCodedSource; //scalarSemiImplicitSource active true; name sourceTime; scalarCodedSourceCoeffs //scalarSemiImplicitSourceCoeffs S(x) = Su + Sp*x // q in [W]; or in [W/m³] if you use specific mode { selectionMode all; fields (h); fieldNames (h); name sourceTime; codeInclude #{ #}; codeCorrect #{ // Pout<< "**codeCorrect**" << endl; #}; codeAddSup #{ const scalarField& V = mesh_.V(); const vectorField& C = mesh_.C(); const volScalarField volPower = mesh().lookupObject<volScalarField>("volPower"); scalarField& hSource = eqn.source(); forAll(C, i) { hSource[i] -= volPower[i]*V[i]; } //Pout << "***codeAddSup***" << endl; #}; codeSetValue #{ // Pout<< "**codeSetValue**" << endl; #}; // Dummy entry. Make dependent on above to trigger recompilation code #{ $codeInclude $codeCorrect $codeAddSup $codeSetValue #}; } sourceTimeCoeffs { // Dummy entry } } |
|
February 18, 2022, 09:55 |
|
#36 |
New Member
ZhuangLi
Join Date: Jan 2022
Posts: 13
Rep Power: 4 |
Hi Lassse,
I have learnt the sharing for sometime. But, I did not understand why it could be “hSource[i] -= volPower[i]*V[i]; ”, As the equation shows, the dimension of hSource is watt , not (w/m3) . The heat source’s distribution is generated from solid region in my case, which is different between iterations. At the same time, I noticed the hEqn in solveSolid.H file(show below), and the dimension of h is (w/m3). I got comfused with the dismatch dimension. Am I right? p { margin-bottom: 0.1in; line-height: 115%; background: transparent } for (int nonOrth=0; nonOrth<=nNonOrthCorr; ++nonOrth) { fvScalarMatrix hEqn ( ( thermo.isotropic() ? -fvm::laplacian(betav*thermo.alpha(), h, "laplacian(alpha,h)") : -fvm::laplacian(betav*taniAlpha(), h, "laplacian(alpha,h)") ) == fvOptions(rho, h) ); hEqn.relax(); fvOptions.constrain(hEqn); hEqn.solve(); fvOptions.correct(h); } ___________ Regard! Zhuangli p { margin-bottom: 0.1in; line-height: 115%; background: transparent } |
|
August 3, 2024, 02:42 |
|
#37 | |
Member
Nikos
Join Date: Aug 2012
Location: Greece
Posts: 30
Rep Power: 14 |
Quote:
Sorry, if I ask, but I don't understand what is the purpose of "-" here "hSource[i] -= volPower[i]*V[i];" ? Why can't you just use "hSource[i] = volPower[i]*V[i];" ? Also why "-" and not "+" e.g. "hSource[i] += volPower[i]*V[i];" ? It's so obscure for me.. Thanks Nikos |
||
Tags |
cell, chtmultiregionsimplefoam, heatsource |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
heat source in one cell only! | David UTFSM MEC | Fluent UDF and Scheme Programming | 1 | October 15, 2013 18:14 |
centOS 5.6 : paraFoam not working | yossi | OpenFOAM Installation | 2 | October 9, 2013 02:41 |
friction forces icoFoam | ofslcm | OpenFOAM | 3 | April 7, 2012 11:57 |
DecomposePar links against liblamso0 with OpenMPI | jens_klostermann | OpenFOAM Bugs | 11 | June 28, 2007 18:51 |
UDFs for Scalar Eqn - Fluid/Solid HT | Greg Perkins | FLUENT | 0 | October 11, 2000 04:43 |