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/)
-   -   Make my solver to work in parallel (https://www.cfd-online.com/Forums/openfoam-programming-development/237854-make-my-solver-work-parallel.html)

gionni August 9, 2021 06:11

Make my solver to work in parallel
 
Goodmorning,
I wrote a solver with some blocks of code where i manually alter some field values. Something like:

Code:

forAll(field,c) {
    if (something) field[c]=1;
}

When I do this, my code can't be run using mpirun: I was expecting the single thread to have its own information only, so field.size() being its own portion of the field, but apparently it doesn't work this way.
How can I have a code like this to work in parallel?

In my case I have 2 regions, and I need to couple them using a 1-halo layer. So I need to update the values at the boundary manually and impose the boundary conditions using boundaryFieldRef. Having the simulation running on a single core only would be very limiting.
Any help is appreciated. Thank you.

klausb August 14, 2021 15:14

Please be more specific about your requirements/setup, I am not convinced, that you need MPI operations at all.

When you talk about two regions, do you mean two areas which are part of your problem description or do you want to decompose your domain into two parts to run your simulation on two cores?

If you decompose you case to run it on multiple cores, are the settings (the values you want to introduce) for your "regions" influencing each other across processor boundaries which would require to transfer information from one core to another?


All times are GMT -4. The time now is 06:07.