CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Pre-Processing

codedFixedValue in laplacianFoam

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 28, 2021, 06:51
Smile codedFixedValue in laplacianFoam
  #1
New Member
 
Saxony
Join Date: Oct 2021
Posts: 2
Rep Power: 0
Saurabh-Tatyaso.Nikam@stu is on a distinguished road
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
Saurabh-Tatyaso.Nikam@stu is offline   Reply With Quote

Reply

Tags
codedfixedvalue, laplacianfoam, temperature bc


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


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


All times are GMT -4. The time now is 13:52.