Skip to content

Conversation

@IshaanDesai
Copy link
Member

@IshaanDesai IshaanDesai commented Mar 20, 2025

This PR is derived from #118 and adds functionality for volumetric coupling to micro-mechanics simulations. The functionality is primarily contributed by @kalupaika. This PR is branched from the feature branch of #118 because #118 contains code which is specific to coupling a macro-scale CalculiX simulation to many micro-scale NASMAT simulations. This PR contains the functionality:

  • Extract Gauss point coordinates of a mesh made with either C3D8 (Hex) or C3D4 (Tet) elements.
  • Get strain tensor from CalculiX and write it to preCICE.
  • Read stress tensor from preCICE and apply it in CalculiX.
  • Read stiffness matrix from preCICE and apply it in CalculiX.

The implemented functionality is tested for steady-state simulations only. To incorporate the features for transient simulations, an appropriate test case would need to be devised.

kalupaika and others added 30 commits January 17, 2024 10:34
@IshaanDesai IshaanDesai marked this pull request as ready for review April 29, 2025 12:33
Copy link
Member

@MakisH MakisH left a comment

Choose a reason for hiding this comment

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

A first round of comments after reading through most files and mostly skimming through adapter/PreciceInterface.c and linstatic_precice.c. Let's go through these files together as well.

Some of my comments are not necessarily something to act upon, just something for my own understanding.

SCCXC += nonlingeo_precice.c dyna_precice.c CCXHelpers.c PreciceInterface.c
SCCXF += getflux.f getkdeltatemp.f
SCCXC += nonlingeo_precice.c dyna_precice.c CCXHelpers.c PreciceInterface.c linstatic_precice.c
SCCXF += getflux.f getkdeltatemp.f getc3d8elementgausspointcoords.f getc3d4elementgausspointcoords.f
Copy link
Member

Choose a reason for hiding this comment

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

Do I understand correctly that these files are completely written for the adapter, and not included in the original CalculiX source code? In that case, I wonder if they should better be under adapter/ or another new folder. What is the motivation for putting them outside?

The operations they define are specific to the adapter, right?

Copy link
Member Author

@IshaanDesai IshaanDesai Aug 11, 2025

Choose a reason for hiding this comment

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

Do I understand correctly that these files are completely written for the adapter, and not included in the original CalculiX source code?

Yes. These files are purely adapter-specific functionality. Moving them into the adapter/ folder makes sense and I will do so. On having a second look, the files have functionality which is directly copied from the CalculiX source code. So the files are intended for use in the adapter, but are not strictly code written by an adapter developer. The files are similar to nonlingeo_precice.c or even ccx_2.20.c for that matter.

My plan now is to remove the linstatic_precice.c entirely, because it is not serving the intended purpose of being a static solver for a multiscale scenario. I am trying to add the commands to read and write material data (stresses and strains) in nonlingeo_precice.c so that we do not have to maintain a second solver in the adapter.

int i, idx;
// Loop through all element and respective gauss points
for (i = 0; i < numIPTotal; i++) {
idx = i * 6 + strainIdx; //TODO: Add explanation for 6
Copy link
Member

Choose a reason for hiding this comment

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

yes, please. Two similar points below.

Comment on lines +30 to +31
integer :: kon(*)
integer :: ipkon(*)
Copy link
Member

Choose a reason for hiding this comment

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

Description missing.

Same in the C3D8 file.

Copy link
Member

Choose a reason for hiding this comment

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

A summary of the preCICE-related changes would be helpful when upgrading to newer CalculiX versions.

*sim->dtheta = 1;
*sim->theta = 0;
*sim->tper = 1;
//*sim->dtheta = 1;
Copy link
Member

Choose a reason for hiding this comment

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

Why removed?
Maybe fully remove?

sim->iendset,
sim->ipkon,
sim->lakon,
*sim->lakon,
Copy link
Member

Choose a reason for hiding this comment

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

Is lakon a pointer?
Was this wrong before, or needed now because the type changed?
Does this need to be updated anywhere else?

free(preciceInterface->writeData);
free(preciceInterface->elementIDs);
free(preciceInterface->faceIDs);
free(preciceInterface->nodeIDs);
Copy link
Member

Choose a reason for hiding this comment

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

How come we previously had elementIDs but not nodeIDs?

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants