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

setFieldsDict for spatially varying field

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

Reply
 
LinkBack Thread Tools Display Modes
Old   October 9, 2017, 09:17
Default setFieldsDict for spatially varying field
  #1
New Member
 
Joanne
Join Date: Aug 2017
Location: Ireland
Posts: 6
Rep Power: 3
Joanne is on a distinguished road
Hi all, I was hoping someone could shed some light.

I am looking to create a scalar field that varies linearly as a function of space and would like to know if there's a way to do it through setFieldsDict.

I am using OF v4.1 on ubuntu 16.06 so unfortunately swak4foam isn't available for me without a complete overhaul.

Any help would be deeply appreciated.
Joanne is offline   Reply With Quote

Old   November 15, 2017, 21:11
Default
  #2
JFM
Member
 
JFM's Avatar
 
John Anonymous
Join Date: Jan 2011
Location: Melbourne Australia
Posts: 37
Rep Power: 9
JFM is on a distinguished road
Send a message via Skype™ to JFM
Hi Joanne

Not sure if this is what you are looking for but this post may assist:
VOF initialization with a STL file (closed volume)

Regards
JFM
JFM is offline   Reply With Quote

Old   November 16, 2017, 14:18
Default
  #3
Senior Member
 
Taher Chegini
Join Date: Nov 2014
Location: Houston, Texas
Posts: 126
Rep Power: 6
Taataa is on a distinguished road
A while ago I used this snippet for setting a parabolic boundary condition for U at the inlet:

Code:
inlet
    {
        type            codedFixedValue;
        value           uniform (0 0 0);
        redirectType    parabolaProfile;   

        code
        #{
            const fvPatch& boundaryPatch = patch();
            const vectorField& Cf = boundaryPatch.Cf();

            vectorField& field = *this; 
            scalar uave = 10;
            scalar h = 5e-3;
            
            scalar vel;

            forAll(Cf, faceI)
            {
                vel = 6 * uave / (h*h) * (h * Cf[faceI].y() - Cf[faceI].y() * Cf[faceI].y());
                field[faceI] = vector(vel, 0, 0);
            }
        #};
    }
You can use a similar approach.
Taataa is offline   Reply With Quote

Reply

Tags
setfields, setfieldsdict, spatial variation

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
rho Constructor interFoam for creating a varying rho field kebsiali OpenFOAM Programming & Development 4 April 16, 2016 20:28
How to create an additional vector with {Field 4, Field 5, Field 6} Bombacar ParaView 1 August 15, 2015 18:05
''unknown radialModelType type Gidaspow'' PROBLEM WITH THE BED TUTORIAL AndoniBM OpenFOAM Running, Solving & CFD 2 March 25, 2015 18:44
New BoundaryCondition: how to modify a single component of a field? look86 OpenFOAM Programming & Development 4 August 28, 2012 16:48
Demagnetization field jan0385 ANSYS 0 April 12, 2012 09:09


All times are GMT -4. The time now is 05:14.