CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   Defining fields as functions of space (https://www.cfd-online.com/Forums/openfoam-programming-development/155402-defining-fields-functions-space.html)

hertzsprung June 30, 2015 08:40

Defining fields as functions of space
 
I have some initial conditions that are specified by functions of (x,y,z).

I would like to programmatically define a field whose values are a function of (x,y,z). Can this be done as part of field construction, rather than looping over cells/faces and setting each value individually?

Further, can I set the internal field and boundary values in a straightforward manner?

chriss85 July 3, 2015 05:08

You need to loop over the cells and manually assign them values. Same for the boundary, you can use a fixedValue BC and assign values to patch faces.

huyidao July 4, 2015 09:03

Which solver do you use?Maybe you can try the funkysetfields in the swak4foam.


All times are GMT -4. The time now is 10:37.