Skip to content

Minimal scripts mechanisms#3

Draft
FoamScience wants to merge 3 commits into
Crompulence:masterfrom
FoamScience:draft_pr_minimal_scripts
Draft

Minimal scripts mechanisms#3
FoamScience wants to merge 3 commits into
Crompulence:masterfrom
FoamScience:draft_pr_minimal_scripts

Conversation

@FoamScience

Copy link
Copy Markdown

This PR serves as a communication board only, around how to work with the minimal scripts

For working code, please checkout fix-minimal branch (which has too many changes, would make the discussion harder).
This one has the only relevant bits

So, apparently I had a faulty COUPLER.in file; The minimal scripts couldn't work on their own with it. It's now fixed (to some extent).

Check comments in these files for more info: minimal_CFD.cpp, minimal_MD.cpp, cpl/COUPLER.in and run_min_MD.sh

##
## -----------------------------------------------------------------------------
CONSTRAINT_INFO
4

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't quiet understand what these parameters do, but the 8s are necessary; they were 32 before which wasn't compatible with the OpenFOAM case we have apparently

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I missed these (my notification email was set to my old Imperial account). The constraint_info specifies which cells to apply the constraint on. The idea of CPL library is to use a single grid (the CFD one) for both MD and CFD regions and then apply constraints to a subset of the cells which overlap the MD domain. In this case, 32 was the number of cells in the CFD domain

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I completely forgot to mail you about it; apologies for that!
Looks like something is wrong with my porting but didn't have enough time to properly debug the situation; will push for this over next week!


//MPI_Cart_get(icomm_grid, 3, npxyz_cfd, cart_periods, cart_coords);

double xyzL[3] = {8*2.099495, 8*5.668637, 8*2.099495}; double xyz_orig[3] = {0.0, 0.0, 0.0};

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These were made so that xL_md/xl is an integer (8)

double xyzL[3] = {8*2.099495, 8*5.668637, 8*2.099495}; double xyz_orig[3] = {0.0, 0.0, 0.0};
int ncxyz[3] = {8, 8, 8};
CPL::setup_cfd(CART_COMM, xyzL, xyz_orig, ncxyz);
CPL::get_arrays(&recv_array, 4, &send_array, 1);

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

4 here works with the current minimal MD; but 3 also works fine if changed on the MD side too

MPI_Cart_create(MD_COMM, 3, npxyz, periods, 1, &CART_COMM);
double xyzL[3] = {8*2.099495, 8*5.668637, 8*2.099495}; double xyz_orig[3] = {0.0, 0.0, 0.0};
CPL::setup_md(CART_COMM, xyzL, xyz_orig);
CPL::get_arrays(&recv_array, 1, &send_array, 4);

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

4 here works with the minimal CFD script, 3 also works if changed on the CFD side too
BUT doesn't work with the OpenFOAM socket; the socket seems to expect 3 elements only.

With 3 elements; the coupled simulation hangs:

Reading field p

Reading field U

Reading/calculating face flux field phi

CPLSocketFOAM: Analysing processor and mesh topology
CPLSocketFOAM: Defining new MPI Cartesian communicator
interp_BCtrue

Creating block mesh topology
OpenFOAM CPL topology initialisation complete

well at least the topology initialization is complete :)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LAMMPS also expects 3 elements. looks like it also hangs when used with minimal CFD:

...
Lammps FixCPLForce forcetype: Velocity with args 1.0
cnstFCells: 8 8 8 
ifix 6 Class fix cplfix
WARNING: One or more dynamic groups may not be updated at correct point in timestep (../fix_group.cpp:171)
Setting up Verlet run ...
  Unit style    : lj
  Current step  : 10000
  Time step     : 0.005

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The number of elements have to match. LAMMPS should send 4 as it packages up the 1 density (or count of number of molecules) and 3 components of velocity (1+3=4). We'll need to adaprt this to maybe include some phase field variables and maybe temperature. For the CFD, it simply sends the 3 components of velocity field (as pressure is not used in the constraints of Nie et al 2004), although stress coupling would send 9 components of the stress tensor.

@edwardsmith999

edwardsmith999 commented May 27, 2022 via email

Copy link
Copy Markdown
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants