Skip to content

Commit 5331fff

Browse files
authored
Merge pull request #48 from sdmytrievs/master
Calculating if the GEMS3k system is without an aqueous phase
2 parents 7cbad19 + 029011c commit 5331fff

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+421
-345
lines changed

.github/workflows/ci-build.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,12 @@ jobs:
2121
os:
2222
- ubuntu-latest
2323
- windows-latest
24-
- macos-13
2524
- macos-latest
2625
include:
2726
- os: ubuntu-latest
2827
conda_platform: linux-64
2928
- os: windows-latest
3029
conda_platform: win-64
31-
- os: macos-13
32-
conda_platform: osx-64
3330
- os: macos-latest
3431
conda_platform: osx-arm64
3532

@@ -72,6 +69,13 @@ jobs:
7269
cmake --build build --target install --config Release || goto :eof
7370
python -c "import solmod4rkt" || goto :eof
7471
72+
- name: Run tests that read GEMS3K
73+
shell: bash -l {0}
74+
run: |
75+
conda activate GEMS3K
76+
python -c "import solmod4rkt"
77+
conda list
78+
7579
- name: Check conda
7680
run: |
7781
conda config --show

CMakeLists.txt

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Require a certain version of cmake
2-
cmake_minimum_required(VERSION 3.16)
2+
cmake_minimum_required(VERSION 3.16..4.2)
33

44
# Set the name of the project
5-
project(GEMS3K VERSION 4.4.3 LANGUAGES CXX C)
5+
project(GEMS3K VERSION 4.4.4 LANGUAGES CXX C)
66

77
set(CMAKE_CXX_STANDARD 20)
88
set(CMAKE_CXX_STANDARD_REQUIRED ON)
@@ -150,10 +150,9 @@ configure_file(
150150
)
151151

152152
# Set some necessary definitions
153-
add_definitions(-DNODEARRAYLEVEL)
154-
155-
if(USE_THERMOFUN MATCHES ON)
156-
add_definitions(-DUSE_THERMOFUN)
153+
if(USE_THERMOFUN MATCHES OFF)
154+
add_definitions(-DNO_THERMOFUN)
155+
else()
157156
#add_definitions(-DUSE_THERMO_LOG)
158157
endif()
159158

GEMS3K/databr.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ typedef struct /// DATABR - template node data bridge structure
7171
Eh, ///< Eh of aqueous solution (V) - - + +
7272
Tm, ///< Actual total simulation time (s) + + - -
7373
dt ///< Actual time step (s) - needed for TKinMet, can change! + + (+) (+)
74-
#ifdef NODEARRAYLEVEL
74+
#ifndef NO_NODEARRAYLEVEL
7575
,
7676
// \section FMT variables (units or dimensionsless) - to be used for storing them
7777
// at the nodearray level, normally not used in the single-node FMT-GEM coupling
@@ -189,7 +189,7 @@ f_IterDone, f_TK, f_P, f_Vs,f_Vi,
189189
f_Ms, f_Mi, f_Hs, f_Hi, f_Gs,
190190
f_IS, f_pH, f_pe, f_Eh,
191191
f_Tm, f_dt,
192-
//#ifdef NODEARRAYLEVEL
192+
//#ifndef NO_NODEARRAYLEVEL
193193
f_Dif,f_Vt, f_vp, f_eps,
194194
f_Km, f_Kf, f_S, f_Tr, f_h,
195195
f_rho,f_al, f_at, f_av, f_hDl,

GEMS3K/datach_api.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,12 @@ void datach_realloc(DATACH* CSD)
352352
CSD->denWg = new double[ 5*gridTP(CSD)];
353353
CSD->epsW = new double[ 5*gridTP(CSD)];
354354
CSD->epsWg = new double[ 5*gridTP(CSD)];
355+
for(int j=0; j<5*gridTP(CSD); j++ ) {
356+
CSD->denW[j] = 0.;
357+
CSD->denWg[j] = 0.;
358+
CSD->epsW[j] = 0.;
359+
CSD->epsWg[j] = 0.;
360+
}
355361

356362
CSD->G0 = new double[CSD->nDC*gridTP(CSD)];
357363
CSD->V0 = new double[CSD->nDC*gridTP(CSD)];
@@ -652,7 +658,7 @@ void databr_reset(DATABR *CnNde1, long int level)
652658
// at the nodearray level = 0.; normally not used in the single-node FMT-GEM coupling
653659
CnNde1->Tm = 0.;
654660
CnNde1->dt = 0.;
655-
#ifdef NODEARRAYLEVEL
661+
#ifndef NO_NODEARRAYLEVEL
656662
CnNde1->Dif = 0.;
657663
CnNde1->Vt = 0.;
658664
CnNde1->vp = 0.;

