# codedFixedValue in laplacianFoam

 Register Blogs Members List Search Today's Posts Mark Forums Read

 October 28, 2021, 05: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; } } #}; }``` Thanx in Advance

 Tags codedfixedvalue, laplacianfoam, temperature bc