mirror of
https://git.gfz-potsdam.de/naaice/iphreeqc.git
synced 2025-12-16 00:28:23 +01:00
removed c com fortran
git-svn-id: svn://136.177.114.72/svn_GW/IPhreeqc/trunk@5244 1feff8c3-07ed-0310-ac33-dd36852eb9cd
This commit is contained in:
parent
ed93e89916
commit
7aa606a511
@ -1,72 +0,0 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <IPhreeqc.h>
|
||||
|
||||
int id;
|
||||
int vt[7];
|
||||
double dv[7];
|
||||
char sv[7][100];
|
||||
char buffer[100];
|
||||
|
||||
void ExtractWrite(int cell)
|
||||
{
|
||||
VAR v;
|
||||
int j;
|
||||
VarInit(&v);
|
||||
for (j = 0; j < 7; ++j) {
|
||||
GetSelectedOutputValue(id, 1, j, &v);
|
||||
vt[j] = v.type;
|
||||
switch (vt[j]) {
|
||||
case TT_DOUBLE:
|
||||
dv[j] = v.dVal;
|
||||
sprintf(sv[j], "%23.15e", v.dVal);
|
||||
break;
|
||||
case TT_STRING:
|
||||
strcpy(sv[j], v.sVal);
|
||||
break;
|
||||
}
|
||||
VarClear(&v);
|
||||
}
|
||||
printf("Cell %d \n\tpH: %4.2f\tSR(calcite): %4.2f\n", cell, dv[5], dv[6]);
|
||||
}
|
||||
|
||||
void EHandler(void)
|
||||
{
|
||||
OutputErrorString(id);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
const char *ConCat(const char *str1, const char *str2)
|
||||
{
|
||||
strcpy(buffer, str1);
|
||||
return strcat(buffer, str2);
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
/* Create module, load database, define initial conditions and selected output */
|
||||
id = CreateIPhreeqc();
|
||||
if (LoadDatabase(id, "phreeqc.dat") != 0) EHandler();
|
||||
if (RunFile(id, "ic") != 0) EHandler();
|
||||
|
||||
/* Run cell 1, extract/write result */
|
||||
if (RunString(id, "RUN_CELLS; -cells; 1; END") != 0) EHandler();
|
||||
ExtractWrite(1);
|
||||
|
||||
/* Advect cell 1 solution to cell 2, run cell 2, extract/write results */
|
||||
AccumulateLine(id, ConCat("SOLUTION_MODIFY 2", "" ));
|
||||
AccumulateLine(id, ConCat(" -cb ", sv[0]));
|
||||
AccumulateLine(id, ConCat(" -total_h ", sv[1]));
|
||||
AccumulateLine(id, ConCat(" -total_o ", sv[2]));
|
||||
AccumulateLine(id, ConCat(" -totals ", "" ));
|
||||
AccumulateLine(id, ConCat(" C ", sv[3]));
|
||||
AccumulateLine(id, ConCat(" Ca ", sv[4]));
|
||||
AccumulateLine(id, ConCat("RUN_CELLS; -cells; 2; END", "" ));
|
||||
if (RunAccumulated(id) != 0) EHandler();
|
||||
ExtractWrite(2);
|
||||
|
||||
/* Destroy module */
|
||||
if (DestroyIPhreeqc(id) != IPQ_OK) EHandler();
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
@ -1,26 +0,0 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 9.00
|
||||
# Visual Studio 2005
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "advect_c", "advect_c.vcproj", "{BD883425-1DD0-466A-911B-32AD6D4CE262}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
DebugDll|Win32 = DebugDll|Win32
|
||||
Release|Win32 = Release|Win32
|
||||
ReleaseDll|Win32 = ReleaseDll|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{BD883425-1DD0-466A-911B-32AD6D4CE262}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{BD883425-1DD0-466A-911B-32AD6D4CE262}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{BD883425-1DD0-466A-911B-32AD6D4CE262}.DebugDll|Win32.ActiveCfg = DebugDll|Win32
|
||||
{BD883425-1DD0-466A-911B-32AD6D4CE262}.DebugDll|Win32.Build.0 = DebugDll|Win32
|
||||
{BD883425-1DD0-466A-911B-32AD6D4CE262}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{BD883425-1DD0-466A-911B-32AD6D4CE262}.Release|Win32.Build.0 = Release|Win32
|
||||
{BD883425-1DD0-466A-911B-32AD6D4CE262}.ReleaseDll|Win32.ActiveCfg = ReleaseDll|Win32
|
||||
{BD883425-1DD0-466A-911B-32AD6D4CE262}.ReleaseDll|Win32.Build.0 = ReleaseDll|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@ -1,359 +0,0 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="advect_c"
|
||||
ProjectGUID="{BD883425-1DD0-466A-911B-32AD6D4CE262}"
|
||||
RootNamespace="advect_c"
|
||||
Keyword="Win32Proj"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=""$(DEV_IPHREEQC)/include""
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="4"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="IPhreeqcd.lib"
|
||||
LinkIncremental="2"
|
||||
AdditionalLibraryDirectories=""$(DEV_IPHREEQC)\lib""
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="1"
|
||||
WholeProgramOptimization="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""$(DEV_IPHREEQC)/include""
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS"
|
||||
RuntimeLibrary="0"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="IPhreeqc.lib"
|
||||
LinkIncremental="1"
|
||||
AdditionalLibraryDirectories=""$(DEV_IPHREEQC)\lib""
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="1"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="ReleaseDll|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="1"
|
||||
WholeProgramOptimization="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""$(DEV_IPHREEQC)/include""
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="IPhreeqc.lib"
|
||||
LinkIncremental="1"
|
||||
AdditionalLibraryDirectories=""$(DEV_IPHREEQC)\dll""
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="1"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="DebugDll|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=""$(DEV_IPHREEQC)/include""
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="4"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="IPhreeqcd.lib"
|
||||
LinkIncremental="2"
|
||||
AdditionalLibraryDirectories=""$(DEV_IPHREEQC)\dll""
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\advect.c"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
||||
>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Resource Files"
|
||||
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
|
||||
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
|
||||
>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
@ -1,121 +0,0 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioUserFile
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
ShowAllFiles="false"
|
||||
>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<DebugSettings
|
||||
Command="$(TargetPath)"
|
||||
WorkingDirectory=""
|
||||
CommandArguments=""
|
||||
Attach="false"
|
||||
DebuggerType="3"
|
||||
Remote="1"
|
||||
RemoteMachine="IGSKAHHWWSNY5H1"
|
||||
RemoteCommand=""
|
||||
HttpUrl=""
|
||||
PDBPath=""
|
||||
SQLDebugging=""
|
||||
Environment=""
|
||||
EnvironmentMerge="true"
|
||||
DebuggerFlavor=""
|
||||
MPIRunCommand=""
|
||||
MPIRunArguments=""
|
||||
MPIRunWorkingDirectory=""
|
||||
ApplicationCommand=""
|
||||
ApplicationArguments=""
|
||||
ShimCommand=""
|
||||
MPIAcceptMode=""
|
||||
MPIAcceptFilter=""
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<DebugSettings
|
||||
Command="$(TargetPath)"
|
||||
WorkingDirectory=""
|
||||
CommandArguments=""
|
||||
Attach="false"
|
||||
DebuggerType="3"
|
||||
Remote="1"
|
||||
RemoteMachine="IGSKAHHWWSNY5H1"
|
||||
RemoteCommand=""
|
||||
HttpUrl=""
|
||||
PDBPath=""
|
||||
SQLDebugging=""
|
||||
Environment=""
|
||||
EnvironmentMerge="true"
|
||||
DebuggerFlavor=""
|
||||
MPIRunCommand=""
|
||||
MPIRunArguments=""
|
||||
MPIRunWorkingDirectory=""
|
||||
ApplicationCommand=""
|
||||
ApplicationArguments=""
|
||||
ShimCommand=""
|
||||
MPIAcceptMode=""
|
||||
MPIAcceptFilter=""
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="ReleaseDll|Win32"
|
||||
>
|
||||
<DebugSettings
|
||||
Command="$(TargetPath)"
|
||||
WorkingDirectory=""
|
||||
CommandArguments=""
|
||||
Attach="false"
|
||||
DebuggerType="3"
|
||||
Remote="1"
|
||||
RemoteMachine="IGSKAHHWWSNY5H1"
|
||||
RemoteCommand=""
|
||||
HttpUrl=""
|
||||
PDBPath=""
|
||||
SQLDebugging=""
|
||||
Environment=""
|
||||
EnvironmentMerge="true"
|
||||
DebuggerFlavor=""
|
||||
MPIRunCommand=""
|
||||
MPIRunArguments=""
|
||||
MPIRunWorkingDirectory=""
|
||||
ApplicationCommand=""
|
||||
ApplicationArguments=""
|
||||
ShimCommand=""
|
||||
MPIAcceptMode=""
|
||||
MPIAcceptFilter=""
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="DebugDll|Win32"
|
||||
>
|
||||
<DebugSettings
|
||||
Command="$(TargetPath)"
|
||||
WorkingDirectory=""
|
||||
CommandArguments=""
|
||||
Attach="false"
|
||||
DebuggerType="3"
|
||||
Remote="1"
|
||||
RemoteMachine="IGSKAHHWWSNY5H1"
|
||||
RemoteCommand=""
|
||||
HttpUrl=""
|
||||
PDBPath=""
|
||||
SQLDebugging=""
|
||||
Environment=""
|
||||
EnvironmentMerge="true"
|
||||
DebuggerFlavor=""
|
||||
MPIRunCommand=""
|
||||
MPIRunArguments=""
|
||||
MPIRunWorkingDirectory=""
|
||||
ApplicationCommand=""
|
||||
ApplicationArguments=""
|
||||
ShimCommand=""
|
||||
MPIAcceptMode=""
|
||||
MPIAcceptFilter=""
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
</VisualStudioUserFile>
|
||||
@ -1,16 +0,0 @@
|
||||
# File ic
|
||||
SOLUTION 1-2
|
||||
END
|
||||
EQUILIBRIUM_PHASES 1
|
||||
CO2(g) -1.5 10
|
||||
|
||||
EQUILIBRIUM_PHASES 2
|
||||
Calcite 0 10
|
||||
SELECTED_OUTPUT
|
||||
-reset false
|
||||
USER_PUNCH
|
||||
-Heading charge H O C Ca pH SR(calcite)
|
||||
10 PUNCH charge_balance
|
||||
20 PUNCH TOTMOLE("H"), TOTMOLE("O"), TOTMOLE("C"), TOTMOLE("Ca")
|
||||
30 PUNCH -LA("H+"), SR("calcite")
|
||||
END
|
||||
File diff suppressed because it is too large
Load Diff
Binary file not shown.
@ -1,52 +0,0 @@
|
||||
"""Compares gypsum solubility for WATEQ4F and Pitzer databases.
|
||||
"""
|
||||
# Import standard library modules first.
|
||||
import os
|
||||
# Then get third party modules.
|
||||
from win32com.client import Dispatch
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
def selected_array(db_path, input_string):
|
||||
"""Load database via COM and run input string.
|
||||
"""
|
||||
dbase = Dispatch('IPhreeqcCOM.Object')
|
||||
dbase.LoadDatabase(db_path)
|
||||
dbase.RunString(input_string)
|
||||
return dbase.GetSelectedOutputArray()
|
||||
|
||||
def show_results(input_string):
|
||||
"""Get results for different databases
|
||||
"""
|
||||
wateq4f_result = selected_array('wateq4f.dat', input_string)
|
||||
pitzer_result = selected_array('pitzer.dat', input_string)
|
||||
# Get data from the arrays.
|
||||
nacl_conc = [entry[0] for entry in wateq4f_result][1:]
|
||||
wateq4f_values = [entry[1] for entry in wateq4f_result][1:]
|
||||
pitzer_values = [entry[1] for entry in pitzer_result][1:]
|
||||
# Plot
|
||||
plt.plot(nacl_conc, pitzer_values, 'k', nacl_conc, wateq4f_values,'k--')
|
||||
plt.axis([0, 6, 0, .06])
|
||||
plt.legend(('PITZER','WATEQ4F'), loc = (0.4, 0.4))
|
||||
plt.ylabel('GYPSUM SOLUBILITY, MOLES PER KILOGRAM WATER')
|
||||
plt.xlabel('NaCl, MOLES PER KILOGRAM WATER')
|
||||
plt.savefig("Figure2.png")
|
||||
plt.show()
|
||||
|
||||
if __name__ == '__main__':
|
||||
# This will only run when called as script from the command line
|
||||
# and not when imported from another script.
|
||||
INPUT_STRING = """
|
||||
SOLUTION 1
|
||||
END
|
||||
INCREMENTAL_REACTIONS
|
||||
REACTION
|
||||
NaCl 1.0
|
||||
0 60*0.1 moles
|
||||
EQUILIBRIUM_PHASES
|
||||
Gypsum
|
||||
USE solution 1
|
||||
SELECTED_OUTPUT
|
||||
-reset false
|
||||
-total Na S(6)
|
||||
END"""
|
||||
show_results(INPUT_STRING)
|
||||
@ -1,63 +0,0 @@
|
||||
implicit none
|
||||
include "IPhreeqc.f90.inc"
|
||||
integer Errors, i, iresult, vtype
|
||||
character(len=1024) Istring
|
||||
character(len=30) svalue
|
||||
double precision, dimension(0:6) :: dvalue
|
||||
|
||||
if (LoadDatabase("phreeqc.dat") .ne. 0) call ErrorMessage(Errors)
|
||||
! Initial conditions
|
||||
write(Istring,"(a/)") &
|
||||
"Solution 1-2; END", &
|
||||
"EQUILIBRIUM_PHASES 1; CO2(g) -1.5 10", &
|
||||
"EQUILIBRIUM_PHASES 2; Calcite 0 10", &
|
||||
"END"
|
||||
Errors = AccumulateLine(Istring)
|
||||
If (Run(.FALSE.,.FALSE.,.FALSE.,.FALSE.) .ne. 0) call ErrorMessage(Errors)
|
||||
!If (runstring(Istring, .FALSE.,.FALSE.,.FALSE.,.FALSE.) .ne. 0) call ErrorMessage(Errors)
|
||||
|
||||
! Define SELECTED_OUTPUT and run cell 1
|
||||
write(Istring,"(a/)") &
|
||||
"SELECTED_OUTPUT; -reset false", &
|
||||
"USER_PUNCH", &
|
||||
" -Heading charge H O C Ca pH SR(calcite)", &
|
||||
"10 w = TOT(""water"")", &
|
||||
"20 PUNCH charge_balance, TOT(""H"")*w, TOT(""O"")*w, TOT(""C"")*w, TOT(""Ca"")*w", &
|
||||
"30 PUNCH -LA(""H+""), SR(""calcite"")", &
|
||||
"RUN_CELLS; -cells; 1; END"
|
||||
Errors = AccumulateLine(Istring)
|
||||
if (Run(.FALSE.,.FALSE.,.FALSE.,.FALSE.) .ne. 0) call ErrorMessage(Errors)
|
||||
!call WriteResults(1, Ostring, GetSelectedOutputArray())
|
||||
|
||||
! Transfer to cell 2 and run cell 2
|
||||
do i = 0, 6
|
||||
iresult = GetSelectedOutputValue(1, i, vtype, dvalue(i), svalue)
|
||||
enddo
|
||||
write(Istring, "(a/3(a,e20.14/),a/2(a,e20.14/),a)") &
|
||||
"SOLUTION_MODIFY 2", &
|
||||
" -cb ", dvalue(0), &
|
||||
" -total_h ", dvalue(1), &
|
||||
" -total_o ", dvalue(2), &
|
||||
" -totals ", &
|
||||
" C ", dvalue(3), &
|
||||
" Ca ", dvalue(4), &
|
||||
"RUN_CELLS; -cells; 2; END"
|
||||
Errors = AccumulateLine(Istring)
|
||||
if (Run(.FALSE.,.FALSE.,.FALSE.,.FALSE.) .ne. 0) call ErrorMessage(Errors)
|
||||
!call WriteResults(2, Ostring, GetSelectedOutputArray())
|
||||
|
||||
end
|
||||
|
||||
subroutine ErrorMessage(Errors)
|
||||
integer Errors
|
||||
write(*,*) "Errors in PHREEQC module: ", Errors
|
||||
end subroutine ErrorMessage
|
||||
|
||||
subroutine WriteResults(cell)
|
||||
integer cell
|
||||
double precision ph, sr
|
||||
ph = GetSelectedOutputValue(1, 5)
|
||||
sr = GetSelectedOutputValue(1, 6)
|
||||
write(*,*) "Cell: ", cell
|
||||
write(*,*) " pH: ", pH, " SR(calcite): ", sr
|
||||
End subroutine WriteResults
|
||||
@ -1,20 +0,0 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 9.00
|
||||
# Visual Studio 2005
|
||||
Project("{6989167D-11E4-40FE-8C1A-2192A86A7E90}") = "advect", "advect.vfproj", "{28459FF2-3C6C-469E-B0C3-2E4D483E7025}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Release|Win32 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{28459FF2-3C6C-469E-B0C3-2E4D483E7025}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{28459FF2-3C6C-469E-B0C3-2E4D483E7025}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{28459FF2-3C6C-469E-B0C3-2E4D483E7025}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{28459FF2-3C6C-469E-B0C3-2E4D483E7025}.Release|Win32.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@ -1,33 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<VisualStudioProject ProjectCreator="Intel Fortran" Keyword="Console Application" Version="11.0" ProjectIdGuid="{28459FF2-3C6C-469E-B0C3-2E4D483E7025}">
|
||||
<Platforms>
|
||||
<Platform Name="Win32"/></Platforms>
|
||||
<Configurations>
|
||||
<Configuration Name="Debug|Win32">
|
||||
<Tool Name="VFFortranCompilerTool" SuppressStartupBanner="true" DebugInformationFormat="debugEnabled" Optimization="optimizeDisabled" Interfaces="true" FixedFormLineLength="fixedLength132" WarnInterfaces="true" Traceback="true" BoundsCheck="true" RuntimeLibrary="rtMultiThreadedDebug"/>
|
||||
<Tool Name="VFLinkerTool" LinkIncremental="linkIncrementalNo" SuppressStartupBanner="true" AdditionalLibraryDirectories="c:\3rdparty\IPhreeqc" IgnoreDefaultLibraryNames="libcmt" GenerateDebugInformation="true" SubSystem="subSystemConsole" AdditionalDependencies="IPhreeqc.4137.lib"/>
|
||||
<Tool Name="VFResourceCompilerTool"/>
|
||||
<Tool Name="VFMidlTool" SuppressStartupBanner="true"/>
|
||||
<Tool Name="VFCustomBuildTool"/>
|
||||
<Tool Name="VFPreLinkEventTool"/>
|
||||
<Tool Name="VFPreBuildEventTool"/>
|
||||
<Tool Name="VFPostBuildEventTool"/>
|
||||
<Tool Name="VFManifestTool" SuppressStartupBanner="true"/></Configuration>
|
||||
<Configuration Name="Release|Win32">
|
||||
<Tool Name="VFFortranCompilerTool" SuppressStartupBanner="true"/>
|
||||
<Tool Name="VFLinkerTool" LinkIncremental="linkIncrementalNo" SuppressStartupBanner="true" AdditionalLibraryDirectories="c:\3rdparty\IPhreeqc" SubSystem="subSystemConsole" AdditionalDependencies="IPhreeqc.4137.lib"/>
|
||||
<Tool Name="VFResourceCompilerTool"/>
|
||||
<Tool Name="VFMidlTool" SuppressStartupBanner="true"/>
|
||||
<Tool Name="VFCustomBuildTool"/>
|
||||
<Tool Name="VFPreLinkEventTool"/>
|
||||
<Tool Name="VFPreBuildEventTool"/>
|
||||
<Tool Name="VFPostBuildEventTool"/>
|
||||
<Tool Name="VFManifestTool" SuppressStartupBanner="true"/></Configuration></Configurations>
|
||||
<Files>
|
||||
<Filter Name="Header Files" Filter="fi;fd">
|
||||
<File RelativePath=".\IPhreeqc.f90.inc"/></Filter>
|
||||
<Filter Name="Resource Files" Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"/>
|
||||
<Filter Name="Source Files" Filter="f90;for;f;fpp;ftn;def;odl;idl">
|
||||
<File RelativePath=".\advect.f90"/></Filter>
|
||||
<File RelativePath=".\ReadMe.txt"/></Files>
|
||||
<Globals/></VisualStudioProject>
|
||||
@ -1,14 +0,0 @@
|
||||
SOLUTION 1-2
|
||||
END
|
||||
EQUILIBRIUM_PHASES 1
|
||||
CO2(g) -1.5 10
|
||||
EQUILIBRIUM_PHASES 2
|
||||
Calcite 0 10
|
||||
SELECTED_OUTPUT
|
||||
-reset false
|
||||
USER_PUNCH
|
||||
-Heading charge H O C Ca pH SR(calcite)
|
||||
10 w = TOT("water")
|
||||
20 PUNCH charge_balance, TOT("H")*w, TOT("O")*w, TOT("C")*w, TOT("Ca")*w
|
||||
30 PUNCH -LA("H+"), SR("calcite")
|
||||
END
|
||||
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user