GEMS3K/datach_formats.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ std::vector<io_formats::outField> DataBR_fields = { // [f_lga+1/*60*/]
7373
{ "Eh", 0, 0, 1, "# Eh: Eh of aqueous solution, V (GEM output)" },
7474
{ "Tm", 0, 0, 1, "# Tm: Actual total simulation time, s (kinetics, metastability, transport)" },
7575
{ "dt", 0, 0, 1, "# dt: Actual time step, s (kinetics, metastability, transport)" },
76-
//#ifdef NODEARRAYLEVEL
76+
//#ifndef NO_NODEARRAYLEVEL
7777
// Scalar parameters below are only used at TNodeArray level
7878
{ "Dif", 0, 0, 1, "# Dif: General diffusivity of disolved matter, m2/s (mass transport)" },
7979
{ "Vt", 0, 0, 1, "# Vt: Total volume of the node, m3 (mass transport)" },
@@ -228,7 +228,7 @@ void databr_to_text_file(const DATACH* CSD, const DATABR* CNode, TIO& out_format
228228
prar.writeField(f_Tm, CNode->Tm, _comment, brief_mode );
229229
prar.writeField(f_dt, CNode->dt, _comment, brief_mode );
230230

231-
#ifdef NODEARRAYLEVEL
231+
#ifndef NO_NODEARRAYLEVEL
232232
if( CNode->NodeStatusFMT != No_nodearray /*TNodeArray::na->nNodes() > 1*/ )
233233
{
234234
if( _comment )
@@ -308,7 +308,7 @@ void databr_to_text_file(const DATACH* CSD, const DATABR* CNode, TIO& out_format
308308
template<typename TIO>
309309
void databr_from_text_file(const DATACH* CSD, DATABR* CNode, TIO& in_format )
310310
{
311-
#ifndef NODEARRAYLEVEL
311+
#ifdef NO_NODEARRAYLEVEL
312312
double tmpVal;
313313
#endif
314314

@@ -366,7 +366,7 @@ void databr_from_text_file(const DATACH* CSD, DATABR* CNode, TIO& in_format )
366366
break;
367367
case f_dt: rdar.readArray( "dt", &CNode->dt, 1);
368368
break;
369-
#ifdef NODEARRAYLEVEL
369+
#ifndef NO_NODEARRAYLEVEL
370370
case f_Dif: rdar.readArray( "Dif", &CNode->Dif, 1);
371371
break;
372372
case f_Vt: rdar.readArray( "Vt", &CNode->Vt, 1);
@@ -848,7 +848,8 @@ void datach_to_file(const DATACH* CSD, GemDataStream& ff)
848848
ff.writeArray( CSD->ccPH, CSD->nPH );
849849

850850
if( CSD->ccPH[0] == PH_AQUEL )
851-
{ ff.writeArray( CSD->denW, 5*gridTP(CSD) );
851+
{
852+
ff.writeArray( CSD->denW, 5*gridTP(CSD) );
852853
ff.writeArray( CSD->denWg, 5*gridTP(CSD) );
853854
ff.writeArray( CSD->epsW, 5*gridTP(CSD) );
854855
ff.writeArray( CSD->epsWg, 5*gridTP(CSD) );
@@ -924,7 +925,7 @@ void databr_to_file(const DATACH* CSD, const DATABR* CNode, GemDataStream& ff)
924925
// const data
925926
ff.writeArray( &CNode->NodeHandle, 6 );
926927

927-
#ifdef NODEARRAYLEVEL
928+
#ifndef NO_NODEARRAYLEVEL
928929
if( CNode->NodeStatusFMT != No_nodearray )
929930
ff.writeArray( &CNode->TK, 32 );
930931
else
@@ -967,7 +968,7 @@ void databr_from_file(const DATACH* CSD, DATABR* CNode, GemDataStream& ff)
967968
// const data
968969
ff.readArray( &CNode->NodeHandle, 6 );
969970

970-
#ifdef NODEARRAYLEVEL
971+
#ifndef NO_NODEARRAYLEVEL
971972
if( CNode->NodeStatusFMT != No_nodearray )
972973
ff.readArray( &CNode->TK, 32 );
973974
else

GEMS3K/gems3k_impex.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ std::string GEMS3KGenerator::gen_dbr_name(const std::string the_name, int time_p
2727
GEMS3KGenerator::GEMS3KGenerator(const std::string &filepath, long anIV, IOModes file_mode):
2828
ipmfiles_lst_name(filepath), nIV(anIV), io_mode(file_mode)
2929
{
30-
#ifndef USE_THERMOFUN
30+
#ifdef NO_THERMOFUN
3131
ErrorIf( io_mode>=f_thermofun, ipmfiles_lst_name, " ThermoFun as an option is hidden");
3232
#endif
3333
set_internal_data();
@@ -88,7 +88,7 @@ void GEMS3KGenerator::load_dat_lst_file()
8888

8989
if( files_mode() >= f_thermofun )
9090
{
91-
#ifdef USE_THERMOFUN
91+
#ifndef NO_THERMOFUN
9292
f_getline( f_lst, thermofun_file_name, ' ');
9393
trim(thermofun_file_name, "\"");
9494
#else

GEMS3K/gems3k_version.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#pragma once
22

3-
#define GEMS3K_VERSION "4.4.3"
4-
#define GEMS3K_VERSION_HASH "33622fe"
3+
#define GEMS3K_VERSION "4.4.4"
4+
#define GEMS3K_VERSION_HASH "0995d4c"
55
#define GEMS3K_GIT_BRANCH "master"
6-
#define GEMS3K_ChemicalFun "0.1.12"
7-
#define GEMS3K_ThermoFun "0.5.2"
6+
#define GEMS3K_ChemicalFun "0.1.13"
7+
#define GEMS3K_ThermoFun "0.5.4"

GEMS3K/jsonconfig.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -287,9 +287,9 @@ std::string GemsSettings::logger_section_name = "log";
287287

288288
std::set<std::string> GemsSettings::default_gems3k_loggers = {
289289
"gems3k", "ipm", "tnode", "kinmet", "solmod",
290-
#ifdef USE_THERMOFUN
290+
#ifndef NO_THERMOFUN
291291
"chemicalfun", "thermofun"
292-
#endif
292+
#endif
293293
};
294294

295295
std::string GemsSettings::gems3k_logger_pattern("[%n] [%^%l%$] %v");

GEMS3K/ms_multi_diff.cpp

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -390,11 +390,21 @@ void TMultiBase::load_all_thermodynamic_from_grid(TNode* aNa, double TK, double
390390
{
391391
Go = dCH->G0[ jj+xTP];
392392
Vv = dCH->V0[ jj+xTP]*1e5;
393-
if( dCH->S0 ) S0 = dCH->S0[ jj+xTP];
394-
if( dCH->H0 ) h0 = dCH->H0[ jj+xTP];
395-
if( dCH->Cp0 ) Cp0 = dCH->Cp0[ jj+xTP];
396-
if( dCH->A0 ) a0 = dCH->A0[ jj+xTP];
397-
if( dCH->U0 ) h0 = dCH->U0[ jj+xTP];
393+
if( dCH->S0 ) {
394+
S0 = dCH->S0[ jj+xTP];
395+
}
396+
if( dCH->H0 ) {
397+
h0 = dCH->H0[ jj+xTP];
398+
}
399+
if( dCH->Cp0 ) {
400+
Cp0 = dCH->Cp0[ jj+xTP];
401+
}
402+
if(dCH->A0) {
403+
a0 = dCH->A0[ jj+xTP];
404+
}
405+
if(dCH->U0) {
406+
u0 = dCH->U0[ jj+xTP];
407+
}
398408
}
399409
else
400410
{

GEMS3K/ms_multi_format.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -688,6 +688,11 @@ void TMultiBase::from_text_file_gemipm( TIO& in_format, DATACH *dCH )
688688
Error( "Error", ret);
689689
}
690690

691+
// Try fix error 09.12.2025 lost pm.E after reading gems3k files
692+
if( pm.E && dCH->ccIC[dCH->nICb-1] != IC_CHARGE) {
693+
pm.E = 0;
694+
}
695+
691696
PAalp_ = PAalp;
692697
PSigm_ = PSigm;
693698
multi_realloc( PAalp, PSigm );
@@ -832,6 +837,7 @@ void TMultiBase::from_text_file_gemipm( TIO& in_format, DATACH *dCH )
832837
alloc_SitFr(LsSitSum);
833838
fillValue( pm.SitFr, 0., LsSitSum );
834839
rddar.readArray( "MoiSN", pm.MoiSN, LsMsnSum);
840+
// ??? rddar.readArray( "SitFr", pm.SitFr, LsSitSum);
835841
}
836842
break;
837843
}

0 commit comments

Comments
 (0)