Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GEM iteration in reinit data #151

Merged
merged 1 commit into from
Dec 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions src/Thermochimica-cxx.C
Original file line number Diff line number Diff line change
Expand Up @@ -476,17 +476,25 @@ namespace Thermochimica
getReinitData()
{
ReinitializationData data;
int available;
int available, iterations;
auto [elements, species] = getReinitDataSizes();
data.assemblage.resize(elements);
data.molesPhase.resize(elements);
data.elementPotential.resize(elements);
data.chemicalPotential.resize(species);
data.moleFraction.resize(species);

TCAPI_getReinitData(data.assemblage.data(), data.molesPhase.data(), data.elementPotential.data(), data.chemicalPotential.data(), data.moleFraction.data(), data.elementsUsed.data(), &available);
TCAPI_getReinitData(data.assemblage.data(),
data.molesPhase.data(),
data.elementPotential.data(),
data.chemicalPotential.data(),
data.moleFraction.data(),
data.elementsUsed.data(),
&available,
&iterations);

data.reinitAvailable = available;
data.GEM_iterations = iterations;

return data;
}
Expand Down
1 change: 1 addition & 0 deletions src/Thermochimica-cxx.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ namespace Thermochimica
int nPeriodicTable = 169;
std::vector<int> elementsUsed = std::vector<int>(nPeriodicTable);
bool reinitAvailable;
int GEM_iterations;
};

ReinitializationData getReinitData();
Expand Down
2 changes: 1 addition & 1 deletion src/Thermochimica.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ extern "C"
char *TCAPI_getMqmqaPairAtIndex(int *, int *, int *);

// MOOSE reinit functions
void TCAPI_getReinitData(int *, double *, double *, double *, double *, int *, int *);
void TCAPI_getReinitData(int *, double *, double *, double *, double *, int *, int *, int *);
void TCAPI_setReinitData(const int *, const int *, const int *, const double *, const double *, const double *, const double *, const int *);

// Heat capacity, enthalpy, and entropy
Expand Down
6 changes: 4 additions & 2 deletions src/api/CouplingUtilities.f90
Original file line number Diff line number Diff line change
Expand Up @@ -603,13 +603,14 @@ subroutine getReinitDataSizes(mElements,mSpecies)
end subroutine getReinitDataSizes

subroutine getReinitData(mAssemblage,mMolesPhase,mElementPotential, &
mChemicalPotential,mMolFraction,mElementsUsed,mReinitAvailable)
mChemicalPotential,mMolFraction,mElementsUsed,mReinitAvailable,mIterations)
USE ModuleReinit
USE ModuleThermoIO
USE ModuleThermo, ONLY: nElements, nSpecies
USE ModuleGEMSolver, ONLY: iterGlobal
implicit none

integer, intent(out) :: mReinitAvailable
integer, intent(out) :: mReinitAvailable, mIterations
integer, intent(out), dimension(nElements) :: mAssemblage
real(8), intent(out), dimension(nElements) :: mMolesPhase, mElementPotential
real(8), intent(out), dimension(nSpecies) :: mChemicalPotential, mMolFraction
Expand All @@ -624,6 +625,7 @@ subroutine getReinitData(mAssemblage,mMolesPhase,mElementPotential, &
mMolFraction = dMolFraction_Old
mElementsUsed = iElementsUsed_Old
mReinitAvailable = 1
mIterations = iterGlobal
else
mReinitAvailable = 0
end if
Expand Down
6 changes: 3 additions & 3 deletions src/api/CouplingUtilitiesISO_C.f90
Original file line number Diff line number Diff line change
Expand Up @@ -668,22 +668,22 @@ subroutine getReinitDataSizesISO(mElements, mSpecies) &
end subroutine getReinitDataSizesISO

subroutine getReinitDataISO(mAssemblage,mMolesPhase,mElementPotential, &
mChemicalPotential,mMolFraction,mElementsUsed,mReinitAvailable) &
mChemicalPotential,mMolFraction,mElementsUsed,mReinitAvailable, mIterations) &
bind(C, name="TCAPI_getReinitData")

USE,INTRINSIC :: ISO_C_BINDING

USE ModuleThermo, ONLY: nElements, nSpecies
implicit none

integer(C_INT), intent(out) :: mReinitAvailable
integer(C_INT), intent(out) :: mReinitAvailable, mIterations
integer(C_INT), intent(out), dimension(nElements) :: mAssemblage
real(C_DOUBLE), intent(out), dimension(nElements) :: mMolesPhase, mElementPotential
real(C_DOUBLE), intent(out), dimension(nSpecies) :: mChemicalPotential, mMolFraction
integer(C_INT), intent(out), dimension(0:168) :: mElementsUsed

call getReinitData(mAssemblage,mMolesPhase,mElementPotential, &
mChemicalPotential,mMolFraction,mElementsUsed,mReinitAvailable)
mChemicalPotential,mMolFraction,mElementsUsed,mReinitAvailable,mIterations)

return

Expand Down