optimize molecular column density

11 views
Skip to first unread message

Gargi Shaw

unread,
Nov 18, 2021, 2:02:36 AM11/18/21
to cloudy-dev
Dear  All,
Yesterday I was trying to optimize some molecular column density. I found that the current source in the master does not optimize molecular column density.
It was working fine in c17.02.

This can be fixed by changing line 309 of parse_optimize.cpp.

To optimize molecular column densities, change line 309 of parse_optimize.cpp from
optimize.chColDen_label.push_back(elementnames.chElementNameShort[p.getElement()]);  to
optimize.chColDen_label.push_back(p.getFirstChunk(4));

Regards,
Gargi


Gary J. Ferland

unread,
Nov 18, 2021, 7:51:11 AM11/18/21
to cloud...@googlegroups.com
it would be helpful if you posted the simplest possible model that shows the problem.  Perhaps simplify the model we were looking at yesterday, or add the optimise command to a setup like this

test
turbulence 1 vary
optimize column density
???
end of column density

thanks,
Gary

--
--
http://groups.google.com/group/cloudy-dev
---
You received this message because you are subscribed to the Google Groups "cloudy-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cloudy-dev+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/cloudy-dev/e1738839-0b0d-4352-a80b-f230e092ec88n%40googlegroups.com.


--
Gary J. Ferland
Physics, Univ of Kentucky
Lexington KY 40506 USA
Tel: 859 257-8795
https://pa.as.uky.edu/users/gary

Gargi Shaw

unread,
Nov 18, 2021, 1:22:53 PM11/18/21
to cloud...@googlegroups.com
The attached input script works fine using c17.02 but gives an error message using master.
This can be fixed by  changing line 309 of parse_optimize.cpp from
optimize.chColDen_label.push_back(elementnames.chElementNameShort[p.getElement()]);  to
optimize.chColDen_label.push_back(p.getFirstChunk(4));
Regards,
Gargi



--
test_optimize.in

Gary Ferland

unread,
Nov 19, 2021, 10:39:11 PM11/19/21
to cloudy-dev
the test can be as simple as

====
optimize column densities
CO 14.7
end of column densities
======


I also tried
"CO" 14.7

the error is
==CO 14.7==
 Abbreviating element names to less than 4 characters is not allowed.
 [Stop in getElement at ../parser.cpp:914, something went wrong]

this is a regression from c17_branch

Gargi has a fix which i have not studied for side effects

Robin Williams

unread,
Nov 20, 2021, 7:38:50 AM11/20/21
to cloud...@googlegroups.com
Gargi's modification reverts to the status quo as at C17.  However, that fails nastily with e.g.
 Optimize column densities
 C2H2+ 0 14.7 error 0.2
 end of column densities
 table ism 1.1 linear vary
 test
-- this doesn't crash, but will instead optimize for the population of C2H2 rather than C2H2+.  C17 also can't cope with short species which aren't all-caps: SiH and He come out with zero column densities, and it thinks Co+ is CO+.

In principle, the optimize command can cope with anything that cdColm can support.  It probably makes sense to unify the rules for what's recognized here with those of e.g. "save species" (apart from not allowing multiple wildcard matches).

  Robin

Gary J. Ferland

unread,
Nov 20, 2021, 7:56:19 AM11/20/21
to cloud...@googlegroups.com

In principle, the optimize command can cope with anything that cdColm can support.  It probably makes sense to unify the rules for what's recognized here with those of e.g. "save species" (apart from not allowing multiple wildcard matches).

I think that is what an end-user would expect - as you have said on many occasions, anything that makes the parser more predictable is good.
thanks,
Gary

Robin Williams

unread,
Nov 20, 2021, 10:52:35 AM11/20/21
to cloud...@googlegroups.com

Robin Williams

unread,
Nov 20, 2021, 2:06:49 PM11/20/21
to cloud...@googlegroups.com
OK, so the modified code in my commit to the issue_452 branch appears to get Gargi's example script running, with the input modified to

Hydrogen 1 20.82 error 0.2
"CO"   14.7 error 0.2
"H200" 20. error 0.2
"H201" 20.2 error 0.2
"H202" 18.04 error 0.2
"H203" 15.9 error 0.2
"H204" 14.7 error 0.3
"H205" 14. error 0.6
"C[1]" 15.23 error 0.1
"C[2]" 14.15 error 0.1
"C[3]" 13.29 error 0.1
"O[1]"  17.85 error 0.1
Sulp 1 13.33 error 0.1

This gains the quote marks, for the reasons discussed above, but loses the meaningless "0" ionization stage.

  Robin

Gary J. Ferland

unread,
Nov 20, 2021, 3:15:13 PM11/20/21
to cloud...@googlegroups.com
Hi Robin,

Looks nice.  A few thoughts.

What does "CO[:]" do?  Our definition is that it is the total column density, the same as CO, I think.  

The last entry is surprising - what is "Sulp 1" but without quotes?   Is it a LAMDA species? (I have not looked). The atom would be "S  1".

is the rule consistent? A simple CO or C  1 would not be accepted?   That is fine, the parser should be predictable.

This should be documented - hazy1 says little about the optimize column density option.  People like to see examples they can copy/paste.

thank you
Gary

 

Robin Williams

unread,
Nov 20, 2021, 3:56:53 PM11/20/21
to cloud...@googlegroups.com
Hi Gary --

I was getting something working, so it's very useful to think through the edge cases -- and to update the docs when it's clear which way this will end up.

The "legacy" behaviour of this code to use unquoted, case insensitive >= 4 character element names + an ionization stage.  "Sulp 1" fits into that pattern.

The 4 character element names are used elsewhere in Cloudy, but are relatively infrequent.  I think it might be better to leave this temporarily as "deprecated" behaviour, and move towards quoted species names as the default: that handles everything more or less uniformly (though cdColm itself has a few compact but inconsistent holdouts, like H2vJ).

  Robin

Gary Ferland

unread,
Nov 21, 2021, 8:51:45 PM11/21/21
to cloudy-dev
thanks for fixing this.
Gary
Reply all
Reply to author
Forward
0 new messages