|
[Sponsors] |
October 28, 2021, 06:51 |
codedFixedValue in laplacianFoam
|
#1 |
New Member
Saxony
Join Date: Oct 2021
Posts: 2
Rep Power: 0 |
Hey guys, I am new to openfoam and programming, so please neglect my programming skills.
Problem Statement: A 3D block with (1 x 1 x 0.01)m dimensions. Assuming it 2D. I want to move my heat source on top surface in X direction. Actually instead of heat source I was planning to assign a temperature value to cell. Now thing is i want to move this cell with constant temperature in X direction with respect to time. for eg : at t=0 sec, X= 1st cell ; at t=1 sec, X=2nd cell ; at t=3sec, x=4th cell and so on . Note: temperature remains constant for all time instants and position. I have tried to use codedFixedValue as i can grab time and position. But i think i am making some mistakes with code. Can you guys help me to sort it out? Also the thing is I have to stick with laplacianFoam only. Also please tell me will this method work for me or i can use something else? Following is my code. I know I am doing wrong stuff, i hope you get the idea what exactly i want to do. Code:
codedPatch { type codedFixedValue; value uniform 0; name codedPatchBC; code #{ const scalar pi = constant::mathematical::pi; const fvPatch& patch = this->patch(); const vectorField& cf = patch.Cf(); const scalar t = this->db().time().value(); scalarField& field = *this; forAll(cf, i) { scalar x = cf[i].x(); for (x=0,t=0; x<0.5 && t<0.5; x++, t++ ) { field[i] = 500; } } #}; } |
|
Tags |
codedfixedvalue, laplacianfoam, temperature bc |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
including parameter file in codedFixedValue | Loekatoni | OpenFOAM Running, Solving & CFD | 4 | November 9, 2023 17:56 |
Multi-region problem using laplacianFoam | zfaraday | OpenFOAM Pre-Processing | 9 | March 19, 2023 07:20 |
Syntax of codedFixedValue | trailer | OpenFOAM Running, Solving & CFD | 1 | July 24, 2021 07:17 |
[sedFoam] codedFixedValue does not transport alpha fields | victor13165 | OpenFOAM Running, Solving & CFD | 0 | July 13, 2021 10:30 |
codedFixedValue: accessing other patch causes crash in parallel | RL-S | OpenFOAM Running, Solving & CFD | 2 | December 24, 2019 22:20 |