Skip to content

Add functionality for volumetric multiscale coupling to micro-mechanics simulations - #135

Draft
IshaanDesai wants to merge 78 commits into
developfrom
multiscale-mech
Draft

IshaanDesai wants to merge 78 commits into
developfrom
multiscale-mech

Conversation

@IshaanDesai

@IshaanDesai IshaanDesai commented Mar 20, 2025

Copy link
Copy Markdown
Member

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 specific to coupling a macro-scale CalculiX simulation with many micro-scale NASMAT simulations. This PR contains the functionality:

  • Get strain tensor from CalculiX and write it to preCICE.
  • Read stress tensor components from preCICE and apply them in CalculiX.
  • Read stiffness matrix components from preCICE and apply them in CalculiX.

The implemented functionality is tested only for steady-state simulations. 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
Comment thread Makefile Outdated

@MakisH MakisH left a comment

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.

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.

Comment thread Makefile Outdated
Comment thread adapter/CCXHelpers.c
Comment thread adapter/CCXHelpers.c Outdated
Comment thread adapter/CCXHelpers.c
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
Copy Markdown
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 thread adapter/CCXHelpers.h Outdated
Comment thread getc3d4elementgausspointcoords.f
Comment thread linstatic_precice.c Outdated

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.

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
Copy Markdown
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
Copy Markdown
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?

Comment thread adapter/PreciceInterface.c Outdated
@MinhazPX

Copy link
Copy Markdown

I could be able to build the adapter by making these changes to the ConfigReader.cpp

if (config["participants"][participantName]["interfaces"][I]["elements-mesh”]) { interface.elementsMeshName = strdup(config["participants"][participantName]["interfaces"][i]["elements-mesh"].get_value<std::string>().c_str()); }

to

if (config["participants"][participantName]["interfaces"][i].contains("elements-mesh")) { interface.elementsMeshName = strdup(config["participants"][participantName]["interfaces"][i]["elements-mesh"].get_value<std::string>().c_str()); }

Hope this helps.

@IshaanDesai

Copy link
Copy Markdown
Member Author

Thanks @MinhazPX for the suggestion. The build works now. I will look into the Segmentation fault problem you are facing.

@IshaanDesai

Copy link
Copy Markdown
Member Author

While trying to get this to work together with @MinhazPX, I noticed that the data structure stx from nonlingeo_precice.c cannot be modified externally. Doing this corrupts the internal memory, and CalculiX is unable to handle the change when results() are called. One alternative is to modify the data sti instead. But this is problematic, as CalculiX internally uses sti to store the converged stress values. This means the only way to modify stresses from outside is to write a UMAT and provide it to results().

It seems the current way of handling stress won't work.

@IshaanDesai

Copy link
Copy Markdown
Member Author

With reference to the previous comment, I am marking this pull request as draft because there is no clear solution for modifying stresses in CalculiX in sight.

@IshaanDesai
IshaanDesai marked this pull request as draft July 30, 2026 08:50
@MakisH

MakisH commented Jul 30, 2026

Copy link
Copy Markdown
Member

there is no clear solution for modifying stresses in CalculiX in sight.

Sounds related to #111

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.

4 participants