Jump to content
Geochemist's Workbench Support Forum

Search the Community

Showing results for tags 'script file'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • The Geochemist's Workbench
    • The Geochemist's Workbench
  • The Geochemist's Workbench Community
    • The Geochemist's Workbench Community

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Location


Interests

Found 3 results

  1. I have two Tcl scripts designed to heat up samples in the first script, and save this to output. I then have a second script that reads in this output from script1 and then mixes and reacts the samples in the second loop. In the first script, the output writes nicely to a file (see output "Output_SW_HOT.txt"). In the second script, any output from the reaction (obtained via the "report" function) only will write to the console and refuses to write to the output. Any other text, including rewriting the input to the outfile is okay. It is just when I am trying to obtain the values with report that it will not write these values to output. I am (1) confused as to why this does this, and (2) even more confused as to why I don't have a problem with this in the first script. I am using GWB v. 10 React console to run the scripts. Here is the first script for heating the samples: #React script, saved Mon Dec 18 2019 by DDS script script start data = "500nocSS.dat" verify #Set up the input and output set in_id [open "SO4_SW_Spreadsheet.txt" r] set out_id [open "Output_SW_HOT.txt" w] fconfigure $out_id -encoding unicode set in_id [open "SO4_SW_Spreadsheet.txt" r] fconfigure $in_id -encoding unicode gets $in_id headers puts $out_id "Temperature\tpH\tH2O\tNa+\tCl-\tSO4--\tH2(aq)\tMg++\tFe++\tCa++" #Loop through remaining lines gets $in_id aline while {$aline != ""} { set i 0 balance on Cl- report set_digits 4 foreach a [lrange $aline 1 end] { incr i 1 if {[lindex $headers $i] == "pH"} { pH = $a } elseif {[lindex $headers $i] == "H2O"} { H2O = $a [lindex $headers $i] kg } else { $a = [lindex $headers $i] mmol/kg } } temperature initial = 25 C, final = 250 C go puts $out_id \ "[report Temperature]\t[report pH]\t[report soln_mass]\t[report concentration Na+]\t[report concentration Cl-]\t[report concentration SO4--]\t[report concentration H2(aq)]\t[report concentration Mg++]\t[report concentration Fe++]\t[report concentration Ca++]" gets $in_id aline } script script start close $in_id close $out_id Here is the second script for mixing the samples: #Set up the input and output set in_id2 [open "Output_SW_HOT.txt" r] set out_id2 [open "Output_HF_SW_MIX.txt" w] fconfigure $out_id2 -encoding unicode set in_id2 [open "Output_SW_HOT.txt" r] fconfigure $in_id2 -encoding unicode gets $in_id2 headers puts $out_id2 "$headers\tTemperature\tpH\tH2O\tNa+\tCl-\tSO4--\tH2(aq)\tMg++\tFe++\tCa++" #Loop through remaining lines gets $in_id2 aline while {$aline != ""} { set i 0 balance on Cl- report set_digits 4 foreach a [lrange $aline 1 end] { incr i 1 if {[lindex $headers $i] == "pH"} { pH = $a } elseif {[lindex $headers $i] == "H2O"} { H2O = $a [lindex $headers $i] kg } else { $a = [lindex $headers $i] mol/kg } } go pickup reactants = fluid temperature initial = 400 C, reactants = 250 C H2O = 2 free kg Na+ = 550 mmol/kg Cl- = 550 mmol/kg balance on Cl- Fe++ = 16.56 mmol/kg pH = 5 swap H2S(aq) for SO4-- H2S(aq) = 19.77 mmol/kg swap H2(aq) for O2(aq) H2(aq) = 19.1 mmol/kg Ca++ = 40 mmol/kg Mg++ = 1e-10 mmol/kg go foreach a [lrange $aline 0 end] { puts -nonewline $out_id2 "$a\t" } puts $out_id2 \ "[report Temperature]\t[report pH]\t[report soln_mass]\t[report concentration Na+]\t[report concentration Cl-]\t[report concentration SO4--]\t[report concentration H2(aq)]\t[report concentration Mg++]\t[report concentration Fe++]\t[report concentration Ca++]" reset reactants gets $in_id2 aline } #Clean up. script script start close $in_id2 close $out_id2 Thank you for your help and insight. Output_SW_HOT.txt Output_HF_SW_MIX.txt SO4_SW_Spreadsheet.txt 500nocSS.dat
  2. I have written a script file for a reaction rate equation. I wrote it in Wordpad, but it gets saved as a '.txt' file. How do you change this to a '.bas' file? I have used the '.txt' file with success, but REACT forgets that I used that file after saving the REACT simulation (on reopening, it reverts to the built-in rate equation). I've searched both the manuals and the user forum to no avail.
  3. Hi! I am very new to GWB, so forgive me if any of this seems rather simplistic. I created a rate law script to try to fix a problem where certain parts of a chemical reaction are going to zero within a few years of a ten-year simulation, causing GWB to crash. Reaction: Methane(aq) + 8*Fe(OH)3 + 15*H+ -> 8*Fe++ +HCO3- + 21*H2O To fix this, I think I want to set the rate equal to zero every time certain elements in a node dip below a threshold value, but running the simulation with my current script gives the following error message "Could not evaluate rate law script at line 2". I'm guessing I have not set up the indexing of my nodes or time step correctly, but am unsure how to proceed. Here is the code as it stands now: i = 1 begin_loop1: If (molality(Methane(aq)(i)) < 1e-20 or mass(Fe(OH)3(i)) < 100) rate = 0; return rate; i = i+1 end_loop1 else cat = 1.0 i = 1 begin_loop: If i > ncatal THEN GOTO end_loop cat = cat* acatal(i)^pcatal(i) i = i+1 GOTO begin_loop end_loop: rate = Wmass*cat*rate_con*(1.0 - QoverK) RETURN rate I would appreciate any advice on how to adapt my script so that I am correctly indexing nodes at each time step. Thanks! Lauren
×
×
  • Create New...